odoo(Openerp)如何在欄位的on_change方法中動態返回domain
阿新 • • 發佈:2019-02-15
My case :
I have two fields :
partner_id
: m2o (res.partner) typetype
: selection(sale or purchase)
On a form view, I want when I set type=sale
, the domain=[('customer','=',True)]
applied
to the field partner_id
My idea is to use onchange action on the field type, but I don't know how
on_change in OpenERP
1: The value dictionary i.e {field1:value1,field2:value2}
2: The domain dictionary i.e {field1:domain1}
3: The warning
Syntax:
res = {'value':{},'domain':{},'warning':'Warning Message'}
According to your case add this to the return dictionary.
{'domain':{'partner_id':[('customer','=',True)]}}
Thanks