Compare amount in invoice currency against amount_to_pay
The transition_pay should have the same test as the default_ask because amount_to_pay is computed in the invoice currency. Otherwise if the rate is lower the test fail in transition_pay and the empty ask state is tested which raises an exception. issue7192 review52471002
This commit is contained in:
1 parent
f67b986e79
commit
71642c6127
1 file changed
+3
-1
+3
-1
@@ -2680,6 +2680,8 @@ class PayInvoice(Wizard):
|
||||
with Transaction().set_context(date=self.start.date):
|
||||
amount = Currency.compute(self.start.currency,
|
||||
self.start.amount, invoice.company.currency)
|
||||
amount_invoice = Currency.compute(
|
||||
self.start.currency, self.start.amount, invoice.currency)
|
||||
|
||||
reconcile_lines, remainder = \
|
||||
self.get_reconcile_lines_for_amount(invoice, amount)
|
||||
@@ -2690,7 +2692,7 @@ class PayInvoice(Wizard):
|
||||
amount_second_currency = self.start.amount
|
||||
second_currency = self.start.currency
|
||||
|
||||
if (abs(amount) > abs(invoice.amount_to_pay)
|
||||
if (amount_invoice > invoice.amount_to_pay
|
||||
and self.ask.type != 'writeoff'):
|
||||
self.raise_user_error('amount_greater_amount_to_pay',
|
||||
(invoice.rec_name,))
|
||||
|
||||
Reference in new issue
Block a user