Odoo Ayuda

0

0
3 Answers
1
Irfankhan Juneja
18/7/18 13:51

Try This

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

2 Comments
Michael Yeung
19/7/18 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
23/7/18 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)

0
Sehrish
19/7/18 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 Comentario
Michael Yeung
20/7/18 5:57

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

Realizar una pregunta
Writer
Etiquetas
Keep Informed
1 seguidor(es)
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 eLearning platform and experience all Odoo Apps through learning videos, use cases and quizzes.

Test it now