fix(defaults): apply discount and provisonal defaults from item group and brand if available (backport #37466) (#37704)
fix(defaults): apply discount and provisonal defaults from item group and brand if available (#37466)
(cherry picked from commit 1612d7ba3f
)
Co-authored-by: David Arnold <dgx.arnold@gmail.com>
This commit is contained in:
parent
bfd240a19d
commit
f382b1cf61
@ -330,8 +330,12 @@ def get_basic_details(args, item, overwrite_warehouse=True):
|
||||
),
|
||||
"expense_account": expense_account
|
||||
or get_default_expense_account(args, item_defaults, item_group_defaults, brand_defaults),
|
||||
"discount_account": get_default_discount_account(args, item_defaults),
|
||||
"provisional_expense_account": get_provisional_account(args, item_defaults),
|
||||
"discount_account": get_default_discount_account(
|
||||
args, item_defaults, item_group_defaults, brand_defaults
|
||||
),
|
||||
"provisional_expense_account": get_provisional_account(
|
||||
args, item_defaults, item_group_defaults, brand_defaults
|
||||
),
|
||||
"cost_center": get_default_cost_center(
|
||||
args, item_defaults, item_group_defaults, brand_defaults
|
||||
),
|
||||
@ -685,12 +689,22 @@ def get_default_expense_account(args, item, item_group, brand):
|
||||
)
|
||||
|
||||
|
||||
def get_provisional_account(args, item):
|
||||
return item.get("default_provisional_account") or args.default_provisional_account
|
||||
def get_provisional_account(args, item, item_group, brand):
|
||||
return (
|
||||
item.get("default_provisional_account")
|
||||
or item_group.get("default_provisional_account")
|
||||
or brand.get("default_provisional_account")
|
||||
or args.default_provisional_account
|
||||
)
|
||||
|
||||
|
||||
def get_default_discount_account(args, item):
|
||||
return item.get("default_discount_account") or args.discount_account
|
||||
def get_default_discount_account(args, item, item_group, brand):
|
||||
return (
|
||||
item.get("default_discount_account")
|
||||
or item_group.get("default_discount_account")
|
||||
or brand.get("default_discount_account")
|
||||
or args.discount_account
|
||||
)
|
||||
|
||||
|
||||
def get_default_deferred_account(args, item, fieldname=None):
|
||||
|
Loading…
Reference in New Issue
Block a user