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.
Hello, I have Odoo8.
Sorry if my question is very simple, but I can't find my mistake.
In a model (sale.order), I have a related field:
acopiado_restante = fields.Float(digits=(8,2), related='pricelist_version_id.monto_acopiado_restante', string="Monto acopiado restante")
The field points to a computed field on model product.pricelist.version.
In a method of sale.order class, I need to use the value of field 'acopiado_restante', specifically in this method:
def onchange_pricelist_id(self, cr, uid, ids, pricelist_id, order_lines, context=None): ...
I try to access to the field using self.acopiado_restante, but I get the error 'sale.order don't have field _ids'.
What is the mistake and how can access to the field? Thanks!
I have a feeling, you are not aware of Onchange definition and its semantics, please learn those before proceeding
Onchange will work in both on saved and unsaved records...
In case of saved records you can use self to fetch data, in case of unsaved of records, self will not be available to be used since record is not saved, hence ids wont be there....
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: 1/8/15, 9:54 PM|
|Seen: 754 times|
|Last updated: 3/16/15, 8:10 AM|