I have noticed that the unallocated_amount
field in the Payment Entry table is calculated from the base (company currency) value for multicurrency accounts:
def set_unallocated_amount(self):
self.unallocated_amount = 0
if self.party:
total_deductions = sum([flt(d.amount) for d in self.get("deductions")])
if self.payment_type == "Receive" \
and self.base_total_allocated_amount < self.base_received_amount + total_deductions \
and self.total_allocated_amount < self.paid_amount + (total_deductions / self.source_exchange_rate):
self.unallocated_amount = (self.base_received_amount + total_deductions -
self.base_total_allocated_amount) / self.source_exchange_rate
elif self.payment_type == "Pay" \
and self.base_total_allocated_amount < (self.base_paid_amount - total_deductions) \
and self.total_allocated_amount < self.received_amount + (total_deductions / self.target_exchange_rate):
self.unallocated_amount = (self.base_paid_amount - (total_deductions +
self.base_total_allocated_amount)) / self.target_exchange_rate
Is there any particular reason for doing it this way instead of just using the originating values? For a few of my transactions the unallocated amount is fractionally different to the original value of the payment as the base value is rounded to 2 d.p. whereas integer values are stored to 6 d.p.
For example, I have a transaction with a paid amount of €69.230000, converted to £60.960000 @ 0.880600. This is fully unallocated, and the system is showing the unallocated amount as €69.225528.
I don’t think this will cause any issues as once an invoice is allocated then the discrepancy will disappear, it just looks strange on ledger reports.
Edit: This might actually be a problem as received_amount
and paid_amount
are set to be outstanding_amount
, so if this issue occurs on an open payment then the GL entry will be wrong.