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.
From sales.order object, how do I get the associated invoices?
I have tried to extend class stock.picking like this and added a function field:
payment_method = fields.Char(compute='_get_payment_terms',string='Payment Method',readonly=True)
self.payment_method = self.sale_id.invoice_ids and self.sale_id.invoice_ids.payment_method_id and self.sale_id.invoice_ids.payment_method_id.name or ''
When loading the module it says: fields = [model._fields[head]] KeyError: 'payment_method_id'
Is there anything obvious I could be missing?
There is a m2m field called "invoice_ids" in Sale Order which contains all the Invoices related to the SO.
I don't see "payment_method_id" field in account.invoice. Make sure you are using right field. I guess you want to show "Payment Terms". For this you have to use "payment_term" field which is in "account.invoice".
Hope this will resolve your issue.
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/10/16, 7:44 AM|
|Seen: 726 times|
|Last updated: 1/10/16, 9:15 AM|