Hello all,
I'm in the model account.invoice, in a new method.
An invoice has an origin sale order.
Trying to get the id of the origin sale_order of an invoice.
Is this the best and cleanest way to get this id?
class AccountInvoice(models.Model):
_inherit = "account.invoice"
def get_origin_sale_order_id(self):
sale_order_id = self.env['sale.order'].search([('name', '=', self.origin)])[0].id
return sale_order_id
Thanks for your comments!