[FIX] account: Fallback on self.env.user language if not user_id on PO
Steps to reproduce: - Install purchase and accounting apps - Set the database to a language that is not English - Create a purchase order - Remove purchase representative from PO (otherwise, no issue) - Action -> Create Vendor Bill - From the vendor bill, print invoice Issue: The pdf is in English (country names, date labels, etc...) Cause: If invoice type is `in_invoice` or `in_refund`, it will use the `invoice_user_id` language (object.invoice_user_id.sudo().lang). In the above case, there is no invoice_user_id on invoice. Solution: While preparing invoice values, set invoice_user_id to self.env.user.id if not user_id on PO. opw-2510134 closes odoo/odoo#74671 X-original-commit: 4b7569ce641a6fb20d5df676bf0b315d9b9d485d Signed-off-by: bon-odoo <nboulif@users.noreply.github.com>
This commit is contained in:
@@ -578,7 +578,7 @@ class PurchaseOrder(models.Model):
|
||||
'move_type': move_type,
|
||||
'narration': self.notes,
|
||||
'currency_id': self.currency_id.id,
|
||||
'invoice_user_id': self.user_id and self.user_id.id,
|
||||
'invoice_user_id': self.user_id and self.user_id.id or self.env.user.id,
|
||||
'partner_id': partner_invoice_id,
|
||||
'fiscal_position_id': (self.fiscal_position_id or self.fiscal_position_id.get_fiscal_position(partner_invoice_id)).id,
|
||||
'payment_reference': self.partner_ref or '',
|
||||
|
||||
Reference in New Issue
Block a user