sales bom issue fixed

This commit is contained in:
Nabin Hait 2012-04-27 11:04:11 +05:30
parent 92ec4dcb6f
commit b9d3ade2f4
2 changed files with 82 additions and 48 deletions

View File

@ -67,7 +67,7 @@ class DocType:
msgprint("Sales Bom Item " + d.item_code +" cannot be child item.")
raise Exception
# Check if is_main_item is modified once saved
if not self.doc.fields.get('__islocal') and d.is_main_item == "Yes" and cstr(d.item_code) != cstr(self.doc.name)[:-3] :
if not self.doc.fields.get('__islocal') and d.is_main_item == "Yes" and cstr(d.item_code) != cstr(self.doc.new_item_code)[:-3] :
msgprint("Modifying the main item is not allowed.")
raise Exception
if len(is_main_item) > 1:
@ -165,19 +165,18 @@ class DocType:
return
# get all Sales BOM that have the first item
sbl = sql("select distinct parent from `tabSales BOM Item` where item_code=%s", il[0].item_code)
sbl = sql("select distinct parent from `tabSales BOM Item` where item_code=%s and parent != %s and docstatus != 2", (il[0].item_code, self.doc.name))
# check all siblings
sub_items = [[d.item_code, flt(d.qty)] for d in il]
for s in sbl:
if not cstr(s[0]) == cstr(self.doc.name) :
t = sql("select item_code, qty from `tabSales BOM Item` where parent=%s", s[0])
t = [[d[0], flt(d[1])] for d in t]
t = sql("select item_code, qty from `tabSales BOM Item` where parent=%s and docstatus != 2", s[0])
t = [[d[0], flt(d[1])] for d in t]
if self.has_same_items(sub_items, t):
msgprint("%s has the same Sales BOM details" % s[0])
raise Exception
if self.has_same_items(sub_items, t):
msgprint("%s has the same Sales BOM details" % s[0])
raise Exception
if finder:
msgprint("There is no Sales BOM present with the following Combination.")

View File

@ -3,9 +3,9 @@
# These values are common in all dictionaries
{
'creation': '2012-04-23 16:00:21',
'creation': '2012-04-26 13:04:56',
'docstatus': 0,
'modified': '2012-04-24 15:07:42',
'modified': '2012-04-27 11:00:18',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
@ -15,7 +15,6 @@
'_last_update': u'1322549701',
'allow_trash': 1,
'colour': u'White:FFF',
'default_print_format': u'Standard',
'doctype': 'DocType',
'document_type': u'Master',
'is_submittable': 1,
@ -124,6 +123,24 @@
'write': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'basic_section',
'fieldtype': u'Section Break',
'label': u'Basic Section',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'col1',
'fieldtype': u'Column Break',
'permlevel': 0,
'width': u'50%'
},
# DocField
{
'doctype': u'DocField',
@ -173,6 +190,15 @@
'width': u'300px'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'col2',
'fieldtype': u'Column Break',
'permlevel': 0,
'width': u'50%'
},
# DocField
{
'doctype': u'DocField',
@ -186,6 +212,18 @@
'reqd': 1
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'stock_uom',
'fieldtype': u'Link',
'label': u'Stock UOM',
'oldfieldname': u'stock_uom',
'oldfieldtype': u'Link',
'options': u'UOM',
'permlevel': 0
},
# DocField
{
'colour': u'White:FFF',
@ -214,42 +252,6 @@
'trigger': u'Client'
},
# DocField
{
'colour': u'White:FFF',
'doctype': u'DocField',
'fieldname': u'find_sales_bom',
'fieldtype': u'Button',
'label': u'Find Sales BOM',
'oldfieldtype': u'Button',
'permlevel': 0,
'trigger': u'Client'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'sales_bom_items',
'fieldtype': u'Table',
'label': u'Sales BOM Items',
'oldfieldname': u'sales_bom_items',
'oldfieldtype': u'Table',
'options': u'Sales BOM Item',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'stock_uom',
'fieldtype': u'Link',
'label': u'Stock UOM',
'oldfieldname': u'stock_uom',
'oldfieldtype': u'Link',
'options': u'UOM',
'permlevel': 0
},
# DocField
{
'depends_on': u'eval:doc.amended_from',
@ -270,11 +272,44 @@
'fieldtype': u'Link',
'label': u'Amended From',
'no_copy': 1,
'options': u'Sales Invoice',
'options': u'Sales BOM',
'permlevel': 1,
'print_hide': 1
},
# DocField
{
'colour': u'White:FFF',
'doctype': u'DocField',
'fieldname': u'find_sales_bom',
'fieldtype': u'Button',
'label': u'Find Sales BOM',
'oldfieldtype': u'Button',
'permlevel': 0,
'trigger': u'Client'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'item_section',
'fieldtype': u'Section Break',
'label': u'Items',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'sales_bom_items',
'fieldtype': u'Table',
'label': u'Sales BOM Items',
'oldfieldname': u'sales_bom_items',
'oldfieldtype': u'Table',
'options': u'Sales BOM Item',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',