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've got a little problem. I'm currently creating a custom module on Odoo 9 and I want to get an attribute defined in _columns in an inherit of pos_order in another class inherited : account_invoice.
For this purpose, I declared a variable order as it :
order = self.env['pos.order'].browse(self.reference)
The value I wanna get is the attribute "coupon_nb" from order but the things I tried ("order['coupon_nb'], order['coupon_nb'], order.coupon_nb, order.get('coupon_nb'), ...).
But nothing worked.
Please, help me !
Thank you in advance for your help.
You just need to define your order variable is as like below.
order = self #self[zero] means first object from record set.
After assign above value you will get pos.order(10) inside your log when you put this in you logger with the help of _logger.info("ORDER = %r", order) . Here 10 is ID of that pos.order record.
Note : order = self.env['pos.order'].browse(self.reference) is creating object of pos.order with the help of reference field value "Main/0017", Odoo will treat that value as ID of the record and you will get above error inside your comment.
I hope this will help you to understand.
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: 5/17/16, 6:01 AM|
|Seen: 549 times|
|Last updated: 5/19/16, 1:08 AM|