Skip to content

Commit

Permalink
[FIX]account_ux: compute currency rate
Browse files Browse the repository at this point in the history
The calculation of the quote depends on the date of the invoice, however this date must be different for the type of invoice:

If it is a customer invoice we should take invoice_date
If it is a supplier invoice we should take date (accounting date).
This change was necessary because we get the following case: in the case of customer invoices, if we take the date field, what it will do is calculate the quote with the date on which the invoice was created. And this is a problem because if the user creates them before and validates them some time later, they will always take into account an old quote, taking into account that the date field is not shown in customer invoices and therefore they cannot edit.
  • Loading branch information
pablohmontenegro committed Feb 11, 2022
1 parent 2976d39 commit dee2a49
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion account_ux/wizards/account_change_currency.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def onchange_currency(self):
)
self.currency_rate = currency._convert(
1.0, self.currency_to_id, self.move_id.company_id,
date=self.move_id.date or
date=self.move_id["date" if self.move_id.is_purchase_document() else "invoice_date"] or
fields.Date.context_today(self))

def change_currency(self):
Expand Down

0 comments on commit dee2a49

Please sign in to comment.