diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.py b/erpnext/stock/doctype/delivery_note/delivery_note.py index 51c123c9365..445e93b8831 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note.py +++ b/erpnext/stock/doctype/delivery_note/delivery_note.py @@ -183,7 +183,6 @@ class DocType(TransactionBase): self.validate_reference_value() self.validate_for_items() sales_com_obj.make_packing_list(self,'delivery_note_details') - get_obj('Stock Ledger').validate_serial_no(self, 'packing_details') sales_com_obj.validate_max_discount(self, 'delivery_note_details') #verify whether rate is not greater than max discount sales_com_obj.get_allocated_sum(self) # this is to verify that the allocated % of sales persons is 100% sales_com_obj.check_conversion_rate(self) @@ -325,6 +324,7 @@ class DocType(TransactionBase): # Check for Approving Authority get_obj('Authorization Control').validate_approving_authority(self.doc.doctype, self.doc.company, self.doc.grand_total, self) sl_obj = get_obj("Stock Ledger") + sl_obj.validate_serial_no(self, 'packing_details') sl_obj.validate_serial_no_warehouse(self, 'packing_details') sl_obj.update_serial_record(self, 'packing_details', is_submit = 1, is_incoming = 0) get_obj("Sales Common").update_prevdoc_detail(1,self) diff --git a/erpnext/stock/doctype/sales_bom/sales_bom.js b/erpnext/stock/doctype/sales_bom/sales_bom.js index f7f6e4d3a49..7d857a20637 100644 --- a/erpnext/stock/doctype/sales_bom/sales_bom.js +++ b/erpnext/stock/doctype/sales_bom/sales_bom.js @@ -22,7 +22,9 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) { } cur_frm.cscript.refresh = function(doc, cdt, cdn) { - + if(!doc.__islocal) { + hide_field('new_item_code'); + } } /* Get Item Code */ diff --git a/erpnext/stock/doctype/sales_bom/sales_bom.py b/erpnext/stock/doctype/sales_bom/sales_bom.py index f2921646dd5..7dea6922e12 100644 --- a/erpnext/stock/doctype/sales_bom/sales_bom.py +++ b/erpnext/stock/doctype/sales_bom/sales_bom.py @@ -38,8 +38,7 @@ class DocType: self.doc, self.doclist = d,dl def autoname(self): - self.doc.name = make_autoname(self.doc.new_item_code) - + self.doc.name = self.doc.new_item_code # Get Ref Rates # -------------- @@ -67,9 +66,9 @@ 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.new_item_code)[:-3] : - msgprint("Modifying the main item is not allowed.") - raise Exception + #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: msgprint('Main item cannot be more than one.') raise Exception , " Validation Error." diff --git a/erpnext/stock/doctype/sales_bom/sales_bom.txt b/erpnext/stock/doctype/sales_bom/sales_bom.txt index dfc2a6547db..29fcd3142fb 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-26 13:04:56', + 'creation': '2012-04-30 12:08:49', 'docstatus': 0, - 'modified': '2012-04-27 11:00:18', + 'modified': '2012-05-04 09:53:08', 'modified_by': u'Administrator', 'owner': u'Administrator' }, @@ -15,6 +15,7 @@ '_last_update': u'1322549701', 'allow_trash': 1, 'colour': u'White:FFF', + 'description': u'Aggregate item and accessories to form a Sales Item. There is no inventory of the new item but of the sub-components.', 'doctype': 'DocType', 'document_type': u'Master', 'is_submittable': 1, @@ -143,6 +144,8 @@ # DocField { + 'colour': u'White:FFF', + 'description': u'Item code of the new aggregate item.', 'doctype': u'DocField', 'fieldname': u'new_item_code', 'fieldtype': u'Data', @@ -150,12 +153,12 @@ 'no_copy': 1, 'oldfieldname': u'new_item_code', 'oldfieldtype': u'Data', - 'permlevel': 1, 'reqd': 1 }, # DocField { + 'colour': u'White:FFF', 'doctype': u'DocField', 'fieldname': u'new_item_name', 'fieldtype': u'Data', @@ -221,7 +224,8 @@ 'oldfieldname': u'stock_uom', 'oldfieldtype': u'Link', 'options': u'UOM', - 'permlevel': 0 + 'permlevel': 0, + 'reqd': 1 }, # DocField @@ -280,17 +284,7 @@ # 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 - { + 'description': u'List items that form a package. One of the items has to be a "main item".', 'doctype': u'DocField', 'fieldname': u'item_section', 'fieldtype': u'Section Break', @@ -310,6 +304,19 @@ 'permlevel': 0 }, + # DocField + { + 'colour': u'White:FFF', + 'description': u'Add a few items and find if there are any Sales BOM created with the same combination to help you identify duplication.', + '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', diff --git a/js/all-app.js b/js/all-app.js index 05b7938c557..0f36858a75d 100644 --- a/js/all-app.js +++ b/js/all-app.js @@ -1719,7 +1719,7 @@ _f.Frm.prototype.check_doctype_conflict=function(docname){var me=this;if(this.do throw'doctype open conflict'}}else{if(wn.views.formview.DocType&&wn.views.formview.DocType.frm.opendocs[this.doctype]){msgprint("Cannot open instance when its DocType is open") throw'doctype open conflict'}}} _f.Frm.prototype.setup=function(){var me=this;this.fields=[];this.fields_dict={};this.wrapper=this.parent;this.setup_print_layout();this.saved_wrapper=$a(this.wrapper,'div');this.setup_std_layout();this.setup_client_script();this.setup_done=true;} -_f.Frm.prototype.setup_print_layout=function(){this.print_wrapper=$a(this.wrapper,'div');this.print_head=$a(this.print_wrapper,'div');this.print_body=$a(this.print_wrapper,'div','layout_wrapper',{padding:'23px',minHeight:'800px'});var t=make_table(this.print_head,1,2,'100%',[],{padding:'6px'});this.view_btn_wrapper=$a($td(t,0,0),'span','green_buttons');this.view_btn=$btn(this.view_btn_wrapper,'View Details',function(){cur_frm.edit_doc()},{marginRight:'4px'},'green');this.print_btn=$btn($td(t,0,0),'Print',function(){cur_frm.print_doc()});$y($td(t,0,1),{textAlign:'right'});this.print_close_btn=$btn($td(t,0,1),'Close',function(){window.back();});} +_f.Frm.prototype.setup_print_layout=function(){this.print_wrapper=$a(this.wrapper,'div');this.print_head=$a(this.print_wrapper,'div');this.print_body=$a(this.print_wrapper,'div','layout_wrapper',{padding:'23px',minHeight:'800px'});var t=make_table(this.print_head,1,2,'100%',[],{padding:'6px'});this.view_btn_wrapper=$a($td(t,0,0),'span','green_buttons');this.view_btn=$btn(this.view_btn_wrapper,'View Details',function(){cur_frm.edit_doc()},{marginRight:'4px'},'green');this.print_btn=$btn($td(t,0,0),'Print',function(){cur_frm.print_doc()});$y($td(t,0,1),{textAlign:'right'});this.print_close_btn=$btn($td(t,0,1),'Close',function(){window.history.back();});} _f.Frm.prototype.onhide=function(){if(_f.cur_grid_cell)_f.cur_grid_cell.grid.cell_deselect();} _f.Frm.prototype.setup_std_layout=function(){this.page_layout=new wn.PageLayout({parent:this.wrapper,main_width:this.meta.in_dialog?'100%':'75%',sidebar_width:this.meta.in_dialog?'0%':'25%'}) this.meta.section_style='Simple';this.layout=new Layout(this.page_layout.body,'100%');if(this.meta.in_dialog){$(this.page_layout.wrapper).removeClass('layout-wrapper-background');$(this.page_layout.main).removeClass('layout-main-section');$(this.page_layout.sidebar_area).toggle(false);}else{this.setup_sidebar();}