feat: Assign Item's Default Discount Account if present

This commit is contained in:
GangaManoj 2021-07-06 16:51:12 +05:30
parent ef667a9a64
commit 657e9b5320

View File

@ -288,6 +288,7 @@ def get_basic_details(args, item, overwrite_warehouse=True):
"warehouse": warehouse,
"income_account": get_default_income_account(args, item_defaults, item_group_defaults, brand_defaults),
"expense_account": expense_account or get_default_expense_account(args, item_defaults, item_group_defaults, brand_defaults) ,
"discount_account": None or get_default_discount_account(args, item_defaults),
"cost_center": get_default_cost_center(args, item_defaults, item_group_defaults, brand_defaults),
'has_serial_no': item.has_serial_no,
'has_batch_no': item.has_batch_no,
@ -590,6 +591,10 @@ def get_default_expense_account(args, item, item_group, brand):
or brand.get("expense_account")
or args.expense_account)
def get_default_discount_account(args, item_defaults):
return (item_defaults.default_discount_account
or args.discount_account)
def get_default_deferred_account(args, item, fieldname=None):
if item.get("enable_deferred_revenue") or item.get("enable_deferred_expense"):
return (item.get(fieldname)