Outstanding Amount not getting updated in Payment Entry #12713 (#12975)

* allow to `set_missing_ref_details` by force

* update payment entry references during submit and cancel
This commit is contained in:
tundebabzy 2018-02-19 08:41:56 +01:00 committed by Nabin Hait
parent 5448318146
commit 6c5d7986ab

View File

@ -58,16 +58,21 @@ class PaymentEntry(AccountsController):
if self.difference_amount:
frappe.throw(_("Difference Amount must be zero"))
self.make_gl_entries()
self.update_outstanding_amounts()
self.update_advance_paid()
self.update_expense_claim()
def on_cancel(self):
self.setup_party_account_field()
self.make_gl_entries(cancel=1)
self.update_outstanding_amounts()
self.update_advance_paid()
self.update_expense_claim()
self.delink_advance_entry_references()
def update_outstanding_amounts(self):
self.set_missing_ref_details(force=True)
def validate_duplicate_entry(self):
reference_names = []
for d in self.get("references"):
@ -129,14 +134,14 @@ class PaymentEntry(AccountsController):
self.set_missing_ref_details()
def set_missing_ref_details(self):
def set_missing_ref_details(self, force=False):
for d in self.get("references"):
if d.allocated_amount:
ref_details = get_reference_details(d.reference_doctype,
d.reference_name, self.party_account_currency)
for field, value in ref_details.items():
if not d.get(field):
if not d.get(field) or force:
d.set(field, value)
def validate_payment_type(self):