Skip to content

Commit

Permalink
Merge pull request #43046 from frappe/mergify/bp/version-15-hotfix/pr…
Browse files Browse the repository at this point in the history
…-42988

fix: adjust price insertion logic for internal suppliers/customers (backport #42988)
  • Loading branch information
vorasmit committed Sep 4, 2024
2 parents a2b7fc1 + daa75ee commit 9444793
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions erpnext/stock/get_item_details.py
Original file line number Diff line number Diff line change
Expand Up @@ -807,14 +807,10 @@ def get_price_list_rate(args, item_doc, out=None):
if price_list_rate is None or frappe.db.get_single_value(
"Stock Settings", "update_existing_price_list_rate"
):
if args.get("is_internal_supplier") or args.get("is_internal_customer"):
return out
insert_item_price(args)

if args.price_list and args.rate:
insert_item_price(args)

if not price_list_rate:
return out
if price_list_rate is None:
return out

out.price_list_rate = flt(price_list_rate) * flt(args.plc_conversion_rate) / flt(args.conversion_rate)

Expand All @@ -835,6 +831,14 @@ def get_price_list_rate(args, item_doc, out=None):

def insert_item_price(args):
"""Insert Item Price if Price List and Price List Rate are specified and currency is the same"""
if (
not args.price_list
or not args.rate
or args.get("is_internal_supplier")
or args.get("is_internal_customer")
):
return

if frappe.db.get_value("Price List", args.price_list, "currency", cache=True) == args.currency and cint(
frappe.db.get_single_value("Stock Settings", "auto_insert_price_list_rate_if_missing")
):
Expand Down

0 comments on commit 9444793

Please sign in to comment.