[fix] process payroll

This commit is contained in:
Rushabh Mehta 2015-11-06 14:46:16 +05:30
parent 0a0c267edb
commit 64e31e9a4e
2 changed files with 7 additions and 3 deletions

View File

@ -168,7 +168,11 @@ def get_pricing_rules(args):
field = frappe.scrub(parenttype) field = frappe.scrub(parenttype)
condition = "" condition = ""
if args.get(field): if args.get(field):
try:
lft, rgt = frappe.db.get_value(parenttype, args[field], ["lft", "rgt"]) lft, rgt = frappe.db.get_value(parenttype, args[field], ["lft", "rgt"])
except TypeError:
frappe.throw(_("Invalid {0}").format(args[field]))
parent_groups = frappe.db.sql_list("""select name from `tab%s` parent_groups = frappe.db.sql_list("""select name from `tab%s`
where lft<=%s and rgt>=%s""" % (parenttype, '%s', '%s'), (lft, rgt)) where lft<=%s and rgt>=%s""" % (parenttype, '%s', '%s'), (lft, rgt))

View File

@ -196,11 +196,11 @@ class ProcessPayroll(Document):
journal_entry.set("accounts", [ journal_entry.set("accounts", [
{ {
"account": salary_account, "account": salary_account,
"debit": amount "debit_in_account_currency": amount
}, },
{ {
"account": default_bank_account, "account": default_bank_account,
"credit": amount "credit_in_account_currency": amount
}, },
]) ])