Skip to content

Commit

Permalink
Merge pull request #43045 from frappe/mergify/bp/version-14-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 authored Sep 4, 2024
2 parents c7fb6e5 + 3912c68 commit ed185a6
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 @@ -855,14 +855,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 @@ -883,6 +879,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 ed185a6

Please sign in to comment.