Skip to content
Snippets Groups Projects
Commit 7f1d7c1c authored by Goffin Simon's avatar Goffin Simon
Browse files

[FIX] account: invoice has not the same currency as the purchase order

Used case:

-Configure company in EUR, and user in multi-currency
-Create a purchase order in USD and confirm it
-Click on the smart button "0 invoices" then click on "create"

Result before the fix:

The system created an invoice in EUR, currency of the company,
instead of in USD, currency of the purchase order.

Result after the fix:

The system created an invoice in USD, the currency of the related purchase order.

opw:677568
parent 96e08535
Branches
Tags
No related merge requests found
......@@ -69,6 +69,9 @@ class AccountInvoice(models.Model):
@api.model
def _default_currency(self):
if 'default_purchase_id' in self.env.context:
purchase_id = self.env.context['default_purchase_id']
return self.env['purchase.order'].browse(purchase_id).currency_id
journal = self._default_journal()
return journal.currency_id or journal.company_id.currency_id
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment