Skip to content

Commit a112444

Browse files
authored
Merge pull request #53110 from diptanilsaha/pr_tt
2 parents d2e0475 + 6342e78 commit a112444

1 file changed

Lines changed: 10 additions & 11 deletions

File tree

erpnext/accounts/doctype/pricing_rule/pricing_rule.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -346,8 +346,7 @@ def apply_pricing_rule(args: str | dict, doc: str | dict | Document | None = Non
346346

347347
args = frappe._dict(args)
348348

349-
if not args.transaction_type:
350-
set_transaction_type(args)
349+
set_transaction_type(args)
351350

352351
# list of dictionaries
353352
out = []
@@ -688,23 +687,23 @@ def remove_pricing_rules(item_list: str | list):
688687
return out
689688

690689

691-
def set_transaction_type(args):
692-
if args.transaction_type:
690+
def set_transaction_type(pricing_ctx: frappe._dict) -> None:
691+
if pricing_ctx.transaction_type in ["buying", "selling"]:
693692
return
694-
if args.doctype in ("Opportunity", "Quotation", "Sales Order", "Delivery Note", "Sales Invoice"):
695-
args.transaction_type = "selling"
696-
elif args.doctype in (
693+
if pricing_ctx.doctype in ("Opportunity", "Quotation", "Sales Order", "Delivery Note", "Sales Invoice"):
694+
pricing_ctx.transaction_type = "selling"
695+
elif pricing_ctx.doctype in (
697696
"Material Request",
698697
"Supplier Quotation",
699698
"Purchase Order",
700699
"Purchase Receipt",
701700
"Purchase Invoice",
702701
):
703-
args.transaction_type = "buying"
704-
elif args.customer:
705-
args.transaction_type = "selling"
702+
pricing_ctx.transaction_type = "buying"
703+
elif pricing_ctx.customer:
704+
pricing_ctx.transaction_type = "selling"
706705
else:
707-
args.transaction_type = "buying"
706+
pricing_ctx.transaction_type = "buying"
708707

709708

710709
@frappe.whitelist()

0 commit comments

Comments
 (0)