This question has been flagged
1 Reply
6511 Views

in my xml view i want to restrict field values but the criteria field is in other model . what would be the syntax for the same i tried like dis

<field name="metal_revision_id" domain="[('metal_revision_relation','=',metal_id)]"/>

the metal_id field come from model metal.metal and the restriction is on chemical model.

This is the python code:

_columns = { 
    'metal_id' :fields.many2one('metal.metal','Metal'), 
    'name' : fields.char('Reference',size=32),
    'properties_lines' : fields.one2many('chemical.properties.line',
    'property_id','Chemical Properties Lines'),
    'metal_revision_id': fields.many2one('metal.revision', 'Revision No.', required=True, ondelete='cascade'),
    'residual_total': fields.function(_get_residual, method=True, type='float', string='Residual Element Total',digits=(16,3)),
    'chemical_property_id':fields.one2many('heat.treatment.master','chemical_property_id')
Avatar
Discard

Can you, please, post you _columns content? Thanks

Author

_columns = { 'metal_id' :fields.many2one('metal.metal','Metal'), 'name' : fields.char('Reference',size=32), 'properties_lines' : fields.one2many('chemical.properties.line','property_id','Chemical Properties Lines'), 'metal_revision_id': fields.many2one('metal.revision','Revision No.', required=True, ondelete='cascade'), 'residual_total': fields.function(_get_residual, method=True, type='float', string='Residual Element Total',digits=(16,3)), 'chemical_property_id':fields.one2many('heat.treatment.master','chemical_property_id

Best Answer

Hi Mihir,

use a fields.related in your model relating to the other model's field and use that field in domain.

Thanks,

Avatar
Discard