Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
I am working with the
product.product class that inherits by delegation from
product.template. I want to access field
uos_id from the parent class. The field is defined as
fields.many2one('product.uom', 'Unit of Sale',help='Some text').
I tried to access the fields as follows:
product_obj = self.pool.get('product.product') product = product_obj.browse(cr, uid, product_id, context=context2) uom = product.uos_id
The code crashes some lines further because (I guess) the variable is empty. I suspect the issue is in the way I access the many2one field because when I use field uos_coeff from the parent class, it works fine (the field is defined as a
fields.float('Unit of Measure -> UOS Coeff', digits_compute= dp.get_precision('Product UoS'), help='Coefficient')
Any idea of what's wrong?
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 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 E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 6/9/13, 8:49 AM|
|Seen: 1195 times|
|Last updated: 3/16/15, 8:10 AM|