fix: adjust price insertion logic for internal suppliers/customers (#42988)
* fix: adjust price insertion logic for internal suppliers/customers * refactor: correct indentation, specify conditions within function * fix: typo --------- Co-authored-by: Smit Vora <smitvora203@gmail.com>
This commit is contained in:
@@ -820,13 +820,9 @@ def get_price_list_rate(args, item_doc, out=None):
|
|||||||
if price_list_rate is None or frappe.db.get_single_value(
|
if price_list_rate is None or frappe.db.get_single_value(
|
||||||
"Stock Settings", "update_existing_price_list_rate"
|
"Stock Settings", "update_existing_price_list_rate"
|
||||||
):
|
):
|
||||||
if args.get("is_internal_supplier") or args.get("is_internal_customer"):
|
|
||||||
return out
|
|
||||||
|
|
||||||
if args.price_list and args.rate:
|
|
||||||
insert_item_price(args)
|
insert_item_price(args)
|
||||||
|
|
||||||
if not price_list_rate:
|
if price_list_rate is None:
|
||||||
return out
|
return out
|
||||||
|
|
||||||
out.price_list_rate = flt(price_list_rate) * flt(args.plc_conversion_rate) / flt(args.conversion_rate)
|
out.price_list_rate = flt(price_list_rate) * flt(args.plc_conversion_rate) / flt(args.conversion_rate)
|
||||||
@@ -848,6 +844,14 @@ def get_price_list_rate(args, item_doc, out=None):
|
|||||||
|
|
||||||
def insert_item_price(args):
|
def insert_item_price(args):
|
||||||
"""Insert Item Price if Price List and Price List Rate are specified and currency is the same"""
|
"""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(
|
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")
|
frappe.db.get_single_value("Stock Settings", "auto_insert_price_list_rate_if_missing")
|
||||||
):
|
):
|
||||||
|
|||||||
Reference in New Issue
Block a user