Merge pull request #30494 from resilient-tech/fix-get-cached-value

fix: update `get_cached_value` usage based on changes in definition
This commit is contained in:
gavin 2022-03-30 16:26:51 +05:30 committed by GitHub
commit b9d37152ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -375,12 +375,12 @@ def get_pricing_rule_for_item(args, price_list_rate=0, doc=None, for_validate=Fa
def update_args_for_pricing_rule(args):
if not (args.item_group and args.brand):
try:
args.item_group, args.brand = frappe.get_cached_value(
"Item", args.item_code, ["item_group", "brand"]
)
except frappe.DoesNotExistError:
item = frappe.get_cached_value("Item", args.item_code, ("item_group", "brand"))
if not item:
return
args.item_group, args.brand = item
if not args.item_group:
frappe.throw(_("Item Group not mentioned in item master for item {0}").format(args.item_code))