feat: pricing rule enhancements
diff --git a/erpnext/accounts/doctype/apply_rule_on_brand/__init__.py b/erpnext/accounts/doctype/apply_rule_on_brand/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/erpnext/accounts/doctype/apply_rule_on_brand/__init__.py
diff --git a/erpnext/accounts/doctype/apply_rule_on_brand/apply_rule_on_brand.json b/erpnext/accounts/doctype/apply_rule_on_brand/apply_rule_on_brand.json
new file mode 100644
index 0000000..cc41f04
--- /dev/null
+++ b/erpnext/accounts/doctype/apply_rule_on_brand/apply_rule_on_brand.json
@@ -0,0 +1,110 @@
+{
+ "allow_copy": 0,
+ "allow_events_in_timeline": 0,
+ "allow_guest_to_view": 0,
+ "allow_import": 0,
+ "allow_rename": 0,
+ "beta": 0,
+ "creation": "2019-02-07 14:50:22.641575",
+ "custom": 0,
+ "docstatus": 0,
+ "doctype": "DocType",
+ "document_type": "",
+ "editable_grid": 1,
+ "engine": "InnoDB",
+ "fields": [
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "depends_on": "eval:parent.apply_on == 'Item Code'",
+ "fieldname": "brand",
+ "fieldtype": "Link",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 1,
+ "in_standard_filter": 0,
+ "label": "Brand",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Brand",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 1,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "uom",
+ "fieldtype": "Link",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 1,
+ "in_standard_filter": 0,
+ "label": "UOM",
+ "length": 0,
+ "no_copy": 0,
+ "options": "UOM",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ }
+ ],
+ "has_web_view": 0,
+ "hide_heading": 0,
+ "hide_toolbar": 0,
+ "idx": 0,
+ "image_view": 0,
+ "in_create": 0,
+ "is_submittable": 0,
+ "issingle": 0,
+ "istable": 1,
+ "max_attachments": 0,
+ "modified": "2019-02-14 15:35:41.963974",
+ "modified_by": "Administrator",
+ "module": "Accounts",
+ "name": "Apply Rule On Brand",
+ "name_case": "",
+ "owner": "Administrator",
+ "permissions": [],
+ "quick_entry": 0,
+ "read_only": 0,
+ "read_only_onload": 0,
+ "show_name_in_global_search": 0,
+ "sort_field": "modified",
+ "sort_order": "DESC",
+ "track_changes": 1,
+ "track_seen": 0,
+ "track_views": 0
+}
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/apply_rule_on_brand/apply_rule_on_brand.py b/erpnext/accounts/doctype/apply_rule_on_brand/apply_rule_on_brand.py
new file mode 100644
index 0000000..2f7a29e
--- /dev/null
+++ b/erpnext/accounts/doctype/apply_rule_on_brand/apply_rule_on_brand.py
@@ -0,0 +1,10 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+import frappe
+from frappe.model.document import Document
+
+class ApplyRuleOnBrand(Document):
+ pass
diff --git a/erpnext/accounts/doctype/apply_rule_on_item_code/__init__.py b/erpnext/accounts/doctype/apply_rule_on_item_code/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/erpnext/accounts/doctype/apply_rule_on_item_code/__init__.py
diff --git a/erpnext/accounts/doctype/apply_rule_on_item_code/apply_rule_on_item_code.json b/erpnext/accounts/doctype/apply_rule_on_item_code/apply_rule_on_item_code.json
new file mode 100644
index 0000000..6b6fd63
--- /dev/null
+++ b/erpnext/accounts/doctype/apply_rule_on_item_code/apply_rule_on_item_code.json
@@ -0,0 +1,110 @@
+{
+ "allow_copy": 0,
+ "allow_events_in_timeline": 0,
+ "allow_guest_to_view": 0,
+ "allow_import": 0,
+ "allow_rename": 0,
+ "beta": 0,
+ "creation": "2019-02-07 14:48:59.649168",
+ "custom": 0,
+ "docstatus": 0,
+ "doctype": "DocType",
+ "document_type": "",
+ "editable_grid": 1,
+ "engine": "InnoDB",
+ "fields": [
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "depends_on": "eval:parent.apply_on == 'Item Code'",
+ "fieldname": "item_code",
+ "fieldtype": "Link",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 1,
+ "in_standard_filter": 0,
+ "label": "Item Code",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Item",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 1,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "uom",
+ "fieldtype": "Link",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 1,
+ "in_standard_filter": 0,
+ "label": "UOM",
+ "length": 0,
+ "no_copy": 0,
+ "options": "UOM",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ }
+ ],
+ "has_web_view": 0,
+ "hide_heading": 0,
+ "hide_toolbar": 0,
+ "idx": 0,
+ "image_view": 0,
+ "in_create": 0,
+ "is_submittable": 0,
+ "issingle": 0,
+ "istable": 1,
+ "max_attachments": 0,
+ "modified": "2019-02-14 15:35:24.455316",
+ "modified_by": "Administrator",
+ "module": "Accounts",
+ "name": "Apply Rule On Item Code",
+ "name_case": "",
+ "owner": "Administrator",
+ "permissions": [],
+ "quick_entry": 0,
+ "read_only": 0,
+ "read_only_onload": 0,
+ "show_name_in_global_search": 0,
+ "sort_field": "modified",
+ "sort_order": "DESC",
+ "track_changes": 1,
+ "track_seen": 0,
+ "track_views": 0
+}
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/apply_rule_on_item_code/apply_rule_on_item_code.py b/erpnext/accounts/doctype/apply_rule_on_item_code/apply_rule_on_item_code.py
new file mode 100644
index 0000000..3959e4a
--- /dev/null
+++ b/erpnext/accounts/doctype/apply_rule_on_item_code/apply_rule_on_item_code.py
@@ -0,0 +1,10 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+import frappe
+from frappe.model.document import Document
+
+class ApplyRuleOnItemCode(Document):
+ pass
diff --git a/erpnext/accounts/doctype/apply_rule_on_item_group/__init__.py b/erpnext/accounts/doctype/apply_rule_on_item_group/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/erpnext/accounts/doctype/apply_rule_on_item_group/__init__.py
diff --git a/erpnext/accounts/doctype/apply_rule_on_item_group/apply_rule_on_item_group.json b/erpnext/accounts/doctype/apply_rule_on_item_group/apply_rule_on_item_group.json
new file mode 100644
index 0000000..24570ce
--- /dev/null
+++ b/erpnext/accounts/doctype/apply_rule_on_item_group/apply_rule_on_item_group.json
@@ -0,0 +1,110 @@
+{
+ "allow_copy": 0,
+ "allow_events_in_timeline": 0,
+ "allow_guest_to_view": 0,
+ "allow_import": 0,
+ "allow_rename": 0,
+ "beta": 0,
+ "creation": "2019-02-07 14:50:01.599577",
+ "custom": 0,
+ "docstatus": 0,
+ "doctype": "DocType",
+ "document_type": "",
+ "editable_grid": 1,
+ "engine": "InnoDB",
+ "fields": [
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "depends_on": "eval:parent.apply_on == 'Item Code'",
+ "fieldname": "item_group",
+ "fieldtype": "Link",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 1,
+ "in_standard_filter": 0,
+ "label": "Item Group",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Item Group",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 1,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "uom",
+ "fieldtype": "Link",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 1,
+ "in_standard_filter": 0,
+ "label": "UOM",
+ "length": 0,
+ "no_copy": 0,
+ "options": "UOM",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ }
+ ],
+ "has_web_view": 0,
+ "hide_heading": 0,
+ "hide_toolbar": 0,
+ "idx": 0,
+ "image_view": 0,
+ "in_create": 0,
+ "is_submittable": 0,
+ "issingle": 0,
+ "istable": 1,
+ "max_attachments": 0,
+ "modified": "2019-02-14 15:35:32.311693",
+ "modified_by": "Administrator",
+ "module": "Accounts",
+ "name": "Apply Rule On Item Group",
+ "name_case": "",
+ "owner": "Administrator",
+ "permissions": [],
+ "quick_entry": 0,
+ "read_only": 0,
+ "read_only_onload": 0,
+ "show_name_in_global_search": 0,
+ "sort_field": "modified",
+ "sort_order": "DESC",
+ "track_changes": 1,
+ "track_seen": 0,
+ "track_views": 0
+}
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/apply_rule_on_item_group/apply_rule_on_item_group.py b/erpnext/accounts/doctype/apply_rule_on_item_group/apply_rule_on_item_group.py
new file mode 100644
index 0000000..0fc1e63
--- /dev/null
+++ b/erpnext/accounts/doctype/apply_rule_on_item_group/apply_rule_on_item_group.py
@@ -0,0 +1,10 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+import frappe
+from frappe.model.document import Document
+
+class ApplyRuleOnItemGroup(Document):
+ pass
diff --git a/erpnext/accounts/doctype/loyalty_program/test_loyalty_program.py b/erpnext/accounts/doctype/loyalty_program/test_loyalty_program.py
index 8a1d6a2..56a0d2f 100644
--- a/erpnext/accounts/doctype/loyalty_program/test_loyalty_program.py
+++ b/erpnext/accounts/doctype/loyalty_program/test_loyalty_program.py
@@ -150,7 +150,7 @@
company_wise_info = get_dashboard_info("Customer", doc.name, doc.loyalty_program)
for d in company_wise_info:
- self.assertTrue(d.loyalty_points)
+ self.assertTrue(d.get("loyalty_points"))
def get_points_earned(self):
def get_returned_amount():
diff --git a/erpnext/accounts/doctype/price_discount_slab/__init__.py b/erpnext/accounts/doctype/price_discount_slab/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/erpnext/accounts/doctype/price_discount_slab/__init__.py
diff --git a/erpnext/accounts/doctype/price_discount_slab/price_discount_slab.json b/erpnext/accounts/doctype/price_discount_slab/price_discount_slab.json
new file mode 100644
index 0000000..3d49a63
--- /dev/null
+++ b/erpnext/accounts/doctype/price_discount_slab/price_discount_slab.json
@@ -0,0 +1,792 @@
+{
+ "allow_copy": 0,
+ "allow_events_in_timeline": 0,
+ "allow_guest_to_view": 0,
+ "allow_import": 0,
+ "allow_rename": 0,
+ "beta": 0,
+ "creation": "2019-01-22 14:59:16.794655",
+ "custom": 0,
+ "docstatus": 0,
+ "doctype": "DocType",
+ "document_type": "",
+ "editable_grid": 1,
+ "engine": "InnoDB",
+ "fields": [
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "disable",
+ "fieldtype": "Check",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Disable",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "column_break_2",
+ "fieldtype": "Column Break",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "rule_description",
+ "fieldtype": "Small Text",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Rule Description",
+ "length": 0,
+ "no_copy": 1,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 1,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "section_break_2",
+ "fieldtype": "Section Break",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 1,
+ "default": "0",
+ "fieldname": "min_qty",
+ "fieldtype": "Float",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 1,
+ "in_standard_filter": 0,
+ "label": "Min Qty",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 1,
+ "default": "0",
+ "fieldname": "max_qty",
+ "fieldtype": "Float",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 1,
+ "in_standard_filter": 0,
+ "label": "Max Qty",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "column_break_3",
+ "fieldtype": "Column Break",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "default": "0",
+ "fieldname": "min_amount",
+ "fieldtype": "Currency",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 1,
+ "in_standard_filter": 0,
+ "label": "Min Amount",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "default": "0",
+ "depends_on": "",
+ "fieldname": "max_amount",
+ "fieldtype": "Currency",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 1,
+ "in_standard_filter": 0,
+ "label": "Max Amount",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "depends_on": "",
+ "fieldname": "section_break_6",
+ "fieldtype": "Section Break",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "default": "Discount Percentage",
+ "depends_on": "",
+ "fieldname": "rate_or_discount",
+ "fieldtype": "Select",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 1,
+ "in_standard_filter": 0,
+ "label": "Discount Type",
+ "length": 0,
+ "no_copy": 0,
+ "options": "\nRate\nDiscount Percentage\nDiscount Amount",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "depends_on": "",
+ "fieldname": "column_break_10",
+ "fieldtype": "Column Break",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 2,
+ "depends_on": "eval:doc.rate_or_discount==\"Rate\"",
+ "fieldname": "rate",
+ "fieldtype": "Currency",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 1,
+ "in_standard_filter": 0,
+ "label": "Rate",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "depends_on": "eval:doc.rate_or_discount==\"Discount Amount\"",
+ "fieldname": "discount_amount",
+ "fieldtype": "Currency",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Discount Amount",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "depends_on": "eval:doc.rate_or_discount==\"Discount Percentage\"",
+ "fieldname": "discount_percentage",
+ "fieldtype": "Float",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Discount Percentage",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "section_break_11",
+ "fieldtype": "Section Break",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "warehouse",
+ "fieldtype": "Link",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Warehouse",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Warehouse",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "threshold_percentage",
+ "fieldtype": "Percent",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Threshold for Suggestion",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "default": "1",
+ "fieldname": "validate_applied_rule",
+ "fieldtype": "Check",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Validate Applied Rule",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "column_break_14",
+ "fieldtype": "Column Break",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "priority",
+ "fieldtype": "Select",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Priority",
+ "length": 0,
+ "no_copy": 0,
+ "options": "\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "depends_on": "priority",
+ "fieldname": "apply_multiple_pricing_rules",
+ "fieldtype": "Check",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Apply Multiple Pricing Rules",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "default": "0",
+ "depends_on": "eval:in_list(['Discount Percentage', 'Discount Amount'], doc.rate_or_discount) && doc.apply_multiple_pricing_rules",
+ "fieldname": "apply_discount_on_rate",
+ "fieldtype": "Check",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Apply Discount on Rate",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ }
+ ],
+ "has_web_view": 0,
+ "hide_heading": 0,
+ "hide_toolbar": 0,
+ "idx": 0,
+ "image_view": 0,
+ "in_create": 0,
+ "is_submittable": 0,
+ "issingle": 0,
+ "istable": 1,
+ "max_attachments": 0,
+ "modified": "2019-03-08 18:54:20.063950",
+ "modified_by": "Administrator",
+ "module": "Accounts",
+ "name": "Price Discount Slab",
+ "name_case": "",
+ "owner": "Administrator",
+ "permissions": [],
+ "quick_entry": 0,
+ "read_only": 0,
+ "read_only_onload": 0,
+ "show_name_in_global_search": 0,
+ "sort_field": "modified",
+ "sort_order": "DESC",
+ "track_changes": 0,
+ "track_seen": 0,
+ "track_views": 0
+}
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/price_discount_slab/price_discount_slab.py b/erpnext/accounts/doctype/price_discount_slab/price_discount_slab.py
new file mode 100644
index 0000000..21abe33
--- /dev/null
+++ b/erpnext/accounts/doctype/price_discount_slab/price_discount_slab.py
@@ -0,0 +1,10 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+import frappe
+from frappe.model.document import Document
+
+class PriceDiscountSlab(Document):
+ pass
diff --git a/erpnext/accounts/doctype/pricing_rule/pricing_rule.js b/erpnext/accounts/doctype/pricing_rule/pricing_rule.js
index c33ab62..e5b6336 100644
--- a/erpnext/accounts/doctype/pricing_rule/pricing_rule.js
+++ b/erpnext/accounts/doctype/pricing_rule/pricing_rule.js
@@ -114,6 +114,16 @@
}
};
};
+
+ ['items', 'item_groups', 'brands'].forEach(d => {
+ frm.fields_dict[d].grid.get_field('uom').get_query = function(doc, cdt, cdn){
+ var row = locals[cdt][cdn];
+ return {
+ query:"erpnext.accounts.doctype.pricing_rule.pricing_rule.get_item_uoms",
+ filters: {'value': row[frappe.scrub(doc.apply_on)], apply_on: doc.apply_on}
+ }
+ };
+ })
},
onload: function(frm) {
@@ -191,6 +201,24 @@
set_field_options("pricing_rule_help", help_content);
frm.events.set_options_for_applicable_for(frm);
+ frm.trigger("toggle_reqd_apply_on");
+ },
+
+ apply_on: function(frm) {
+ frm.trigger("toggle_reqd_apply_on");
+ },
+
+ toggle_reqd_apply_on: function(frm) {
+ const fields = {
+ 'Item Code': 'items',
+ 'Item Group': 'item_groups',
+ 'Brand': 'brands'
+ }
+
+ for (var key in fields) {
+ frm.toggle_reqd(fields[key],
+ frm.doc.apply_on === key ? 1 : 0);
+ }
},
rate_or_discount: function(frm) {
@@ -220,13 +248,13 @@
options = $.merge(options, ["Customer", "Customer Group", "Territory", "Sales Partner", "Campaign"]);
}
if(frm.doc.buying) {
- $.merge(options, ["Supplier", "Supplier Type"]);
+ $.merge(options, ["Supplier", "Supplier Group"]);
}
-
+
set_field_options("applicable_for", options.join("\n"));
-
+
if(!in_list(options, applicable_for)) applicable_for = null;
frm.set_value("applicable_for", applicable_for);
}
-
+
});
diff --git a/erpnext/accounts/doctype/pricing_rule/pricing_rule.json b/erpnext/accounts/doctype/pricing_rule/pricing_rule.json
index ac59904..299e634 100644
--- a/erpnext/accounts/doctype/pricing_rule/pricing_rule.json
+++ b/erpnext/accounts/doctype/pricing_rule/pricing_rule.json
@@ -1,5 +1,6 @@
{
"allow_copy": 0,
+ "allow_events_in_timeline": 0,
"allow_guest_to_view": 0,
"allow_import": 1,
"allow_rename": 1,
@@ -14,10 +15,12 @@
"fields": [
{
"allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "depends_on": "",
"fieldname": "applicability_section",
"fieldtype": "Section Break",
"hidden": 0,
@@ -39,11 +42,12 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
- "translatable": 0,
+ "translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -70,201 +74,12 @@
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
- "translatable": 0,
- "unique": 0
+ "translatable": 0,
+ "unique": 1
},
{
"allow_bulk_edit": 0,
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
- "default": "Item Code",
- "fieldname": "apply_on",
- "fieldtype": "Select",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_global_search": 0,
- "in_list_view": 1,
- "in_standard_filter": 1,
- "label": "Apply On",
- "length": 0,
- "no_copy": 0,
- "options": "\nItem Code\nItem Group\nBrand",
- "permlevel": 0,
- "print_hide": 0,
- "print_hide_if_no_value": 0,
- "read_only": 0,
- "remember_last_selected_value": 0,
- "report_hide": 0,
- "reqd": 1,
- "search_index": 0,
- "set_only_once": 0,
- "translatable": 0,
- "unique": 0
- },
- {
- "allow_bulk_edit": 0,
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
- "depends_on": "eval:doc.apply_on==\"Item Code\"",
- "fieldname": "item_code",
- "fieldtype": "Link",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_global_search": 0,
- "in_list_view": 1,
- "in_standard_filter": 1,
- "label": "Item Code",
- "length": 0,
- "no_copy": 0,
- "options": "Item",
- "permlevel": 0,
- "print_hide": 0,
- "print_hide_if_no_value": 0,
- "read_only": 0,
- "remember_last_selected_value": 0,
- "report_hide": 0,
- "reqd": 0,
- "search_index": 0,
- "set_only_once": 0,
- "translatable": 0,
- "unique": 0
- },
- {
- "allow_bulk_edit": 0,
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
- "depends_on": "eval:doc.apply_on==\"Brand\"",
- "fieldname": "brand",
- "fieldtype": "Link",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_global_search": 0,
- "in_list_view": 1,
- "in_standard_filter": 0,
- "label": "Brand",
- "length": 0,
- "no_copy": 0,
- "options": "Brand",
- "permlevel": 0,
- "print_hide": 0,
- "print_hide_if_no_value": 0,
- "read_only": 0,
- "remember_last_selected_value": 0,
- "report_hide": 0,
- "reqd": 0,
- "search_index": 0,
- "set_only_once": 0,
- "translatable": 0,
- "unique": 0
- },
- {
- "allow_bulk_edit": 0,
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
- "depends_on": "eval:doc.apply_on==\"Item Group\"",
- "fieldname": "item_group",
- "fieldtype": "Link",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_global_search": 0,
- "in_list_view": 1,
- "in_standard_filter": 0,
- "label": "Item Group",
- "length": 0,
- "no_copy": 0,
- "options": "Item Group",
- "permlevel": 0,
- "print_hide": 0,
- "print_hide_if_no_value": 0,
- "read_only": 0,
- "remember_last_selected_value": 0,
- "report_hide": 0,
- "reqd": 0,
- "search_index": 0,
- "set_only_once": 0,
- "translatable": 0,
- "unique": 0
- },
- {
- "allow_bulk_edit": 0,
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
- "fieldname": "column_break_7",
- "fieldtype": "Column Break",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_global_search": 0,
- "in_list_view": 0,
- "in_standard_filter": 0,
- "length": 0,
- "no_copy": 0,
- "permlevel": 0,
- "precision": "",
- "print_hide": 0,
- "print_hide_if_no_value": 0,
- "read_only": 0,
- "remember_last_selected_value": 0,
- "report_hide": 0,
- "reqd": 0,
- "search_index": 0,
- "set_only_once": 0,
- "translatable": 0,
- "unique": 0
- },
- {
- "allow_bulk_edit": 0,
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
- "description": "Higher the number, higher the priority",
- "fieldname": "priority",
- "fieldtype": "Select",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_global_search": 0,
- "in_list_view": 0,
- "in_standard_filter": 0,
- "label": "Priority",
- "length": 0,
- "no_copy": 0,
- "options": "\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20",
- "permlevel": 0,
- "print_hide": 0,
- "print_hide_if_no_value": 0,
- "read_only": 0,
- "remember_last_selected_value": 0,
- "report_hide": 0,
- "reqd": 0,
- "search_index": 0,
- "set_only_once": 0,
- "translatable": 0,
- "unique": 0
- },
- {
- "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -290,17 +105,118 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
- "translatable": 0,
+ "translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
- "fieldname": "section_break_7",
- "fieldtype": "Section Break",
+ "default": "Item Code",
+ "fieldname": "apply_on",
+ "fieldtype": "Select",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 1,
+ "in_standard_filter": 1,
+ "label": "Apply On",
+ "length": 0,
+ "no_copy": 0,
+ "options": "\nItem Code\nItem Group\nBrand\nTransaction",
+ "permlevel": 0,
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 1,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "price_or_product_discount",
+ "fieldtype": "Select",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Price or Product Discount",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Price\nProduct",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 1,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "depends_on": "eval:doc.apply_on != 'Transaction'",
+ "fieldname": "warehouse",
+ "fieldtype": "Link",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Warehouse",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Warehouse",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 1,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "column_break_7",
+ "fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
@@ -320,11 +236,412 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
- "translatable": 0,
+ "translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "depends_on": "eval:doc.apply_on == 'Item Code'",
+ "fieldname": "items",
+ "fieldtype": "Table",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Apply Rule On Item Code",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Apply Rule On Item Code",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "depends_on": "eval:doc.apply_on == 'Item Group'",
+ "fieldname": "item_groups",
+ "fieldtype": "Table",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Apply Rule On Item Group",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Apply Rule On Item Group",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "depends_on": "eval:doc.apply_on == 'Brand'",
+ "fieldname": "brands",
+ "fieldtype": "Table",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Apply Rule On Brand",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Apply Rule On Brand",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "depends_on": "eval:doc.apply_on != 'Transaction'",
+ "description": "Conditions will be applied on all the selected items combined. ",
+ "fieldname": "mixed_conditions",
+ "fieldtype": "Check",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Mixed Conditions",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "depends_on": "",
+ "fieldname": "is_cumulative",
+ "fieldtype": "Check",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Is Cumulative",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 1,
+ "columns": 0,
+ "depends_on": "eval:doc.apply_on != 'Transaction'",
+ "fieldname": "section_break_18",
+ "fieldtype": "Section Break",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Discount on Other Item",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "apply_rule_on_other",
+ "fieldtype": "Select",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Apply Rule On Other",
+ "length": 0,
+ "no_copy": 0,
+ "options": "\nItem Code\nItem Group\nBrand",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "column_break_17",
+ "fieldtype": "Column Break",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "depends_on": "eval:doc.apply_rule_on_other == 'Item Code'",
+ "fieldname": "other_item_code",
+ "fieldtype": "Link",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Item Code",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Item",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "depends_on": "eval:doc.apply_rule_on_other == 'Item Group'",
+ "fieldname": "other_item_group",
+ "fieldtype": "Link",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Item Group",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Item Group",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "depends_on": "eval:doc.apply_rule_on_other == 'Brand'",
+ "fieldname": "other_brand",
+ "fieldtype": "Link",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Brand",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Brand",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "section_break_7",
+ "fieldtype": "Section Break",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Party Information",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -350,11 +667,12 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
- "translatable": 0,
+ "translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -380,11 +698,12 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
- "translatable": 0,
+ "translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -410,11 +729,12 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
- "translatable": 0,
+ "translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -432,7 +752,7 @@
"label": "Applicable For",
"length": 0,
"no_copy": 0,
- "options": "\nCustomer\nCustomer Group\nTerritory\nSales Partner\nCampaign\nSupplier\nSupplier Group",
+ "options": "\nCustomer\nCustomer Group\nTerritory\nSales Partner\nCampaign\nSupplier\nSupplier Group",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
@@ -442,11 +762,12 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
- "translatable": 0,
+ "translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -474,11 +795,12 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
- "translatable": 0,
+ "translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -506,11 +828,12 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
- "translatable": 0,
+ "translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -538,11 +861,12 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
- "translatable": 0,
+ "translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -570,11 +894,12 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
- "translatable": 0,
+ "translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -602,11 +927,12 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
- "translatable": 0,
+ "translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -634,17 +960,18 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
- "translatable": 0,
+ "translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
- "depends_on": "eval:doc.applicable_for==\"Supplier Group\"",
- "fieldname": "supplier_group",
+ "depends_on": "eval:doc.applicable_for==\"Supplier Group\"",
+ "fieldname": "supplier_group",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
@@ -653,10 +980,10 @@
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
- "label": "Supplier Group",
+ "label": "Supplier Group",
"length": 0,
"no_copy": 0,
- "options": "Supplier Group",
+ "options": "Supplier Group",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
@@ -666,15 +993,17 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
- "translatable": 0,
+ "translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "depends_on": "",
"fieldname": "section_break_19",
"fieldtype": "Section Break",
"hidden": 0,
@@ -684,6 +1013,7 @@
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
+ "label": "Quantity and Amount",
"length": 0,
"no_copy": 0,
"permlevel": 0,
@@ -696,11 +1026,12 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
- "translatable": 0,
+ "translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -726,41 +1057,12 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
- "translatable": 0,
+ "translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
- "fieldname": "column_break_21",
- "fieldtype": "Column Break",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_global_search": 0,
- "in_list_view": 0,
- "in_standard_filter": 0,
- "length": 0,
- "no_copy": 0,
- "permlevel": 0,
- "precision": "",
- "print_hide": 0,
- "print_hide_if_no_value": 0,
- "read_only": 0,
- "remember_last_selected_value": 0,
- "report_hide": 0,
- "reqd": 0,
- "search_index": 0,
- "set_only_once": 0,
- "translatable": 0,
- "unique": 0
- },
- {
- "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -786,17 +1088,18 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
- "translatable": 0,
+ "translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
- "fieldname": "section_break_23",
- "fieldtype": "Section Break",
+ "fieldname": "column_break_21",
+ "fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
@@ -816,11 +1119,112 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
- "translatable": 0,
+ "translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "default": "0",
+ "fieldname": "min_amt",
+ "fieldtype": "Currency",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Min Amt",
+ "length": 0,
+ "no_copy": 0,
+ "options": "currency",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "default": "0",
+ "fieldname": "max_amt",
+ "fieldtype": "Currency",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Max Amt",
+ "length": 0,
+ "no_copy": 0,
+ "options": "currency",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "section_break_23",
+ "fieldtype": "Section Break",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Period Settings",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -847,11 +1251,12 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
- "translatable": 0,
+ "translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -877,11 +1282,12 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
- "translatable": 0,
+ "translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -906,11 +1312,12 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
- "translatable": 0,
+ "translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -937,11 +1344,12 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
- "translatable": 0,
+ "translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -970,11 +1378,12 @@
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
- "translatable": 0,
+ "translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -1002,11 +1411,12 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
- "translatable": 0,
+ "translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -1035,11 +1445,12 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
- "translatable": 0,
+ "translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -1065,11 +1476,12 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
- "translatable": 0,
+ "translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -1098,16 +1510,18 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
- "translatable": 0,
+ "translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
- "fieldname": "price_discount_section",
+ "depends_on": "eval:doc.price_or_product_discount == 'Price'",
+ "fieldname": "price_discount_scheme_section",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
@@ -1116,7 +1530,7 @@
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
- "label": "",
+ "label": "Price Discount Scheme",
"length": 0,
"no_copy": 0,
"permlevel": 0,
@@ -1128,11 +1542,12 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
- "translatable": 0,
+ "translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -1150,7 +1565,7 @@
"label": "Rate or Discount",
"length": 0,
"no_copy": 0,
- "options": "\nRate\nDiscount Percentage",
+ "options": "\nRate\nDiscount Percentage\nDiscount Amount",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
@@ -1160,15 +1575,52 @@
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
- "translatable": 0,
+ "translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "default": "Grand Total",
+ "depends_on": "eval:doc.apply_on == 'Transaction' && doc.rate_or_discount != 'Rate'",
+ "fieldname": "apply_discount_on",
+ "fieldtype": "Select",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Apply Discount On",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Grand Total\nNet Total",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "depends_on": "",
"fieldname": "col_break2",
"fieldtype": "Column Break",
"hidden": 0,
@@ -1189,11 +1641,12 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
- "translatable": 0,
+ "translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -1220,11 +1673,47 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
- "translatable": 0,
+ "translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "default": "0",
+ "depends_on": "eval:doc.rate_or_discount==\"Discount Amount\"",
+ "fieldname": "discount_amount",
+ "fieldtype": "Currency",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Discount Amount",
+ "length": 0,
+ "no_copy": 0,
+ "options": "currency",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -1239,7 +1728,7 @@
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
- "label": "Discount on Price List Rate (%)",
+ "label": "Discount Percentage",
"length": 0,
"no_copy": 0,
"permlevel": 0,
@@ -1251,11 +1740,12 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
- "translatable": 0,
+ "translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -1283,11 +1773,502 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
- "translatable": 0,
+ "translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "depends_on": "eval:doc.price_or_product_discount == 'Product'",
+ "fieldname": "product_discount_scheme_section",
+ "fieldtype": "Section Break",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Product Discount Scheme",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "depends_on": "eval:!doc.mixed_conditions",
+ "fieldname": "same_item",
+ "fieldtype": "Check",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Same Item",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "depends_on": "eval:!doc.same_item || doc.mixed_conditions",
+ "fieldname": "free_item",
+ "fieldtype": "Link",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Free Item",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Item",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "free_qty",
+ "fieldtype": "Float",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Qty",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "column_break_51",
+ "fieldtype": "Column Break",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "free_item_uom",
+ "fieldtype": "Link",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "UOM",
+ "length": 0,
+ "no_copy": 0,
+ "options": "UOM",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "free_item_rate",
+ "fieldtype": "Currency",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Rate",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 1,
+ "columns": 0,
+ "depends_on": "",
+ "fieldname": "section_break_13",
+ "fieldtype": "Section Break",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Advanced Settings",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "description": "System will notify to increase or decrease quantity or amount ",
+ "fieldname": "threshold_percentage",
+ "fieldtype": "Percent",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Threshold for Suggestion",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "description": "Higher the number, higher the priority",
+ "fieldname": "priority",
+ "fieldtype": "Select",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Priority",
+ "length": 0,
+ "no_copy": 0,
+ "options": "\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20",
+ "permlevel": 0,
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "column_break_66",
+ "fieldtype": "Column Break",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "apply_multiple_pricing_rules",
+ "fieldtype": "Check",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Apply Multiple Pricing Rules",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "depends_on": "eval:in_list(['Discount Percentage', 'Discount Amount'], doc.rate_or_discount) && doc.apply_multiple_pricing_rules",
+ "fieldname": "apply_discount_on_rate",
+ "fieldtype": "Check",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Apply Discount on Rate",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "depends_on": "eval:doc.price_or_product_discount == 'Price'",
+ "description": "",
+ "fieldname": "validate_applied_rule",
+ "fieldtype": "Check",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Validate Applied Rule",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "depends_on": "validate_applied_rule",
+ "fieldname": "rule_description",
+ "fieldtype": "Small Text",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Rule Description",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -1314,11 +2295,12 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
- "translatable": 0,
+ "translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -1344,7 +2326,104 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
- "translatable": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "reference_section",
+ "fieldtype": "Section Break",
+ "hidden": 1,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Reference",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "promotional_scheme_id",
+ "fieldtype": "Data",
+ "hidden": 1,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Promotional Scheme Id",
+ "length": 0,
+ "no_copy": 1,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 1,
+ "print_hide_if_no_value": 0,
+ "read_only": 1,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "promotional_scheme",
+ "fieldtype": "Link",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Promotional Scheme",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Promotional Scheme",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
"unique": 0
}
],
@@ -1359,7 +2438,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
- "modified": "2018-04-19 07:52:41.024618",
+ "modified": "2019-03-08 18:38:01.898869",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Pricing Rule",
@@ -1469,5 +2548,6 @@
"sort_order": "DESC",
"title_field": "",
"track_changes": 0,
- "track_seen": 0
+ "track_seen": 0,
+ "track_views": 0
}
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/pricing_rule/pricing_rule.py b/erpnext/accounts/doctype/pricing_rule/pricing_rule.py
index a7d1f6f..1e11c4e 100644
--- a/erpnext/accounts/doctype/pricing_rule/pricing_rule.py
+++ b/erpnext/accounts/doctype/pricing_rule/pricing_rule.py
@@ -8,30 +8,45 @@
import json
import copy
from frappe import throw, _
-from frappe.utils import flt, cint
+from frappe.utils import flt, cint, getdate
+
from frappe.model.document import Document
from six import string_types
-class MultiplePricingRuleConflict(frappe.ValidationError): pass
+apply_on_dict = {"Item Code": "items",
+ "Item Group": "item_groups", "Brand": "brands"}
class PricingRule(Document):
def validate(self):
self.validate_mandatory()
+ self.validate_duplicate_apply_on()
self.validate_applicable_for_selling_or_buying()
+ self.validate_min_max_amt()
self.validate_min_max_qty()
self.cleanup_fields_value()
self.validate_rate_or_discount()
self.validate_max_discount()
self.validate_price_list_with_currency()
+ self.validate_dates()
if not self.margin_type: self.margin_rate_or_amount = 0.0
+ def validate_duplicate_apply_on(self):
+ field = apply_on_dict.get(self.apply_on)
+ values = [d.get(frappe.scrub(self.apply_on)) for d in self.get(field)]
+
+ if len(values) != len(set(values)):
+ frappe.throw(_("Duplicate {0} found in the table").format(self.apply_on))
+
def validate_mandatory(self):
- for field in ["apply_on", "applicable_for"]:
- tocheck = frappe.scrub(self.get(field) or "")
- if tocheck and not self.get(tocheck):
- throw(_("{0} is required").format(self.meta.get_label(tocheck)), frappe.MandatoryError)
+ for apply_on, field in apply_on_dict.items():
+ if self.apply_on == apply_on and len(self.get(field) or []) < 1:
+ throw(_("{0} is not added in the table").format(apply_on), frappe.MandatoryError)
+
+ tocheck = frappe.scrub(self.get("applicable_for", ""))
+ if tocheck and not self.get(tocheck):
+ throw(_("{0} is required").format(self.meta.get_label(tocheck)), frappe.MandatoryError)
def validate_applicable_for_selling_or_buying(self):
if not self.selling and not self.buying:
@@ -50,6 +65,10 @@
if self.min_qty and self.max_qty and flt(self.min_qty) > flt(self.max_qty):
throw(_("Min Qty can not be greater than Max Qty"))
+ def validate_min_max_amt(self):
+ if self.min_amt and self.max_amt and flt(self.min_amt) > flt(self.max_amt):
+ throw(_("Min Amt can not be greater than Max Amt"))
+
def cleanup_fields_value(self):
for logic_field in ["apply_on", "applicable_for", "rate_or_discount"]:
fieldname = frappe.scrub(self.get(logic_field) or "")
@@ -63,16 +82,26 @@
if f!=fieldname:
self.set(f, None)
+ if self.mixed_conditions and self.get("same_item"):
+ self.same_item = 0
+
def validate_rate_or_discount(self):
for field in ["Rate"]:
if flt(self.get(frappe.scrub(field))) < 0:
throw(_("{0} can not be negative").format(field))
+ if self.price_or_product_discount == 'Product' and not self.free_item:
+ if self.mixed_conditions:
+ frappe.throw(_("Free item code is not selected"))
+ else:
+ self.same_item = 1
+
def validate_max_discount(self):
- if self.rate_or_discount == "Discount Percentage" and self.item_code:
- max_discount = frappe.get_cached_value("Item", self.item_code, "max_discount")
- if max_discount and flt(self.discount_percentage) > flt(max_discount):
- throw(_("Max discount allowed for item: {0} is {1}%").format(self.item_code, max_discount))
+ if self.rate_or_discount == "Discount Percentage" and self.items:
+ for d in self.items:
+ max_discount = frappe.get_cached_value("Item", d.item_code, "max_discount")
+ if max_discount and flt(self.discount_percentage) > flt(max_discount):
+ throw(_("Max discount allowed for item: {0} is {1}%").format(self.item_code, max_discount))
def validate_price_list_with_currency(self):
if self.currency and self.for_price_list:
@@ -80,6 +109,13 @@
if not self.currency == price_list_currency:
throw(_("Currency should be same as Price List Currency: {0}").format(price_list_currency))
+ def validate_dates(self):
+ if self.is_cumulative and not (self.valid_from and self.valid_upto):
+ frappe.throw(_("Valid from and valid upto fields are mandatory for the cumulative"))
+
+ if self.valid_from and self.valid_upto and getdate(self.valid_from) > getdate(self.valid_upto):
+ frappe.throw(_("Valid from date must be less than valid upto date"))
+
#--------------------------------------------------------------------------------
@frappe.whitelist()
@@ -125,7 +161,8 @@
for item in item_list:
args_copy = copy.deepcopy(args)
args_copy.update(item)
- out.append(get_pricing_rule_for_item(args_copy))
+ data = get_pricing_rule_for_item(args_copy, item.get('price_list_rate'))
+ out.append(data)
if set_serial_nos_based_on_fifo and not args.get('is_return'):
out.append(get_serial_no_for_item(args_copy))
return out
@@ -142,18 +179,26 @@
item_details.serial_no = get_serial_no(args)
return item_details
-def get_pricing_rule_for_item(args):
- if args.get("parenttype") == "Material Request": return {}
+def get_pricing_rule_for_item(args, price_list_rate=0, doc=None):
+ from erpnext.accounts.doctype.pricing_rule.utils import get_pricing_rules
+
+ if (args.get('is_free_item') or
+ args.get("parenttype") == "Material Request"): return {}
item_details = frappe._dict({
"doctype": args.doctype,
"name": args.name,
- "pricing_rule": None
+ "parent": args.parent,
+ "parenttype": args.parenttype,
+ "child_docname": args.get('child_docname'),
+ "discount_percentage_on_rate": [],
+ "discount_amount_on_rate": []
})
if args.ignore_pricing_rule or not args.item_code:
- if frappe.db.exists(args.doctype, args.name) and args.get("pricing_rule"):
- item_details = remove_pricing_rule_for_item(args.get("pricing_rule"), item_details)
+ if frappe.db.exists(args.doctype, args.name) and args.get("pricing_rules"):
+ item_details = remove_pricing_rule_for_item(args.get("pricing_rules"),
+ item_details, args.get('item_code'))
return item_details
if not (args.item_group and args.brand):
@@ -177,50 +222,113 @@
args.supplier_group = frappe.get_cached_value("Supplier", args.supplier, "supplier_group")
args.customer = args.customer_group = args.territory = None
- pricing_rules = get_pricing_rules(args)
- pricing_rule = filter_pricing_rules(args, pricing_rules)
+ pricing_rules = get_pricing_rules(args, doc)
- if pricing_rule:
- item_details.pricing_rule = pricing_rule.name
- item_details.pricing_rule_for = pricing_rule.rate_or_discount
+ if pricing_rules:
+ rules = []
- if (pricing_rule.margin_type == 'Amount' and pricing_rule.currency == args.currency)\
- or (pricing_rule.margin_type == 'Percentage'):
- item_details.margin_type = pricing_rule.margin_type
- item_details.margin_rate_or_amount = pricing_rule.margin_rate_or_amount
- else:
- item_details.margin_type = None
- item_details.margin_rate_or_amount = 0.0
+ item_details.discount_percentage = 0
+ item_details.discount_amount = 0
+ for pricing_rule in pricing_rules:
+ if not pricing_rule or pricing_rule.get('suggestion'): continue
- if pricing_rule.rate_or_discount == 'Rate':
- pricing_rule_rate = 0.0
- if pricing_rule.currency == args.currency:
- pricing_rule_rate = pricing_rule.rate
+ rules.append(get_pricing_rule_details(args, pricing_rule))
+ if pricing_rule.mixed_conditions or pricing_rule.apply_rule_on_other:
+ continue
- item_details.update({
- "price_list_rate": pricing_rule_rate * args.get("conversion_factor"),
- "discount_percentage": 0.0
- })
- else:
- item_details.discount_percentage = (pricing_rule.get('discount_percentage', 0)
- if pricing_rule else args.discount_percentage)
- elif args.get('pricing_rule'):
- item_details = remove_pricing_rule_for_item(args.get("pricing_rule"), item_details)
+ if (not pricing_rule.validate_applied_rule and
+ pricing_rule.price_or_product_discount == "Price"):
+ apply_price_discount_pricing_rule(pricing_rule, item_details, args)
+
+ item_details.has_pricing_rule = 1
+
+ # if discount is applied on the rate and not on price list rate
+ if price_list_rate:
+ set_discount_amount(price_list_rate, item_details)
+
+ item_details.pricing_rules = ','.join([d.pricing_rule for d in rules])
+
+ if not doc: return item_details
+
+ for rule in rules:
+ doc.append('pricing_rules', rule)
+
+ elif args.get("pricing_rules"):
+ item_details = remove_pricing_rule_for_item(args.get("pricing_rules"),
+ item_details, args.get('item_code'))
return item_details
-def remove_pricing_rule_for_item(pricing_rule, item_details):
- pricing_rule = frappe.get_cached_value('Pricing Rule', pricing_rule,
- ['price_or_discount', 'margin_type'], as_dict=1)
- if pricing_rule and pricing_rule.price_or_discount == 'Discount Percentage':
- item_details.discount_percentage = 0.0
+def get_pricing_rule_details(args, pricing_rule):
+ return frappe._dict({
+ 'pricing_rule': pricing_rule.name,
+ 'rate_or_discount': pricing_rule.rate_or_discount,
+ 'margin_type': pricing_rule.margin_type,
+ 'item_code': pricing_rule.item_code,
+ 'child_docname': args.get('child_docname')
+ })
- if pricing_rule and pricing_rule.margin_type in ['Percentage', 'Amount']:
- item_details.margin_rate_or_amount = 0.0
+def apply_price_discount_pricing_rule(pricing_rule, item_details, args):
+ item_details.pricing_rule_for = pricing_rule.rate_or_discount
+
+ if ((pricing_rule.margin_type == 'Amount' and pricing_rule.currency == args.currency)
+ or (pricing_rule.margin_type == 'Percentage')):
+ item_details.margin_type = pricing_rule.margin_type
+ item_details.margin_rate_or_amount = pricing_rule.margin_rate_or_amount
+ else:
item_details.margin_type = None
+ item_details.margin_rate_or_amount = 0.0
- if item_details.pricing_rule:
- item_details.pricing_rule = None
+ if pricing_rule.rate_or_discount == 'Rate':
+ pricing_rule_rate = 0.0
+ if pricing_rule.currency == args.currency:
+ pricing_rule_rate = pricing_rule.rate
+ item_details.update({
+ "price_list_rate": pricing_rule_rate * args.get("conversion_factor", 1),
+ "discount_percentage": 0.0
+ })
+
+ for apply_on in ['Discount Amount', 'Discount Percentage']:
+ if pricing_rule.rate_or_discount != apply_on: continue
+
+ field = frappe.scrub(apply_on)
+ if pricing_rule.apply_discount_on_rate:
+ discount_field = "{0}_on_rate".format(field)
+ item_details[discount_field].append(pricing_rule.get(field, 0))
+ else:
+ item_details[field] += (pricing_rule.get(field, 0)
+ if pricing_rule else args.get(field, 0))
+
+def set_discount_amount(rate, item_details):
+ for field in ['discount_percentage_on_rate', 'discount_amount_on_rate']:
+ for d in item_details.get(field):
+ dis_amount = (rate * d / 100
+ if field == 'discount_percentage_on_rate' else d)
+ rate -= dis_amount
+ item_details.rate = rate
+
+def remove_pricing_rule_for_item(pricing_rules, item_details, item_code=None):
+ for d in pricing_rules.split(','):
+ if not d: continue
+ pricing_rule = frappe.get_doc('Pricing Rule', d)
+
+ if pricing_rule.price_or_product_discount == 'Price':
+ if pricing_rule.rate_or_discount == 'Discount Percentage':
+ item_details.discount_percentage = 0.0
+ item_details.discount_amount = 0.0
+
+ if pricing_rule.rate_or_discount == 'Discount Amount':
+ item_details.discount_amount = 0.0
+
+ if pricing_rule.margin_type in ['Percentage', 'Amount']:
+ item_details.margin_rate_or_amount = 0.0
+ item_details.margin_type = None
+ elif pricing_rule.get('free_item'):
+ item_details.remove_free_item = (item_code if pricing_rule.get('same_item')
+ else pricing_rule.get('free_item'))
+
+ item_details.pricing_rules = ''
+
return item_details
@frappe.whitelist()
@@ -231,150 +339,12 @@
out = []
for item in item_list:
item = frappe._dict(item)
- out.append(remove_pricing_rule_for_item(item.get("pricing_rule"), item))
+ if item.get('pricing_rules'):
+ out.append(remove_pricing_rule_for_item(item.get("pricing_rules"),
+ item, item.item_code))
return out
-def get_pricing_rules(args):
- def _get_tree_conditions(parenttype, allow_blank=True):
- field = frappe.scrub(parenttype)
- condition = ""
- if args.get(field):
- if not frappe.flags.tree_conditions:
- frappe.flags.tree_conditions = {}
- key = (parenttype, args[field], )
- if key in frappe.flags.tree_conditions:
- return frappe.flags.tree_conditions[key]
-
- try:
- lft, rgt = frappe.db.get_value(parenttype, args[field], ["lft", "rgt"])
- except TypeError:
- frappe.throw(_("Invalid {0}").format(args[field]))
-
- parent_groups = frappe.db.sql_list("""select name from `tab%s`
- where lft<=%s and rgt>=%s""" % (parenttype, '%s', '%s'), (lft, rgt))
-
- if parent_groups:
- if allow_blank: parent_groups.append('')
- condition = "ifnull({field}, '') in ({parent_groups})".format(
- field=field,
- parent_groups=", ".join([frappe.db.escape(d) for d in parent_groups])
- )
-
- frappe.flags.tree_conditions[key] = condition
- return condition
-
-
- conditions = item_variant_condition = ""
- values = {"item_code": args.get("item_code"), "brand": args.get("brand")}
-
- for field in ["company", "customer", "supplier", "supplier_group", "campaign", "sales_partner"]:
- if args.get(field):
- conditions += " and ifnull("+field+", '') in (%("+field+")s, '')"
- values[field] = args.get(field)
- else:
- conditions += " and ifnull("+field+", '') = ''"
-
- for parenttype in ["Customer Group", "Territory"]:
- group_condition = _get_tree_conditions(parenttype)
- if group_condition:
- conditions += " and " + group_condition
-
- if not args.price_list: args.price_list = None
- conditions += " and ifnull(for_price_list, '') in (%(price_list)s, '')"
- values["price_list"] = args.get("price_list")
-
- if args.get("transaction_date"):
- conditions += """ and %(transaction_date)s between ifnull(valid_from, '2000-01-01')
- and ifnull(valid_upto, '2500-12-31')"""
- values['transaction_date'] = args.get('transaction_date')
-
- item_group_condition = _get_tree_conditions("Item Group", False)
- if item_group_condition:
- item_group_condition = " or " + item_group_condition
-
- # load variant of if not defined
- if "variant_of" not in args:
- args.variant_of = frappe.get_cached_value("Item", args.item_code, "variant_of")
-
- if args.variant_of:
- item_variant_condition = ' or item_code=%(variant_of)s '
- values['variant_of'] = args.variant_of
-
- return frappe.db.sql("""select * from `tabPricing Rule`
- where (item_code=%(item_code)s {item_variant_condition} {item_group_condition} or brand=%(brand)s)
- and docstatus < 2 and disable = 0
- and {transaction_type} = 1 {conditions}
- order by priority desc, name desc""".format(
- item_group_condition = item_group_condition,
- item_variant_condition = item_variant_condition,
- transaction_type = args.transaction_type,
- conditions = conditions), values, as_dict=1)
-
-def filter_pricing_rules(args, pricing_rules):
- # filter for qty
- if pricing_rules:
- stock_qty = flt(args.get('qty')) * args.get('conversion_factor', 1)
-
- pricing_rules = list(filter(lambda x: (flt(stock_qty)>=flt(x.min_qty)
- and (flt(stock_qty)<=x.max_qty if x.max_qty else True)), pricing_rules))
-
- # add variant_of property in pricing rule
- for p in pricing_rules:
- if p.item_code and args.variant_of:
- p.variant_of = args.variant_of
- else:
- p.variant_of = None
-
- # find pricing rule with highest priority
- if pricing_rules:
- max_priority = max([cint(p.priority) for p in pricing_rules])
- if max_priority:
- pricing_rules = list(filter(lambda x: cint(x.priority)==max_priority, pricing_rules))
-
- # apply internal priority
- all_fields = ["item_code", "item_group", "brand", "customer", "customer_group", "territory",
- "supplier", "supplier_group", "campaign", "sales_partner", "variant_of"]
-
- if len(pricing_rules) > 1:
- for field_set in [["item_code", "variant_of", "item_group", "brand"],
- ["customer", "customer_group", "territory"], ["supplier", "supplier_group"]]:
- remaining_fields = list(set(all_fields) - set(field_set))
- if if_all_rules_same(pricing_rules, remaining_fields):
- pricing_rules = apply_internal_priority(pricing_rules, field_set, args)
- break
-
- if len(pricing_rules) > 1:
- rate_or_discount = list(set([d.rate_or_discount for d in pricing_rules]))
- if len(rate_or_discount) == 1 and rate_or_discount[0] == "Discount Percentage":
- pricing_rules = list(filter(lambda x: x.for_price_list==args.price_list, pricing_rules)) \
- or pricing_rules
-
- if len(pricing_rules) > 1 and not args.for_shopping_cart:
- frappe.throw(_("Multiple Price Rules exists with same criteria, please resolve conflict by assigning priority. Price Rules: {0}")
- .format("\n".join([d.name for d in pricing_rules])), MultiplePricingRuleConflict)
- elif pricing_rules:
- return pricing_rules[0]
-
-def if_all_rules_same(pricing_rules, fields):
- all_rules_same = True
- val = [pricing_rules[0][k] for k in fields]
- for p in pricing_rules[1:]:
- if val != [p[k] for k in fields]:
- all_rules_same = False
- break
-
- return all_rules_same
-
-def apply_internal_priority(pricing_rules, field_set, args):
- filtered_rules = []
- for field in field_set:
- if args.get(field):
- filtered_rules = list(filter(lambda x: x[field]==args[field], pricing_rules))
- if filtered_rules: break
-
- return filtered_rules or pricing_rules
-
def set_transaction_type(args):
if args.transaction_type:
return
@@ -397,3 +367,44 @@
doc.buying = 1 if doctype == "Supplier" else 0
return doc
+
+@frappe.whitelist()
+def get_free_items(pricing_rules, item_row):
+ if isinstance(item_row, string_types):
+ item_row = json.loads(item_row)
+
+ free_items = []
+ pricing_rules = list(set(pricing_rules.split(',')))
+
+ for d in pricing_rules:
+ pr_doc = frappe.get_doc('Pricing Rule', d)
+ if pr_doc.price_or_product_discount == 'Product':
+ item = (item_row.get('item_code') if pr_doc.same_item
+ else pr_doc.free_item)
+ if not item: return free_items
+
+ doc = frappe.get_doc('Item', item)
+
+ free_items.append({
+ 'item_code': item,
+ 'item_name': doc.item_name,
+ 'description': doc.description,
+ 'qty': pr_doc.free_qty,
+ 'uom': pr_doc.free_item_uom,
+ 'rate': pr_doc.free_item_rate or 0,
+ 'is_free_item': 1
+ })
+
+ return free_items
+
+def get_item_uoms(doctype, txt, searchfield, start, page_len, filters):
+ items = [filters.get('value')]
+ if filters.get('apply_on') != 'Item Code':
+ field = frappe.scrub(filters.get('apply_on'))
+
+ items = frappe.db.sql_list("""select name
+ from `tabItem` where {0} = %s""".format(field), filters.get('value'))
+
+ return frappe.get_all('UOM Conversion Detail',
+ filters = {'parent': ('in', items), 'uom': ("like", "{0}%".format(txt))},
+ fields = ["distinct uom"], as_list=1)
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py b/erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py
index e4f37c4..8d4af32 100644
--- a/erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py
+++ b/erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py
@@ -12,10 +12,10 @@
class TestPricingRule(unittest.TestCase):
def setUp(self):
- frappe.db.sql("delete from `tabPricing Rule`")
+ delete_existing_pricing_rules()
def tearDown(self):
- frappe.db.sql("delete from `tabPricing Rule`")
+ delete_existing_pricing_rules()
def test_pricing_rule_for_discount(self):
from erpnext.stock.get_item_details import get_item_details
@@ -25,7 +25,9 @@
"doctype": "Pricing Rule",
"title": "_Test Pricing Rule",
"apply_on": "Item Code",
- "item_code": "_Test Item",
+ "items": [{
+ "item_code": "_Test Item"
+ }],
"currency": "USD",
"selling": 1,
"rate_or_discount": "Discount Percentage",
@@ -64,7 +66,10 @@
prule = frappe.get_doc(test_record.copy())
prule.apply_on = "Item Group"
- prule.item_group = "All Item Groups"
+ prule.items = []
+ prule.append('item_groups', {
+ 'item_group': "All Item Groups"
+ })
prule.title = "_Test Pricing Rule for Item Group"
prule.discount_percentage = 15
prule.insert()
@@ -86,7 +91,7 @@
self.assertEqual(details.get("discount_percentage"), 5)
frappe.db.sql("update `tabPricing Rule` set priority=NULL where campaign='_Test Campaign'")
- from erpnext.accounts.doctype.pricing_rule.pricing_rule import MultiplePricingRuleConflict
+ from erpnext.accounts.doctype.pricing_rule.utils import MultiplePricingRuleConflict
self.assertRaises(MultiplePricingRuleConflict, get_item_details, args)
args.item_code = "_Test Item 2"
@@ -101,7 +106,9 @@
"doctype": "Pricing Rule",
"title": "_Test Pricing Rule",
"apply_on": "Item Code",
- "item_code": "_Test FG Item 2",
+ "items": [{
+ "item_code": "_Test FG Item 2",
+ }],
"selling": 1,
"currency": "USD",
"rate_or_discount": "Discount Percentage",
@@ -166,7 +173,9 @@
"title": "_Test Pricing Rule 1",
"apply_on": "Item Code",
"currency": "USD",
- "item_code": "_Test Variant Item",
+ "items": [{
+ "item_code": "_Test Variant Item",
+ }],
"selling": 1,
"rate_or_discount": "Discount Percentage",
"rate": 0,
@@ -196,7 +205,9 @@
"doctype": "Pricing Rule",
"title": "_Test Pricing Rule 2",
"apply_on": "Item Code",
- "item_code": "Test Variant PRT",
+ "items": [{
+ "item_code": "Test Variant PRT",
+ }],
"currency": "USD",
"selling": 1,
"rate_or_discount": "Discount Percentage",
@@ -214,7 +225,9 @@
"title": "_Test Pricing Rule",
"apply_on": "Item Code",
"currency": "USD",
- "item_code": "_Test Item",
+ "items": [{
+ "item_code": "_Test Item",
+ }],
"selling": 1,
"rate_or_discount": "Discount Percentage",
"rate": 0,
@@ -273,7 +286,6 @@
"title": args.title or "_Test Pricing Rule",
"company": args.company or "_Test Company",
"apply_on": args.apply_on or "Item Code",
- "item_code": args.item_code or "_Test Item",
"applicable_for": args.applicable_for,
"selling": args.selling or 0,
"currency": "USD",
@@ -285,12 +297,25 @@
"rate": args.rate or 0.0,
"margin_type": args.margin_type,
"margin_rate_or_amount": args.margin_rate_or_amount or 0.0
- }).insert(ignore_permissions=True)
+ })
apply_on = doc.apply_on.replace(' ', '_').lower()
+ child_table = {'Item Code': 'items', 'Item Group': 'item_groups', 'Brand': 'brands'}
+ doc.append(child_table.get(doc.apply_on), {
+ apply_on: args.get(apply_on) or "_Test Item"
+ })
+
+ doc.insert(ignore_permissions=True)
if args.get(apply_on) and apply_on != "item_code":
doc.db_set(apply_on, args.get(apply_on))
applicable_for = doc.applicable_for.replace(' ', '_').lower()
if args.get(applicable_for):
doc.db_set(applicable_for, args.get(applicable_for))
+
+
+def delete_existing_pricing_rules():
+ for doctype in ["Pricing Rule", "Apply Rule On Item Code",
+ "Apply Rule On Item Group", "Apply Rule On Brand"]:
+
+ frappe.db.sql("delete from `tab{0}`".format(doctype))
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/pricing_rule/utils.py b/erpnext/accounts/doctype/pricing_rule/utils.py
new file mode 100644
index 0000000..e384bbb
--- /dev/null
+++ b/erpnext/accounts/doctype/pricing_rule/utils.py
@@ -0,0 +1,493 @@
+# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
+# MIT License. See license.txt
+
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+import frappe
+import json
+import copy
+from frappe import throw, _
+from frappe.utils import flt, cint, get_datetime
+from erpnext.stock.doctype.warehouse.warehouse import get_child_warehouses
+from erpnext.stock.get_item_details import get_conversion_factor
+
+class MultiplePricingRuleConflict(frappe.ValidationError): pass
+
+def get_pricing_rules(args, doc=None):
+ pricing_rules = []
+ values = {}
+
+ for apply_on in ['Item Code', 'Item Group', 'Brand']:
+ pricing_rules.extend(_get_pricing_rules(apply_on, args, values))
+ if pricing_rules and not apply_multiple_pricing_rules(pricing_rules):
+ break
+
+ rules = []
+
+ if not pricing_rules: return []
+
+ if apply_multiple_pricing_rules(pricing_rules):
+ for pricing_rule in pricing_rules:
+ pricing_rule = filter_pricing_rules(args, pricing_rule, doc)
+ if pricing_rule:
+ rules.append(pricing_rule)
+ else:
+ rules.append(filter_pricing_rules(args, pricing_rules, doc))
+
+ return rules
+
+def _get_pricing_rules(apply_on, args, values):
+ apply_on_field = frappe.scrub(apply_on)
+
+ if not args.get(apply_on_field): return []
+
+ child_doc = '`tabApply Rule On {0}`'.format(apply_on)
+
+ conditions = item_variant_condition = item_conditions = ""
+ values[apply_on_field] = args.get(apply_on_field)
+ if apply_on_field in ['item_code', 'brand']:
+ item_conditions = "{child_doc}.{apply_on_field}= %({apply_on_field})s".format(child_doc=child_doc,
+ apply_on_field = apply_on_field)
+
+ if apply_on_field == 'item_code':
+ if "variant_of" not in args:
+ args.variant_of = frappe.get_cached_value("Item", args.item_code, "variant_of")
+
+ if args.variant_of:
+ item_variant_condition = ' or {child_doc}.item_code=%(variant_of)s '.format(child_doc=child_doc)
+ values['variant_of'] = args.variant_of
+ elif apply_on_field == 'item_group':
+ item_conditions = _get_tree_conditions(args, "Item Group", child_doc, False)
+
+ conditions += get_other_conditions(conditions, values, args)
+ warehouse_conditions = _get_tree_conditions(args, "Warehouse", '`tabPricing Rule`')
+ if warehouse_conditions:
+ warehouse_conditions = " and {0}".format(warehouse_conditions)
+
+ if not args.price_list: args.price_list = None
+
+ conditions += " and ifnull(`tabPricing Rule`.for_price_list, '') in (%(price_list)s, '')"
+ values["price_list"] = args.get("price_list")
+
+ pricing_rules = frappe.db.sql("""select `tabPricing Rule`.*,
+ {child_doc}.{apply_on_field}, {child_doc}.uom
+ from `tabPricing Rule`, {child_doc}
+ where ({item_conditions} or (`tabPricing Rule`.apply_rule_on_other is not null
+ and `tabPricing Rule`.{apply_on_other_field}=%({apply_on_field})s) {item_variant_condition})
+ and {child_doc}.parent = `tabPricing Rule`.name
+ and `tabPricing Rule`.disable = 0 and
+ `tabPricing Rule`.{transaction_type} = 1 {warehouse_cond} {conditions}
+ order by `tabPricing Rule`.priority desc,
+ `tabPricing Rule`.name desc""".format(
+ child_doc = child_doc,
+ apply_on_field = apply_on_field,
+ item_conditions = item_conditions,
+ item_variant_condition = item_variant_condition,
+ transaction_type = args.transaction_type,
+ warehouse_cond = warehouse_conditions,
+ apply_on_other_field = "other_{0}".format(apply_on_field),
+ conditions = conditions), values, as_dict=1) or []
+
+ return pricing_rules
+
+def apply_multiple_pricing_rules(pricing_rules):
+ apply_multiple_rule = [d.apply_multiple_pricing_rules
+ for d in pricing_rules if d.apply_multiple_pricing_rules]
+
+ if not apply_multiple_rule: return False
+
+ if (apply_multiple_rule
+ and len(apply_multiple_rule) == len(pricing_rules)):
+ return True
+
+def _get_tree_conditions(args, parenttype, table, allow_blank=True):
+ field = frappe.scrub(parenttype)
+ condition = ""
+ if args.get(field):
+ if not frappe.flags.tree_conditions:
+ frappe.flags.tree_conditions = {}
+ key = (parenttype, args.get(field))
+ if key in frappe.flags.tree_conditions:
+ return frappe.flags.tree_conditions[key]
+
+ try:
+ lft, rgt = frappe.db.get_value(parenttype, args.get(field), ["lft", "rgt"])
+ except TypeError:
+ frappe.throw(_("Invalid {0}").format(args.get(field)))
+
+ parent_groups = frappe.db.sql_list("""select name from `tab%s`
+ where lft<=%s and rgt>=%s""" % (parenttype, '%s', '%s'), (lft, rgt))
+
+ if parent_groups:
+ if allow_blank: parent_groups.append('')
+ condition = "ifnull({table}.{field}, '') in ({parent_groups})".format(
+ table=table,
+ field=field,
+ parent_groups=", ".join([frappe.db.escape(d) for d in parent_groups])
+ )
+
+ frappe.flags.tree_conditions[key] = condition
+ return condition
+
+def get_other_conditions(conditions, values, args):
+ for field in ["company", "customer", "supplier", "campaign", "sales_partner"]:
+ if args.get(field):
+ conditions += " and ifnull(`tabPricing Rule`.{0}, '') in (%({1})s, '')".format(field, field)
+ values[field] = args.get(field)
+ else:
+ conditions += " and ifnull(`tabPricing Rule`.{0}, '') = ''".format(field)
+
+ for parenttype in ["Customer Group", "Territory", "Supplier Group"]:
+ group_condition = _get_tree_conditions(args, parenttype, '`tabPricing Rule`')
+ if group_condition:
+ conditions += " and " + group_condition
+
+ if args.get("transaction_date"):
+ conditions += """ and %(transaction_date)s between ifnull(`tabPricing Rule`.valid_from, '2000-01-01')
+ and ifnull(`tabPricing Rule`.valid_upto, '2500-12-31')"""
+ values['transaction_date'] = args.get('transaction_date')
+
+ return conditions
+
+def filter_pricing_rules(args, pricing_rules, doc=None):
+ if not isinstance(pricing_rules, list):
+ pricing_rules = [pricing_rules]
+
+ original_pricing_rule = copy.copy(pricing_rules)
+
+ # filter for qty
+ if pricing_rules:
+ stock_qty = flt(args.get('stock_qty'))
+ amount = flt(args.get('price_list_rate')) * flt(args.get('qty'))
+
+ if pricing_rules[0].apply_rule_on_other:
+ field = frappe.scrub(pricing_rules[0].apply_rule_on_other)
+
+ if (field and pricing_rules[0].get('other_' + field) != args.get(field)): return
+
+ pr_doc = frappe.get_doc('Pricing Rule', pricing_rules[0].name)
+
+ if pricing_rules[0].mixed_conditions and doc:
+ stock_qty, amount = get_qty_and_rate_for_mixed_conditions(doc, pr_doc)
+
+ elif pricing_rules[0].is_cumulative:
+ items = [args.get(frappe.scrub(pr_doc.get('apply_on')))]
+ data = get_qty_amount_data_for_cumulative(pr_doc, args, items)
+
+ if data:
+ stock_qty += data[0]
+ amount += data[1]
+
+ if pricing_rules[0].apply_rule_on_other and not pricing_rules[0].mixed_conditions and doc:
+ pricing_rules = get_qty_and_rate_for_other_item(doc, pr_doc, pricing_rules) or []
+ else:
+ pricing_rules = filter_pricing_rules_for_qty_amount(stock_qty, amount, pricing_rules, args)
+
+ if not pricing_rules:
+ for d in original_pricing_rule:
+ if not d.threshold_percentage: continue
+
+ msg = validate_quantity_and_amount_for_suggestion(d, stock_qty,
+ amount, args.get('item_code'), args.get('transaction_type'))
+
+ if msg:
+ return {'suggestion': msg, 'item_code': args.get('item_code')}
+
+ # add variant_of property in pricing rule
+ for p in pricing_rules:
+ if p.item_code and args.variant_of:
+ p.variant_of = args.variant_of
+ else:
+ p.variant_of = None
+
+ # find pricing rule with highest priority
+ if pricing_rules:
+ max_priority = max([cint(p.priority) for p in pricing_rules])
+ if max_priority:
+ pricing_rules = list(filter(lambda x: cint(x.priority)==max_priority, pricing_rules))
+
+ # apply internal priority
+ all_fields = ["item_code", "item_group", "brand", "customer", "customer_group", "territory",
+ "supplier", "supplier_group", "campaign", "sales_partner", "variant_of"]
+
+ if len(pricing_rules) > 1:
+ for field_set in [["item_code", "variant_of", "item_group", "brand"],
+ ["customer", "customer_group", "territory"], ["supplier", "supplier_group"]]:
+ remaining_fields = list(set(all_fields) - set(field_set))
+ if if_all_rules_same(pricing_rules, remaining_fields):
+ pricing_rules = apply_internal_priority(pricing_rules, field_set, args)
+ break
+
+ if pricing_rules and not isinstance(pricing_rules, list):
+ pricing_rules = list(pricing_rules)
+
+ if len(pricing_rules) > 1:
+ rate_or_discount = list(set([d.rate_or_discount for d in pricing_rules]))
+ if len(rate_or_discount) == 1 and rate_or_discount[0] == "Discount Percentage":
+ pricing_rules = filter(lambda x: x.for_price_list==args.price_list, pricing_rules) \
+ or pricing_rules
+
+ if len(pricing_rules) > 1 and not args.for_shopping_cart:
+ frappe.throw(_("Multiple Price Rules exists with same criteria, please resolve conflict by assigning priority. Price Rules: {0}")
+ .format("\n".join([d.name for d in pricing_rules])), MultiplePricingRuleConflict)
+ elif pricing_rules:
+ return pricing_rules[0]
+
+def validate_quantity_and_amount_for_suggestion(args, qty, amount, item_code, transaction_type):
+ fieldname, msg = '', ''
+ type_of_transaction = 'purcahse' if transaction_type == "buying" else "sale"
+
+ for field, value in {'min_qty': qty, 'min_amt': amount}.items():
+ if (args.get(field) and value < args.get(field)
+ and (args.get(field) - cint(args.get(field) * args.threshold_percentage * 0.01)) <= value):
+ fieldname = field
+
+ for field, value in {'max_qty': qty, 'max_amt': amount}.items():
+ if (args.get(field) and value > args.get(field)
+ and (args.get(field) + cint(args.get(field) * args.threshold_percentage * 0.01)) >= value):
+ fieldname = field
+
+ if fieldname:
+ msg = _("""If you {0} {1} quantities of the item <b>{2}</b>, the scheme <b>{3}</b>
+ will be applied on the item.""").format(type_of_transaction, args.get(fieldname), item_code, args.rule_description)
+
+ if fieldname in ['min_amt', 'max_amt']:
+ msg = _("""If you {0} {1} worth item <b>{2}</b>, the scheme <b>{3}</b> will be applied on the item.
+ """).format(frappe.fmt_money(type_of_transaction, args.get(fieldname)), item_code, args.rule_description)
+
+ frappe.msgprint(msg)
+
+ return msg
+
+def filter_pricing_rules_for_qty_amount(qty, rate, pricing_rules, args=None):
+ rules = []
+
+ for rule in pricing_rules:
+ status = False
+ conversion_factor = 1
+
+ if rule.get("uom"):
+ conversion_factor = get_conversion_factor(rule.item_code, rule.uom).get("conversion_factor", 1)
+
+ if (flt(qty) >= (flt(rule.min_qty) * conversion_factor)
+ and (flt(qty)<= (rule.max_qty * conversion_factor) if rule.max_qty else True)):
+ status = True
+
+ # if user has created item price against the transaction UOM
+ if rule.get("uom") == args.get("uom"):
+ conversion_factor = 1.0
+
+ if status and (flt(rate) >= (flt(rule.min_amt) * conversion_factor)
+ and (flt(rate)<= (rule.max_amt * conversion_factor) if rule.max_amt else True)):
+ status = True
+ else:
+ status = False
+
+ if status:
+ rules.append(rule)
+
+ return rules
+
+def if_all_rules_same(pricing_rules, fields):
+ all_rules_same = True
+ val = [pricing_rules[0].get(k) for k in fields]
+ for p in pricing_rules[1:]:
+ if val != [p.get(k) for k in fields]:
+ all_rules_same = False
+ break
+
+ return all_rules_same
+
+def apply_internal_priority(pricing_rules, field_set, args):
+ filtered_rules = []
+ for field in field_set:
+ if args.get(field):
+ filtered_rules = filter(lambda x: x[field]==args[field], pricing_rules)
+ if filtered_rules: break
+
+ return filtered_rules or pricing_rules
+
+def get_qty_and_rate_for_mixed_conditions(doc, pr_doc):
+ sum_qty, sum_amt = [0, 0]
+ items = get_pricing_rule_items(pr_doc) or []
+ apply_on = frappe.scrub(pr_doc.get('apply_on'))
+
+ if items and doc.get("items"):
+ for row in doc.get('items'):
+ if row.get(apply_on) not in items: continue
+
+ if pr_doc.mixed_conditions:
+ sum_qty += row.stock_qty
+ sum_amt += row.amount
+
+ if pr_doc.is_cumulative:
+ data = get_qty_amount_data_for_cumulative(pr_doc, doc, items)
+
+ if data and data[0]:
+ sum_qty += data[0]
+ sum_amt += data[1]
+
+ return sum_qty, sum_amt
+
+def get_qty_and_rate_for_other_item(doc, pr_doc, pricing_rules):
+ for d in get_pricing_rule_items(pr_doc):
+ for row in doc.items:
+ if d == row.get(frappe.scrub(pr_doc.apply_on)):
+ pricing_rules = filter_pricing_rules_for_qty_amount(row.stock_qty,
+ row.amount, pricing_rules, row)
+
+ if pricing_rules and pricing_rules[0]:
+ return pricing_rules
+
+def get_qty_amount_data_for_cumulative(pr_doc, doc, items=[]):
+ sum_qty, sum_amt = [0, 0]
+ doctype = doc.get('parenttype') or doc.doctype
+
+ date_field = ('transaction_date'
+ if doc.get('transaction_date') else 'posting_date')
+
+ child_doctype = '{0} Item'.format(doctype)
+ apply_on = frappe.scrub(pr_doc.get('apply_on'))
+
+ values = [pr_doc.valid_from, pr_doc.valid_upto]
+ condition = ""
+
+ if pr_doc.warehouse:
+ warehouses = get_child_warehouses(pr_doc.warehouse)
+
+ condition += """ and `tab{child_doc}`.warehouse in ({warehouses})
+ """.format(child_doc=child_doctype, warehouses = ','.join(['%s'] * len(warehouses)))
+
+ values.extend(warehouses)
+
+ if items:
+ condition = " and `tab{child_doc}`.{apply_on} in ({items})".format(child_doc = child_doctype,
+ apply_on = apply_on, items = ','.join(['%s'] * len(items)))
+
+ values.extend(items)
+
+ data_set = frappe.db.sql(""" SELECT `tab{child_doc}`.stock_qty,
+ `tab{child_doc}`.amount
+ FROM `tab{child_doc}`, `tab{parent_doc}`
+ WHERE
+ `tab{child_doc}`.parent = `tab{parent_doc}`.name and {date_field}
+ between %s and %s and `tab{parent_doc}`.docstatus = 1
+ {condition} group by `tab{child_doc}`.name
+ """.format(parent_doc = doctype,
+ child_doc = child_doctype,
+ condition = condition,
+ date_field = date_field
+ ), tuple(values), as_dict=1)
+
+ for data in data_set:
+ sum_qty += data.get('stock_qty')
+ sum_amt += data.get('amount')
+
+ return [sum_qty, sum_amt]
+
+def validate_pricing_rules(doc):
+ validate_pricing_rule_on_transactions(doc)
+
+ if not doc.pricing_rules: return
+
+ for d in doc.items:
+ validate_pricing_rule_on_items(doc, d)
+
+ doc.calculate_taxes_and_totals()
+
+def validate_pricing_rule_on_items(doc, item_row):
+ value = 0
+ for pr_row in get_applied_pricing_rules(doc, item_row):
+ pr_doc = frappe.get_doc('Pricing Rule', pr_row.pricing_rule)
+
+ if pr_doc.get('apply_on') == 'Transaction': continue
+
+ if pr_doc.get('price_or_product_discount') == 'Product':
+ apply_pricing_rule_for_free_items(doc, pr_doc)
+ else:
+ for field in ['discount_percentage', 'discount_amount', 'rate']:
+ if not pr_doc.get(field): continue
+
+ value += pr_doc.get(field)
+ apply_pricing_rule(doc, pr_doc, pr_row, item_row, value)
+
+def validate_pricing_rule_on_transactions(doc):
+ conditions = "apply_on = 'Transaction'"
+
+ values = {}
+ conditions = get_other_conditions(conditions, values, doc)
+
+ pricing_rules = frappe.db.sql(""" Select `tabPricing Rule`.* from `tabPricing Rule`
+ where {conditions} """.format(conditions = conditions), values, as_dict=1)
+
+ if pricing_rules:
+ pricing_rules = filter_pricing_rules_for_qty_amount(doc.total_qty,
+ doc.total, pricing_rules)
+
+ for d in pricing_rules:
+ if d.price_or_product_discount == 'Price':
+ if d.apply_discount_on:
+ doc.set('apply_discount_on', d.apply_discount_on)
+
+ for field in ['additional_discount_percentage', 'discount_amount']:
+ if not d.get(field): continue
+
+ pr_field = ('discount_percentage'
+ if field == 'additional_discount_percentage' else field)
+
+ if d.validate_applied_rule and doc.get(field) < d.get(pr_field):
+ frappe.msgprint(_("User has not applied rule on the invoice {0}")
+ .format(doc.name))
+ else:
+ doc.set(field, d.get(pr_field))
+ elif d.price_or_product_discount == 'Product':
+ apply_pricing_rule_for_free_items(doc, d)
+
+def get_applied_pricing_rules(doc, item_row):
+ return [d for d in doc.pricing_rules
+ if d.child_docname == item_row.name]
+
+def apply_pricing_rule_for_free_items(doc, pricing_rule):
+ if pricing_rule.get('free_item'):
+ items = [d.item_code for d in doc.items
+ if d.item_code == (d.item_code
+ if pricing_rule.get('same_item') else pricing_rule.get('free_item')) and d.is_free_item]
+
+ if not items:
+ doc.append('items', {
+ 'item_code': pricing_rule.get('free_item'),
+ 'qty': pricing_rule.get('free_qty'),
+ 'uom': pricing_rule.get('free_item_uom'),
+ 'rate': pricing_rule.get('free_item_rate'),
+ 'is_free_item': 1
+ })
+
+ doc.set_missing_values()
+
+def apply_pricing_rule(doc, pr_doc, pr_row, item_row, value):
+ apply_on = frappe.scrub(pr_doc.get('apply_on'))
+ items = (get_pricing_rule_items(pr_doc)
+ if pr_doc.mixed_conditions else [item_row.get(apply_on)])
+
+ if pr_doc.apply_rule_on_other:
+ apply_on = frappe.scrub(pr_doc.apply_rule_on_other)
+ items = [pr_doc.get(apply_on)]
+
+ rule_applied = 1
+ if item_row.get(apply_on) in items:
+ for field in ['discount_percentage', 'discount_amount', 'rate']:
+ if not pr_doc.get(field): continue
+
+ if not pr_doc.validate_applied_rule:
+ item_row.set(field, value)
+ elif item_row.get(field) < value:
+ rule_applied = 0
+ frappe.msgprint(_("Row {0}: user has not applied rule <b>{1}</b> on the item <b>{2}</b>")
+ .format(item_row.idx, pr_doc.title, item_row.item_code))
+
+ pr_row.rule_applied = rule_applied
+
+def get_pricing_rule_items(pr_doc):
+ apply_on = frappe.scrub(pr_doc.get('apply_on'))
+ return [item.get(apply_on) for item in pr_doc.items] or []
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/pricing_rule_detail/__init__.py b/erpnext/accounts/doctype/pricing_rule_detail/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/erpnext/accounts/doctype/pricing_rule_detail/__init__.py
diff --git a/erpnext/accounts/doctype/pricing_rule_detail/pricing_rule_detail.json b/erpnext/accounts/doctype/pricing_rule_detail/pricing_rule_detail.json
new file mode 100644
index 0000000..196c5f4
--- /dev/null
+++ b/erpnext/accounts/doctype/pricing_rule_detail/pricing_rule_detail.json
@@ -0,0 +1,237 @@
+{
+ "allow_copy": 0,
+ "allow_events_in_timeline": 0,
+ "allow_guest_to_view": 0,
+ "allow_import": 0,
+ "allow_rename": 0,
+ "beta": 0,
+ "creation": "2019-02-01 13:07:49.073255",
+ "custom": 0,
+ "docstatus": 0,
+ "doctype": "DocType",
+ "document_type": "",
+ "editable_grid": 1,
+ "engine": "InnoDB",
+ "fields": [
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "pricing_rule",
+ "fieldtype": "Link",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 1,
+ "in_standard_filter": 0,
+ "label": "Pricing Rule",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Pricing Rule",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 1,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "item_code",
+ "fieldtype": "Data",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 1,
+ "in_standard_filter": 0,
+ "label": "Item Code",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 1,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "margin_type",
+ "fieldtype": "Data",
+ "hidden": 1,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Margin Type",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 1,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "rate_or_discount",
+ "fieldtype": "Data",
+ "hidden": 1,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Rate or Discount",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 1,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "child_docname",
+ "fieldtype": "Data",
+ "hidden": 1,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Child Docname",
+ "length": 0,
+ "no_copy": 1,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 1,
+ "print_hide_if_no_value": 0,
+ "read_only": 1,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "default": "1",
+ "fieldname": "rule_applied",
+ "fieldtype": "Check",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Rule Applied",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 1,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ }
+ ],
+ "has_web_view": 0,
+ "hide_heading": 0,
+ "hide_toolbar": 0,
+ "idx": 0,
+ "image_view": 0,
+ "in_create": 0,
+ "is_submittable": 0,
+ "issingle": 0,
+ "istable": 1,
+ "max_attachments": 0,
+ "modified": "2019-03-06 16:01:49.855764",
+ "modified_by": "Administrator",
+ "module": "Accounts",
+ "name": "Pricing Rule Detail",
+ "name_case": "",
+ "owner": "Administrator",
+ "permissions": [],
+ "quick_entry": 1,
+ "read_only": 0,
+ "read_only_onload": 0,
+ "show_name_in_global_search": 0,
+ "sort_field": "modified",
+ "sort_order": "DESC",
+ "track_changes": 1,
+ "track_seen": 0,
+ "track_views": 0
+}
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/pricing_rule_detail/pricing_rule_detail.py b/erpnext/accounts/doctype/pricing_rule_detail/pricing_rule_detail.py
new file mode 100644
index 0000000..3cb7da9
--- /dev/null
+++ b/erpnext/accounts/doctype/pricing_rule_detail/pricing_rule_detail.py
@@ -0,0 +1,10 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+import frappe
+from frappe.model.document import Document
+
+class PricingRuleDetail(Document):
+ pass
diff --git a/erpnext/accounts/doctype/product_discount_slab/__init__.py b/erpnext/accounts/doctype/product_discount_slab/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/erpnext/accounts/doctype/product_discount_slab/__init__.py
diff --git a/erpnext/accounts/doctype/product_discount_slab/product_discount_slab.json b/erpnext/accounts/doctype/product_discount_slab/product_discount_slab.json
new file mode 100644
index 0000000..3c437b3
--- /dev/null
+++ b/erpnext/accounts/doctype/product_discount_slab/product_discount_slab.json
@@ -0,0 +1,751 @@
+{
+ "allow_copy": 0,
+ "allow_events_in_timeline": 0,
+ "allow_guest_to_view": 0,
+ "allow_import": 0,
+ "allow_rename": 0,
+ "beta": 0,
+ "creation": "2019-01-22 15:16:17.920804",
+ "custom": 0,
+ "docstatus": 0,
+ "doctype": "DocType",
+ "document_type": "",
+ "editable_grid": 1,
+ "engine": "InnoDB",
+ "fields": [
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "disable",
+ "fieldtype": "Data",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Disable",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "column_break_2",
+ "fieldtype": "Column Break",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "rule_description",
+ "fieldtype": "Small Text",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Rule Description",
+ "length": 0,
+ "no_copy": 1,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 1,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "section_break_1",
+ "fieldtype": "Section Break",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "default": "0",
+ "fieldname": "min_qty",
+ "fieldtype": "Float",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 1,
+ "in_standard_filter": 0,
+ "label": "Min Qty",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "default": "0",
+ "fieldname": "max_qty",
+ "fieldtype": "Float",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 1,
+ "in_standard_filter": 0,
+ "label": "Max Qty",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "column_break_3",
+ "fieldtype": "Column Break",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "default": "0",
+ "fieldname": "min_amount",
+ "fieldtype": "Currency",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 1,
+ "in_standard_filter": 0,
+ "label": "Min Amount",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "default": "0",
+ "fieldname": "max_amount",
+ "fieldtype": "Currency",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 1,
+ "in_standard_filter": 0,
+ "label": "Max Amount",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "section_break_6",
+ "fieldtype": "Section Break",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Free Item",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "depends_on": "eval:!parent.mixed_conditions",
+ "fieldname": "same_item",
+ "fieldtype": "Check",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Same Item",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "depends_on": "eval:!doc.same_item || parent.mixed_conditions",
+ "fieldname": "free_item",
+ "fieldtype": "Link",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 1,
+ "in_standard_filter": 0,
+ "label": "Item Code",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Item",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "free_qty",
+ "fieldtype": "Float",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 1,
+ "in_standard_filter": 0,
+ "label": "Qty",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "column_break_9",
+ "fieldtype": "Column Break",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "free_item_uom",
+ "fieldtype": "Link",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "UOM",
+ "length": 0,
+ "no_copy": 0,
+ "options": "UOM",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "free_item_rate",
+ "fieldtype": "Currency",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Rate",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "section_break_12",
+ "fieldtype": "Section Break",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "warehouse",
+ "fieldtype": "Link",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Warehouse",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Warehouse",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "threshold_percentage",
+ "fieldtype": "Percent",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Threshold for Suggestion",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "column_break_15",
+ "fieldtype": "Column Break",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "priority",
+ "fieldtype": "Select",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Priority",
+ "length": 0,
+ "no_copy": 0,
+ "options": "\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "apply_multiple_pricing_rules",
+ "fieldtype": "Check",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Apply Multiple Pricing Rules",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ }
+ ],
+ "has_web_view": 0,
+ "hide_heading": 0,
+ "hide_toolbar": 0,
+ "idx": 0,
+ "image_view": 0,
+ "in_create": 0,
+ "is_submittable": 0,
+ "issingle": 0,
+ "istable": 1,
+ "max_attachments": 0,
+ "modified": "2019-03-08 18:55:43.621860",
+ "modified_by": "Administrator",
+ "module": "Accounts",
+ "name": "Product Discount Slab",
+ "name_case": "",
+ "owner": "Administrator",
+ "permissions": [],
+ "quick_entry": 0,
+ "read_only": 0,
+ "read_only_onload": 0,
+ "show_name_in_global_search": 0,
+ "sort_field": "modified",
+ "sort_order": "DESC",
+ "track_changes": 0,
+ "track_seen": 0,
+ "track_views": 0
+}
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/product_discount_slab/product_discount_slab.py b/erpnext/accounts/doctype/product_discount_slab/product_discount_slab.py
new file mode 100644
index 0000000..940fce6
--- /dev/null
+++ b/erpnext/accounts/doctype/product_discount_slab/product_discount_slab.py
@@ -0,0 +1,10 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+import frappe
+from frappe.model.document import Document
+
+class ProductDiscountSlab(Document):
+ pass
diff --git a/erpnext/accounts/doctype/promotional_scheme/__init__.py b/erpnext/accounts/doctype/promotional_scheme/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/erpnext/accounts/doctype/promotional_scheme/__init__.py
diff --git a/erpnext/accounts/doctype/promotional_scheme/promotional_scheme.js b/erpnext/accounts/doctype/promotional_scheme/promotional_scheme.js
new file mode 100644
index 0000000..890a187
--- /dev/null
+++ b/erpnext/accounts/doctype/promotional_scheme/promotional_scheme.js
@@ -0,0 +1,51 @@
+// Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors
+// For license information, please see license.txt
+
+frappe.ui.form.on('Promotional Scheme', {
+ refresh: function(frm) {
+ frm.trigger("set_options_for_applicable_for");
+ frm.trigger("toggle_reqd_apply_on");
+ },
+
+ selling: function(frm) {
+ frm.trigger("set_options_for_applicable_for");
+ },
+
+ buying: function(frm) {
+ frm.trigger("set_options_for_applicable_for");
+ },
+
+ set_options_for_applicable_for: function(frm) {
+ var options = [""];
+ var applicable_for = frm.doc.applicable_for;
+
+ if(frm.doc.selling) {
+ options = $.merge(options, ["Customer", "Customer Group", "Territory", "Sales Partner", "Campaign"]);
+ }
+ if(frm.doc.buying) {
+ $.merge(options, ["Supplier", "Supplier Group"]);
+ }
+
+ set_field_options("applicable_for", options.join("\n"));
+
+ if(!in_list(options, applicable_for)) applicable_for = null;
+ frm.set_value("applicable_for", applicable_for);
+ },
+
+ apply_on: function(frm) {
+ frm.trigger("toggle_reqd_apply_on");
+ },
+
+ toggle_reqd_apply_on: function(frm) {
+ const fields = {
+ 'Item Code': 'items',
+ 'Item Group': 'item_groups',
+ 'Brand': 'brands'
+ };
+
+ for (var key in fields) {
+ frm.toggle_reqd(fields[key],
+ frm.doc.apply_on === key ? 1 : 0);
+ }
+ }
+});
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/promotional_scheme/promotional_scheme.json b/erpnext/accounts/doctype/promotional_scheme/promotional_scheme.json
new file mode 100644
index 0000000..5d0edcb
--- /dev/null
+++ b/erpnext/accounts/doctype/promotional_scheme/promotional_scheme.json
@@ -0,0 +1,1344 @@
+{
+ "allow_copy": 0,
+ "allow_events_in_timeline": 0,
+ "allow_guest_to_view": 0,
+ "allow_import": 1,
+ "allow_rename": 1,
+ "autoname": "Prompt",
+ "beta": 0,
+ "creation": "2019-02-08 17:10:36.077402",
+ "custom": 0,
+ "docstatus": 0,
+ "doctype": "DocType",
+ "document_type": "",
+ "editable_grid": 1,
+ "engine": "InnoDB",
+ "fields": [
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "section_break_1",
+ "fieldtype": "Section Break",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "default": "Item Code",
+ "fieldname": "apply_on",
+ "fieldtype": "Select",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 1,
+ "in_standard_filter": 0,
+ "label": "Apply On",
+ "length": 0,
+ "no_copy": 0,
+ "options": "\nItem Code\nItem Group\nBrand\nTransaction",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 1,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "disable",
+ "fieldtype": "Check",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Disable",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "depends_on": "",
+ "fieldname": "column_break_3",
+ "fieldtype": "Column Break",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "depends_on": "eval:doc.apply_on == 'Item Code'",
+ "fieldname": "items",
+ "fieldtype": "Table",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Apply Rule On Item Code",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Apply Rule On Item Code",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "depends_on": "eval:doc.apply_on == 'Item Group'",
+ "fieldname": "item_groups",
+ "fieldtype": "Table",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Apply Rule On Item Group",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Apply Rule On Item Group",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "depends_on": "eval:doc.apply_on == 'Brand'",
+ "fieldname": "brands",
+ "fieldtype": "Table",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Apply Rule On Brand",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Apply Rule On Brand",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "mixed_conditions",
+ "fieldtype": "Check",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Mixed Conditions",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "is_cumulative",
+ "fieldtype": "Check",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Is Cumulative",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 1,
+ "columns": 0,
+ "fieldname": "section_break_10",
+ "fieldtype": "Section Break",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Discount on Other Item",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "depends_on": "",
+ "fieldname": "apply_rule_on_other",
+ "fieldtype": "Select",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Apply Rule On Other",
+ "length": 0,
+ "no_copy": 0,
+ "options": "\nItem Code\nItem Group\nBrand",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "depends_on": "",
+ "fieldname": "column_break_11",
+ "fieldtype": "Column Break",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "depends_on": "eval:doc.apply_rule_on_other == 'Item Code'",
+ "fieldname": "other_item_code",
+ "fieldtype": "Link",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Item Code",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Item",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "depends_on": "eval:doc.apply_rule_on_other == 'Item Group'",
+ "fieldname": "other_item_group",
+ "fieldtype": "Link",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Item Group",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Item Group",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "depends_on": "eval:doc.apply_rule_on_other == 'Brand'",
+ "fieldname": "other_brand",
+ "fieldtype": "Link",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Brand",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Brand",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 1,
+ "columns": 0,
+ "depends_on": "",
+ "fieldname": "section_break_8",
+ "fieldtype": "Section Break",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Party Information",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "selling",
+ "fieldtype": "Check",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Selling",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "buying",
+ "fieldtype": "Check",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Buying",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "depends_on": "",
+ "fieldname": "column_break_12",
+ "fieldtype": "Column Break",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "depends_on": "eval: doc.buying || doc.selling",
+ "fieldname": "applicable_for",
+ "fieldtype": "Select",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Applicable For",
+ "length": 0,
+ "no_copy": 0,
+ "options": "\nCustomer\nCustomer Group\nTerritory\nSales Partner\nCampaign\nSupplier\nSupplier Group",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "depends_on": "eval:doc.applicable_for=='Customer'",
+ "fieldname": "customer",
+ "fieldtype": "Link",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Customer",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Customer",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "depends_on": "eval:doc.applicable_for==\"Customer Group\"",
+ "fieldname": "customer_group",
+ "fieldtype": "Link",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Customer Group",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Customer Group",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "depends_on": "eval:doc.applicable_for==\"Territory\"",
+ "fieldname": "territory",
+ "fieldtype": "Link",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Territory",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Territory",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "depends_on": "eval:doc.applicable_for==\"Sales Partner\"",
+ "fieldname": "sales_partner",
+ "fieldtype": "Link",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Sales Partner",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Sales Partner",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "depends_on": "eval:doc.applicable_for==\"Campaign\"",
+ "fieldname": "campaign",
+ "fieldtype": "Link",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Campaign",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Campaign",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "depends_on": "eval:doc.applicable_for=='Supplier'",
+ "fieldname": "supplier",
+ "fieldtype": "Link",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Supplier",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Supplier",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "depends_on": "eval:doc.applicable_for==\"Supplier Group\"",
+ "fieldname": "supplier_group",
+ "fieldtype": "Link",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Supplier Group",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Supplier Group",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "period_settings_section",
+ "fieldtype": "Section Break",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Period Settings",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "default": "Today",
+ "fieldname": "valid_from",
+ "fieldtype": "Date",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Valid From",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "valid_upto",
+ "fieldtype": "Date",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Valid Upto",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "column_break_26",
+ "fieldtype": "Column Break",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "company",
+ "fieldtype": "Link",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 1,
+ "in_standard_filter": 0,
+ "label": "Company",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Company",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 1,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "currency",
+ "fieldtype": "Link",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Currency",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Currency",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "depends_on": "",
+ "fieldname": "section_break_14",
+ "fieldtype": "Section Break",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Price Discount Slabs",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 1,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "price_discount_slabs",
+ "fieldtype": "Table",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Price Discount Slabs",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Price Discount Slab",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "depends_on": "",
+ "fieldname": "section_break_15",
+ "fieldtype": "Section Break",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Product Discount Slabs",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 1,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "product_discount_slabs",
+ "fieldtype": "Table",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Product Discount Slabs",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Product Discount Slab",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ }
+ ],
+ "has_web_view": 0,
+ "hide_heading": 0,
+ "hide_toolbar": 0,
+ "idx": 0,
+ "image_view": 0,
+ "in_create": 0,
+ "is_submittable": 0,
+ "issingle": 0,
+ "istable": 0,
+ "max_attachments": 0,
+ "modified": "2019-03-08 14:55:25.341607",
+ "modified_by": "Administrator",
+ "module": "Accounts",
+ "name": "Promotional Scheme",
+ "name_case": "",
+ "owner": "Administrator",
+ "permissions": [
+ {
+ "amend": 0,
+ "cancel": 0,
+ "create": 1,
+ "delete": 1,
+ "email": 1,
+ "export": 1,
+ "if_owner": 0,
+ "import": 0,
+ "permlevel": 0,
+ "print": 1,
+ "read": 1,
+ "report": 1,
+ "role": "System Manager",
+ "set_user_permissions": 0,
+ "share": 1,
+ "submit": 0,
+ "write": 1
+ },
+ {
+ "amend": 0,
+ "cancel": 0,
+ "create": 1,
+ "delete": 1,
+ "email": 1,
+ "export": 1,
+ "if_owner": 0,
+ "import": 0,
+ "permlevel": 0,
+ "print": 1,
+ "read": 1,
+ "report": 1,
+ "role": "Accounts Manager",
+ "set_user_permissions": 0,
+ "share": 1,
+ "submit": 0,
+ "write": 1
+ },
+ {
+ "amend": 0,
+ "cancel": 0,
+ "create": 1,
+ "delete": 1,
+ "email": 1,
+ "export": 1,
+ "if_owner": 0,
+ "import": 0,
+ "permlevel": 0,
+ "print": 1,
+ "read": 1,
+ "report": 1,
+ "role": "Sales Manager",
+ "set_user_permissions": 0,
+ "share": 1,
+ "submit": 0,
+ "write": 1
+ },
+ {
+ "amend": 0,
+ "cancel": 0,
+ "create": 1,
+ "delete": 1,
+ "email": 1,
+ "export": 1,
+ "if_owner": 0,
+ "import": 0,
+ "permlevel": 0,
+ "print": 1,
+ "read": 1,
+ "report": 1,
+ "role": "Accounts User",
+ "set_user_permissions": 0,
+ "share": 1,
+ "submit": 0,
+ "write": 1
+ }
+ ],
+ "quick_entry": 0,
+ "read_only": 0,
+ "read_only_onload": 0,
+ "show_name_in_global_search": 0,
+ "sort_field": "modified",
+ "sort_order": "DESC",
+ "track_changes": 1,
+ "track_seen": 0,
+ "track_views": 0
+}
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/promotional_scheme/promotional_scheme.py b/erpnext/accounts/doctype/promotional_scheme/promotional_scheme.py
new file mode 100644
index 0000000..89f7238
--- /dev/null
+++ b/erpnext/accounts/doctype/promotional_scheme/promotional_scheme.py
@@ -0,0 +1,114 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+import frappe
+from frappe import _
+from frappe.utils import cstr
+from frappe.model.naming import make_autoname
+from frappe.model.document import Document
+
+pricing_rule_fields = ['apply_on', 'mixed_conditions', 'is_cumulative', 'other_item_code', 'other_item_group'
+ 'apply_rule_on_other', 'other_brand', 'selling', 'buying', 'applicable_for', 'valid_from',
+ 'valid_upto', 'customer', 'customer_group', 'territory', 'sales_partner', 'campaign', 'supplier',
+ 'supplier_group', 'company', 'currency']
+
+other_fields = ['min_qty', 'max_qty', 'min_amt',
+ 'max_amt', 'priority','warehouse', 'threshold_percentage', 'rule_description']
+
+price_discount_fields = ['rate_or_discount', 'apply_discount_on', 'apply_discount_on_rate',
+ 'rate', 'discount_amount', 'discount_percentage', 'validate_applied_rule']
+
+product_discount_fields = ['free_item', 'free_qty', 'free_item_uom',
+ 'free_item_rate', 'same_item']
+
+class PromotionalScheme(Document):
+ def validate(self):
+ if not (self.price_discount_slabs
+ or self.product_discount_slabs):
+ frappe.throw(_("Price or product discount slabs are required"))
+
+ def on_update(self):
+ data = frappe.get_all('Pricing Rule', fields = ["promotional_scheme_id", "name"],
+ filters = {'promotional_scheme': self.name}) or {}
+
+ self.update_pricing_rules(data)
+
+ def update_pricing_rules(self, data):
+ rules = {}
+ count = 0
+
+ for d in data:
+ rules[d.get('promotional_scheme_id')] = d.get('name')
+
+ docs = get_pricing_rules(self, rules)
+
+ for doc in docs:
+ doc.run_method("validate")
+ if doc.get("__islocal"):
+ count += 1
+ doc.insert()
+ else:
+ doc.save()
+ frappe.msgprint(_("Pricing Rule {0} is updated").format(doc.name))
+
+ if count:
+ frappe.msgprint(_("New {0} pricing rules are created").format(count))
+
+ def on_trash(self):
+ for d in frappe.get_all('Pricing Rule',
+ {'promotional_scheme': self.name}):
+ frappe.delete_doc('Pricing Rule', d.name)
+
+def get_pricing_rules(doc, rules = {}):
+ new_doc = []
+ for child_doc, fields in {'price_discount_slabs': price_discount_fields,
+ 'product_discount_slabs': product_discount_fields}.items():
+ if doc.get(child_doc):
+ new_doc.extend(_get_pricing_rules(doc, child_doc, fields, rules))
+
+ return new_doc
+
+def _get_pricing_rules(doc, child_doc, discount_fields, rules = {}):
+ new_doc = []
+ args = get_args_for_pricing_rule(doc)
+ for d in doc.get(child_doc):
+ if d.name in rules:
+ pr = frappe.get_doc('Pricing Rule', rules.get(d.name))
+ else:
+ pr = frappe.new_doc("Pricing Rule")
+ pr.title = make_autoname("{0}/.####".format(doc.name))
+
+ pr.update(args)
+ for field in (other_fields + discount_fields):
+ pr.set(field, d.get(field))
+
+ pr.promotional_scheme_id = d.name
+ pr.promotional_scheme = doc.name
+ pr.disable = d.disable if d.disable else doc.disable
+ pr.price_or_product_discount = ('Price'
+ if child_doc == 'price_discount_slabs' else 'Product')
+
+ for field in ['items', 'item_groups', 'brands']:
+ if doc.get(field):
+ pr.set(field, [])
+
+ apply_on = frappe.scrub(doc.get('apply_on'))
+ for d in doc.get(field):
+ pr.append(field, {
+ apply_on: d.get(apply_on),
+ 'uom': d.uom
+ })
+
+ new_doc.append(pr)
+
+ return new_doc
+
+def get_args_for_pricing_rule(doc):
+ args = { 'promotional_scheme': doc.name }
+
+ for d in pricing_rule_fields:
+ args[d] = doc.get(d)
+
+ return args
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/promotional_scheme/promotional_scheme_dashboard.py b/erpnext/accounts/doctype/promotional_scheme/promotional_scheme_dashboard.py
new file mode 100644
index 0000000..28c4c61
--- /dev/null
+++ b/erpnext/accounts/doctype/promotional_scheme/promotional_scheme_dashboard.py
@@ -0,0 +1,12 @@
+from frappe import _
+
+def get_data():
+ return {
+ 'fieldname': 'promotional_scheme',
+ 'transactions': [
+ {
+ 'label': _('Reference'),
+ 'items': ['Pricing Rule']
+ }
+ ]
+ }
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/promotional_scheme/test_promotional_scheme.py b/erpnext/accounts/doctype/promotional_scheme/test_promotional_scheme.py
new file mode 100644
index 0000000..8dc0499
--- /dev/null
+++ b/erpnext/accounts/doctype/promotional_scheme/test_promotional_scheme.py
@@ -0,0 +1,10 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and Contributors
+# See license.txt
+from __future__ import unicode_literals
+
+import frappe
+import unittest
+
+class TestPromotionalScheme(unittest.TestCase):
+ pass
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json
index 97c011f..65a1b98 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json
@@ -1825,6 +1825,73 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "collapsible_depends_on": "",
+ "columns": 0,
+ "fieldname": "pricing_rule_details",
+ "fieldtype": "Section Break",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Pricing Rules",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "collapsible_depends_on": "",
+ "columns": 0,
+ "fieldname": "pricing_rules",
+ "fieldtype": "Table",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Pricing Rule Detail",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Pricing Rule Detail",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 1,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
"collapsible_depends_on": "supplied_items",
"columns": 0,
"depends_on": "",
@@ -4759,7 +4826,7 @@
"istable": 0,
"max_attachments": 0,
"menu_index": 0,
- "modified": "2018-12-27 02:07:04.299399",
+ "modified": "2019-02-13 00:55:15.530604",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Purchase Invoice",
diff --git a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py
index c8c23c7..76494d2 100644
--- a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py
+++ b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py
@@ -551,7 +551,7 @@
sum(credit) as credit, debit_in_account_currency, credit_in_account_currency
from `tabGL Entry` where voucher_type='Purchase Invoice' and voucher_no=%s
group by account, voucher_no order by account asc;""", pi.name, as_dict=1)
-
+
stock_in_hand_account = get_inventory_account(pi.company, pi.get("items")[0].warehouse)
self.assertTrue(gl_entries)
@@ -634,7 +634,7 @@
self.assertEqual(frappe.db.get_value("Serial No", pi.get("items")[0].rejected_serial_no,
"warehouse"), pi.get("items")[0].rejected_warehouse)
-
+
def test_outstanding_amount_after_advance_jv_cancelation(self):
from erpnext.accounts.doctype.journal_entry.test_journal_entry \
import test_records as jv_test_records
@@ -656,14 +656,14 @@
pi.insert()
pi.submit()
pi.load_from_db()
-
+
#check outstanding after advance allocation
self.assertEqual(flt(pi.outstanding_amount), flt(pi.rounded_total - pi.total_advance))
-
+
#added to avoid Document has been modified exception
jv = frappe.get_doc("Journal Entry", jv.name)
jv.cancel()
-
+
pi.load_from_db()
#check outstanding after advance cancellation
self.assertEqual(flt(pi.outstanding_amount), flt(pi.rounded_total + pi.total_advance))
@@ -722,7 +722,7 @@
shipping_rule = create_shipping_rule(shipping_rule_type = "Buying", shipping_rule_name = "Shipping Rule - Purchase Invoice Test")
pi = frappe.copy_doc(test_records[0])
-
+
pi.shipping_rule = shipping_rule.name
pi.insert()
@@ -740,14 +740,14 @@
"tax_amount": shipping_amount,
"description": shipping_rule.name,
"add_deduct_tax": "Add"
- }
+ }
pi.append("taxes", shipping_charge)
pi.save()
self.assertEqual(pi.net_total, 1250)
self.assertEqual(pi.total_taxes_and_charges, 462.3)
- self.assertEqual(pi.grand_total, 1712.3)
+ self.assertEqual(pi.grand_total, 1712.3)
def test_make_pi_without_terms(self):
pi = make_purchase_invoice(do_not_save=1)
diff --git a/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json b/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json
index 6fb2c80..a8e14c6 100644
--- a/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json
+++ b/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json
@@ -20,6 +20,7 @@
"bold": 1,
"collapsible": 0,
"columns": 3,
+ "fetch_if_empty": 0,
"fieldname": "item_code",
"fieldtype": "Link",
"hidden": 0,
@@ -54,6 +55,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "col_break1",
"fieldtype": "Column Break",
"hidden": 0,
@@ -84,6 +86,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "item_name",
"fieldtype": "Data",
"hidden": 0,
@@ -117,6 +120,7 @@
"bold": 0,
"collapsible": 1,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "description_section",
"fieldtype": "Section Break",
"hidden": 0,
@@ -149,6 +153,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "description",
"fieldtype": "Text Editor",
"hidden": 0,
@@ -184,6 +189,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "image",
"fieldtype": "Attach",
"hidden": 1,
@@ -216,6 +222,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "image_view",
"fieldtype": "Image",
"hidden": 0,
@@ -249,6 +256,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "quantity_and_rate",
"fieldtype": "Section Break",
"hidden": 0,
@@ -280,6 +288,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "received_qty",
"fieldtype": "Float",
"hidden": 0,
@@ -312,6 +321,7 @@
"bold": 1,
"collapsible": 0,
"columns": 2,
+ "fetch_if_empty": 0,
"fieldname": "qty",
"fieldtype": "Float",
"hidden": 0,
@@ -345,6 +355,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "rejected_qty",
"fieldtype": "Float",
"hidden": 0,
@@ -377,6 +388,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "stock_uom",
"fieldtype": "Link",
"hidden": 0,
@@ -410,6 +422,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "col_break2",
"fieldtype": "Column Break",
"hidden": 0,
@@ -440,6 +453,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "uom",
"fieldtype": "Link",
"hidden": 0,
@@ -473,6 +487,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "conversion_factor",
"fieldtype": "Float",
"hidden": 0,
@@ -505,6 +520,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "stock_qty",
"fieldtype": "Float",
"hidden": 0,
@@ -537,6 +553,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "sec_break1",
"fieldtype": "Section Break",
"hidden": 0,
@@ -567,6 +584,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "price_list_rate",
"fieldtype": "Currency",
"hidden": 0,
@@ -600,6 +618,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "price_list_rate",
+ "fetch_if_empty": 0,
"fieldname": "discount_percentage",
"fieldtype": "Percent",
"hidden": 0,
@@ -631,7 +650,8 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
- "depends_on": "discount_percentage",
+ "depends_on": "price_list_rate",
+ "fetch_if_empty": 0,
"fieldname": "discount_amount",
"fieldtype": "Currency",
"hidden": 0,
@@ -649,7 +669,7 @@
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
- "read_only": 1,
+ "read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
@@ -665,6 +685,8 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "depends_on": "",
+ "fetch_if_empty": 0,
"fieldname": "col_break3",
"fieldtype": "Column Break",
"hidden": 0,
@@ -695,6 +717,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "base_price_list_rate",
"fieldtype": "Currency",
"hidden": 0,
@@ -727,6 +750,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "sec_break2",
"fieldtype": "Section Break",
"hidden": 0,
@@ -757,6 +781,7 @@
"bold": 1,
"collapsible": 0,
"columns": 3,
+ "fetch_if_empty": 0,
"fieldname": "rate",
"fieldtype": "Currency",
"hidden": 0,
@@ -791,6 +816,7 @@
"bold": 0,
"collapsible": 0,
"columns": 2,
+ "fetch_if_empty": 0,
"fieldname": "amount",
"fieldtype": "Currency",
"hidden": 0,
@@ -825,6 +851,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "col_break4",
"fieldtype": "Column Break",
"hidden": 0,
@@ -855,6 +882,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "base_rate",
"fieldtype": "Currency",
"hidden": 0,
@@ -889,6 +917,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "base_amount",
"fieldtype": "Currency",
"hidden": 0,
@@ -923,21 +952,22 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
- "fieldname": "pricing_rule",
- "fieldtype": "Link",
- "hidden": 0,
+ "fetch_if_empty": 0,
+ "fieldname": "pricing_rules",
+ "fieldtype": "Small Text",
+ "hidden": 1,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
- "label": "Pricing Rule",
+ "label": "Pricing Rules",
"length": 0,
"no_copy": 0,
- "options": "Pricing Rule",
"permlevel": 0,
- "print_hide": 0,
+ "precision": "",
+ "print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
@@ -955,6 +985,40 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
+ "fieldname": "is_free_item",
+ "fieldtype": "Check",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Is Free Item",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 1,
+ "print_hide_if_no_value": 0,
+ "read_only": 1,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "section_break_22",
"fieldtype": "Section Break",
"hidden": 0,
@@ -986,6 +1050,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "net_rate",
"fieldtype": "Currency",
"hidden": 0,
@@ -1019,6 +1084,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "net_amount",
"fieldtype": "Currency",
"hidden": 0,
@@ -1052,6 +1118,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "column_break_25",
"fieldtype": "Column Break",
"hidden": 0,
@@ -1083,6 +1150,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "base_net_rate",
"fieldtype": "Currency",
"hidden": 0,
@@ -1116,6 +1184,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "base_net_amount",
"fieldtype": "Currency",
"hidden": 0,
@@ -1149,6 +1218,7 @@
"bold": 0,
"collapsible": 1,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "item_weight_details",
"fieldtype": "Section Break",
"hidden": 0,
@@ -1181,6 +1251,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "weight_per_unit",
"fieldtype": "Float",
"hidden": 0,
@@ -1213,6 +1284,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "total_weight",
"fieldtype": "Float",
"hidden": 0,
@@ -1245,6 +1317,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "column_break_38",
"fieldtype": "Column Break",
"hidden": 0,
@@ -1276,6 +1349,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "weight_uom",
"fieldtype": "Link",
"hidden": 0,
@@ -1309,6 +1383,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "warehouse_section",
"fieldtype": "Section Break",
"hidden": 0,
@@ -1342,6 +1417,7 @@
"collapsible": 0,
"columns": 0,
"default": "",
+ "fetch_if_empty": 0,
"fieldname": "warehouse",
"fieldtype": "Link",
"hidden": 0,
@@ -1375,6 +1451,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "rejected_warehouse",
"fieldtype": "Link",
"hidden": 0,
@@ -1409,6 +1486,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "eval:!doc.__islocal",
+ "fetch_if_empty": 0,
"fieldname": "quality_inspection",
"fieldtype": "Link",
"hidden": 0,
@@ -1442,6 +1520,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "batch_no",
"fieldtype": "Link",
"hidden": 0,
@@ -1475,6 +1554,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "col_br_wh",
"fieldtype": "Column Break",
"hidden": 0,
@@ -1507,6 +1587,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "serial_no",
"fieldtype": "Text",
"hidden": 0,
@@ -1539,6 +1620,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "rejected_serial_no",
"fieldtype": "Text",
"hidden": 0,
@@ -1571,6 +1653,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "accounting",
"fieldtype": "Section Break",
"hidden": 0,
@@ -1602,6 +1685,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "expense_account",
"fieldtype": "Link",
"hidden": 0,
@@ -1638,6 +1722,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "item_tax_template",
"fieldtype": "Link",
"hidden": 0,
@@ -1671,6 +1756,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "col_break5",
"fieldtype": "Column Break",
"hidden": 0,
@@ -1701,6 +1787,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "project",
"fieldtype": "Link",
"hidden": 0,
@@ -1735,6 +1822,7 @@
"columns": 0,
"default": ":Company",
"depends_on": "eval:!doc.is_fixed_asset",
+ "fetch_if_empty": 0,
"fieldname": "cost_center",
"fieldtype": "Link",
"hidden": 0,
@@ -1771,6 +1859,7 @@
"bold": 0,
"collapsible": 1,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "deferred_expense_section",
"fieldtype": "Section Break",
"hidden": 0,
@@ -1804,6 +1893,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "enable_deferred_expense",
+ "fetch_if_empty": 0,
"fieldname": "deferred_expense_account",
"fieldtype": "Link",
"hidden": 0,
@@ -1838,6 +1928,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "enable_deferred_expense",
+ "fetch_if_empty": 0,
"fieldname": "service_stop_date",
"fieldtype": "Date",
"hidden": 0,
@@ -1870,6 +1961,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "enable_deferred_expense",
"fieldtype": "Check",
"hidden": 0,
@@ -1902,6 +1994,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "column_break_58",
"fieldtype": "Column Break",
"hidden": 0,
@@ -1934,6 +2027,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "enable_deferred_expense",
+ "fetch_if_empty": 0,
"fieldname": "service_start_date",
"fieldtype": "Date",
"hidden": 0,
@@ -1967,6 +2061,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "enable_deferred_expense",
+ "fetch_if_empty": 0,
"fieldname": "service_end_date",
"fieldtype": "Date",
"hidden": 0,
@@ -1999,6 +2094,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "reference",
"fieldtype": "Section Break",
"hidden": 0,
@@ -2030,6 +2126,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "allow_zero_valuation_rate",
"fieldtype": "Check",
"hidden": 0,
@@ -2062,6 +2159,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "brand",
"fieldtype": "Data",
"hidden": 1,
@@ -2096,6 +2194,7 @@
"collapsible": 0,
"columns": 0,
"description": "",
+ "fetch_if_empty": 0,
"fieldname": "item_group",
"fieldtype": "Link",
"hidden": 1,
@@ -2131,6 +2230,7 @@
"collapsible": 0,
"columns": 0,
"description": "Tax detail table fetched from item master as a string and stored in this field.\nUsed for Taxes and Charges",
+ "fetch_if_empty": 0,
"fieldname": "item_tax_rate",
"fieldtype": "Code",
"hidden": 1,
@@ -2164,6 +2264,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "item_tax_amount",
"fieldtype": "Currency",
"hidden": 1,
@@ -2198,6 +2299,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "purchase_order",
"fieldtype": "Link",
"hidden": 0,
@@ -2232,6 +2334,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "bom",
"fieldtype": "Link",
"hidden": 0,
@@ -2266,6 +2369,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "eval:parent.is_subcontracted == 'Yes'",
+ "fetch_if_empty": 0,
"fieldname": "include_exploded_items",
"fieldtype": "Check",
"hidden": 0,
@@ -2298,6 +2402,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "col_break6",
"fieldtype": "Column Break",
"hidden": 0,
@@ -2328,6 +2433,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "is_fixed_asset",
"fieldtype": "Check",
"hidden": 1,
@@ -2361,6 +2467,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "is_fixed_asset",
+ "fetch_if_empty": 0,
"fieldname": "asset",
"fieldtype": "Link",
"hidden": 0,
@@ -2395,6 +2502,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "is_fixed_asset",
+ "fetch_if_empty": 0,
"fieldname": "asset_location",
"fieldtype": "Link",
"hidden": 0,
@@ -2428,6 +2536,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "po_detail",
"fieldtype": "Data",
"hidden": 1,
@@ -2461,6 +2570,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "purchase_receipt",
"fieldtype": "Link",
"hidden": 0,
@@ -2495,6 +2605,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "page_break",
"fieldtype": "Check",
"hidden": 0,
@@ -2526,6 +2637,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "pr_detail",
"fieldtype": "Data",
"hidden": 1,
@@ -2559,6 +2671,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "valuation_rate",
"fieldtype": "Currency",
"hidden": 1,
@@ -2591,6 +2704,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "rm_supp_cost",
"fieldtype": "Currency",
"hidden": 1,
@@ -2623,6 +2737,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "landed_cost_voucher_amount",
"fieldtype": "Currency",
"hidden": 0,
@@ -2659,7 +2774,7 @@
"issingle": 0,
"istable": 1,
"max_attachments": 0,
- "modified": "2019-02-18 19:03:19.250280",
+ "modified": "2019-03-19 03:00:30.827973",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Purchase Invoice Item",
@@ -2674,4 +2789,4 @@
"track_changes": 0,
"track_seen": 0,
"track_views": 0
-}
+}
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
index 575960b..aa7a030 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
@@ -1790,6 +1790,71 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fieldname": "pricing_rule_details",
+ "fieldtype": "Section Break",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Pricing Rules",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "pricing_rules",
+ "fieldtype": "Table",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Pricing Rule Detail",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Pricing Rule Detail",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 1,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
"fieldname": "packing_list",
"fieldtype": "Section Break",
"hidden": 0,
@@ -5677,7 +5742,7 @@
"istable": 0,
"max_attachments": 0,
"menu_index": 0,
- "modified": "2019-02-18 18:56:51.265257",
+ "modified": "2019-03-17 18:56:51.265257",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Sales Invoice",
diff --git a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
index bfee235..801d620 100644
--- a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
@@ -543,6 +543,7 @@
si.get("taxes")[6].tax_amount = 2
si.insert()
+ print(si.name)
expected_values = [
{
diff --git a/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json b/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json
index e1385ec..8afb0a8 100644
--- a/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json
+++ b/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json
@@ -21,6 +21,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "barcode",
"fieldtype": "Data",
"hidden": 0,
@@ -52,6 +53,7 @@
"bold": 1,
"collapsible": 0,
"columns": 4,
+ "fetch_if_empty": 0,
"fieldname": "item_code",
"fieldtype": "Link",
"hidden": 0,
@@ -86,6 +88,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "col_break1",
"fieldtype": "Column Break",
"hidden": 0,
@@ -116,6 +119,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "item_name",
"fieldtype": "Data",
"hidden": 0,
@@ -149,6 +153,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "customer_item_code",
"fieldtype": "Data",
"hidden": 1,
@@ -180,6 +185,7 @@
"bold": 0,
"collapsible": 1,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "section_break_6",
"fieldtype": "Section Break",
"hidden": 0,
@@ -212,6 +218,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "description",
"fieldtype": "Text Editor",
"hidden": 0,
@@ -247,6 +254,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "column_break_8",
"fieldtype": "Column Break",
"hidden": 0,
@@ -278,6 +286,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "image_view",
"fieldtype": "Image",
"hidden": 0,
@@ -311,6 +320,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "image",
"fieldtype": "Attach",
"hidden": 1,
@@ -343,6 +353,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "quantity_and_rate",
"fieldtype": "Section Break",
"hidden": 0,
@@ -374,6 +385,7 @@
"bold": 1,
"collapsible": 0,
"columns": 2,
+ "fetch_if_empty": 0,
"fieldname": "qty",
"fieldtype": "Float",
"hidden": 0,
@@ -407,6 +419,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "stock_uom",
"fieldtype": "Link",
"hidden": 0,
@@ -439,6 +452,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "col_break2",
"fieldtype": "Column Break",
"hidden": 0,
@@ -469,6 +483,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "uom",
"fieldtype": "Link",
"hidden": 0,
@@ -502,6 +517,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "conversion_factor",
"fieldtype": "Float",
"hidden": 0,
@@ -534,6 +550,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "stock_qty",
"fieldtype": "Float",
"hidden": 0,
@@ -566,6 +583,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "section_break_17",
"fieldtype": "Section Break",
"hidden": 0,
@@ -597,6 +615,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "price_list_rate",
"fieldtype": "Currency",
"hidden": 0,
@@ -631,6 +650,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "base_price_list_rate",
"fieldtype": "Currency",
"hidden": 0,
@@ -665,6 +685,7 @@
"bold": 0,
"collapsible": 1,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "discount_and_margin",
"fieldtype": "Section Break",
"hidden": 0,
@@ -698,6 +719,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "price_list_rate",
+ "fetch_if_empty": 0,
"fieldname": "margin_type",
"fieldtype": "Select",
"hidden": 0,
@@ -732,6 +754,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.margin_type && doc.price_list_rate",
+ "fetch_if_empty": 0,
"fieldname": "margin_rate_or_amount",
"fieldtype": "Float",
"hidden": 0,
@@ -765,6 +788,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.margin_type && doc.price_list_rate && doc.margin_rate_or_amount",
+ "fetch_if_empty": 0,
"fieldname": "rate_with_margin",
"fieldtype": "Currency",
"hidden": 0,
@@ -798,6 +822,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "column_break_19",
"fieldtype": "Column Break",
"hidden": 0,
@@ -830,6 +855,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "price_list_rate",
+ "fetch_if_empty": 0,
"fieldname": "discount_percentage",
"fieldtype": "Percent",
"hidden": 0,
@@ -864,7 +890,8 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
- "depends_on": "discount_percentage",
+ "depends_on": "price_list_rate",
+ "fetch_if_empty": 0,
"fieldname": "discount_amount",
"fieldtype": "Currency",
"hidden": 0,
@@ -882,7 +909,7 @@
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
- "read_only": 1,
+ "read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
@@ -899,6 +926,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.margin_type && doc.price_list_rate && doc.margin_rate_or_amount",
+ "fetch_if_empty": 0,
"fieldname": "base_rate_with_margin",
"fieldtype": "Currency",
"hidden": 0,
@@ -932,6 +960,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "section_break1",
"fieldtype": "Section Break",
"hidden": 0,
@@ -962,6 +991,7 @@
"bold": 1,
"collapsible": 0,
"columns": 2,
+ "fetch_if_empty": 0,
"fieldname": "rate",
"fieldtype": "Currency",
"hidden": 0,
@@ -996,6 +1026,7 @@
"bold": 0,
"collapsible": 0,
"columns": 2,
+ "fetch_if_empty": 0,
"fieldname": "amount",
"fieldtype": "Currency",
"hidden": 0,
@@ -1030,6 +1061,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "col_break3",
"fieldtype": "Column Break",
"hidden": 0,
@@ -1060,6 +1092,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "base_rate",
"fieldtype": "Currency",
"hidden": 0,
@@ -1094,6 +1127,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "base_amount",
"fieldtype": "Currency",
"hidden": 0,
@@ -1128,21 +1162,22 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
- "fieldname": "pricing_rule",
- "fieldtype": "Link",
- "hidden": 0,
+ "fetch_if_empty": 0,
+ "fieldname": "pricing_rules",
+ "fieldtype": "Small Text",
+ "hidden": 1,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
- "label": "Pricing Rule",
+ "label": "Pricing Rules",
"length": 0,
"no_copy": 0,
- "options": "Pricing Rule",
"permlevel": 0,
- "print_hide": 0,
+ "precision": "",
+ "print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
@@ -1160,6 +1195,40 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
+ "fieldname": "is_free_item",
+ "fieldtype": "Check",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Is Free Item",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 1,
+ "print_hide_if_no_value": 0,
+ "read_only": 1,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "section_break_21",
"fieldtype": "Section Break",
"hidden": 0,
@@ -1191,6 +1260,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "net_rate",
"fieldtype": "Currency",
"hidden": 0,
@@ -1224,6 +1294,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "net_amount",
"fieldtype": "Currency",
"hidden": 0,
@@ -1257,6 +1328,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "column_break_24",
"fieldtype": "Column Break",
"hidden": 0,
@@ -1288,6 +1360,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "base_net_rate",
"fieldtype": "Currency",
"hidden": 0,
@@ -1321,6 +1394,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "base_net_amount",
"fieldtype": "Currency",
"hidden": 0,
@@ -1355,6 +1429,7 @@
"collapsible": 1,
"collapsible_depends_on": "eval:doc.delivered_by_supplier==1",
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "drop_ship",
"fieldtype": "Section Break",
"hidden": 0,
@@ -1387,6 +1462,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "delivered_by_supplier",
"fieldtype": "Check",
"hidden": 0,
@@ -1419,6 +1495,7 @@
"bold": 0,
"collapsible": 1,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "accounting",
"fieldtype": "Section Break",
"hidden": 0,
@@ -1450,6 +1527,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "income_account",
"fieldtype": "Link",
"hidden": 0,
@@ -1486,6 +1564,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "expense_account",
"fieldtype": "Link",
"hidden": 0,
@@ -1519,6 +1598,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "col_break4",
"fieldtype": "Column Break",
"hidden": 0,
@@ -1549,6 +1629,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "item_tax_template",
"fieldtype": "Link",
"hidden": 0,
@@ -1583,6 +1664,7 @@
"collapsible": 0,
"columns": 0,
"default": ":Company",
+ "fetch_if_empty": 0,
"fieldname": "cost_center",
"fieldtype": "Link",
"hidden": 0,
@@ -1619,6 +1701,7 @@
"bold": 0,
"collapsible": 1,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "deferred_revenue",
"fieldtype": "Section Break",
"hidden": 0,
@@ -1652,6 +1735,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "enable_deferred_revenue",
+ "fetch_if_empty": 0,
"fieldname": "deferred_revenue_account",
"fieldtype": "Link",
"hidden": 0,
@@ -1686,6 +1770,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "enable_deferred_revenue",
+ "fetch_if_empty": 0,
"fieldname": "service_stop_date",
"fieldtype": "Date",
"hidden": 0,
@@ -1719,6 +1804,7 @@
"collapsible": 0,
"columns": 0,
"default": "0",
+ "fetch_if_empty": 0,
"fieldname": "enable_deferred_revenue",
"fieldtype": "Check",
"hidden": 0,
@@ -1751,6 +1837,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "column_break_50",
"fieldtype": "Column Break",
"hidden": 0,
@@ -1783,6 +1870,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "enable_deferred_revenue",
+ "fetch_if_empty": 0,
"fieldname": "service_start_date",
"fieldtype": "Date",
"hidden": 0,
@@ -1816,6 +1904,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "enable_deferred_revenue",
+ "fetch_if_empty": 0,
"fieldname": "service_end_date",
"fieldtype": "Date",
"hidden": 0,
@@ -1848,6 +1937,7 @@
"bold": 0,
"collapsible": 1,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "section_break_18",
"fieldtype": "Section Break",
"hidden": 0,
@@ -1880,6 +1970,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "weight_per_unit",
"fieldtype": "Float",
"hidden": 0,
@@ -1913,6 +2004,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "total_weight",
"fieldtype": "Float",
"hidden": 0,
@@ -1945,6 +2037,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "column_break_21",
"fieldtype": "Column Break",
"hidden": 0,
@@ -1976,6 +2069,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "weight_uom",
"fieldtype": "Link",
"hidden": 0,
@@ -2011,6 +2105,7 @@
"collapsible_depends_on": "eval:doc.serial_no || doc.batch_no",
"columns": 0,
"depends_on": "",
+ "fetch_if_empty": 0,
"fieldname": "warehouse_and_reference",
"fieldtype": "Section Break",
"hidden": 0,
@@ -2042,6 +2137,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "warehouse",
"fieldtype": "Link",
"hidden": 0,
@@ -2076,6 +2172,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "target_warehouse",
"fieldtype": "Link",
"hidden": 1,
@@ -2110,6 +2207,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "eval:!doc.__islocal",
+ "fetch_if_empty": 0,
"fieldname": "quality_inspection",
"fieldtype": "Link",
"hidden": 0,
@@ -2143,6 +2241,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "batch_no",
"fieldtype": "Link",
"hidden": 0,
@@ -2175,6 +2274,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "col_break5",
"fieldtype": "Column Break",
"hidden": 0,
@@ -2205,6 +2305,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "allow_zero_valuation_rate",
"fieldtype": "Check",
"hidden": 0,
@@ -2237,6 +2338,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "serial_no",
"fieldtype": "Small Text",
"hidden": 0,
@@ -2271,6 +2373,7 @@
"collapsible": 0,
"columns": 0,
"description": "",
+ "fetch_if_empty": 0,
"fieldname": "item_group",
"fieldtype": "Link",
"hidden": 1,
@@ -2305,6 +2408,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "brand",
"fieldtype": "Data",
"hidden": 1,
@@ -2338,6 +2442,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "item_tax_rate",
"fieldtype": "Small Text",
"hidden": 1,
@@ -2371,6 +2476,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "actual_batch_qty",
"fieldtype": "Float",
"hidden": 0,
@@ -2405,6 +2511,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "actual_qty",
"fieldtype": "Float",
"hidden": 0,
@@ -2438,6 +2545,7 @@
"bold": 0,
"collapsible": 1,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "edit_references",
"fieldtype": "Section Break",
"hidden": 0,
@@ -2470,6 +2578,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "sales_order",
"fieldtype": "Link",
"hidden": 0,
@@ -2504,6 +2613,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "so_detail",
"fieldtype": "Data",
"hidden": 1,
@@ -2537,6 +2647,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "column_break_74",
"fieldtype": "Column Break",
"hidden": 0,
@@ -2568,6 +2679,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "delivery_note",
"fieldtype": "Link",
"hidden": 0,
@@ -2602,6 +2714,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "dn_detail",
"fieldtype": "Data",
"hidden": 1,
@@ -2635,6 +2748,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "delivered_qty",
"fieldtype": "Float",
"hidden": 0,
@@ -2668,6 +2782,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "is_fixed_asset",
"fieldtype": "Check",
"hidden": 1,
@@ -2700,6 +2815,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "asset",
"fieldtype": "Link",
"hidden": 0,
@@ -2733,6 +2849,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "section_break_54",
"fieldtype": "Section Break",
"hidden": 0,
@@ -2764,6 +2881,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "page_break",
"fieldtype": "Check",
"hidden": 0,
@@ -2799,7 +2917,7 @@
"issingle": 0,
"istable": 1,
"max_attachments": 0,
- "modified": "2019-02-18 18:59:52.223628",
+ "modified": "2019-03-18 14:03:13.084320",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Sales Invoice Item",
@@ -2814,4 +2932,4 @@
"track_changes": 0,
"track_seen": 0,
"track_views": 0
-}
+}
\ No newline at end of file
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.js b/erpnext/buying/doctype/purchase_order/purchase_order.js
index cf4ec49..b2c1de5 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.js
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.js
@@ -25,6 +25,9 @@
frm.set_indicator_formatter('item_code',
function(doc) { return (doc.qty<=doc.received_qty) ? "green" : "orange" })
+ frm.set_indicator_formatter('pricing_rule',
+ function(doc) { return (doc.rule_applied) ? "green" : "red" })
+
frm.set_query("blanket_order", "items", function() {
return {
filters: {
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.json b/erpnext/buying/doctype/purchase_order/purchase_order.json
index 6920f11..4be1018 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.json
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.json
@@ -298,7 +298,7 @@
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
- "in_standard_filter": 1,
+ "in_standard_filter": 0,
"label": "Date",
"length": 0,
"no_copy": 0,
@@ -1553,6 +1553,72 @@
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
+ "collapsible": 1,
+ "columns": 0,
+ "fieldname": "section_break_48",
+ "fieldtype": "Section Break",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Pricing Rules",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "collapsible_depends_on": "",
+ "columns": 0,
+ "fieldname": "pricing_rules",
+ "fieldtype": "Table",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Purchase Order Pricing Rule",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Pricing Rule Detail",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 1,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
"collapsible": 0,
"collapsible_depends_on": "supplied_items",
"columns": 0,
@@ -1914,7 +1980,8 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
- "fieldname": "tax_category",
+ "description": "",
+ "fieldname": "taxes_and_charges",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
@@ -1923,12 +1990,13 @@
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
- "label": "Tax Category",
+ "label": "Taxes and Charges",
"length": 0,
"no_copy": 0,
- "options": "Tax Category",
+ "oldfieldname": "purchase_other_charges",
+ "oldfieldtype": "Link",
+ "options": "Purchase Taxes and Charges Template",
"permlevel": 0,
- "precision": "",
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 0,
@@ -2042,41 +2110,6 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
- "description": "",
- "fieldname": "taxes_and_charges",
- "fieldtype": "Link",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_global_search": 0,
- "in_list_view": 0,
- "in_standard_filter": 0,
- "label": "Purchase Taxes and Charges Template",
- "length": 0,
- "no_copy": 0,
- "oldfieldname": "purchase_other_charges",
- "oldfieldtype": "Link",
- "options": "Purchase Taxes and Charges Template",
- "permlevel": 0,
- "print_hide": 1,
- "print_hide_if_no_value": 0,
- "read_only": 0,
- "remember_last_selected_value": 0,
- "report_hide": 0,
- "reqd": 0,
- "search_index": 0,
- "set_only_once": 0,
- "translatable": 0,
- "unique": 0
- },
- {
- "allow_bulk_edit": 0,
- "allow_in_quick_entry": 0,
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
"fieldname": "taxes",
"fieldtype": "Table",
"hidden": 0,
@@ -2914,7 +2947,6 @@
"label": "Rounded Total",
"length": 0,
"no_copy": 0,
- "options": "currency",
"permlevel": 0,
"precision": "",
"print_hide": 0,
@@ -3865,7 +3897,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
- "modified": "2018-12-27 02:04:14.410491",
+ "modified": "2019-02-14 19:36:49.390935",
"modified_by": "Administrator",
"module": "Buying",
"name": "Purchase Order",
@@ -3960,4 +3992,4 @@
"track_changes": 0,
"track_seen": 0,
"track_views": 0
-}
+}
\ No newline at end of file
diff --git a/erpnext/buying/doctype/purchase_order_item/purchase_order_item.json b/erpnext/buying/doctype/purchase_order_item/purchase_order_item.json
index 9b26085..b297b5a 100644
--- a/erpnext/buying/doctype/purchase_order_item/purchase_order_item.json
+++ b/erpnext/buying/doctype/purchase_order_item/purchase_order_item.json
@@ -21,6 +21,7 @@
"bold": 1,
"collapsible": 0,
"columns": 3,
+ "fetch_if_empty": 0,
"fieldname": "item_code",
"fieldtype": "Link",
"hidden": 0,
@@ -56,6 +57,7 @@
"collapsible": 0,
"columns": 0,
"description": "",
+ "fetch_if_empty": 0,
"fieldname": "supplier_part_no",
"fieldtype": "Data",
"hidden": 1,
@@ -87,6 +89,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "item_name",
"fieldtype": "Data",
"hidden": 0,
@@ -120,6 +123,8 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "depends_on": "",
+ "fetch_if_empty": 0,
"fieldname": "column_break_4",
"fieldtype": "Column Break",
"hidden": 0,
@@ -151,6 +156,7 @@
"bold": 1,
"collapsible": 0,
"columns": 2,
+ "fetch_if_empty": 0,
"fieldname": "schedule_date",
"fieldtype": "Date",
"hidden": 0,
@@ -184,6 +190,7 @@
"bold": 1,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "expected_delivery_date",
"fieldtype": "Date",
"hidden": 0,
@@ -216,6 +223,7 @@
"bold": 0,
"collapsible": 1,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "section_break_5",
"fieldtype": "Section Break",
"hidden": 0,
@@ -248,6 +256,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "description",
"fieldtype": "Text Editor",
"hidden": 0,
@@ -283,6 +292,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "col_break1",
"fieldtype": "Column Break",
"hidden": 0,
@@ -313,6 +323,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "image",
"fieldtype": "Attach",
"hidden": 1,
@@ -345,6 +356,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "image_view",
"fieldtype": "Image",
"hidden": 0,
@@ -378,6 +390,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "quantity_and_rate",
"fieldtype": "Section Break",
"hidden": 0,
@@ -409,6 +422,7 @@
"bold": 1,
"collapsible": 0,
"columns": 1,
+ "fetch_if_empty": 0,
"fieldname": "qty",
"fieldtype": "Float",
"hidden": 0,
@@ -444,6 +458,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "stock_uom",
"fieldtype": "Link",
"hidden": 0,
@@ -460,7 +475,7 @@
"oldfieldtype": "Data",
"options": "UOM",
"permlevel": 0,
- "print_hide": 1,
+ "print_hide": 0,
"print_hide_if_no_value": 0,
"print_width": "100px",
"read_only": 1,
@@ -480,6 +495,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "col_break2",
"fieldtype": "Column Break",
"hidden": 0,
@@ -511,6 +527,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "uom",
"fieldtype": "Link",
"hidden": 0,
@@ -547,6 +564,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "conversion_factor",
"fieldtype": "Float",
"hidden": 0,
@@ -583,6 +601,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "sec_break1",
"fieldtype": "Section Break",
"hidden": 0,
@@ -613,6 +632,8 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "depends_on": "",
+ "fetch_if_empty": 0,
"fieldname": "price_list_rate",
"fieldtype": "Currency",
"hidden": 0,
@@ -646,6 +667,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "price_list_rate",
+ "fetch_if_empty": 0,
"fieldname": "discount_percentage",
"fieldtype": "Percent",
"hidden": 0,
@@ -677,7 +699,8 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
- "depends_on": "discount_percentage",
+ "depends_on": "price_list_rate",
+ "fetch_if_empty": 0,
"fieldname": "discount_amount",
"fieldtype": "Currency",
"hidden": 0,
@@ -695,7 +718,7 @@
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
- "read_only": 1,
+ "read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
@@ -711,6 +734,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "col_break3",
"fieldtype": "Column Break",
"hidden": 0,
@@ -741,6 +765,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "last_purchase_rate",
"fieldtype": "Currency",
"hidden": 0,
@@ -774,6 +799,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "base_price_list_rate",
"fieldtype": "Currency",
"hidden": 0,
@@ -806,6 +832,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "sec_break2",
"fieldtype": "Section Break",
"hidden": 0,
@@ -836,6 +863,8 @@
"bold": 1,
"collapsible": 0,
"columns": 2,
+ "depends_on": "",
+ "fetch_if_empty": 0,
"fieldname": "rate",
"fieldtype": "Currency",
"hidden": 0,
@@ -870,6 +899,8 @@
"bold": 0,
"collapsible": 0,
"columns": 2,
+ "depends_on": "",
+ "fetch_if_empty": 0,
"fieldname": "amount",
"fieldtype": "Currency",
"hidden": 0,
@@ -904,6 +935,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "col_break4",
"fieldtype": "Column Break",
"hidden": 0,
@@ -934,6 +966,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "base_rate",
"fieldtype": "Currency",
"hidden": 0,
@@ -971,6 +1004,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "base_amount",
"fieldtype": "Currency",
"hidden": 0,
@@ -1005,20 +1039,21 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
- "fieldname": "pricing_rule",
- "fieldtype": "Link",
- "hidden": 0,
+ "fetch_if_empty": 0,
+ "fieldname": "pricing_rules",
+ "fieldtype": "Small Text",
+ "hidden": 1,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
- "label": "Pricing Rule",
+ "label": "Pricing Rules",
"length": 0,
"no_copy": 0,
- "options": "Pricing Rule",
"permlevel": 0,
+ "precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
@@ -1037,6 +1072,40 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
+ "fieldname": "is_free_item",
+ "fieldtype": "Check",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Is Free Item",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 1,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "section_break_29",
"fieldtype": "Section Break",
"hidden": 0,
@@ -1068,6 +1137,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "net_rate",
"fieldtype": "Currency",
"hidden": 0,
@@ -1101,6 +1171,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "net_amount",
"fieldtype": "Currency",
"hidden": 0,
@@ -1134,6 +1205,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "column_break_32",
"fieldtype": "Column Break",
"hidden": 0,
@@ -1165,6 +1237,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "base_net_rate",
"fieldtype": "Currency",
"hidden": 0,
@@ -1198,6 +1271,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "base_net_amount",
"fieldtype": "Currency",
"hidden": 0,
@@ -1231,6 +1305,7 @@
"bold": 0,
"collapsible": 1,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "item_weight_details",
"fieldtype": "Section Break",
"hidden": 0,
@@ -1263,6 +1338,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "weight_per_unit",
"fieldtype": "Float",
"hidden": 0,
@@ -1295,6 +1371,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "total_weight",
"fieldtype": "Float",
"hidden": 0,
@@ -1327,6 +1404,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "column_break_40",
"fieldtype": "Column Break",
"hidden": 0,
@@ -1358,6 +1436,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "weight_uom",
"fieldtype": "Link",
"hidden": 0,
@@ -1391,6 +1470,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "warehouse_and_reference",
"fieldtype": "Section Break",
"hidden": 0,
@@ -1422,6 +1502,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "warehouse",
"fieldtype": "Link",
"hidden": 0,
@@ -1456,6 +1537,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "project",
"fieldtype": "Link",
"hidden": 0,
@@ -1488,6 +1570,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "material_request",
"fieldtype": "Link",
"hidden": 0,
@@ -1524,6 +1607,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "material_request_item",
"fieldtype": "Data",
"hidden": 1,
@@ -1557,6 +1641,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "sales_order",
"fieldtype": "Link",
"hidden": 0,
@@ -1590,6 +1675,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "sales_order_item",
"fieldtype": "Data",
"hidden": 1,
@@ -1622,6 +1708,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "supplier_quotation",
"fieldtype": "Link",
"hidden": 0,
@@ -1654,6 +1741,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "supplier_quotation_item",
"fieldtype": "Link",
"hidden": 1,
@@ -1686,6 +1774,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "delivered_by_supplier",
"fieldtype": "Check",
"hidden": 0,
@@ -1718,6 +1807,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "blanket_order",
"fieldtype": "Link",
"hidden": 0,
@@ -1751,6 +1841,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "blanket_order_rate",
"fieldtype": "Currency",
"hidden": 0,
@@ -1783,6 +1874,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "col_break5",
"fieldtype": "Column Break",
"hidden": 0,
@@ -1814,6 +1906,7 @@
"collapsible": 0,
"columns": 0,
"description": "",
+ "fetch_if_empty": 0,
"fieldname": "item_group",
"fieldtype": "Link",
"hidden": 1,
@@ -1848,6 +1941,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "brand",
"fieldtype": "Link",
"hidden": 1,
@@ -1882,6 +1976,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "bom",
"fieldtype": "Link",
"hidden": 0,
@@ -1917,6 +2012,7 @@
"columns": 0,
"default": "1",
"depends_on": "eval:parent.is_subcontracted == 'Yes'",
+ "fetch_if_empty": 0,
"fieldname": "include_exploded_items",
"fieldtype": "Check",
"hidden": 0,
@@ -1949,6 +2045,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "section_break_56",
"fieldtype": "Section Break",
"hidden": 0,
@@ -1980,6 +2077,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "stock_qty",
"fieldtype": "Float",
"hidden": 0,
@@ -2015,6 +2113,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "received_qty",
"fieldtype": "Float",
"hidden": 0,
@@ -2049,6 +2148,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "returned_qty",
+ "fetch_if_empty": 0,
"fieldname": "returned_qty",
"fieldtype": "Float",
"hidden": 0,
@@ -2081,6 +2181,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "column_break_60",
"fieldtype": "Column Break",
"hidden": 0,
@@ -2112,6 +2213,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "billed_amt",
"fieldtype": "Currency",
"hidden": 0,
@@ -2145,6 +2247,7 @@
"collapsible": 0,
"columns": 0,
"description": "Tax detail table fetched from item master as a string and stored in this field.\nUsed for Taxes and Charges",
+ "fetch_if_empty": 0,
"fieldname": "item_tax_rate",
"fieldtype": "Code",
"hidden": 1,
@@ -2178,6 +2281,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "accounting_details",
"fieldtype": "Section Break",
"hidden": 0,
@@ -2210,6 +2314,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "expense_account",
"fieldtype": "Link",
"hidden": 0,
@@ -2243,39 +2348,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
- "fieldname": "item_tax_template",
- "fieldtype": "Link",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_global_search": 0,
- "in_list_view": 0,
- "in_standard_filter": 0,
- "label": "Item Tax Template",
- "length": 0,
- "no_copy": 0,
- "options": "Item Tax Template",
- "permlevel": 0,
- "precision": "",
- "print_hide": 1,
- "print_hide_if_no_value": 0,
- "read_only": 0,
- "remember_last_selected_value": 0,
- "report_hide": 0,
- "reqd": 0,
- "search_index": 0,
- "set_only_once": 0,
- "translatable": 0,
- "unique": 0
- },
- {
- "allow_bulk_edit": 0,
- "allow_in_quick_entry": 0,
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "column_break_68",
"fieldtype": "Column Break",
"hidden": 0,
@@ -2307,6 +2380,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "cost_center",
"fieldtype": "Link",
"hidden": 0,
@@ -2340,6 +2414,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "page_break",
"fieldtype": "Check",
"hidden": 0,
@@ -2377,7 +2452,7 @@
"issingle": 0,
"istable": 1,
"max_attachments": 0,
- "modified": "2018-11-23 16:53:57.220731",
+ "modified": "2019-03-19 03:00:17.096662",
"modified_by": "Administrator",
"module": "Buying",
"name": "Purchase Order Item",
@@ -2386,10 +2461,11 @@
"quick_entry": 1,
"read_only": 0,
"read_only_onload": 0,
+ "search_fields": "item_name",
"show_name_in_global_search": 0,
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1,
"track_seen": 0,
"track_views": 0
-}
+}
\ No newline at end of file
diff --git a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.json b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.json
index 049dc9f..b17bed4 100644
--- a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.json
+++ b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.json
@@ -907,6 +907,71 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fieldname": "pricing_rule_details",
+ "fieldtype": "Section Break",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Pricing Rules",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "pricing_rules",
+ "fieldtype": "Table",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Pricing Rule Detail",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Pricing Rule Detail",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 1,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
"fieldname": "section_break_22",
"fieldtype": "Section Break",
"hidden": 0,
@@ -2878,7 +2943,7 @@
"istable": 0,
"max_attachments": 0,
"menu_index": 0,
- "modified": "2018-12-27 02:08:16.421501",
+ "modified": "2019-02-13 00:52:28.602904",
"modified_by": "Administrator",
"module": "Buying",
"name": "Supplier Quotation",
diff --git a/erpnext/buying/doctype/supplier_quotation_item/supplier_quotation_item.json b/erpnext/buying/doctype/supplier_quotation_item/supplier_quotation_item.json
index ec8fc7f..41d71c1 100644
--- a/erpnext/buying/doctype/supplier_quotation_item/supplier_quotation_item.json
+++ b/erpnext/buying/doctype/supplier_quotation_item/supplier_quotation_item.json
@@ -21,6 +21,7 @@
"bold": 1,
"collapsible": 0,
"columns": 4,
+ "fetch_if_empty": 0,
"fieldname": "item_code",
"fieldtype": "Link",
"hidden": 0,
@@ -56,6 +57,7 @@
"collapsible": 0,
"columns": 0,
"description": "",
+ "fetch_if_empty": 0,
"fieldname": "supplier_part_no",
"fieldtype": "Data",
"hidden": 1,
@@ -87,6 +89,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "item_name",
"fieldtype": "Data",
"hidden": 0,
@@ -120,6 +123,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "column_break_3",
"fieldtype": "Column Break",
"hidden": 0,
@@ -151,6 +155,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "lead_time_days",
"fieldtype": "Int",
"hidden": 0,
@@ -183,6 +188,7 @@
"bold": 0,
"collapsible": 1,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "section_break_5",
"fieldtype": "Section Break",
"hidden": 0,
@@ -215,6 +221,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "description",
"fieldtype": "Text Editor",
"hidden": 0,
@@ -250,6 +257,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "col_break1",
"fieldtype": "Column Break",
"hidden": 0,
@@ -280,6 +288,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "image",
"fieldtype": "Attach",
"hidden": 1,
@@ -312,6 +321,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "image_view",
"fieldtype": "Image",
"hidden": 0,
@@ -345,6 +355,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "quantity_and_rate",
"fieldtype": "Section Break",
"hidden": 0,
@@ -376,6 +387,7 @@
"bold": 1,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "qty",
"fieldtype": "Float",
"hidden": 0,
@@ -411,6 +423,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "stock_uom",
"fieldtype": "Link",
"hidden": 0,
@@ -444,6 +457,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "price_list_rate",
"fieldtype": "Currency",
"hidden": 0,
@@ -477,6 +491,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "price_list_rate",
+ "fetch_if_empty": 0,
"fieldname": "discount_percentage",
"fieldtype": "Percent",
"hidden": 0,
@@ -508,7 +523,8 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
- "depends_on": "discount_percentage",
+ "depends_on": "price_list_rate",
+ "fetch_if_empty": 0,
"fieldname": "discount_amount",
"fieldtype": "Currency",
"hidden": 0,
@@ -526,7 +542,7 @@
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
- "read_only": 1,
+ "read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
@@ -542,6 +558,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "col_break2",
"fieldtype": "Column Break",
"hidden": 0,
@@ -572,6 +589,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "uom",
"fieldtype": "Link",
"hidden": 0,
@@ -607,6 +625,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "conversion_factor",
"fieldtype": "Float",
"hidden": 0,
@@ -639,6 +658,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "stock_qty",
"fieldtype": "Float",
"hidden": 0,
@@ -671,6 +691,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "base_price_list_rate",
"fieldtype": "Currency",
"hidden": 0,
@@ -704,6 +725,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "sec_break1",
"fieldtype": "Section Break",
"hidden": 0,
@@ -734,6 +756,7 @@
"bold": 1,
"collapsible": 0,
"columns": 2,
+ "fetch_if_empty": 0,
"fieldname": "rate",
"fieldtype": "Currency",
"hidden": 0,
@@ -768,6 +791,7 @@
"bold": 0,
"collapsible": 0,
"columns": 2,
+ "fetch_if_empty": 0,
"fieldname": "amount",
"fieldtype": "Currency",
"hidden": 0,
@@ -802,6 +826,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "col_break3",
"fieldtype": "Column Break",
"hidden": 0,
@@ -832,6 +857,8 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "depends_on": "",
+ "fetch_if_empty": 0,
"fieldname": "base_rate",
"fieldtype": "Currency",
"hidden": 0,
@@ -869,6 +896,8 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "depends_on": "",
+ "fetch_if_empty": 0,
"fieldname": "base_amount",
"fieldtype": "Currency",
"hidden": 0,
@@ -903,21 +932,22 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
- "fieldname": "pricing_rule",
- "fieldtype": "Link",
- "hidden": 0,
+ "fetch_if_empty": 0,
+ "fieldname": "pricing_rules",
+ "fieldtype": "Small Text",
+ "hidden": 1,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
- "label": "Pricing Rule",
+ "label": "Pricing Rules",
"length": 0,
"no_copy": 0,
- "options": "Pricing Rule",
"permlevel": 0,
- "print_hide": 0,
+ "precision": "",
+ "print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
@@ -935,6 +965,40 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
+ "fieldname": "is_free_item",
+ "fieldtype": "Check",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Is Free Item",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 1,
+ "print_hide_if_no_value": 0,
+ "read_only": 1,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "section_break_24",
"fieldtype": "Section Break",
"hidden": 0,
@@ -966,6 +1030,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "net_rate",
"fieldtype": "Currency",
"hidden": 0,
@@ -998,6 +1063,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "net_amount",
"fieldtype": "Currency",
"hidden": 0,
@@ -1031,6 +1097,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "column_break_27",
"fieldtype": "Column Break",
"hidden": 0,
@@ -1062,6 +1129,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "base_net_rate",
"fieldtype": "Currency",
"hidden": 0,
@@ -1095,6 +1163,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "base_net_amount",
"fieldtype": "Currency",
"hidden": 0,
@@ -1128,6 +1197,7 @@
"bold": 0,
"collapsible": 1,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "item_weight_details",
"fieldtype": "Section Break",
"hidden": 0,
@@ -1160,6 +1230,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "weight_per_unit",
"fieldtype": "Float",
"hidden": 0,
@@ -1192,6 +1263,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "total_weight",
"fieldtype": "Float",
"hidden": 0,
@@ -1224,6 +1296,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "column_break_23",
"fieldtype": "Column Break",
"hidden": 0,
@@ -1255,6 +1328,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "weight_uom",
"fieldtype": "Link",
"hidden": 0,
@@ -1288,6 +1362,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "warehouse_and_reference",
"fieldtype": "Section Break",
"hidden": 0,
@@ -1319,6 +1394,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "warehouse",
"fieldtype": "Link",
"hidden": 0,
@@ -1353,6 +1429,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "project",
"fieldtype": "Link",
"hidden": 0,
@@ -1385,6 +1462,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "prevdoc_doctype",
"fieldtype": "Data",
"hidden": 1,
@@ -1418,6 +1496,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "material_request",
"fieldtype": "Link",
"hidden": 0,
@@ -1454,6 +1533,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "sales_order",
"fieldtype": "Link",
"hidden": 0,
@@ -1487,6 +1567,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "request_for_quotation",
"fieldtype": "Link",
"hidden": 0,
@@ -1520,6 +1601,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "col_break4",
"fieldtype": "Column Break",
"hidden": 0,
@@ -1550,6 +1632,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "item_tax_template",
"fieldtype": "Link",
"hidden": 0,
@@ -1583,6 +1666,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "material_request_item",
"fieldtype": "Data",
"hidden": 1,
@@ -1616,6 +1700,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "request_for_quotation_item",
"fieldtype": "Data",
"hidden": 1,
@@ -1648,6 +1733,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "brand",
"fieldtype": "Link",
"hidden": 0,
@@ -1683,6 +1769,7 @@
"collapsible": 0,
"columns": 0,
"description": "",
+ "fetch_if_empty": 0,
"fieldname": "item_group",
"fieldtype": "Link",
"hidden": 0,
@@ -1718,6 +1805,7 @@
"collapsible": 0,
"columns": 0,
"description": "Tax detail table fetched from item master as a string and stored in this field.\nUsed for Taxes and Charges",
+ "fetch_if_empty": 0,
"fieldname": "item_tax_rate",
"fieldtype": "Code",
"hidden": 1,
@@ -1751,6 +1839,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "section_break_44",
"fieldtype": "Section Break",
"hidden": 0,
@@ -1782,6 +1871,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "page_break",
"fieldtype": "Check",
"hidden": 0,
@@ -1819,7 +1909,7 @@
"issingle": 0,
"istable": 1,
"max_attachments": 0,
- "modified": "2019-02-18 18:58:10.351451",
+ "modified": "2019-03-19 03:01:18.888957",
"modified_by": "Administrator",
"module": "Buying",
"name": "Supplier Quotation Item",
@@ -1834,4 +1924,4 @@
"track_changes": 1,
"track_seen": 0,
"track_views": 0
-}
+}
\ No newline at end of file
diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py
index 1a12d5c..a4c6628 100644
--- a/erpnext/controllers/accounts_controller.py
+++ b/erpnext/controllers/accounts_controller.py
@@ -13,11 +13,11 @@
from erpnext.buying.utils import update_last_purchase_rate
from erpnext.controllers.sales_and_purchase_return import validate_return
from erpnext.accounts.party import get_party_account_currency, validate_party_frozen_disabled
+from erpnext.accounts.doctype.pricing_rule.utils import validate_pricing_rules
from erpnext.exceptions import InvalidCurrency
from six import text_type
-force_item_fields = ("item_group", "brand", "stock_uom", "is_fixed_asset", "item_tax_rate")
-
+force_item_fields = ("item_group", "brand", "stock_uom", "is_fixed_asset", "item_tax_rate", "pricing_rules")
class AccountsController(TransactionBase):
def __init__(self, *args, **kwargs):
@@ -96,6 +96,8 @@
self.validate_qty()
validate_regional(self)
+ if self.doctype != 'Material Request':
+ validate_pricing_rules(self)
def validate_invoice_documents_schedule(self):
self.validate_payment_schedule_dates()
@@ -237,6 +239,7 @@
document_type = "{} Item".format(self.doctype)
parent_dict.update({"document_type": document_type})
+ self.set('pricing_rules', [])
for item in self.get("items"):
if item.get("item_code"):
args = parent_dict.copy()
@@ -244,13 +247,16 @@
args["doctype"] = self.doctype
args["name"] = self.name
+ args["child_docname"] = item.name
if not args.get("transaction_date"):
args["transaction_date"] = args.get("posting_date")
if self.get("is_subcontracted"):
args["is_subcontracted"] = self.is_subcontracted
- ret = get_item_details(args)
+
+ ret = get_item_details(args, self)
+
for fieldname, value in ret.items():
if item.meta.get_field(fieldname) and value is not None:
if (item.get(fieldname) is None or fieldname in force_item_fields):
@@ -270,16 +276,20 @@
if self.doctype in ["Purchase Invoice", "Sales Invoice"] and item.meta.get_field('is_fixed_asset'):
item.set('is_fixed_asset', ret.get('is_fixed_asset', 0))
- if ret.get("pricing_rule"):
+ if ret.get("pricing_rules"):
# if user changed the discount percentage then set user's discount percentage ?
- item.set("pricing_rule", ret.get("pricing_rule"))
+ item.set("pricing_rules", ret.get("pricing_rules"))
item.set("discount_percentage", ret.get("discount_percentage"))
+ item.set("discount_amount", ret.get("discount_amount"))
if ret.get("pricing_rule_for") == "Rate":
item.set("price_list_rate", ret.get("price_list_rate"))
- if item.price_list_rate:
+ if item.get("price_list_rate"):
item.rate = flt(item.price_list_rate *
- (1.0 - (flt(item.discount_percentage) / 100.0)), item.precision("rate"))
+ (1.0 - (flt(item.discount_percentage) / 100.0)), item.precision("rate"))
+
+ if item.get('discount_amount'):
+ item.rate = item.price_list_rate - item.discount_amount
if self.doctype == "Purchase Invoice":
self.set_expense_account(for_validate)
diff --git a/erpnext/controllers/taxes_and_totals.py b/erpnext/controllers/taxes_and_totals.py
index 8184e92..b3880be 100644
--- a/erpnext/controllers/taxes_and_totals.py
+++ b/erpnext/controllers/taxes_and_totals.py
@@ -59,9 +59,12 @@
if item.discount_percentage == 100:
item.rate = 0.0
- elif not item.rate:
+ elif (not item.rate or item.discount_percentage > 0) and item.price_list_rate:
item.rate = flt(item.price_list_rate *
(1.0 - (item.discount_percentage / 100.0)), item.precision("rate"))
+ item.discount_amount = item.price_list_rate * (item.discount_percentage / 100.0)
+ elif item.discount_amount and item.price_list_rate:
+ item.rate = item.price_list_rate - item.discount_amount
if item.doctype in ['Quotation Item', 'Sales Order Item', 'Delivery Note Item', 'Sales Invoice Item']:
item.rate_with_margin, item.base_rate_with_margin = self.calculate_margin(item)
@@ -69,8 +72,8 @@
if flt(item.rate_with_margin) > 0:
item.rate = flt(item.rate_with_margin * (1.0 - (item.discount_percentage / 100.0)), item.precision("rate"))
item.discount_amount = item.rate_with_margin - item.rate
- elif flt(item.price_list_rate) > 0:
- item.discount_amount = item.price_list_rate - item.rate
+ elif flt(item.price_list_rate) > 0 and not item.discount_amount:
+ item.discount_amount = item.price_list_rate - item.rate
item.net_rate = item.rate
item.amount = flt(item.rate * item.qty, item.precision("amount"))
@@ -537,16 +540,17 @@
rate_with_margin = 0.0
base_rate_with_margin = 0.0
if item.price_list_rate:
- if item.pricing_rule and not self.doc.ignore_pricing_rule:
- pricing_rule = frappe.get_doc('Pricing Rule', item.pricing_rule)
+ if item.pricing_rules and not self.doc.ignore_pricing_rule:
+ for d in item.pricing_rules.split(','):
+ pricing_rule = frappe.get_doc('Pricing Rule', d)
- if (pricing_rule.margin_type == 'Amount' and pricing_rule.currency == self.doc.currency)\
- or (pricing_rule.margin_type == 'Percentage'):
- item.margin_type = pricing_rule.margin_type
- item.margin_rate_or_amount = pricing_rule.margin_rate_or_amount
- else:
- item.margin_type = None
- item.margin_rate_or_amount = 0.0
+ if (pricing_rule.margin_type == 'Amount' and pricing_rule.currency == self.doc.currency)\
+ or (pricing_rule.margin_type == 'Percentage'):
+ item.margin_type = pricing_rule.margin_type
+ item.margin_rate_or_amount = pricing_rule.margin_rate_or_amount
+ else:
+ item.margin_type = None
+ item.margin_rate_or_amount = 0.0
if item.margin_type and item.margin_rate_or_amount:
margin_value = item.margin_rate_or_amount if item.margin_type == 'Amount' else flt(item.price_list_rate) * flt(item.margin_rate_or_amount) / 100
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index cb1e77c..9017fe8 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -586,3 +586,4 @@
erpnext.patches.v11_0.remove_barcodes_field_from_copy_fields_to_variants
erpnext.patches.v12_0.set_task_status
erpnext.patches.v11_0.make_italian_localization_fields # 01-03-2019
+erpnext.patches.v12_0.update_pricing_rule_fields
\ No newline at end of file
diff --git a/erpnext/patches/v12_0/update_pricing_rule_fields.py b/erpnext/patches/v12_0/update_pricing_rule_fields.py
new file mode 100644
index 0000000..26bb693
--- /dev/null
+++ b/erpnext/patches/v12_0/update_pricing_rule_fields.py
@@ -0,0 +1,71 @@
+# Copyright (c) 2017, Frappe and Contributors
+# License: GNU General Public License v3. See license.txt
+
+from __future__ import unicode_literals
+import frappe
+
+parentfield = {
+ 'item_code': 'items',
+ 'item_group': 'item_groups',
+ 'brand': 'brands'
+}
+
+def execute():
+
+ if not frappe.get_all('Pricing Rule', limit=1):
+ return
+
+ frappe.reload_doc('accounts', 'doctype', 'pricing_rule_detail')
+ doctypes = {'Supplier Quotation': 'buying', 'Purchase Order': 'buying', 'Purchase Invoice': 'accounts',
+ 'Purchase Receipt': 'stock', 'Quotation': 'selling', 'Sales Order': 'selling',
+ 'Sales Invoice': 'accounts', 'Delivery Note': 'stock'}
+
+ for doctype, module in doctypes.items():
+ frappe.reload_doc(module, 'doctype', frappe.scrub(doctype))
+
+ child_doc = frappe.scrub(doctype) + '_item'
+ frappe.reload_doc(module, 'doctype', child_doc)
+
+ child_doctype = doctype + ' Item'
+
+ frappe.db.sql(""" UPDATE `tab{child_doctype}` SET pricing_rules = pricing_rule
+ WHERE docstatus < 2 and pricing_rule is not null and pricing_rule != ''
+ """.format(child_doctype= child_doctype))
+
+ data = frappe.db.sql(""" SELECT pricing_rule, name, parent,
+ parenttype, creation, modified, docstatus, modified_by, owner, name
+ FROM `tab{child_doc}` where docstatus < 2 and pricing_rule is not null
+ and pricing_rule != ''""".format(child_doc=child_doctype), as_dict=1)
+
+ values = []
+ for d in data:
+ values.append((d.pricing_rule, d.name, d.parent, 'pricing_rules', d.parenttype,
+ d.creation, d.modified, d.docstatus, d.modified_by, d.owner, frappe.generate_hash("", 10)))
+
+ if values:
+ frappe.db.sql(""" INSERT INTO
+ `tabPricing Rule Detail` (`pricing_rule`, `child_docname`, `parent`, `parentfield`, `parenttype`,
+ `creation`, `modified`, `docstatus`, `modified_by`, `owner`, `name`)
+ VALUES {values} """.format(values=', '.join(['%s'] * len(values))), tuple(values))
+
+ frappe.reload_doc('accounts', 'doctype', 'pricing_rule')
+
+ for doctype, apply_on in {'Apply Rule On Item Code': 'Item Code',
+ 'Apply Rule On Item Group': 'Item Group', 'Apply Rule On Brand': 'Brand'}.items():
+ frappe.reload_doc('accounts', 'doctype', frappe.scrub(doctype))
+
+ field = frappe.scrub(apply_on)
+ data = frappe.get_all('Pricing Rule', fields=[field, "name", "creation", "modified",
+ "owner", "modified_by"], filters= {'apply_on': apply_on})
+
+ values = []
+ for d in data:
+ values.append((d.get(field), d.name, parentfield.get(field), 'Pricing Rule',
+ d.creation, d.modified, d.owner, d.modified_by, frappe.generate_hash("", 10)))
+
+ if values:
+ frappe.db.sql(""" INSERT INTO
+ `tab{doctype}` ({field}, parent, parentfield, parenttype, creation, modified,
+ owner, modified_by, name)
+ VALUES {values} """.format(doctype=doctype,
+ field=field, values=', '.join(['%s'] * len(values))), tuple(values), debug=1)
\ No newline at end of file
diff --git a/erpnext/public/js/controllers/buying.js b/erpnext/public/js/controllers/buying.js
index a2a431d..3ec27fc 100644
--- a/erpnext/public/js/controllers/buying.js
+++ b/erpnext/public/js/controllers/buying.js
@@ -130,13 +130,23 @@
if (doc.doctype == "Purchase Order" && item.blanket_order_rate) {
item_rate = item.blanket_order_rate;
}
- item.discount_amount = flt(item_rate) * flt(item.discount_percentage) / 100;
+
+ if (item.discount_percentage) {
+ item.discount_amount = flt(item_rate) * flt(item.discount_percentage) / 100;
+ }
+
item.rate = flt((item.price_list_rate) - (item.discount_amount), precision('rate', item));
this.calculate_taxes_and_totals();
},
discount_percentage: function(doc, cdt, cdn) {
+ var item = frappe.get_doc(cdt, cdn);
+ item.discount_amount = 0.0;
+ this.price_list_rate(doc, cdt, cdn);
+ },
+
+ discount_amount: function(doc, cdt, cdn) {
this.price_list_rate(doc, cdt, cdn);
},
diff --git a/erpnext/public/js/controllers/taxes_and_totals.js b/erpnext/public/js/controllers/taxes_and_totals.js
index d09c15a..b3c8538 100644
--- a/erpnext/public/js/controllers/taxes_and_totals.js
+++ b/erpnext/public/js/controllers/taxes_and_totals.js
@@ -20,6 +20,9 @@
if(item.discount_percentage){
item.discount_amount = flt(item.rate_with_margin) * flt(item.discount_percentage) / 100;
+ }
+
+ if (item.discount_amount) {
item.rate = flt((item.rate_with_margin) - (item.discount_amount), precision('rate', item));
}
},
diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js
index 1430383..f647913 100644
--- a/erpnext/public/js/controllers/transaction.js
+++ b/erpnext/public/js/controllers/transaction.js
@@ -455,7 +455,8 @@
pos_profile: me.frm.doc.doctype == 'Sales Invoice' ? me.frm.doc.pos_profile : '',
cost_center: item.cost_center,
tax_category: me.frm.doc.tax_category,
- item_tax_template: item.item_tax_template
+ item_tax_template: item.item_tax_template,
+ child_docname: item.name
}
},
@@ -480,7 +481,8 @@
});
}
},
- () => me.conversion_factor(doc, cdt, cdn, true)
+ () => me.conversion_factor(doc, cdt, cdn, true),
+ () => me.update_free_items(item)
]);
}
}
@@ -904,8 +906,9 @@
},
qty: function(doc, cdt, cdn) {
+ let item = frappe.get_doc(cdt, cdn);
this.conversion_factor(doc, cdt, cdn, true);
- this.apply_pricing_rule(frappe.get_doc(cdt, cdn), true);
+ this.apply_pricing_rule(item, true);
},
service_stop_date: function(frm, cdt, cdn) {
@@ -1096,11 +1099,14 @@
var item_list = [];
$.each(this.frm.doc["items"] || [], function(i, d) {
- if (d.item_code) {
+ if (d.item_code && !d.is_free_item) {
item_list.push({
"doctype": d.doctype,
"name": d.name,
- "pricing_rule": d.pricing_rule
+ "item_code": d.item_code,
+ "pricing_rules": d.pricing_rules,
+ "parenttype": d.parenttype,
+ "parent": d.parent
})
}
});
@@ -1109,6 +1115,9 @@
args: { item_list: item_list },
callback: function(r) {
if (!r.exc && r.message) {
+ r.message.forEach(row_item => {
+ me.update_free_items(row_item);
+ });
me._set_values_for_item_list(r.message);
me.calculate_taxes_and_totals();
if(me.frm.doc.apply_discount_on) me.frm.trigger("apply_discount_on");
@@ -1127,6 +1136,7 @@
if(calculate_taxes_and_totals) me.calculate_taxes_and_totals();
return;
}
+
return this.frm.call({
method: "erpnext.accounts.doctype.pricing_rule.pricing_rule.apply_pricing_rule",
args: { args: args },
@@ -1136,6 +1146,7 @@
if(item) me.set_gross_profit(item);
if(calculate_taxes_and_totals) me.calculate_taxes_and_totals();
if(me.frm.doc.apply_discount_on) me.frm.trigger("apply_discount_on")
+ me.update_free_items(item);
}
}
});
@@ -1176,16 +1187,19 @@
item_list.push({
"doctype": d.doctype,
"name": d.name,
+ "child_docname": d.name,
"item_code": d.item_code,
"item_group": d.item_group,
"brand": d.brand,
"qty": d.qty,
+ "stock_qty": d.stock_qty,
"uom": d.uom,
"parenttype": d.parenttype,
"parent": d.parent,
- "pricing_rule": d.pricing_rule,
+ "pricing_rules": d.pricing_rules,
"warehouse": d.warehouse,
"serial_no": d.serial_no,
+ "price_list_rate": d.price_list_rate,
"discount_percentage": d.discount_percentage || 0.0,
"conversion_factor": d.conversion_factor || 1.0
});
@@ -1213,7 +1227,7 @@
var price_list_rate_changed = false;
for(var i=0, l=children.length; i<l; i++) {
var d = children[i];
- var existing_pricing_rule = frappe.model.get_value(d.doctype, d.name, "pricing_rule");
+ var existing_pricing_rule = frappe.model.get_value(d.doctype, d.name, "pricing_rules");
for(var k in d) {
var v = d[k];
if (["doctype", "name"].indexOf(k)===-1) {
@@ -1225,7 +1239,7 @@
}
// if pricing rule set as blank from an existing value, apply price_list
- if(!me.frm.doc.ignore_pricing_rule && existing_pricing_rule && !d.pricing_rule) {
+ if(!me.frm.doc.ignore_pricing_rule && existing_pricing_rule && !d.pricing_rules) {
me.apply_price_list(frappe.get_doc(d.doctype, d.name));
}
}
@@ -1274,6 +1288,58 @@
});
},
+ update_free_items: function(item) {
+ var me = this;
+
+ if (item.pricing_rules) {
+ frappe.call({
+ method: "erpnext.accounts.doctype.pricing_rule.pricing_rule.get_free_items",
+ args: {
+ pricing_rules: item.pricing_rules,
+ item_row: item
+ },
+ callback: function(r) {
+ let items = [];
+ let child = '';
+
+ me.frm.doc.items.map(d => {
+ items[d.item_code] = d;
+ });
+
+ if(r.message && r.message.length) {
+ r.message.forEach(d => {
+ // If free item is already exists
+
+ if(d.item_code in items &&
+ d.is_free_item && items[d.item_code].is_free_item) {
+ child = items[d.item_code];
+ } else {
+ child = frappe.model.add_child(me.frm.doc, item.doctype, "items");
+ }
+
+ $.each(d, function(k, v) {
+ child[k] = v;
+ });
+
+ me.frm.script_manager.trigger("price_list_rate", child.doctype, child.name);
+ });
+ }
+ }
+ });
+ } else if(item.remove_free_item) {
+ var items = [];
+
+ me.frm.doc.items.forEach(d => {
+ if(d.item_code != item.remove_free_item || !d.is_free_item) {
+ items.push(d);
+ }
+ });
+
+ me.frm.doc.items = items;
+ refresh_field('items');
+ }
+ },
+
validate_company_and_party: function() {
var me = this;
var valid = true;
diff --git a/erpnext/selling/doctype/quotation/quotation.json b/erpnext/selling/doctype/quotation/quotation.json
index e57a55c..7332eba 100644
--- a/erpnext/selling/doctype/quotation/quotation.json
+++ b/erpnext/selling/doctype/quotation/quotation.json
@@ -1188,6 +1188,71 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fieldname": "pricing_rule_details",
+ "fieldtype": "Section Break",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Pricing Rules",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "pricing_rules",
+ "fieldtype": "Table",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Pricing Rule Detail",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Pricing Rule Detail",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 1,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
"fieldname": "sec_break23",
"fieldtype": "Section Break",
"hidden": 0,
@@ -3231,7 +3296,7 @@
"istable": 0,
"max_attachments": 1,
"menu_index": 0,
- "modified": "2018-12-27 02:07:50.702241",
+ "modified": "2019-02-13 01:00:21.545591",
"modified_by": "Administrator",
"module": "Selling",
"name": "Quotation",
diff --git a/erpnext/selling/doctype/quotation_item/quotation_item.json b/erpnext/selling/doctype/quotation_item/quotation_item.json
index 118c333..6b7c057 100644
--- a/erpnext/selling/doctype/quotation_item/quotation_item.json
+++ b/erpnext/selling/doctype/quotation_item/quotation_item.json
@@ -1,18 +1,18 @@
{
- "allow_copy": 0,
- "allow_events_in_timeline": 0,
- "allow_guest_to_view": 0,
- "allow_import": 0,
- "allow_rename": 0,
- "autoname": "",
- "beta": 0,
- "creation": "2013-03-07 11:42:57",
- "custom": 0,
- "docstatus": 0,
- "doctype": "DocType",
- "document_type": "Document",
- "editable_grid": 1,
- "engine": "InnoDB",
+ "allow_copy": 0,
+ "allow_events_in_timeline": 0,
+ "allow_guest_to_view": 0,
+ "allow_import": 0,
+ "allow_rename": 0,
+ "autoname": "",
+ "beta": 0,
+ "creation": "2013-03-07 11:42:57",
+ "custom": 0,
+ "docstatus": 0,
+ "doctype": "DocType",
+ "document_type": "Document",
+ "editable_grid": 1,
+ "engine": "InnoDB",
"fields": [
{
"allow_bulk_edit": 0,
@@ -21,6 +21,7 @@
"bold": 1,
"collapsible": 0,
"columns": 4,
+ "fetch_if_empty": 0,
"fieldname": "item_code",
"fieldtype": "Link",
"hidden": 0,
@@ -57,6 +58,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "customer_item_code",
"fieldtype": "Data",
"hidden": 1,
@@ -88,6 +90,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "col_break1",
"fieldtype": "Column Break",
"hidden": 0,
@@ -118,6 +121,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "item_name",
"fieldtype": "Data",
"hidden": 0,
@@ -153,6 +157,7 @@
"bold": 0,
"collapsible": 1,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "section_break_5",
"fieldtype": "Section Break",
"hidden": 0,
@@ -185,6 +190,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "description",
"fieldtype": "Text Editor",
"hidden": 0,
@@ -220,6 +226,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "column_break_7",
"fieldtype": "Column Break",
"hidden": 0,
@@ -251,6 +258,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "image",
"fieldtype": "Attach",
"hidden": 1,
@@ -283,6 +291,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "image_view",
"fieldtype": "Image",
"hidden": 0,
@@ -316,6 +325,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "quantity_and_rate",
"fieldtype": "Section Break",
"hidden": 0,
@@ -347,6 +357,7 @@
"bold": 1,
"collapsible": 0,
"columns": 2,
+ "fetch_if_empty": 0,
"fieldname": "qty",
"fieldtype": "Float",
"hidden": 0,
@@ -382,6 +393,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "stock_uom",
"fieldtype": "Link",
"hidden": 0,
@@ -418,6 +430,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "col_break2",
"fieldtype": "Column Break",
"hidden": 0,
@@ -448,6 +461,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "uom",
"fieldtype": "Link",
"hidden": 0,
@@ -481,6 +495,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "conversion_factor",
"fieldtype": "Float",
"hidden": 0,
@@ -513,6 +528,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "stock_qty",
"fieldtype": "Float",
"hidden": 0,
@@ -545,6 +561,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "section_break_16",
"fieldtype": "Section Break",
"hidden": 0,
@@ -576,6 +593,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "price_list_rate",
"fieldtype": "Currency",
"hidden": 0,
@@ -612,6 +630,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "base_price_list_rate",
"fieldtype": "Currency",
"hidden": 0,
@@ -648,6 +667,7 @@
"bold": 0,
"collapsible": 1,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "discount_and_margin",
"fieldtype": "Section Break",
"hidden": 0,
@@ -681,6 +701,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "price_list_rate",
+ "fetch_if_empty": 0,
"fieldname": "margin_type",
"fieldtype": "Select",
"hidden": 0,
@@ -715,6 +736,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.margin_type && doc.price_list_rate",
+ "fetch_if_empty": 0,
"fieldname": "margin_rate_or_amount",
"fieldtype": "Float",
"hidden": 0,
@@ -748,6 +770,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.margin_type && doc.price_list_rate && doc.margin_rate_or_amount",
+ "fetch_if_empty": 0,
"fieldname": "rate_with_margin",
"fieldtype": "Currency",
"hidden": 0,
@@ -781,6 +804,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "column_break_18",
"fieldtype": "Column Break",
"hidden": 0,
@@ -813,6 +837,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "price_list_rate",
+ "fetch_if_empty": 0,
"fieldname": "discount_percentage",
"fieldtype": "Percent",
"hidden": 0,
@@ -848,7 +873,8 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
- "depends_on": "discount_percentage",
+ "depends_on": "price_list_rate",
+ "fetch_if_empty": 0,
"fieldname": "discount_amount",
"fieldtype": "Currency",
"hidden": 0,
@@ -866,7 +892,7 @@
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
- "read_only": 1,
+ "read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
@@ -883,6 +909,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.margin_type && doc.price_list_rate && doc.margin_rate_or_amount",
+ "fetch_if_empty": 0,
"fieldname": "base_rate_with_margin",
"fieldtype": "Currency",
"hidden": 0,
@@ -916,6 +943,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "section_break1",
"fieldtype": "Section Break",
"hidden": 0,
@@ -947,6 +975,7 @@
"collapsible": 0,
"columns": 2,
"depends_on": "",
+ "fetch_if_empty": 0,
"fieldname": "rate",
"fieldtype": "Currency",
"hidden": 0,
@@ -984,6 +1013,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "net_rate",
"fieldtype": "Currency",
"hidden": 0,
@@ -1017,6 +1047,7 @@
"bold": 0,
"collapsible": 0,
"columns": 2,
+ "fetch_if_empty": 0,
"fieldname": "amount",
"fieldtype": "Currency",
"hidden": 0,
@@ -1053,6 +1084,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "net_amount",
"fieldtype": "Currency",
"hidden": 0,
@@ -1086,6 +1118,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "col_break3",
"fieldtype": "Column Break",
"hidden": 0,
@@ -1116,6 +1149,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "base_rate",
"fieldtype": "Currency",
"hidden": 0,
@@ -1152,6 +1186,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "base_net_rate",
"fieldtype": "Currency",
"hidden": 0,
@@ -1184,6 +1219,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "base_amount",
"fieldtype": "Currency",
"hidden": 0,
@@ -1220,6 +1256,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "base_net_amount",
"fieldtype": "Currency",
"hidden": 0,
@@ -1253,8 +1290,42 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
- "fieldname": "pricing_rule",
- "fieldtype": "Link",
+ "fetch_if_empty": 0,
+ "fieldname": "pricing_rules",
+ "fieldtype": "Small Text",
+ "hidden": 1,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Pricing Rules",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 1,
+ "print_hide_if_no_value": 0,
+ "read_only": 1,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fetch_if_empty": 0,
+ "fieldname": "is_free_item",
+ "fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
@@ -1262,12 +1333,12 @@
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
- "label": "Pricing Rule",
+ "label": "Is Free Item",
"length": 0,
"no_copy": 0,
- "options": "Pricing Rule",
"permlevel": 0,
- "print_hide": 0,
+ "precision": "",
+ "print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
@@ -1285,6 +1356,7 @@
"bold": 0,
"collapsible": 1,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "item_weight_details",
"fieldtype": "Section Break",
"hidden": 0,
@@ -1317,6 +1389,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "weight_per_unit",
"fieldtype": "Float",
"hidden": 0,
@@ -1349,6 +1422,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "total_weight",
"fieldtype": "Float",
"hidden": 0,
@@ -1381,6 +1455,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "column_break_20",
"fieldtype": "Column Break",
"hidden": 0,
@@ -1412,6 +1487,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "weight_uom",
"fieldtype": "Link",
"hidden": 0,
@@ -1446,6 +1522,7 @@
"collapsible": 1,
"collapsible_depends_on": "eval:doc.warehouse",
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "item_balance",
"fieldtype": "Section Break",
"hidden": 0,
@@ -1478,6 +1555,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "warehouse",
"fieldtype": "Link",
"hidden": 0,
@@ -1511,6 +1589,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "column_break_30",
"fieldtype": "Column Break",
"hidden": 0,
@@ -1542,6 +1621,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "projected_qty",
"fieldtype": "Float",
"hidden": 0,
@@ -1575,6 +1655,7 @@
"collapsible": 0,
"columns": 0,
"description": "",
+ "fetch_if_empty": 0,
"fieldname": "actual_qty",
"fieldtype": "Float",
"hidden": 0,
@@ -1607,6 +1688,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "stock_balance",
"fieldtype": "Button",
"hidden": 0,
@@ -1639,6 +1721,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "reference",
"fieldtype": "Section Break",
"hidden": 0,
@@ -1670,6 +1753,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "prevdoc_doctype",
"fieldtype": "Link",
"hidden": 1,
@@ -1706,6 +1790,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "prevdoc_docname",
"fieldtype": "Dynamic Link",
"hidden": 0,
@@ -1742,6 +1827,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "item_tax_rate",
"fieldtype": "Code",
"hidden": 1,
@@ -1775,6 +1861,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "col_break4",
"fieldtype": "Column Break",
"hidden": 0,
@@ -1805,6 +1892,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "item_tax_template",
"fieldtype": "Link",
"hidden": 0,
@@ -1838,6 +1926,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "page_break",
"fieldtype": "Check",
"hidden": 0,
@@ -1872,6 +1961,7 @@
"collapsible": 0,
"columns": 0,
"description": "",
+ "fetch_if_empty": 0,
"fieldname": "item_group",
"fieldtype": "Link",
"hidden": 1,
@@ -1906,6 +1996,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "brand",
"fieldtype": "Link",
"hidden": 1,
@@ -1934,96 +2025,96 @@
"translatable": 0,
"unique": 0,
"width": "150px"
- },
+ },
{
- "allow_bulk_edit": 0,
- "allow_in_quick_entry": 0,
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 1,
- "columns": 0,
- "fieldname": "shopping_cart_section",
- "fieldtype": "Section Break",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_global_search": 0,
- "in_list_view": 0,
- "in_standard_filter": 0,
- "label": "Shopping Cart",
- "length": 0,
- "no_copy": 0,
- "permlevel": 0,
- "precision": "",
- "print_hide": 0,
- "print_hide_if_no_value": 0,
- "read_only": 0,
- "remember_last_selected_value": 0,
- "report_hide": 0,
- "reqd": 0,
- "search_index": 0,
- "set_only_once": 0,
- "translatable": 0,
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 1,
+ "columns": 0,
+ "fieldname": "shopping_cart_section",
+ "fieldtype": "Section Break",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Shopping Cart",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
"unique": 0
- },
+ },
{
- "allow_bulk_edit": 0,
- "allow_in_quick_entry": 0,
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
- "fieldname": "additional_notes",
- "fieldtype": "Text",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_global_search": 0,
- "in_list_view": 0,
- "in_standard_filter": 0,
- "label": "Additional Notes",
- "length": 0,
- "no_copy": 0,
- "permlevel": 0,
- "precision": "",
- "print_hide": 0,
- "print_hide_if_no_value": 0,
- "read_only": 0,
- "remember_last_selected_value": 0,
- "report_hide": 0,
- "reqd": 0,
- "search_index": 0,
- "set_only_once": 0,
- "translatable": 0,
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "additional_notes",
+ "fieldtype": "Text",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Additional Notes",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
"unique": 0
}
- ],
- "has_web_view": 0,
- "hide_heading": 0,
- "hide_toolbar": 0,
- "idx": 1,
- "image_view": 0,
- "in_create": 0,
- "is_submittable": 0,
- "issingle": 0,
- "istable": 1,
- "max_attachments": 0,
- "menu_index": 0,
- "modified": "2019-01-09 17:49:41.606821",
- "modified_by": "Administrator",
- "module": "Selling",
- "name": "Quotation Item",
- "owner": "Administrator",
- "permissions": [],
- "quick_entry": 0,
- "read_only": 0,
- "read_only_onload": 0,
- "show_name_in_global_search": 0,
- "sort_field": "modified",
- "sort_order": "DESC",
- "track_changes": 1,
- "track_seen": 0,
+ ],
+ "has_web_view": 0,
+ "hide_heading": 0,
+ "hide_toolbar": 0,
+ "idx": 1,
+ "image_view": 0,
+ "in_create": 0,
+ "is_submittable": 0,
+ "issingle": 0,
+ "istable": 1,
+ "max_attachments": 0,
+ "menu_index": 0,
+ "modified": "2019-03-19 02:59:44.021667",
+ "modified_by": "Administrator",
+ "module": "Selling",
+ "name": "Quotation Item",
+ "owner": "Administrator",
+ "permissions": [],
+ "quick_entry": 0,
+ "read_only": 0,
+ "read_only_onload": 0,
+ "show_name_in_global_search": 0,
+ "sort_field": "modified",
+ "sort_order": "DESC",
+ "track_changes": 1,
+ "track_seen": 0,
"track_views": 0
}
\ No newline at end of file
diff --git a/erpnext/selling/doctype/sales_order/sales_order.json b/erpnext/selling/doctype/sales_order/sales_order.json
index 737f12d..8522cff 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.json
+++ b/erpnext/selling/doctype/sales_order/sales_order.json
@@ -1407,6 +1407,71 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fieldname": "pricing_rule_details",
+ "fieldtype": "Section Break",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Pricing Rules",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "pricing_rules",
+ "fieldtype": "Table",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Pricing Rule Detail",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Pricing Rule Detail",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 1,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
"fieldname": "section_break_31",
"fieldtype": "Section Break",
"hidden": 0,
@@ -4113,7 +4178,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
- "modified": "2019-01-09 16:51:47.917330",
+ "modified": "2019-02-13 01:02:45.882179",
"modified_by": "Administrator",
"module": "Selling",
"name": "Sales Order",
diff --git a/erpnext/selling/doctype/sales_order_item/sales_order_item.json b/erpnext/selling/doctype/sales_order_item/sales_order_item.json
index fe40c77..c761641 100644
--- a/erpnext/selling/doctype/sales_order_item/sales_order_item.json
+++ b/erpnext/selling/doctype/sales_order_item/sales_order_item.json
@@ -21,6 +21,7 @@
"bold": 1,
"collapsible": 0,
"columns": 3,
+ "fetch_if_empty": 0,
"fieldname": "item_code",
"fieldtype": "Link",
"hidden": 0,
@@ -57,6 +58,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "customer_item_code",
"fieldtype": "Data",
"hidden": 1,
@@ -88,6 +90,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "ensure_delivery_based_on_produced_serial_no",
"fieldtype": "Check",
"hidden": 0,
@@ -120,6 +123,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "col_break1",
"fieldtype": "Column Break",
"hidden": 0,
@@ -150,6 +154,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "item_name",
"fieldtype": "Data",
"hidden": 0,
@@ -185,6 +190,7 @@
"bold": 0,
"collapsible": 1,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "section_break_5",
"fieldtype": "Section Break",
"hidden": 0,
@@ -217,6 +223,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "description",
"fieldtype": "Text Editor",
"hidden": 0,
@@ -252,6 +259,7 @@
"bold": 0,
"collapsible": 0,
"columns": 2,
+ "fetch_if_empty": 0,
"fieldname": "delivery_date",
"fieldtype": "Date",
"hidden": 0,
@@ -284,6 +292,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "column_break_7",
"fieldtype": "Column Break",
"hidden": 0,
@@ -315,6 +324,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "image",
"fieldtype": "Attach",
"hidden": 1,
@@ -347,6 +357,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "image_view",
"fieldtype": "Image",
"hidden": 0,
@@ -380,6 +391,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "quantity_and_rate",
"fieldtype": "Section Break",
"hidden": 0,
@@ -411,6 +423,7 @@
"bold": 0,
"collapsible": 0,
"columns": 1,
+ "fetch_if_empty": 0,
"fieldname": "qty",
"fieldtype": "Float",
"hidden": 0,
@@ -446,6 +459,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "stock_uom",
"fieldtype": "Link",
"hidden": 0,
@@ -482,6 +496,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "col_break2",
"fieldtype": "Column Break",
"hidden": 0,
@@ -512,6 +527,8 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "depends_on": "",
+ "fetch_if_empty": 0,
"fieldname": "uom",
"fieldtype": "Link",
"hidden": 0,
@@ -545,6 +562,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "conversion_factor",
"fieldtype": "Float",
"hidden": 0,
@@ -577,6 +595,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "stock_qty",
"fieldtype": "Float",
"hidden": 0,
@@ -609,6 +628,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "section_break_16",
"fieldtype": "Section Break",
"hidden": 0,
@@ -640,6 +660,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "price_list_rate",
"fieldtype": "Currency",
"hidden": 0,
@@ -676,6 +697,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "base_price_list_rate",
"fieldtype": "Currency",
"hidden": 0,
@@ -712,6 +734,7 @@
"bold": 0,
"collapsible": 1,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "discount_and_margin",
"fieldtype": "Section Break",
"hidden": 0,
@@ -745,6 +768,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "price_list_rate",
+ "fetch_if_empty": 0,
"fieldname": "margin_type",
"fieldtype": "Select",
"hidden": 0,
@@ -779,6 +803,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.margin_type && doc.price_list_rate",
+ "fetch_if_empty": 0,
"fieldname": "margin_rate_or_amount",
"fieldtype": "Float",
"hidden": 0,
@@ -812,6 +837,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.margin_type && doc.price_list_rate && doc.margin_rate_or_amount",
+ "fetch_if_empty": 0,
"fieldname": "rate_with_margin",
"fieldtype": "Currency",
"hidden": 0,
@@ -845,6 +871,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "column_break_19",
"fieldtype": "Column Break",
"hidden": 0,
@@ -877,6 +904,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "price_list_rate",
+ "fetch_if_empty": 0,
"fieldname": "discount_percentage",
"fieldtype": "Percent",
"hidden": 0,
@@ -912,7 +940,8 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
- "depends_on": "discount_percentage",
+ "depends_on": "price_list_rate",
+ "fetch_if_empty": 0,
"fieldname": "discount_amount",
"fieldtype": "Currency",
"hidden": 0,
@@ -930,7 +959,7 @@
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
- "read_only": 1,
+ "read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
@@ -947,6 +976,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.margin_type && doc.price_list_rate && doc.margin_rate_or_amount",
+ "fetch_if_empty": 0,
"fieldname": "base_rate_with_margin",
"fieldtype": "Currency",
"hidden": 0,
@@ -980,6 +1010,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "section_break_simple1",
"fieldtype": "Section Break",
"hidden": 0,
@@ -1012,6 +1043,7 @@
"collapsible": 0,
"columns": 2,
"depends_on": "eval: doc.type != \"\"",
+ "fetch_if_empty": 0,
"fieldname": "rate",
"fieldtype": "Currency",
"hidden": 0,
@@ -1048,6 +1080,7 @@
"bold": 0,
"collapsible": 0,
"columns": 2,
+ "fetch_if_empty": 0,
"fieldname": "amount",
"fieldtype": "Currency",
"hidden": 0,
@@ -1085,6 +1118,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "col_break3",
"fieldtype": "Column Break",
"hidden": 0,
@@ -1115,6 +1149,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "base_rate",
"fieldtype": "Currency",
"hidden": 0,
@@ -1151,6 +1186,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "base_amount",
"fieldtype": "Currency",
"hidden": 0,
@@ -1187,21 +1223,22 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
- "fieldname": "pricing_rule",
- "fieldtype": "Link",
- "hidden": 0,
+ "fetch_if_empty": 0,
+ "fieldname": "pricing_rules",
+ "fieldtype": "Small Text",
+ "hidden": 1,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
- "label": "Pricing Rule",
+ "label": "Pricing Rules",
"length": 0,
"no_copy": 0,
- "options": "Pricing Rule",
"permlevel": 0,
- "print_hide": 0,
+ "precision": "",
+ "print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
@@ -1219,6 +1256,40 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
+ "fieldname": "is_free_item",
+ "fieldtype": "Check",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Is Free Item",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 1,
+ "print_hide_if_no_value": 0,
+ "read_only": 1,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "section_break_24",
"fieldtype": "Section Break",
"hidden": 0,
@@ -1250,6 +1321,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "net_rate",
"fieldtype": "Currency",
"hidden": 0,
@@ -1283,6 +1355,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "net_amount",
"fieldtype": "Currency",
"hidden": 0,
@@ -1316,6 +1389,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "column_break_27",
"fieldtype": "Column Break",
"hidden": 0,
@@ -1347,6 +1421,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "base_net_rate",
"fieldtype": "Currency",
"hidden": 0,
@@ -1380,6 +1455,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "base_net_amount",
"fieldtype": "Currency",
"hidden": 0,
@@ -1414,6 +1490,7 @@
"collapsible": 1,
"collapsible_depends_on": "eval:doc.delivered_by_supplier==1||doc.supplier",
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "drop_ship_section",
"fieldtype": "Section Break",
"hidden": 0,
@@ -1446,6 +1523,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "delivered_by_supplier",
"fieldtype": "Check",
"hidden": 0,
@@ -1478,6 +1556,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "supplier",
"fieldtype": "Link",
"hidden": 0,
@@ -1511,6 +1590,7 @@
"bold": 0,
"collapsible": 1,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "item_weight_details",
"fieldtype": "Section Break",
"hidden": 0,
@@ -1543,6 +1623,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "weight_per_unit",
"fieldtype": "Float",
"hidden": 0,
@@ -1575,6 +1656,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "total_weight",
"fieldtype": "Float",
"hidden": 0,
@@ -1607,6 +1689,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "column_break_21",
"fieldtype": "Column Break",
"hidden": 0,
@@ -1638,6 +1721,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "weight_uom",
"fieldtype": "Link",
"hidden": 0,
@@ -1671,6 +1755,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "warehouse_and_reference",
"fieldtype": "Section Break",
"hidden": 0,
@@ -1703,6 +1788,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.delivered_by_supplier!=1",
+ "fetch_if_empty": 0,
"fieldname": "warehouse",
"fieldtype": "Link",
"hidden": 0,
@@ -1740,6 +1826,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.delivered_by_supplier!=1",
+ "fetch_if_empty": 0,
"fieldname": "target_warehouse",
"fieldtype": "Link",
"hidden": 1,
@@ -1773,6 +1860,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "prevdoc_docname",
"fieldtype": "Link",
"hidden": 0,
@@ -1807,6 +1895,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "brand",
"fieldtype": "Link",
"hidden": 1,
@@ -1842,6 +1931,7 @@
"collapsible": 0,
"columns": 0,
"description": "",
+ "fetch_if_empty": 0,
"fieldname": "item_group",
"fieldtype": "Link",
"hidden": 1,
@@ -1876,6 +1966,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "billed_amt",
"fieldtype": "Currency",
"hidden": 0,
@@ -1908,6 +1999,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "valuation_rate",
"fieldtype": "Currency",
"hidden": 0,
@@ -1941,6 +2033,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "gross_profit",
"fieldtype": "Currency",
"hidden": 0,
@@ -1974,6 +2067,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "blanket_order",
"fieldtype": "Link",
"hidden": 0,
@@ -2007,6 +2101,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "blanket_order_rate",
"fieldtype": "Currency",
"hidden": 0,
@@ -2039,6 +2134,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "col_break4",
"fieldtype": "Column Break",
"hidden": 0,
@@ -2069,6 +2165,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "projected_qty",
"fieldtype": "Float",
"hidden": 0,
@@ -2104,6 +2201,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "actual_qty",
"fieldtype": "Float",
"hidden": 0,
@@ -2137,6 +2235,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "ordered_qty",
"fieldtype": "Float",
"hidden": 0,
@@ -2169,6 +2268,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "delivered_qty",
"fieldtype": "Float",
"hidden": 0,
@@ -2204,6 +2304,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "work_order_qty",
"fieldtype": "Float",
"hidden": 0,
@@ -2237,6 +2338,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "returned_qty",
+ "fetch_if_empty": 0,
"fieldname": "returned_qty",
"fieldtype": "Float",
"hidden": 0,
@@ -2269,6 +2371,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "section_break_63",
"fieldtype": "Section Break",
"hidden": 0,
@@ -2300,6 +2403,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "item_tax_template",
"fieldtype": "Link",
"hidden": 0,
@@ -2333,6 +2437,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "col_break5",
"fieldtype": "Column Break",
"hidden": 0,
@@ -2364,6 +2469,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "page_break",
"fieldtype": "Check",
"hidden": 0,
@@ -2398,6 +2504,7 @@
"collapsible": 0,
"columns": 0,
"description": "For Production",
+ "fetch_if_empty": 0,
"fieldname": "planned_qty",
"fieldtype": "Float",
"hidden": 1,
@@ -2434,6 +2541,7 @@
"collapsible": 0,
"columns": 0,
"description": "For Production",
+ "fetch_if_empty": 0,
"fieldname": "produced_qty",
"fieldtype": "Float",
"hidden": 1,
@@ -2469,6 +2577,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "item_tax_rate",
"fieldtype": "Code",
"hidden": 1,
@@ -2503,6 +2612,7 @@
"collapsible": 0,
"columns": 0,
"description": "Used for Production Plan",
+ "fetch_if_empty": 0,
"fieldname": "transaction_date",
"fieldtype": "Date",
"hidden": 1,
@@ -2541,7 +2651,7 @@
"istable": 1,
"max_attachments": 0,
"menu_index": 0,
- "modified": "2019-02-18 18:53:23.425126",
+ "modified": "2019-03-19 03:01:35.361411",
"modified_by": "Administrator",
"module": "Selling",
"name": "Sales Order Item",
@@ -2556,4 +2666,4 @@
"track_changes": 1,
"track_seen": 0,
"track_views": 0
-}
+}
\ No newline at end of file
diff --git a/erpnext/selling/sales_common.js b/erpnext/selling/sales_common.js
index a246822..965d2b0 100644
--- a/erpnext/selling/sales_common.js
+++ b/erpnext/selling/sales_common.js
@@ -140,8 +140,18 @@
discount_percentage: function(doc, cdt, cdn) {
var item = frappe.get_doc(cdt, cdn);
+ item.discount_amount = 0.0;
+ this.apply_discount_on_item(doc, cdt, cdn, 'discount_percentage');
+ },
+
+ discount_amount: function(doc, cdt, cdn) {
+ this.apply_discount_on_item(doc, cdt, cdn, 'discount_amount');
+ },
+
+ apply_discount_on_item: function(doc, cdt, cdn, field) {
+ var item = frappe.get_doc(cdt, cdn);
if(!item.price_list_rate) {
- item.discount_percentage = 0.0;
+ item[field] = 0.0;
} else {
this.price_list_rate(doc, cdt, cdn);
}
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.json b/erpnext/stock/doctype/delivery_note/delivery_note.json
index 9f7de64..b5f2c34 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.json
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.json
@@ -1569,6 +1569,73 @@
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
+ "collapsible": 0,
+ "collapsible_depends_on": "",
+ "columns": 0,
+ "fieldname": "pricing_rule_details",
+ "fieldtype": "Section Break",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Pricing Rules",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "collapsible_depends_on": "",
+ "columns": 0,
+ "fieldname": "pricing_rules",
+ "fieldtype": "Table",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Pricing Rule Detail",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Pricing Rule Detail",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 1,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
"collapsible": 1,
"collapsible_depends_on": "packed_items",
"columns": 0,
@@ -1801,6 +1868,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "depends_on": "",
"fieldname": "column_break_33",
"fieldtype": "Column Break",
"hidden": 0,
@@ -4329,7 +4397,7 @@
"istable": 0,
"max_attachments": 0,
"menu_index": 0,
- "modified": "2018-12-27 01:53:41.645566",
+ "modified": "2019-02-13 01:06:29.783590",
"modified_by": "Administrator",
"module": "Stock",
"name": "Delivery Note",
diff --git a/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json b/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json
index 1157051..eb1c68e 100644
--- a/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json
+++ b/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json
@@ -21,6 +21,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "barcode",
"fieldtype": "Data",
"hidden": 0,
@@ -52,6 +53,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "item_code",
"fieldtype": "Link",
"hidden": 0,
@@ -88,6 +90,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "item_name",
"fieldtype": "Data",
"hidden": 0,
@@ -123,6 +126,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "col_break1",
"fieldtype": "Column Break",
"hidden": 0,
@@ -153,6 +157,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "customer_item_code",
"fieldtype": "Data",
"hidden": 1,
@@ -184,6 +189,7 @@
"bold": 0,
"collapsible": 1,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "section_break_6",
"fieldtype": "Section Break",
"hidden": 0,
@@ -216,6 +222,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "description",
"fieldtype": "Text Editor",
"hidden": 0,
@@ -251,6 +258,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "column_break_8",
"fieldtype": "Column Break",
"hidden": 0,
@@ -282,6 +290,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "image",
"fieldtype": "Attach",
"hidden": 1,
@@ -314,6 +323,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "image_view",
"fieldtype": "Image",
"hidden": 0,
@@ -347,6 +357,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "quantity_and_rate",
"fieldtype": "Section Break",
"hidden": 0,
@@ -378,6 +389,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "qty",
"fieldtype": "Float",
"hidden": 0,
@@ -413,6 +425,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "stock_uom",
"fieldtype": "Link",
"hidden": 0,
@@ -449,6 +462,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "col_break2",
"fieldtype": "Column Break",
"hidden": 0,
@@ -479,6 +493,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "uom",
"fieldtype": "Link",
"hidden": 0,
@@ -512,6 +527,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "conversion_factor",
"fieldtype": "Float",
"hidden": 0,
@@ -544,6 +560,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "stock_qty",
"fieldtype": "Float",
"hidden": 0,
@@ -576,6 +593,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "section_break_17",
"fieldtype": "Section Break",
"hidden": 0,
@@ -607,6 +625,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "price_list_rate",
"fieldtype": "Currency",
"hidden": 0,
@@ -643,6 +662,8 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "depends_on": "",
+ "fetch_if_empty": 0,
"fieldname": "base_price_list_rate",
"fieldtype": "Currency",
"hidden": 0,
@@ -679,6 +700,7 @@
"bold": 0,
"collapsible": 1,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "discount_and_margin",
"fieldtype": "Section Break",
"hidden": 0,
@@ -712,6 +734,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "price_list_rate",
+ "fetch_if_empty": 0,
"fieldname": "margin_type",
"fieldtype": "Select",
"hidden": 0,
@@ -746,6 +769,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.margin_type && doc.price_list_rate",
+ "fetch_if_empty": 0,
"fieldname": "margin_rate_or_amount",
"fieldtype": "Float",
"hidden": 0,
@@ -779,6 +803,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.margin_type && doc.price_list_rate && doc.margin_rate_or_amount",
+ "fetch_if_empty": 0,
"fieldname": "rate_with_margin",
"fieldtype": "Currency",
"hidden": 0,
@@ -812,6 +837,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "column_break_19",
"fieldtype": "Column Break",
"hidden": 0,
@@ -844,6 +870,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "price_list_rate",
+ "fetch_if_empty": 0,
"fieldname": "discount_percentage",
"fieldtype": "Float",
"hidden": 0,
@@ -879,7 +906,8 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
- "depends_on": "discount_percentage",
+ "depends_on": "price_list_rate",
+ "fetch_if_empty": 0,
"fieldname": "discount_amount",
"fieldtype": "Currency",
"hidden": 0,
@@ -897,7 +925,7 @@
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
- "read_only": 1,
+ "read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
@@ -914,6 +942,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.margin_type && doc.price_list_rate && doc.margin_rate_or_amount",
+ "fetch_if_empty": 0,
"fieldname": "base_rate_with_margin",
"fieldtype": "Currency",
"hidden": 0,
@@ -947,6 +976,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "section_break_1",
"fieldtype": "Section Break",
"hidden": 0,
@@ -977,6 +1007,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "rate",
"fieldtype": "Currency",
"hidden": 0,
@@ -1013,6 +1044,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "amount",
"fieldtype": "Currency",
"hidden": 0,
@@ -1049,6 +1081,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "col_break3",
"fieldtype": "Column Break",
"hidden": 0,
@@ -1079,6 +1112,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "base_rate",
"fieldtype": "Currency",
"hidden": 0,
@@ -1115,6 +1149,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "base_amount",
"fieldtype": "Currency",
"hidden": 0,
@@ -1151,21 +1186,22 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
- "fieldname": "pricing_rule",
- "fieldtype": "Link",
- "hidden": 0,
+ "fetch_if_empty": 0,
+ "fieldname": "pricing_rules",
+ "fieldtype": "Small Text",
+ "hidden": 1,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
- "label": "Pricing Rule",
+ "label": "Pricing Rules",
"length": 0,
"no_copy": 0,
- "options": "Pricing Rule",
"permlevel": 0,
- "print_hide": 0,
+ "precision": "",
+ "print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
@@ -1183,6 +1219,40 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
+ "fieldname": "is_free_item",
+ "fieldtype": "Check",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Is Free Item",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 1,
+ "print_hide_if_no_value": 0,
+ "read_only": 1,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "section_break_25",
"fieldtype": "Section Break",
"hidden": 0,
@@ -1214,6 +1284,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "net_rate",
"fieldtype": "Currency",
"hidden": 0,
@@ -1247,6 +1318,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "net_amount",
"fieldtype": "Currency",
"hidden": 0,
@@ -1280,6 +1352,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "column_break_28",
"fieldtype": "Column Break",
"hidden": 0,
@@ -1311,6 +1384,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "base_net_rate",
"fieldtype": "Currency",
"hidden": 0,
@@ -1344,6 +1418,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "base_net_amount",
"fieldtype": "Currency",
"hidden": 0,
@@ -1377,6 +1452,7 @@
"bold": 0,
"collapsible": 1,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "item_weight_details",
"fieldtype": "Section Break",
"hidden": 0,
@@ -1409,6 +1485,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "weight_per_unit",
"fieldtype": "Float",
"hidden": 0,
@@ -1441,6 +1518,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "total_weight",
"fieldtype": "Float",
"hidden": 0,
@@ -1473,6 +1551,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "column_break_21",
"fieldtype": "Column Break",
"hidden": 0,
@@ -1504,6 +1583,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "weight_uom",
"fieldtype": "Link",
"hidden": 0,
@@ -1537,6 +1617,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "warehouse_and_reference",
"fieldtype": "Section Break",
"hidden": 0,
@@ -1568,6 +1649,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "warehouse",
"fieldtype": "Link",
"hidden": 0,
@@ -1606,6 +1688,7 @@
"columns": 0,
"depends_on": "",
"description": "",
+ "fetch_if_empty": 0,
"fieldname": "target_warehouse",
"fieldtype": "Link",
"hidden": 1,
@@ -1640,6 +1723,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "eval:!doc.__islocal",
+ "fetch_if_empty": 0,
"fieldname": "quality_inspection",
"fieldtype": "Link",
"hidden": 0,
@@ -1673,6 +1757,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "section_break_40",
"fieldtype": "Section Break",
"hidden": 0,
@@ -1704,6 +1789,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "batch_no",
"fieldtype": "Link",
"hidden": 0,
@@ -1738,6 +1824,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "actual_qty",
"fieldtype": "Float",
"hidden": 0,
@@ -1774,6 +1861,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "batch_no",
+ "fetch_if_empty": 0,
"fieldname": "actual_batch_qty",
"fieldtype": "Float",
"hidden": 0,
@@ -1808,6 +1896,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "serial_no",
"fieldtype": "Text",
"hidden": 0,
@@ -1842,6 +1931,7 @@
"collapsible": 0,
"columns": 0,
"description": "",
+ "fetch_if_empty": 0,
"fieldname": "item_group",
"fieldtype": "Link",
"hidden": 1,
@@ -1876,6 +1966,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "brand",
"fieldtype": "Link",
"hidden": 1,
@@ -1912,6 +2003,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "item_tax_rate",
"fieldtype": "Small Text",
"hidden": 1,
@@ -1945,6 +2037,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "col_break4",
"fieldtype": "Column Break",
"hidden": 0,
@@ -1975,6 +2068,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "expense_account",
"fieldtype": "Link",
"hidden": 0,
@@ -2008,6 +2102,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "item_tax_template",
"fieldtype": "Link",
"hidden": 0,
@@ -2042,6 +2137,7 @@
"collapsible": 0,
"columns": 0,
"default": ":Company",
+ "fetch_if_empty": 0,
"fieldname": "cost_center",
"fieldtype": "Link",
"hidden": 0,
@@ -2075,6 +2171,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "allow_zero_valuation_rate",
"fieldtype": "Check",
"hidden": 0,
@@ -2107,6 +2204,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "against_sales_order",
"fieldtype": "Link",
"hidden": 0,
@@ -2139,6 +2237,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "against_sales_invoice",
"fieldtype": "Link",
"hidden": 0,
@@ -2171,6 +2270,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "so_detail",
"fieldtype": "Data",
"hidden": 1,
@@ -2206,6 +2306,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "si_detail",
"fieldtype": "Data",
"hidden": 1,
@@ -2238,6 +2339,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "installed_qty",
"fieldtype": "Float",
"hidden": 0,
@@ -2273,6 +2375,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "billed_amt",
"fieldtype": "Currency",
"hidden": 0,
@@ -2306,6 +2409,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "page_break",
"fieldtype": "Check",
"hidden": 0,
@@ -2343,7 +2447,7 @@
"issingle": 0,
"istable": 1,
"max_attachments": 0,
- "modified": "2019-02-18 18:58:51.342901",
+ "modified": "2019-03-19 03:00:50.753523",
"modified_by": "Administrator",
"module": "Stock",
"name": "Delivery Note Item",
@@ -2358,4 +2462,4 @@
"track_changes": 0,
"track_seen": 0,
"track_views": 0
-}
+}
\ No newline at end of file
diff --git a/erpnext/stock/doctype/price_list/test_records.json b/erpnext/stock/doctype/price_list/test_records.json
index ca8a620..7ca949c 100644
--- a/erpnext/stock/doctype/price_list/test_records.json
+++ b/erpnext/stock/doctype/price_list/test_records.json
@@ -1,34 +1,35 @@
[
- {
- "buying": 1,
- "currency": "INR",
- "doctype": "Price List",
- "enabled": 1,
- "price_list_name": "_Test Price List",
- "selling": 1
- },
- {
- "buying": 1,
- "currency": "INR",
- "doctype": "Price List",
- "enabled": 1,
- "price_list_name": "_Test Price List 2",
- "selling": 1
- },
- {
- "buying": 1,
- "currency": "INR",
- "doctype": "Price List",
- "enabled": 1,
- "price_list_name": "_Test Price List India",
- "selling": 1
- },
- {
- "buying": 1,
- "currency": "USD",
- "doctype": "Price List",
- "enabled": 1,
- "price_list_name": "_Test Price List Rest of the World",
- "selling": 1
- }
+ {
+ "buying": 1,
+ "currency": "INR",
+ "doctype": "Price List",
+ "enabled": 1,
+ "price_not_uom_dependant": 1,
+ "price_list_name": "_Test Price List",
+ "selling": 1
+ },
+ {
+ "buying": 1,
+ "currency": "INR",
+ "doctype": "Price List",
+ "enabled": 1,
+ "price_list_name": "_Test Price List 2",
+ "selling": 1
+ },
+ {
+ "buying": 1,
+ "currency": "INR",
+ "doctype": "Price List",
+ "enabled": 1,
+ "price_list_name": "_Test Price List India",
+ "selling": 1
+ },
+ {
+ "buying": 1,
+ "currency": "USD",
+ "doctype": "Price List",
+ "enabled": 1,
+ "price_list_name": "_Test Price List Rest of the World",
+ "selling": 1
+ }
]
diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json
index 61767d9..3ddcd95 100755
--- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json
+++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json
@@ -1352,6 +1352,71 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fieldname": "pricing_rule_details",
+ "fieldtype": "Section Break",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Pricing Rules",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "pricing_rules",
+ "fieldtype": "Table",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Pricing Rule Detail",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Pricing Rule Detail",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 1,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
"fieldname": "get_current_stock",
"fieldtype": "Button",
"hidden": 0,
@@ -3742,7 +3807,7 @@
"istable": 0,
"max_attachments": 0,
"menu_index": 0,
- "modified": "2018-12-27 02:06:29.508848",
+ "modified": "2019-02-13 00:58:26.302834",
"modified_by": "Administrator",
"module": "Stock",
"name": "Purchase Receipt",
diff --git a/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json b/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json
index 2bc4b7d..7c50d8f 100644
--- a/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json
+++ b/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json
@@ -20,6 +20,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "barcode",
"fieldtype": "Data",
"hidden": 0,
@@ -52,6 +53,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "section_break_2",
"fieldtype": "Section Break",
"hidden": 0,
@@ -83,6 +85,7 @@
"bold": 1,
"collapsible": 0,
"columns": 3,
+ "fetch_if_empty": 0,
"fieldname": "item_code",
"fieldtype": "Link",
"hidden": 0,
@@ -119,6 +122,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "supplier_part_no",
"fieldtype": "Data",
"hidden": 1,
@@ -151,6 +155,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "column_break_2",
"fieldtype": "Column Break",
"hidden": 0,
@@ -182,6 +187,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "item_name",
"fieldtype": "Data",
"hidden": 0,
@@ -215,6 +221,7 @@
"bold": 0,
"collapsible": 1,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "section_break_4",
"fieldtype": "Section Break",
"hidden": 0,
@@ -247,6 +254,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "description",
"fieldtype": "Text Editor",
"hidden": 0,
@@ -282,6 +290,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "col_break1",
"fieldtype": "Column Break",
"hidden": 0,
@@ -312,6 +321,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "image",
"fieldtype": "Attach",
"hidden": 1,
@@ -344,6 +354,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "image_view",
"fieldtype": "Image",
"hidden": 0,
@@ -377,6 +388,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "received_and_accepted",
"fieldtype": "Section Break",
"hidden": 0,
@@ -408,6 +420,7 @@
"bold": 1,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "received_qty",
"fieldtype": "Float",
"hidden": 0,
@@ -443,6 +456,7 @@
"bold": 0,
"collapsible": 0,
"columns": 2,
+ "fetch_if_empty": 0,
"fieldname": "qty",
"fieldtype": "Float",
"hidden": 0,
@@ -478,6 +492,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "rejected_qty",
"fieldtype": "Float",
"hidden": 0,
@@ -513,6 +528,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "col_break2",
"fieldtype": "Column Break",
"hidden": 0,
@@ -544,6 +560,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "uom",
"fieldtype": "Link",
"hidden": 0,
@@ -581,6 +598,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "stock_uom",
"fieldtype": "Link",
"hidden": 0,
@@ -617,6 +635,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "conversion_factor",
"fieldtype": "Float",
"hidden": 0,
@@ -654,6 +673,7 @@
"collapsible": 0,
"columns": 0,
"fetch_from": "item_code.retain_sample",
+ "fetch_if_empty": 0,
"fieldname": "retain_sample",
"fieldtype": "Check",
"hidden": 0,
@@ -689,6 +709,7 @@
"columns": 0,
"depends_on": "retain_sample",
"fetch_from": "item_code.sample_quantity",
+ "fetch_if_empty": 0,
"fieldname": "sample_quantity",
"fieldtype": "Int",
"hidden": 0,
@@ -722,6 +743,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "rate_and_amount",
"fieldtype": "Section Break",
"hidden": 0,
@@ -753,6 +775,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "price_list_rate",
"fieldtype": "Currency",
"hidden": 0,
@@ -786,6 +809,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "price_list_rate",
+ "fetch_if_empty": 0,
"fieldname": "discount_percentage",
"fieldtype": "Percent",
"hidden": 0,
@@ -817,7 +841,8 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
- "depends_on": "discount_percentage",
+ "depends_on": "price_list_rate",
+ "fetch_if_empty": 0,
"fieldname": "discount_amount",
"fieldtype": "Currency",
"hidden": 0,
@@ -835,7 +860,7 @@
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
- "read_only": 1,
+ "read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
@@ -851,6 +876,8 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "depends_on": "",
+ "fetch_if_empty": 0,
"fieldname": "col_break3",
"fieldtype": "Column Break",
"hidden": 0,
@@ -881,6 +908,8 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "depends_on": "",
+ "fetch_if_empty": 0,
"fieldname": "base_price_list_rate",
"fieldtype": "Currency",
"hidden": 0,
@@ -913,6 +942,8 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "depends_on": "",
+ "fetch_if_empty": 0,
"fieldname": "sec_break1",
"fieldtype": "Section Break",
"hidden": 0,
@@ -943,6 +974,7 @@
"bold": 1,
"collapsible": 0,
"columns": 3,
+ "fetch_if_empty": 0,
"fieldname": "rate",
"fieldtype": "Currency",
"hidden": 0,
@@ -979,6 +1011,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "amount",
"fieldtype": "Currency",
"hidden": 0,
@@ -1013,6 +1046,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "col_break4",
"fieldtype": "Column Break",
"hidden": 0,
@@ -1043,6 +1077,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "base_rate",
"fieldtype": "Currency",
"hidden": 0,
@@ -1079,6 +1114,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "base_amount",
"fieldtype": "Currency",
"hidden": 0,
@@ -1115,21 +1151,22 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
- "fieldname": "pricing_rule",
- "fieldtype": "Link",
- "hidden": 0,
+ "fetch_if_empty": 0,
+ "fieldname": "pricing_rules",
+ "fieldtype": "Small Text",
+ "hidden": 1,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
- "label": "Pricing Rule",
+ "label": "Pricing Rules",
"length": 0,
"no_copy": 0,
- "options": "Pricing Rule",
"permlevel": 0,
- "print_hide": 0,
+ "precision": "",
+ "print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
@@ -1147,6 +1184,40 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
+ "fieldname": "is_free_item",
+ "fieldtype": "Check",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Is Free Item",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 1,
+ "print_hide_if_no_value": 0,
+ "read_only": 1,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "translatable": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_in_quick_entry": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "section_break_29",
"fieldtype": "Section Break",
"hidden": 0,
@@ -1178,6 +1249,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "net_rate",
"fieldtype": "Currency",
"hidden": 0,
@@ -1211,6 +1283,7 @@
"bold": 0,
"collapsible": 0,
"columns": 2,
+ "fetch_if_empty": 0,
"fieldname": "net_amount",
"fieldtype": "Currency",
"hidden": 0,
@@ -1244,6 +1317,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "column_break_32",
"fieldtype": "Column Break",
"hidden": 0,
@@ -1275,6 +1349,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "base_net_rate",
"fieldtype": "Currency",
"hidden": 0,
@@ -1308,6 +1383,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "base_net_amount",
"fieldtype": "Currency",
"hidden": 0,
@@ -1341,6 +1417,7 @@
"bold": 0,
"collapsible": 1,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "item_weight_details",
"fieldtype": "Section Break",
"hidden": 0,
@@ -1373,6 +1450,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "weight_per_unit",
"fieldtype": "Float",
"hidden": 0,
@@ -1405,6 +1483,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "total_weight",
"fieldtype": "Float",
"hidden": 0,
@@ -1437,6 +1516,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "column_break_41",
"fieldtype": "Column Break",
"hidden": 0,
@@ -1468,6 +1548,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "weight_uom",
"fieldtype": "Link",
"hidden": 0,
@@ -1501,6 +1582,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "warehouse_and_reference",
"fieldtype": "Section Break",
"hidden": 0,
@@ -1532,6 +1614,7 @@
"bold": 1,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "warehouse",
"fieldtype": "Link",
"hidden": 0,
@@ -1568,6 +1651,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "rejected_warehouse",
"fieldtype": "Link",
"hidden": 0,
@@ -1605,6 +1689,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "eval:!doc.__islocal",
+ "fetch_if_empty": 0,
"fieldname": "quality_inspection",
"fieldtype": "Link",
"hidden": 0,
@@ -1639,6 +1724,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "column_break_40",
"fieldtype": "Column Break",
"hidden": 0,
@@ -1670,6 +1756,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "is_fixed_asset",
"fieldtype": "Check",
"hidden": 1,
@@ -1703,6 +1790,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "is_fixed_asset",
+ "fetch_if_empty": 0,
"fieldname": "asset",
"fieldtype": "Link",
"hidden": 0,
@@ -1737,6 +1825,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "is_fixed_asset",
+ "fetch_if_empty": 0,
"fieldname": "asset_location",
"fieldtype": "Link",
"hidden": 0,
@@ -1770,6 +1859,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "purchase_order",
"fieldtype": "Link",
"hidden": 0,
@@ -1806,6 +1896,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "schedule_date",
"fieldtype": "Date",
"hidden": 0,
@@ -1839,6 +1930,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "stock_qty",
"fieldtype": "Float",
"hidden": 0,
@@ -1874,6 +1966,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "section_break_45",
"fieldtype": "Section Break",
"hidden": 0,
@@ -1905,6 +1998,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "serial_no",
"fieldtype": "Small Text",
"hidden": 0,
@@ -1938,6 +2032,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "batch_no",
"fieldtype": "Link",
"hidden": 0,
@@ -1972,6 +2067,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "column_break_48",
"fieldtype": "Column Break",
"hidden": 0,
@@ -2004,6 +2100,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "rejected_serial_no",
"fieldtype": "Small Text",
"hidden": 0,
@@ -2035,6 +2132,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "section_break_50",
"fieldtype": "Section Break",
"hidden": 0,
@@ -2066,6 +2164,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "item_tax_template",
"fieldtype": "Link",
"hidden": 0,
@@ -2099,6 +2198,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "project",
"fieldtype": "Link",
"hidden": 0,
@@ -2133,6 +2233,7 @@
"columns": 0,
"default": ":Company",
"depends_on": "eval:cint(erpnext.is_perpetual_inventory_enabled(parent.company))",
+ "fetch_if_empty": 0,
"fieldname": "cost_center",
"fieldtype": "Link",
"hidden": 0,
@@ -2165,6 +2266,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "purchase_order_item",
"fieldtype": "Data",
"hidden": 1,
@@ -2200,6 +2302,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "col_break5",
"fieldtype": "Column Break",
"hidden": 0,
@@ -2230,6 +2333,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "allow_zero_valuation_rate",
"fieldtype": "Check",
"hidden": 0,
@@ -2262,6 +2366,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "bom",
"fieldtype": "Link",
"hidden": 0,
@@ -2296,6 +2401,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "eval:parent.is_subcontracted == 'Yes'",
+ "fetch_if_empty": 0,
"fieldname": "include_exploded_items",
"fieldtype": "Check",
"hidden": 0,
@@ -2328,6 +2434,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "billed_amt",
"fieldtype": "Currency",
"hidden": 0,
@@ -2361,6 +2468,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "landed_cost_voucher_amount",
"fieldtype": "Currency",
"hidden": 0,
@@ -2393,6 +2501,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "brand",
"fieldtype": "Link",
"hidden": 1,
@@ -2428,6 +2537,7 @@
"collapsible": 0,
"columns": 0,
"description": "",
+ "fetch_if_empty": 0,
"fieldname": "item_group",
"fieldtype": "Link",
"hidden": 1,
@@ -2462,6 +2572,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "rm_supp_cost",
"fieldtype": "Currency",
"hidden": 1,
@@ -2498,6 +2609,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "item_tax_amount",
"fieldtype": "Currency",
"hidden": 1,
@@ -2534,6 +2646,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "valuation_rate",
"fieldtype": "Currency",
"hidden": 1,
@@ -2571,6 +2684,7 @@
"collapsible": 0,
"columns": 0,
"description": "Tax detail table fetched from item master as a string and stored in this field.\nUsed for Taxes and Charges",
+ "fetch_if_empty": 0,
"fieldname": "item_tax_rate",
"fieldtype": "Code",
"hidden": 1,
@@ -2604,6 +2718,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fetch_if_empty": 0,
"fieldname": "page_break",
"fieldtype": "Check",
"hidden": 0,
@@ -2641,7 +2756,7 @@
"issingle": 0,
"istable": 1,
"max_attachments": 0,
- "modified": "2019-02-18 16:04:36.138776",
+ "modified": "2019-03-19 03:02:05.086119",
"modified_by": "Administrator",
"module": "Stock",
"name": "Purchase Receipt Item",
@@ -2656,4 +2771,4 @@
"track_changes": 0,
"track_seen": 0,
"track_views": 0
-}
+}
\ No newline at end of file
diff --git a/erpnext/stock/doctype/warehouse/warehouse.py b/erpnext/stock/doctype/warehouse/warehouse.py
index da97bc6..57256c8 100644
--- a/erpnext/stock/doctype/warehouse/warehouse.py
+++ b/erpnext/stock/doctype/warehouse/warehouse.py
@@ -175,3 +175,9 @@
def convert_to_group_or_ledger():
args = frappe.form_dict
return frappe.get_doc("Warehouse", args.docname).convert_to_group_or_ledger()
+
+def get_child_warehouses(warehouse):
+ p_warehouse = frappe.get_doc("Warehouse", warehouse)
+
+ return frappe.db.sql_list("""select name from `tabWarehouse`
+ where lft >= %s and rgt =< %s""", (p_warehouse.lft, p_warehouse.rgt))
diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py
index a0f3ac2..d8e78c8 100644
--- a/erpnext/stock/get_item_details.py
+++ b/erpnext/stock/get_item_details.py
@@ -5,7 +5,7 @@
import frappe
from frappe import _, throw
from frappe.utils import flt, cint, add_days, cstr, add_months
-import json
+import json, copy
from erpnext.accounts.doctype.pricing_rule.pricing_rule import get_pricing_rule_for_item, set_transaction_type
from erpnext.setup.utils import get_exchange_rate
from frappe.model.meta import get_field_precision
@@ -20,7 +20,7 @@
purchase_doctypes = ['Material Request', 'Supplier Quotation', 'Purchase Order', 'Purchase Receipt', 'Purchase Invoice']
@frappe.whitelist()
-def get_item_details(args):
+def get_item_details(args, doc=None):
"""
args = {
"item_code": "",
@@ -71,7 +71,8 @@
if args.get(key) is None:
args[key] = value
- out.update(get_pricing_rule_for_item(args))
+ data = get_pricing_rule_for_item(args, out.price_list_rate, doc)
+ out.update(data)
update_stock(args, out)
@@ -837,7 +838,7 @@
item_doc = frappe.get_doc("Item", args.item_code)
get_price_list_rate(args, item_doc, item_details)
- item_details.update(get_pricing_rule_for_item(args))
+ item_details.update(get_pricing_rule_for_item(args, item_details.price_list_rate))
return item_details