fix(accounts): currency fields no longer read as strings by validation function in Payment Entry (#33535)

fix(accounts): currency fields no longer read as strings by validation function in Payment Entry (#33535)

explicitly cast paid_amount and received_amount to float in the Payment Entry set_unallocated_amount validation function

(cherry picked from commit 4d5067d6d4)

Co-authored-by: Gughan Ravikumar <gughanrk@gmail.com>
This commit is contained in:
mergify[bot]
2023-01-10 09:55:12 +05:30
committed by GitHub
parent 914e2fdded
commit 44a95da8ab

View File

@@ -622,7 +622,7 @@ class PaymentEntry(AccountsController):
self.payment_type == "Receive" self.payment_type == "Receive"
and self.base_total_allocated_amount < self.base_received_amount + total_deductions and self.base_total_allocated_amount < self.base_received_amount + total_deductions
and self.total_allocated_amount and self.total_allocated_amount
< self.paid_amount + (total_deductions / self.source_exchange_rate) < flt(self.paid_amount) + (total_deductions / self.source_exchange_rate)
): ):
self.unallocated_amount = ( self.unallocated_amount = (
self.base_received_amount + total_deductions - self.base_total_allocated_amount self.base_received_amount + total_deductions - self.base_total_allocated_amount
@@ -632,7 +632,7 @@ class PaymentEntry(AccountsController):
self.payment_type == "Pay" self.payment_type == "Pay"
and self.base_total_allocated_amount < (self.base_paid_amount - total_deductions) and self.base_total_allocated_amount < (self.base_paid_amount - total_deductions)
and self.total_allocated_amount and self.total_allocated_amount
< self.received_amount + (total_deductions / self.target_exchange_rate) < flt(self.received_amount) + (total_deductions / self.target_exchange_rate)
): ):
self.unallocated_amount = ( self.unallocated_amount = (
self.base_paid_amount - (total_deductions + self.base_total_allocated_amount) self.base_paid_amount - (total_deductions + self.base_total_allocated_amount)