Compare amount in the invoice currency against amount_to_pay
issue6842 review40841002
This commit is contained in:
1 parent
afbcfe61c9
commit
d26c0a6dde
1 file changed
+7
-2
+7
-2
@@ -2546,8 +2546,11 @@ 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)
|
||||
_, remainder = self.get_reconcile_lines_for_amount(invoice, amount)
|
||||
if remainder == Decimal('0.0') and amount <= invoice.amount_to_pay:
|
||||
if (remainder == Decimal('0.0')
|
||||
and amount_invoice <= invoice.amount_to_pay):
|
||||
return 'pay'
|
||||
return 'ask'
|
||||
|
||||
@@ -2570,6 +2573,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)
|
||||
|
||||
if invoice.company.currency.is_zero(amount):
|
||||
lines = invoice.lines_to_pay
|
||||
@@ -2588,7 +2593,7 @@ class PayInvoice(Wizard):
|
||||
default['currency_digits_writeoff'] = invoice.company.currency.digits
|
||||
default['invoice'] = invoice.id
|
||||
|
||||
if (amount > invoice.amount_to_pay
|
||||
if (amount_invoice > invoice.amount_to_pay
|
||||
or invoice.company.currency.is_zero(amount)):
|
||||
default['type'] = 'writeoff'
|
||||
return default
|
||||
|
||||
Reference in new issue
Block a user