feat: init outstanding amount same as payment amount

This commit is contained in:
Saqib Ansari
2021-02-10 13:50:02 +05:30
committed by Deepesh Garg
parent c648027473
commit e2e2a305da
2 changed files with 6 additions and 10 deletions

View File

@@ -71,6 +71,7 @@
"options": "Mode of Payment" "options": "Mode of Payment"
}, },
{ {
"depends_on": "paid_amount",
"fieldname": "paid_amount", "fieldname": "paid_amount",
"fieldtype": "Currency", "fieldtype": "Currency",
"label": "Paid Amount" "label": "Paid Amount"
@@ -86,12 +87,15 @@
}, },
{ {
"default": "0", "default": "0",
"depends_on": "discounted_amount",
"fieldname": "discounted_amount", "fieldname": "discounted_amount",
"fieldtype": "Currency", "fieldtype": "Currency",
"label": "Discounted Amount", "label": "Discounted Amount",
"read_only": 1 "read_only": 1
}, },
{ {
"depends_on": "outstanding || paid_amount",
"fetch_from": "payment_amount",
"fieldname": "outstanding", "fieldname": "outstanding",
"fieldtype": "Currency", "fieldtype": "Currency",
"label": "Outstanding", "label": "Outstanding",
@@ -101,7 +105,7 @@
"index_web_pages_for_search": 1, "index_web_pages_for_search": 1,
"istable": 1, "istable": 1,
"links": [], "links": [],
"modified": "2021-02-09 20:47:56.617701", "modified": "2021-02-10 13:39:47.405252",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Payment Schedule", "name": "Payment Schedule",

View File

@@ -910,10 +910,8 @@ class AccountsController(TransactionBase):
else: else:
for d in self.get("payment_schedule"): for d in self.get("payment_schedule"):
if d.invoice_portion: if d.invoice_portion:
d.payment_amount = flt(grand_total * flt(d.invoice_portion / 100), d.precision('payment_amount')) d.payment_amount = flt(grand_total * flt(d.invoice_portion) / 100, d.precision('payment_amount'))
d.base_payment_amount = flt(base_grand_total * flt(d.invoice_portion / 100), d.precision('payment_amount'))
d.outstanding = d.payment_amount d.outstanding = d.payment_amount
d.base_outstanding = d.base_payment_amount
def set_due_date(self): def set_due_date(self):
due_dates = [d.due_date for d in self.get("payment_schedule") if d.due_date] due_dates = [d.due_date for d in self.get("payment_schedule") if d.due_date]
@@ -1234,13 +1232,7 @@ def get_payment_term_details(term, posting_date=None, grand_total=None, base_gra
term_details.description = term.description term_details.description = term.description
term_details.invoice_portion = term.invoice_portion term_details.invoice_portion = term.invoice_portion
term_details.payment_amount = flt(term.invoice_portion) * flt(grand_total) / 100 term_details.payment_amount = flt(term.invoice_portion) * flt(grand_total) / 100
term_details.base_payment_amount = flt(term.invoice_portion) * flt(base_grand_total) / 100
term_details.discount_type = term.discount_type
term_details.discount = term.discount
term_details.outstanding = term_details.payment_amount term_details.outstanding = term_details.payment_amount
term_details.base_outstanding = term_details.base_payment_amount
term_details.mode_of_payment = term.mode_of_payment
if bill_date: if bill_date:
term_details.due_date = get_due_date(term, bill_date) term_details.due_date = get_due_date(term, bill_date)
elif posting_date: elif posting_date: