Odoo Help


How to change domain using attributes?

Solanki Shamji
on 7/30/15, 9:57 AM 2,046 views


I have following field in sale.py

'product_id': fields.many2one('product.product', 'Product', domain=[('sale_ok', '=', True)], change_default=True, readonly=True, states={'draft': [('readonly', False)]}, ondelete='restrict'), 

Here my domain is domain=[('sale_ok', '=', True)]

Now I want to extent this domain like

<xpath expr="//field[@name='order_line']/form/group/group/field[@name='product_id']" position="attributes">
<attribute name="domain">[('sale_ok','=',True),('my_new_field','=',True)]</attribute>

But its not working.

I have another idea if I replace product_id with new field like

'product_id': fields.many2one('product.product', 'Product', domain=[('sale_ok', '=', True),('my_new_field','=',True)], change_default=True, readonly=True, states={'draft': [('readonly', False)]}, ondelete='restrict')
Diego Calzadilla
On 7/12/16, 5:53 PM

did you solve this issue?

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.


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

1 follower(s)


Asked: 7/30/15, 9:57 AM
Seen: 2046 times
Last updated: 7/12/16, 5:53 PM