fix: dynamic condition in the pricing rule not working (#42467)
(cherry picked from commit 0e817f42ef)
Co-authored-by: rohitwaghchaure <rohitw1991@gmail.com>
This commit is contained in:
@@ -1666,7 +1666,7 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe
|
|||||||
me.in_apply_price_list = true;
|
me.in_apply_price_list = true;
|
||||||
return this.frm.call({
|
return this.frm.call({
|
||||||
method: "erpnext.stock.get_item_details.apply_price_list",
|
method: "erpnext.stock.get_item_details.apply_price_list",
|
||||||
args: { args: args },
|
args: { args: args, doc: me.frm.doc },
|
||||||
callback: function(r) {
|
callback: function(r) {
|
||||||
if (!r.exc) {
|
if (!r.exc) {
|
||||||
frappe.run_serially([
|
frappe.run_serially([
|
||||||
|
|||||||
@@ -1297,7 +1297,7 @@ def get_batch_qty(batch_no, warehouse, item_code):
|
|||||||
|
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def apply_price_list(args, as_doc=False):
|
def apply_price_list(args, as_doc=False, doc=None):
|
||||||
"""Apply pricelist on a document-like dict object and return as
|
"""Apply pricelist on a document-like dict object and return as
|
||||||
{'parent': dict, 'children': list}
|
{'parent': dict, 'children': list}
|
||||||
|
|
||||||
@@ -1336,7 +1336,7 @@ def apply_price_list(args, as_doc=False):
|
|||||||
for item in item_list:
|
for item in item_list:
|
||||||
args_copy = frappe._dict(args.copy())
|
args_copy = frappe._dict(args.copy())
|
||||||
args_copy.update(item)
|
args_copy.update(item)
|
||||||
item_details = apply_price_list_on_item(args_copy)
|
item_details = apply_price_list_on_item(args_copy, doc=doc)
|
||||||
children.append(item_details)
|
children.append(item_details)
|
||||||
|
|
||||||
if as_doc:
|
if as_doc:
|
||||||
@@ -1354,10 +1354,10 @@ def apply_price_list(args, as_doc=False):
|
|||||||
return {"parent": parent, "children": children}
|
return {"parent": parent, "children": children}
|
||||||
|
|
||||||
|
|
||||||
def apply_price_list_on_item(args):
|
def apply_price_list_on_item(args, doc=None):
|
||||||
item_doc = frappe.db.get_value("Item", args.item_code, ["name", "variant_of"], as_dict=1)
|
item_doc = frappe.db.get_value("Item", args.item_code, ["name", "variant_of"], as_dict=1)
|
||||||
item_details = get_price_list_rate(args, item_doc)
|
item_details = get_price_list_rate(args, item_doc)
|
||||||
item_details.update(get_pricing_rule_for_item(args))
|
item_details.update(get_pricing_rule_for_item(args, doc=doc))
|
||||||
|
|
||||||
return item_details
|
return item_details
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user