From ebf696c8c8a8225bffb383b5166ba739227ccff2 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 4 Nov 2020 15:01:32 +0530 Subject: [PATCH] fix(minor): minor fixes in document_naming.py and mandatory --- .../document_naming_rule/document_naming_rule.json | 10 ++++++---- .../document_naming_rule/document_naming_rule.py | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/frappe/core/doctype/document_naming_rule/document_naming_rule.json b/frappe/core/doctype/document_naming_rule/document_naming_rule.json index 79eebdbe64..4a88e3be6e 100644 --- a/frappe/core/doctype/document_naming_rule/document_naming_rule.json +++ b/frappe/core/doctype/document_naming_rule/document_naming_rule.json @@ -34,7 +34,8 @@ "fieldname": "prefix", "fieldtype": "Data", "label": "Prefix", - "mandatory_depends_on": "eval:doc.naming_by===\"Numbered\"" + "mandatory_depends_on": "eval:doc.naming_by===\"Numbered\"", + "reqd": 1 }, { "fieldname": "counter", @@ -48,7 +49,8 @@ "fieldname": "prefix_digits", "fieldtype": "Int", "label": "Digits", - "mandatory_depends_on": "eval:doc.naming_by===\"Numbered\"" + "mandatory_depends_on": "eval:doc.naming_by===\"Numbered\"", + "reqd": 1 }, { "fieldname": "naming_section", @@ -69,7 +71,7 @@ "options": "Document Naming Rule Condition" }, { - "description": "Rules with higher priority will be applied first.", + "description": "Rules with higher priority number will be applied first.", "fieldname": "priority", "fieldtype": "Int", "label": "Priority" @@ -77,7 +79,7 @@ ], "index_web_pages_for_search": 1, "links": [], - "modified": "2020-09-21 10:23:34.401539", + "modified": "2020-11-04 14:38:14.836056", "modified_by": "Administrator", "module": "Core", "name": "Document Naming Rule", diff --git a/frappe/core/doctype/document_naming_rule/document_naming_rule.py b/frappe/core/doctype/document_naming_rule/document_naming_rule.py index 2de7552dc1..3ff47facc3 100644 --- a/frappe/core/doctype/document_naming_rule/document_naming_rule.py +++ b/frappe/core/doctype/document_naming_rule/document_naming_rule.py @@ -13,7 +13,7 @@ class DocumentNamingRule(Document): Apply naming rules for the given document. Will set `name` if the rule is matched. ''' if self.conditions: - if not evaluate_filters(doc, [(d.field, d.condition, d.value) for d in self.conditions]): + if not evaluate_filters(doc, [(self.document_type, d.field, d.condition, d.value) for d in self.conditions]): return counter = frappe.db.get_value(self.doctype, self.name, 'counter', for_update=True) or 0