sales bom issue fixed
diff --git a/erpnext/stock/doctype/sales_bom/sales_bom.py b/erpnext/stock/doctype/sales_bom/sales_bom.py
index ae3378e..f292164 100644
--- a/erpnext/stock/doctype/sales_bom/sales_bom.py
+++ b/erpnext/stock/doctype/sales_bom/sales_bom.py
@@ -67,7 +67,7 @@
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 @@
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.")
diff --git a/erpnext/stock/doctype/sales_bom/sales_bom.txt b/erpnext/stock/doctype/sales_bom/sales_bom.txt
index 476a319..dfc2a65 100644
--- a/erpnext/stock/doctype/sales_bom/sales_bom.txt
+++ b/erpnext/stock/doctype/sales_bom/sales_bom.txt
@@ -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,
@@ -127,6 +126,24 @@
# 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',
'fieldname': u'new_item_code',
'fieldtype': u'Data',
'label': u'New Item Code',
@@ -176,6 +193,15 @@
# DocField
{
'doctype': u'DocField',
+ 'fieldname': u'col2',
+ 'fieldtype': u'Column Break',
+ 'permlevel': 0,
+ 'width': u'50%'
+ },
+
+ # DocField
+ {
+ 'doctype': u'DocField',
'fieldname': u'item_group',
'fieldtype': u'Link',
'label': u'Item Group',
@@ -188,6 +214,18 @@
# 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',
'doctype': u'DocField',
'fieldname': u'price_list',
@@ -216,42 +254,6 @@
# 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',
'description': u'The date at which current entry is corrected in the system.',
'doctype': u'DocField',
@@ -270,13 +272,46 @@
'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',
'fieldname': u'trash_reason',
'fieldtype': u'Small Text',