Skip to content

Commit 0d0014c

Browse files
authored
Merge pull request #52994 from frappe/mergify/bp/version-16/pr-52188
fix(payment entry): round unallocated amount (backport #52188)
2 parents e178290 + e7e5285 commit 0d0014c

File tree

1 file changed

+22
-10
lines changed

1 file changed

+22
-10
lines changed

erpnext/accounts/doctype/payment_entry/payment_entry.py

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,20 +1082,32 @@ def set_unallocated_amount(self):
10821082
self.base_paid_amount + deductions_to_consider
10831083
):
10841084
self.unallocated_amount = (
1085-
self.base_paid_amount
1086-
+ deductions_to_consider
1087-
- self.base_total_allocated_amount
1088-
- included_taxes
1089-
) / self.source_exchange_rate
1085+
flt(
1086+
(
1087+
self.base_paid_amount
1088+
+ deductions_to_consider
1089+
- self.base_total_allocated_amount
1090+
- included_taxes
1091+
),
1092+
self.precision("unallocated_amount"),
1093+
)
1094+
/ self.source_exchange_rate
1095+
)
10901096
elif self.payment_type == "Pay" and self.base_total_allocated_amount < (
10911097
self.base_received_amount - deductions_to_consider
10921098
):
10931099
self.unallocated_amount = (
1094-
self.base_received_amount
1095-
- deductions_to_consider
1096-
- self.base_total_allocated_amount
1097-
- included_taxes
1098-
) / self.target_exchange_rate
1100+
flt(
1101+
(
1102+
self.base_received_amount
1103+
- deductions_to_consider
1104+
- self.base_total_allocated_amount
1105+
- included_taxes
1106+
),
1107+
self.precision("unallocated_amount"),
1108+
)
1109+
/ self.target_exchange_rate
1110+
)
10991111

11001112
def set_exchange_gain_loss(self):
11011113
exchange_gain_loss = flt(

0 commit comments

Comments
 (0)