Odoo Help


3 Answers
Irfankhan Juneja
2018/7/18 下午1:51

Try This

<field name="x_uom1" domain="[('category_id.name', '=', 'Length / Distance')]" options="{'no_create_edit': True, 'no_create':True}"/>

Michael Yeung
2018/7/19 上午1:23

It works! Thanks! One more question. Can I set a default value for this? options="{'default':'m'}" or default="m", or the unit ID? Thanks so much

Michael Yeung
2018/7/23 上午7:36

Big issue! I found it does not work when the user switch to another language. The domain refers the name only as the name of the language. I change the category_id.name as category_id.id, since 'Length / Distance' is one of the main category of units, and the id is 4. Now I have to manually set the Area, since its not in the base. (I created it by myself)

2018/7/19 上午3:58
def default_xuom1(self):    
    # your logic goes here and return desired result   
    return your_result   
x_uom1 = fields.Many2one('product.uom','New Field',default=default_xuom1)

Hope this will helps you

1 Comment
Michael Yeung
2018/7/20 上午5:57

umm... could you show me how to write it on QWEB please?

Ask a Question
Keep Informed
1 follower(s)
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 eLearning platform and experience all Odoo Apps through learning videos, use cases and quizzes.

Test it now