[fixes] item_code non-mandatory in item if naming_series

This commit is contained in:
Nabin Hait 2013-05-07 16:03:10 +05:30
parent f2d4df975e
commit 04f888fa52
4 changed files with 17 additions and 65 deletions

View File

@ -66,6 +66,6 @@ class DocType:
vouchers.append(d.voucher_id) vouchers.append(d.voucher_id)
if vouchers: if vouchers:
msgprint("Clearance Date updated in %s" % vouchers) msgprint("Clearance Date updated in %s" % ", ".join(vouchers))
else: else:
msgprint("Clearance Date not mentioned") msgprint("Clearance Date not mentioned")

View File

@ -47,10 +47,6 @@ class DocType:
rate=%s, amount=qty*%s where bom_no = %s and docstatus < 2""", 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)) (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): def get_parent_boms(self):
return [d[0] for d in webnotes.conn.sql("""select distinct parent return [d[0] for d in webnotes.conn.sql("""select distinct parent
from `tabBOM Item` where ifnull(bom_no, '') = %s and docstatus < 2""", from `tabBOM Item` where ifnull(bom_no, '') = %s and docstatus < 2""",

View File

@ -31,6 +31,8 @@ class DocType(DocListController):
if webnotes.conn.get_default("item_naming_by")=="Naming Series": if webnotes.conn.get_default("item_naming_by")=="Naming Series":
from webnotes.model.doc import make_autoname from webnotes.model.doc import make_autoname
self.doc.item_code = make_autoname(self.doc.naming_series+'.#####') 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 self.doc.name = self.doc.item_code

View File

@ -1,8 +1,8 @@
[ [
{ {
"creation": "2013-04-25 10:56:55", "creation": "2013-05-03 10:45:46",
"docstatus": 0, "docstatus": 0,
"modified": "2013-05-02 15:10:53", "modified": "2013-05-07 15:58:58",
"modified_by": "Administrator", "modified_by": "Administrator",
"owner": "Administrator" "owner": "Administrator"
}, },
@ -28,13 +28,14 @@
"permlevel": 0 "permlevel": 0
}, },
{ {
"amend": 0,
"doctype": "DocPerm", "doctype": "DocPerm",
"name": "__common__", "name": "__common__",
"parent": "Item", "parent": "Item",
"parentfield": "permissions", "parentfield": "permissions",
"parenttype": "DocType", "parenttype": "DocType",
"permlevel": 0,
"read": 1, "read": 1,
"report": 1,
"submit": 0 "submit": 0
}, },
{ {
@ -55,7 +56,8 @@
"fieldname": "naming_series", "fieldname": "naming_series",
"fieldtype": "Select", "fieldtype": "Select",
"label": "Naming Series", "label": "Naming Series",
"options": "\nITEM" "options": "\nITEM",
"read_only": 0
}, },
{ {
"description": "Item will be saved by this name in the data base.", "description": "Item will be saved by this name in the data base.",
@ -64,10 +66,11 @@
"fieldtype": "Data", "fieldtype": "Data",
"in_filter": 0, "in_filter": 0,
"label": "Item Code", "label": "Item Code",
"no_copy": 1,
"oldfieldname": "item_code", "oldfieldname": "item_code",
"oldfieldtype": "Data", "oldfieldtype": "Data",
"read_only": 0, "read_only": 0,
"reqd": 1, "reqd": 0,
"search_index": 0 "search_index": 0
}, },
{ {
@ -883,76 +886,27 @@
"label": "Website Description", "label": "Website Description",
"read_only": 0 "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, "cancel": 1,
"create": 1, "create": 1,
"doctype": "DocPerm", "doctype": "DocPerm",
"permlevel": 0,
"report": 1,
"role": "Material Master Manager", "role": "Material Master Manager",
"write": 1 "write": 1
}, },
{ {
"amend": 0,
"cancel": 0, "cancel": 0,
"create": 0, "create": 0,
"doctype": "DocPerm", "doctype": "DocPerm",
"permlevel": 1, "role": "Material Manager",
"report": 0,
"role": "Material Master Manager",
"write": 0 "write": 0
}, },
{ {
"cancel": 1, "amend": 0,
"create": 1,
"doctype": "DocPerm",
"permlevel": 0,
"report": 1,
"role": "System Manager",
"write": 1
},
{
"cancel": 0, "cancel": 0,
"create": 0, "create": 0,
"doctype": "DocPerm", "doctype": "DocPerm",
"permlevel": 1, "role": "Material User",
"report": 0,
"role": "System Manager",
"write": 0 "write": 0
} }
] ]