From afb8ec9cb6aa80498b932e2c6142bd76bc0e0e2d Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 1 Feb 2016 12:52:58 +0530 Subject: [PATCH 1/4] [fix] Validate company abbr --- erpnext/setup/doctype/company/company.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/erpnext/setup/doctype/company/company.py b/erpnext/setup/doctype/company/company.py index 01e5742c2a..6689d66748 100644 --- a/erpnext/setup/doctype/company/company.py +++ b/erpnext/setup/doctype/company/company.py @@ -27,15 +27,21 @@ class Company(Document): return exists def validate(self): + self.validate_abbr() + self.validate_default_accounts() + self.validate_currency() + + def validate_abbr(self): self.abbr = self.abbr.strip() + if self.get('__islocal') and len(self.abbr) > 5: frappe.throw(_("Abbreviation cannot have more than 5 characters")) if not self.abbr.strip(): frappe.throw(_("Abbreviation is mandatory")) - - self.validate_default_accounts() - self.validate_currency() + + if frappe.db.sql("select abbr from tabCompany where name!=%s and abbr=%s", (self.name, self.abbr)): + frappe.throw(_("Abbreviation already used for another company")) def validate_default_accounts(self): for field in ["default_bank_account", "default_cash_account", "default_receivable_account", "default_payable_account", @@ -167,7 +173,7 @@ class Company(Document): frappe.defaults.clear_cache() def abbreviate(self): - self.abbr = ''.join([c[0].upper() for c in self.name.split()]) + self.abbr = ''.join([c[0].upper() for c in self.company_name.split()]) def on_trash(self): """ From a85a1ff1459537ae7024648705343e09a1680363 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 1 Feb 2016 12:54:19 +0530 Subject: [PATCH 2/4] [fix] Validate rate with reference doc --- erpnext/stock/doctype/delivery_note/delivery_note.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.py b/erpnext/stock/doctype/delivery_note/delivery_note.py index 7cb855fd67..0dabfa13e1 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note.py +++ b/erpnext/stock/doctype/delivery_note/delivery_note.py @@ -124,8 +124,8 @@ class DeliveryNote(SellingController): }) if cint(frappe.db.get_single_value('Selling Settings', 'maintain_same_sales_rate')) and not self.is_return: - self.validate_rate_with_reference_doc([["Sales Order", "sales_order", "so_detail"], - ["Sales Invoice", "sales_invoice", "si_detail"]]) + self.validate_rate_with_reference_doc([["Sales Order", "against_sales_order", "so_detail"], + ["Sales Invoice", "against_sales_invoice", "si_detail"]]) def validate_proj_cust(self): """check for does customer belong to same project as entered..""" From d5fda57297c4d4475772a6fcd15a3e8d3a8d76c3 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 1 Feb 2016 12:55:23 +0530 Subject: [PATCH 3/4] [fix] Ignore permissions and made Customer warehouse field hidden in selling cycle --- .../sales_invoice_item.json | 11 +-- .../sales_order_item/sales_order_item.json | 9 +- .../doctype/delivery_note/delivery_note.json | 90 ++++++++++++++----- .../delivery_note_item.json | 9 +- 4 files changed, 82 insertions(+), 37 deletions(-) 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 8e9be7ee15..79f5f555c2 100644 --- a/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json +++ b/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json @@ -7,6 +7,7 @@ "custom": 0, "docstatus": 0, "doctype": "DocType", + "document_type": "Document", "fields": [ { "allow_on_submit": 0, @@ -972,13 +973,13 @@ "collapsible": 0, "fieldname": "target_warehouse", "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, + "hidden": 1, + "ignore_user_permissions": 1, "in_filter": 0, "in_list_view": 0, - "label": "Target Warehouse", + "label": "Customer Warehouse (Optional)", "length": 0, - "no_copy": 0, + "no_copy": 1, "options": "Warehouse", "permlevel": 0, "precision": "", @@ -1444,7 +1445,7 @@ "issingle": 0, "istable": 1, "max_attachments": 0, - "modified": "2016-01-06 02:23:06.432442", + "modified": "2016-02-01 11:16:58.288462", "modified_by": "Administrator", "module": "Accounts", "name": "Sales Invoice Item", 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 823b805bf6..184a4f48eb 100644 --- a/erpnext/selling/doctype/sales_order_item/sales_order_item.json +++ b/erpnext/selling/doctype/sales_order_item/sales_order_item.json @@ -7,6 +7,7 @@ "custom": 0, "docstatus": 0, "doctype": "DocType", + "document_type": "Document", "fields": [ { "allow_on_submit": 0, @@ -874,13 +875,13 @@ "depends_on": "eval:doc.delivered_by_supplier!=1", "fieldname": "target_warehouse", "fieldtype": "Link", - "hidden": 0, + "hidden": 1, "ignore_user_permissions": 1, "in_filter": 0, "in_list_view": 0, - "label": "Target Warehouse", + "label": "Customer Warehouse (Optional)", "length": 0, - "no_copy": 0, + "no_copy": 1, "options": "Warehouse", "permlevel": 0, "precision": "", @@ -1289,7 +1290,7 @@ "istable": 1, "max_attachments": 0, "menu_index": 0, - "modified": "2015-12-11 14:53:24.444343", + "modified": "2016-02-01 11:16:40.514399", "modified_by": "Administrator", "module": "Selling", "name": "Sales Order Item", diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.json b/erpnext/stock/doctype/delivery_note/delivery_note.json index f001f85455..5f85c01860 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note.json +++ b/erpnext/stock/doctype/delivery_note/delivery_note.json @@ -2696,18 +2696,58 @@ "istable": 0, "max_attachments": 0, "menu_index": 0, - "modified": "2015-12-25 16:20:39.014291", + "modified": "2016-01-31 14:06:52.136821", "modified_by": "Administrator", "module": "Stock", "name": "Delivery Note", "owner": "Administrator", "permissions": [ + { + "amend": 0, + "apply_user_permissions": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "All", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 0 + }, { "amend": 1, "apply_user_permissions": 0, "cancel": 1, "create": 1, - "delete": 1, + "delete": 0, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Office Coordinator", + "set_user_permissions": 0, + "share": 1, + "submit": 1, + "write": 1 + }, + { + "amend": 1, + "apply_user_permissions": 0, + "cancel": 1, + "create": 1, + "delete": 0, "email": 1, "export": 0, "if_owner": 0, @@ -2722,6 +2762,27 @@ "submit": 1, "write": 1 }, + { + "amend": 0, + "apply_user_permissions": 1, + "cancel": 1, + "create": 1, + "delete": 0, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Store Keeper", + "set_user_permissions": 0, + "share": 1, + "submit": 1, + "user_permission_doctypes": "[\"Warehouse\"]", + "write": 1 + }, { "amend": 1, "apply_user_permissions": 0, @@ -2744,10 +2805,10 @@ }, { "amend": 1, - "apply_user_permissions": 0, + "apply_user_permissions": 1, "cancel": 1, "create": 1, - "delete": 1, + "delete": 0, "email": 1, "export": 0, "if_owner": 0, @@ -2760,6 +2821,7 @@ "set_user_permissions": 0, "share": 1, "submit": 1, + "user_permission_doctypes": "[\"Warehouse\"]", "write": 1 }, { @@ -2801,26 +2863,6 @@ "share": 0, "submit": 0, "write": 0 - }, - { - "amend": 0, - "apply_user_permissions": 0, - "cancel": 0, - "create": 0, - "delete": 0, - "email": 0, - "export": 0, - "if_owner": 0, - "import": 0, - "permlevel": 1, - "print": 0, - "read": 1, - "report": 0, - "role": "Stock Manager", - "set_user_permissions": 0, - "share": 0, - "submit": 0, - "write": 1 } ], "read_only": 0, 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 dcafc1e4e8..6ed16ce51b 100644 --- a/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json +++ b/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json @@ -7,6 +7,7 @@ "custom": 0, "docstatus": 0, "doctype": "DocType", + "document_type": "Document", "fields": [ { "allow_on_submit": 0, @@ -823,13 +824,13 @@ "description": "", "fieldname": "target_warehouse", "fieldtype": "Link", - "hidden": 0, + "hidden": 1, "ignore_user_permissions": 1, "in_filter": 0, "in_list_view": 0, - "label": "To Warehouse (Optional)", + "label": "Customer Warehouse (Optional)", "length": 0, - "no_copy": 0, + "no_copy": 1, "options": "Warehouse", "permlevel": 0, "precision": "", @@ -1286,7 +1287,7 @@ "issingle": 0, "istable": 1, "max_attachments": 0, - "modified": "2016-01-07 05:59:56.448357", + "modified": "2016-02-01 11:16:23.749244", "modified_by": "Administrator", "module": "Stock", "name": "Delivery Note Item", From 3c55d89f7f3c89a6d1a8ec61fd66cb2691d8fd24 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 1 Feb 2016 15:55:02 +0530 Subject: [PATCH 4/4] [minor] Reference doctype in Item-wise price List Rate report --- .../item_wise_price_list_rate.json | 32 ++++++++++--------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/erpnext/stock/report/item_wise_price_list_rate/item_wise_price_list_rate.json b/erpnext/stock/report/item_wise_price_list_rate/item_wise_price_list_rate.json index ec8f599f36..6a8ddc362b 100644 --- a/erpnext/stock/report/item_wise_price_list_rate/item_wise_price_list_rate.json +++ b/erpnext/stock/report/item_wise_price_list_rate/item_wise_price_list_rate.json @@ -1,17 +1,19 @@ { - "apply_user_permissions": 1, - "creation": "2013-09-25 10:21:15", - "docstatus": 0, - "doctype": "Report", - "idx": 1, - "is_standard": "Yes", - "json": "{\"filters\":[[\"Item Price\",\"price_list\",\"like\",\"%\"],[\"Item Price\",\"item_code\",\"like\",\"%\"]],\"columns\":[[\"name\",\"Item Price\"],[\"price_list\",\"Item Price\"],[\"item_code\",\"Item Price\"],[\"item_name\",\"Item Price\"],[\"item_description\",\"Item Price\"],[\"price_list_rate\",\"Item Price\"],[\"buying\",\"Item Price\"],[\"selling\",\"Item Price\"],[\"currency\",\"Item Price\"]],\"sort_by\":\"Item Price.modified\",\"sort_order\":\"desc\",\"sort_by_next\":\"\",\"sort_order_next\":\"desc\"}", - "modified": "2014-06-09 10:21:15.097955", - "modified_by": "Administrator", - "module": "Stock", - "name": "Item-wise Price List Rate", - "owner": "Administrator", - "ref_doctype": "Price List", - "report_name": "Item-wise Price List Rate", + "add_total_row": 0, + "apply_user_permissions": 1, + "creation": "2013-09-25 10:21:15", + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 1, + "is_standard": "Yes", + "json": "{\"filters\":[],\"columns\":[[\"name\",\"Item Price\"],[\"price_list\",\"Item Price\"],[\"item_code\",\"Item Price\"],[\"item_name\",\"Item Price\"],[\"item_description\",\"Item Price\"],[\"price_list_rate\",\"Item Price\"],[\"buying\",\"Item Price\"],[\"selling\",\"Item Price\"],[\"currency\",\"Item Price\"]],\"sort_by\":\"Item Price.modified\",\"sort_order\":\"desc\",\"sort_by_next\":null,\"sort_order_next\":\"desc\"}", + "modified": "2016-02-01 14:31:04.075909", + "modified_by": "Administrator", + "module": "Stock", + "name": "Item-wise Price List Rate", + "owner": "Administrator", + "ref_doctype": "Item Price", + "report_name": "Item-wise Price List Rate", "report_type": "Report Builder" -} +} \ No newline at end of file