mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-27 17:04:47 +00:00
refactor: added naming series for pricing rule
This commit is contained in:
@@ -2,12 +2,13 @@
|
|||||||
"actions": [],
|
"actions": [],
|
||||||
"allow_import": 1,
|
"allow_import": 1,
|
||||||
"allow_rename": 1,
|
"allow_rename": 1,
|
||||||
"autoname": "field:title",
|
"autoname": "naming_series:",
|
||||||
"creation": "2014-02-21 15:02:51",
|
"creation": "2014-02-21 15:02:51",
|
||||||
"doctype": "DocType",
|
"doctype": "DocType",
|
||||||
"engine": "InnoDB",
|
"engine": "InnoDB",
|
||||||
"field_order": [
|
"field_order": [
|
||||||
"applicability_section",
|
"applicability_section",
|
||||||
|
"naming_series",
|
||||||
"title",
|
"title",
|
||||||
"disable",
|
"disable",
|
||||||
"apply_on",
|
"apply_on",
|
||||||
@@ -95,8 +96,7 @@
|
|||||||
"fieldtype": "Data",
|
"fieldtype": "Data",
|
||||||
"label": "Title",
|
"label": "Title",
|
||||||
"no_copy": 1,
|
"no_copy": 1,
|
||||||
"reqd": 1,
|
"reqd": 1
|
||||||
"unique": 1
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"default": "0",
|
"default": "0",
|
||||||
@@ -571,6 +571,13 @@
|
|||||||
"fieldname": "is_recursive",
|
"fieldname": "is_recursive",
|
||||||
"fieldtype": "Check",
|
"fieldtype": "Check",
|
||||||
"label": "Is Recursive"
|
"label": "Is Recursive"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"default": "PRLE-.####",
|
||||||
|
"fieldname": "naming_series",
|
||||||
|
"fieldtype": "Select",
|
||||||
|
"label": "Naming Series",
|
||||||
|
"options": "PRLE-.####"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"icon": "fa fa-gift",
|
"icon": "fa fa-gift",
|
||||||
@@ -634,5 +641,6 @@
|
|||||||
],
|
],
|
||||||
"show_name_in_global_search": 1,
|
"show_name_in_global_search": 1,
|
||||||
"sort_field": "modified",
|
"sort_field": "modified",
|
||||||
"sort_order": "DESC"
|
"sort_order": "DESC",
|
||||||
|
"title_field": "title"
|
||||||
}
|
}
|
||||||
@@ -81,7 +81,7 @@ def _get_pricing_rules(doc, child_doc, discount_fields, rules = {}):
|
|||||||
new_doc = []
|
new_doc = []
|
||||||
args = get_args_for_pricing_rule(doc)
|
args = get_args_for_pricing_rule(doc)
|
||||||
applicable_for = frappe.scrub(doc.get('applicable_for'))
|
applicable_for = frappe.scrub(doc.get('applicable_for'))
|
||||||
for d in doc.get(child_doc):
|
for idx, d in enumerate(doc.get(child_doc)):
|
||||||
if d.name in rules:
|
if d.name in rules:
|
||||||
for applicable_for_value in args.get(applicable_for):
|
for applicable_for_value in args.get(applicable_for):
|
||||||
temp_args = args.copy()
|
temp_args = args.copy()
|
||||||
@@ -100,7 +100,7 @@ def _get_pricing_rules(doc, child_doc, discount_fields, rules = {}):
|
|||||||
pr = set_args(temp_args, pr, doc, child_doc, discount_fields, d)
|
pr = set_args(temp_args, pr, doc, child_doc, discount_fields, d)
|
||||||
else:
|
else:
|
||||||
pr = frappe.new_doc("Pricing Rule")
|
pr = frappe.new_doc("Pricing Rule")
|
||||||
pr.title = make_autoname("{0}/.####".format(doc.name))
|
pr.title = doc.name
|
||||||
temp_args[applicable_for] = applicable_for_value
|
temp_args[applicable_for] = applicable_for_value
|
||||||
pr = set_args(temp_args, pr, doc, child_doc, discount_fields, d)
|
pr = set_args(temp_args, pr, doc, child_doc, discount_fields, d)
|
||||||
|
|
||||||
@@ -110,7 +110,7 @@ def _get_pricing_rules(doc, child_doc, discount_fields, rules = {}):
|
|||||||
for i in range(len(args.get(applicable_for))) :
|
for i in range(len(args.get(applicable_for))) :
|
||||||
|
|
||||||
pr = frappe.new_doc("Pricing Rule")
|
pr = frappe.new_doc("Pricing Rule")
|
||||||
pr.title = make_autoname("{0}/.####".format(doc.name))
|
pr.title = doc.name
|
||||||
temp_args = args.copy()
|
temp_args = args.copy()
|
||||||
temp_args[applicable_for] = args[applicable_for][i]
|
temp_args[applicable_for] = args[applicable_for][i]
|
||||||
pr = set_args(temp_args, pr, doc, child_doc, discount_fields, d)
|
pr = set_args(temp_args, pr, doc, child_doc, discount_fields, d)
|
||||||
|
|||||||
Reference in New Issue
Block a user