I have a many2one field 'default_profile_id' in object 'CIM'
'default_profile_id': fields.many2one('cim.object','Default Profile', domain="[('cim_id','=',id)]"),
in the view file,
<field name="default_profile_id" widget="selection" />
By doing this, I thought I would get the list of profile that are for customer profile like a SELECTION field, but the DOMAIN restriction is not working.
My Requirement is that:
I want to show payment profile available for the current Customer Profile in SELECTION Format
<field name="default_profile_id" widget="selection" domain="[('cim_id','=',active_id)]" /> But showing error as active_id is not available
Thanks & Regards,
If you want that records from profile those are belongs to cim.object. Than make sure in cim.object there must be one2many field with the "name" cim_id and the object of that field would be your current class object in which you have added this default_profile_id.
Now you just need to give domain in xml only
<field name="default_profile_id" widget="selection" domain="[('cim_id','=',active_id)]"/> Now your xml domain will work it will give you the records the profile which has the active_id.
If still it not work it means the domain is not work with widget you have used. so you need to override the search method. this the last option What you say?
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!
About This Community
|Asked: 10/31/13, 4:37 AM|
|Seen: 3755 times|
|Last updated: 3/31/15, 5:36 PM|