mirror of
https://bitbucket.org/presik/trytonpsk-account_voucher.git
synced 2023-12-14 06:03:15 +01:00
fix difference_in_exchange
This commit is contained in:
parent
a7008a4be0
commit
6a664be024
2 changed files with 6 additions and 2 deletions
|
@ -1,5 +1,5 @@
|
|||
[tryton]
|
||||
version=6.0.10
|
||||
version=6.0.11
|
||||
depends:
|
||||
account
|
||||
account_invoice
|
||||
|
|
|
@ -540,6 +540,9 @@ class Voucher(Workflow, ModelSQL, ModelView):
|
|||
pool = Pool()
|
||||
Invoice = pool.get('account.invoice')
|
||||
MoveLine = pool.get('account.move.line')
|
||||
pool = Pool()
|
||||
config = pool.get('account.configuration')(1)
|
||||
writeoff = None
|
||||
# reconcile check
|
||||
lines_list = []
|
||||
for sl, ml in to_reconcile.values():
|
||||
|
@ -549,6 +552,7 @@ class Voucher(Workflow, ModelSQL, ModelView):
|
|||
amount = abs(ml.credit - ml.debit)
|
||||
if invoice.currency != invoice.company.currency:
|
||||
amount = abs(ml.amount_second_currency)
|
||||
writeoff = config.difference_in_exchange
|
||||
if self.currency.is_zero(abs(invoice.amount_to_pay) - amount) or self.currency.is_zero(invoice.amount_to_pay):
|
||||
pending_reconcile = [l for l in invoice.payment_lines + invoice.lines_to_pay
|
||||
if not l.reconciliation]
|
||||
|
@ -585,7 +589,7 @@ class Voucher(Workflow, ModelSQL, ModelView):
|
|||
if to_reconcile_lines:
|
||||
lines_list.append(to_reconcile_lines)
|
||||
if lines_list:
|
||||
MoveLine.reconcile(*lines_list)
|
||||
MoveLine.reconcile(*lines_list, writeoff=writeoff)
|
||||
|
||||
@classmethod
|
||||
def delete(cls, vouchers):
|
||||
|
|
Loading…
Reference in a new issue