[FIX] sale: pass invoice origin as string instead of list

Currently, the default invoice origin for the sale action_view_invoice
is being passed as a list by using the mapped method. This causes that,
when an invoice is created from this view, the origin is set to ['SOXXXXX'].

With the fix, we properly pass the origin as a string so the origin is set
as SOXXXXX, which should be the expected. Notice also that the context is
only passed when dealing with a single SO.

closes odoo/odoo#74579

X-original-commit: 3ad1310eb88581333bb8ccb28b859abcbadabe42
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
This commit is contained in:
JordiMForgeFlow
2021-08-02 14:25:41 +00:00
committed by Victor Feyens
parent 9c131562a8
commit f8aeb414ef
+1 -1
View File
@@ -638,7 +638,7 @@ class SaleOrder(models.Model):
'default_partner_id': self.partner_id.id,
'default_partner_shipping_id': self.partner_shipping_id.id,
'default_invoice_payment_term_id': self.payment_term_id.id or self.partner_id.property_payment_term_id.id or self.env['account.move'].default_get(['invoice_payment_term_id']).get('invoice_payment_term_id'),
'default_invoice_origin': self.mapped('name'),
'default_invoice_origin': self.name,
'default_user_id': self.user_id.id,
})
action['context'] = context