I want to bring the total value of the invoice to the stock.picking using the origin to bring it right
I tried to do something else, it did not work
can you help me?
from odoo import api, fields, models, _ from odoo.exceptions import UserError
class StockPicking(models.Model):
_inherit = 'stock.picking'
def get_x_total(self):
current_total = self.env['account.invoice'].search([('origin','=',self.origin)])
x_total = current_total.('account.invoice').amount_total
return x_total
x_amout_total = fields.Float('Valor Total', default=lambda self: self.get_x_total())