Hello,
I am working on Odoo 11 and I am trying to update the cost of items in the inventory module when I click on the validate button of a supplier invoice (Purchase module). The cost of the items shall take the cost indicated in the invoice.
I created the following method:
from odoo import fields, models, api
class ProductCost(models.Model):
_inherit = 'account.invoice'
@api.multi()
def _get_last_price(self):
for record in self.product_id:
record.write({'standard_price': self.price_unit})
return super(ProductCost, self).action_invoice_open()
But it doesn't work, if anyone can help me that would be great!
Thanks
It works !! thank you very much !