Odoo Help

Welcome!

This community 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.

0

how to set another model's field in domain

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

--Naresh Soni (nch)--
Tiny ERP Pvt Ltd
http://www.odoo.com
1281
| 2 2 4
India
--Naresh Soni (nch)--

Team Lead, Odoo(Formerly OpenERP) Support & OPW

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,

Your Answer

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

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

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