Odoo Help

0

how to set another model's field in domain

By
mihir shah
on 5/8/13, 12:26 PM 1,855 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')

Can you, please, post you _columns content? Thanks

Francesco OpenCode
on 5/8/13, 1:12 PM

_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

mihir shah
on 5/9/13, 3:02 AM
1
Naresh Soni (nch)
On 5/9/13, 6:57 AM

Hi Mihir,

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

Thanks,

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

0 follower(s)

Stats

Asked: 5/8/13, 12:26 PM
Seen: 1855 times
Last updated: 3/16/15, 8:10 AM