Afficher une liste déroulante de type combo box avec un fields.function
bonjour,
je souhaite afficher une liste déroulante dans une vue de type formulaire mais l'affichage ne s'effectue pas en mode edition voici le code :
1 - dans mon .py (j'hérite de pos.order ) j'ai cette fonction et ce champ customisé :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
......
def _get_list_partner(self,cr, uid, ids, field_name, arg, context): #(self, cr, uid, context=None): #
result = {}
cr.execute("SELECT distinct id,'[' || ref || '] ' || name as name,bl_partner_passage \
FROM res_partner \
WHERE (customer = True and bl_partner_passage = True and char_length(ref) = 4 and \
CAST (substring(ref from 3 for 2) AS integer) = EXTRACT(MONTH FROM current_date) and \
substring(ref from 2 for 1) = (SELECT code_shop FROM res_company)) \
or (customer = True and bl_partner_passage = False and char_length(ref) = 4 and \
CAST (substring(ref from 3 for 2) AS integer) = EXTRACT(MONTH FROM current_date) and \
substring(ref from 2 for 1) = (SELECT code_shop FROM res_company) ) or bl_en_compte = True \
ORDER BY bl_partner_passage DESC ")
line_ids = cr.dictfetchall()
for line in line_ids:
res[line['id']]['id'] = line['id']
res[line['id']]['name'] = line['name']
return result
.....
_columns = {
'mars_partner_id': fields.function(_get_list_partner, type='many2one', obj='res.partner',store=True,method=True,string='Client'),
} |
dans ma vue formulaire .xml j'ai ceci :
Code:
1 2 3 4 5 6 7 8 9
|
......
<group>
<field name="name" string="Ref. Commande" />
<field name="mars_partner_id" string="Client" on_change="onchange_mars_partner_id(mars_partner_id,date_order)" />
</group>
...... |
Avez vous une idée ?