[test-case] test cases for delinking advance payments

This commit is contained in:
Saurabh
2016-11-16 13:42:44 +05:30
parent 866c295989
commit 8adbfa8a09
4 changed files with 73 additions and 3 deletions

View File

@@ -129,11 +129,16 @@ class TransactionBase(StatusUpdater):
def delink_advance_entries(self, jv):
total_allocated_amount = 0
for adv in self.advances:
consider_for_total_advance = True
if adv.reference_name == jv:
frappe.db.sql("""delete from `tab{0} Advance`
where name = %s""".format(self.doctype), adv.name)
total_allocated_amount += flt(adv.allocated_amount, adv.precision("allocated_amount"))
self.db_set("total_advance", total_allocated_amount)
consider_for_total_advance = False
if consider_for_total_advance:
total_allocated_amount += flt(adv.allocated_amount, adv.precision("allocated_amount"))
frappe.db.set_value(self.doctype, self.name, "total_advance", total_allocated_amount, update_modified=False)
def delete_events(ref_type, ref_name):
frappe.delete_doc("Event", frappe.db.sql_list("""select name from `tabEvent`