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.

1

How to change domain using attributes?

By
Solanki Shamji
on 7/30/15, 9:57 AM 950 views

Hello,

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>
</xpath>

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')
0
Diego Calzadilla
On 7/12/16, 5:53 PM

did you solve this issue?

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

1 follower(s)

Stats

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