From 04f888fa52f13822d23442fd6203363168945ac7 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 7 May 2013 16:03:10 +0530 Subject: [PATCH] [fixes] item_code non-mandatory in item if naming_series --- .../bank_reconciliation.py | 2 +- .../bom_replace_tool/bom_replace_tool.py | 6 +- stock/doctype/item/item.py | 4 +- stock/doctype/item/item.txt | 70 ++++--------------- 4 files changed, 17 insertions(+), 65 deletions(-) diff --git a/accounts/doctype/bank_reconciliation/bank_reconciliation.py b/accounts/doctype/bank_reconciliation/bank_reconciliation.py index 980af5844f..f19df48306 100644 --- a/accounts/doctype/bank_reconciliation/bank_reconciliation.py +++ b/accounts/doctype/bank_reconciliation/bank_reconciliation.py @@ -66,6 +66,6 @@ class DocType: vouchers.append(d.voucher_id) if vouchers: - msgprint("Clearance Date updated in %s" % vouchers) + msgprint("Clearance Date updated in %s" % ", ".join(vouchers)) else: msgprint("Clearance Date not mentioned") \ No newline at end of file diff --git a/manufacturing/doctype/bom_replace_tool/bom_replace_tool.py b/manufacturing/doctype/bom_replace_tool/bom_replace_tool.py index 177adcda83..4c9c42da2e 100644 --- a/manufacturing/doctype/bom_replace_tool/bom_replace_tool.py +++ b/manufacturing/doctype/bom_replace_tool/bom_replace_tool.py @@ -46,11 +46,7 @@ class DocType: webnotes.conn.sql("""update `tabBOM Item` set bom_no=%s, rate=%s, amount=qty*%s where bom_no = %s and docstatus < 2""", (self.doc.new_bom, current_bom_unitcost, current_bom_unitcost, self.doc.current_bom)) - - def get_parent_boms(bom_no): - return [d[0] for d in webnotes.conn.sql("""select distinct parent from - `tabBOM Item` where ifnull(bom_no, '')=%s and docstatus < 2""", bom_no)] - + def get_parent_boms(self): return [d[0] for d in webnotes.conn.sql("""select distinct parent from `tabBOM Item` where ifnull(bom_no, '') = %s and docstatus < 2""", diff --git a/stock/doctype/item/item.py b/stock/doctype/item/item.py index 63275047ad..fde532c96c 100644 --- a/stock/doctype/item/item.py +++ b/stock/doctype/item/item.py @@ -31,7 +31,9 @@ class DocType(DocListController): if webnotes.conn.get_default("item_naming_by")=="Naming Series": from webnotes.model.doc import make_autoname self.doc.item_code = make_autoname(self.doc.naming_series+'.#####') - + elif not self.doc.item_code: + msgprint(_("Item Code is mandatory"), raise_exception=1) + self.doc.name = self.doc.item_code def validate(self): diff --git a/stock/doctype/item/item.txt b/stock/doctype/item/item.txt index 274719eec5..c799029d95 100644 --- a/stock/doctype/item/item.txt +++ b/stock/doctype/item/item.txt @@ -1,8 +1,8 @@ [ { - "creation": "2013-04-25 10:56:55", + "creation": "2013-05-03 10:45:46", "docstatus": 0, - "modified": "2013-05-02 15:10:53", + "modified": "2013-05-07 15:58:58", "modified_by": "Administrator", "owner": "Administrator" }, @@ -28,13 +28,14 @@ "permlevel": 0 }, { - "amend": 0, "doctype": "DocPerm", "name": "__common__", "parent": "Item", "parentfield": "permissions", "parenttype": "DocType", + "permlevel": 0, "read": 1, + "report": 1, "submit": 0 }, { @@ -55,7 +56,8 @@ "fieldname": "naming_series", "fieldtype": "Select", "label": "Naming Series", - "options": "\nITEM" + "options": "\nITEM", + "read_only": 0 }, { "description": "Item will be saved by this name in the data base.", @@ -64,10 +66,11 @@ "fieldtype": "Data", "in_filter": 0, "label": "Item Code", + "no_copy": 1, "oldfieldname": "item_code", "oldfieldtype": "Data", "read_only": 0, - "reqd": 1, + "reqd": 0, "search_index": 0 }, { @@ -883,76 +886,27 @@ "label": "Website Description", "read_only": 0 }, - { - "cancel": 0, - "create": 0, - "doctype": "DocPerm", - "permlevel": 1, - "report": 0, - "role": "Material Manager", - "write": 0 - }, - { - "cancel": 0, - "create": 0, - "doctype": "DocPerm", - "permlevel": 0, - "report": 1, - "role": "Material Manager", - "write": 0 - }, - { - "cancel": 0, - "create": 0, - "doctype": "DocPerm", - "permlevel": 1, - "report": 0, - "role": "Material User", - "write": 0 - }, - { - "cancel": 0, - "create": 0, - "doctype": "DocPerm", - "permlevel": 0, - "report": 1, - "role": "Material User", - "write": 0 - }, { "cancel": 1, "create": 1, "doctype": "DocPerm", - "permlevel": 0, - "report": 1, "role": "Material Master Manager", "write": 1 }, { + "amend": 0, "cancel": 0, "create": 0, "doctype": "DocPerm", - "permlevel": 1, - "report": 0, - "role": "Material Master Manager", + "role": "Material Manager", "write": 0 }, { - "cancel": 1, - "create": 1, - "doctype": "DocPerm", - "permlevel": 0, - "report": 1, - "role": "System Manager", - "write": 1 - }, - { + "amend": 0, "cancel": 0, "create": 0, "doctype": "DocPerm", - "permlevel": 1, - "report": 0, - "role": "System Manager", + "role": "Material User", "write": 0 } ] \ No newline at end of file