Rounding Adjustment via a separate field, instead of last tax row (#10659)

* Rounding Adjust via a separate field, instead of last tax row

* Fixed test cases
This commit is contained in:
Nabin Hait
2017-09-19 14:53:16 +05:30
committed by GitHub
parent f551b43a94
commit 2e4de83df6
15 changed files with 733 additions and 154 deletions

View File

@@ -136,14 +136,7 @@ def round_off_debit_credit(gl_map):
make_round_off_gle(gl_map, debit_credit_diff)
def make_round_off_gle(gl_map, debit_credit_diff):
round_off_account, round_off_cost_center = frappe.db.get_value("Company", gl_map[0].company,
["round_off_account", "round_off_cost_center"]) or [None, None]
if not round_off_account:
frappe.throw(_("Please mention Round Off Account in Company"))
if not round_off_cost_center:
frappe.throw(_("Please mention Round Off Cost Center in Company"))
round_off_account, round_off_cost_center = get_round_off_account_and_cost_center(gl_map[0].company)
round_off_gle = frappe._dict()
for k in ["voucher_type", "voucher_no", "company",
@@ -165,6 +158,17 @@ def make_round_off_gle(gl_map, debit_credit_diff):
gl_map.append(round_off_gle)
def get_round_off_account_and_cost_center(company):
round_off_account, round_off_cost_center = frappe.db.get_value("Company", company,
["round_off_account", "round_off_cost_center"]) or [None, None]
if not round_off_account:
frappe.throw(_("Please mention Round Off Account in Company"))
if not round_off_cost_center:
frappe.throw(_("Please mention Round Off Cost Center in Company"))
return round_off_account, round_off_cost_center
def delete_gl_entries(gl_entries=None, voucher_type=None, voucher_no=None,
adv_adj=False, update_outstanding="Yes"):