Merge pull request #32844 from deepeshgarg007/auto_allocate_advances

fix: Auto advance allocation against partial invoices
This commit is contained in:
Deepesh Garg
2022-11-05 16:27:59 +05:30
committed by GitHub
2 changed files with 67 additions and 7 deletions

View File

@@ -804,15 +804,12 @@ class AccountsController(TransactionBase):
self.set("advances", [])
advance_allocated = 0
for d in res:
if d.against_order:
allocated_amount = flt(d.amount)
if self.get("party_account_currency") == self.company_currency:
amount = self.get("base_rounded_total") or self.base_grand_total
else:
if self.get("party_account_currency") == self.company_currency:
amount = self.get("base_rounded_total") or self.base_grand_total
else:
amount = self.get("rounded_total") or self.grand_total
amount = self.get("rounded_total") or self.grand_total
allocated_amount = min(amount - advance_allocated, d.amount)
allocated_amount = min(amount - advance_allocated, d.amount)
advance_allocated += flt(allocated_amount)
advance_row = {