From 6e31b8474fc34d6fab6449b1835e97f3c7397f3a Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 3 May 2012 18:21:33 +0530 Subject: [PATCH 1/4] fix in data field, when field value is undefined, insert it as blank in dom --- js/all-app.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/all-app.js b/js/all-app.js index 05b7938c55..a292e4633b 100644 --- a/js/all-app.js +++ b/js/all-app.js @@ -839,7 +839,7 @@ if(this.txt){try{this.txt.focus();}catch(e){} this.txt.field_object=this;}} function DataField(){}DataField.prototype=new Field();DataField.prototype.make_input=function(){var me=this;this.input=$a_input(this.input_area,this.df.fieldtype=='Password'?'password':'text');this.get_value=function(){var v=this.input.value;if(this.validate) v=this.validate(v);return v;} -this.input.name=this.df.fieldname;$(this.input).change(function(){me.set_value(me.get_value&&me.get_value()||$(this.input).val());});this.set_value=function(val){if(!me.last_value)me.last_value='';if(me.validate){val=me.validate(val);me.input.value=val;} +this.input.name=this.df.fieldname;$(this.input).change(function(){me.set_value(me.get_value&&me.get_value()||$(this.input).val());});this.set_value=function(val){if(!me.last_value)me.last_value='';if(me.validate){val=me.validate(val);me.input.value=val==undefined?'':val;} me.set(val);if(me.format_input) me.format_input();if(in_list(['Currency','Float','Int'],me.df.fieldtype)){if(flt(me.last_value)==flt(val)){me.last_value=val;return;}} me.last_value=val;me.run_trigger();} @@ -1530,7 +1530,7 @@ if(this.txt){try{this.txt.focus();}catch(e){} this.txt.field_object=this;}} function DataField(){}DataField.prototype=new Field();DataField.prototype.make_input=function(){var me=this;this.input=$a_input(this.input_area,this.df.fieldtype=='Password'?'password':'text');this.get_value=function(){var v=this.input.value;if(this.validate) v=this.validate(v);return v;} -this.input.name=this.df.fieldname;$(this.input).change(function(){me.set_value(me.get_value&&me.get_value()||$(this.input).val());});this.set_value=function(val){if(!me.last_value)me.last_value='';if(me.validate){val=me.validate(val);me.input.value=val;} +this.input.name=this.df.fieldname;$(this.input).change(function(){me.set_value(me.get_value&&me.get_value()||$(this.input).val());});this.set_value=function(val){if(!me.last_value)me.last_value='';if(me.validate){val=me.validate(val);me.input.value=val==undefined?'':val;} me.set(val);if(me.format_input) me.format_input();if(in_list(['Currency','Float','Int'],me.df.fieldtype)){if(flt(me.last_value)==flt(val)){me.last_value=val;return;}} me.last_value=val;me.run_trigger();} From 5a774db02165d9fd730e0dc82a8d23128c5542d0 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Fri, 4 May 2012 10:02:09 +0530 Subject: [PATCH 2/4] delivery, not and sales_bom --- .../doctype/delivery_note/delivery_note.py | 2 +- erpnext/stock/doctype/sales_bom/sales_bom.js | 4 +- erpnext/stock/doctype/sales_bom/sales_bom.py | 9 ++--- erpnext/stock/doctype/sales_bom/sales_bom.txt | 37 +++++++++++-------- js/all-app.js | 2 +- 5 files changed, 31 insertions(+), 23 deletions(-) diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.py b/erpnext/stock/doctype/delivery_note/delivery_note.py index 51c123c936..445e93b883 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 f7f6e4d3a4..7d857a2063 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 f2921646dd..7dea6922e1 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 dfc2a6547d..29fcd3142f 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 05b7938c55..0f36858a75 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();} From 7f5791ba1e1a23ea3f366602e3d38dbf8b97f9d2 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Fri, 4 May 2012 10:10:30 +0530 Subject: [PATCH 3/4] jv, search fix --- .../accounts/doctype/journal_voucher/journal_voucher.txt | 8 ++++---- js/all-app.js | 6 +++--- js/all-web.js | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/erpnext/accounts/doctype/journal_voucher/journal_voucher.txt b/erpnext/accounts/doctype/journal_voucher/journal_voucher.txt index 09b41dfd52..36567e3743 100644 --- a/erpnext/accounts/doctype/journal_voucher/journal_voucher.txt +++ b/erpnext/accounts/doctype/journal_voucher/journal_voucher.txt @@ -3,9 +3,9 @@ # These values are common in all dictionaries { - 'creation': '2012-04-30 12:08:36', + 'creation': '2012-05-01 17:10:24', 'docstatus': 0, - 'modified': '2012-04-30 15:59:52', + 'modified': '2012-05-04 10:05:25', 'modified_by': u'Administrator', 'owner': u'Administrator' }, @@ -521,11 +521,11 @@ 'doctype': u'DocField', 'fieldname': u'pay_to_recd_from', 'fieldtype': u'Data', - 'hidden': 1, + 'hidden': 0, 'label': u'Pay To / Recd From', 'no_copy': 1, 'permlevel': 0, - 'print_hide': 1, + 'print_hide': 0, 'report_hide': 1 }, diff --git a/js/all-app.js b/js/all-app.js index f2b9a15ee3..09a302013d 100644 --- a/js/all-app.js +++ b/js/all-app.js @@ -331,8 +331,8 @@ if(this.onrun)this.onrun();if(this.callback)this.callback(r);},render_list:funct /* * lib/js/wn/ui/filters.js */ -wn.ui.FilterList=Class.extend({init:function(opts){wn.require('lib/js/legacy/widgets/form/fields.js');$.extend(this,opts);this.filters=[];this.$w=this.$parent;this.set_events();},set_events:function(){var me=this;this.$w.find('.add-filter-btn').bind('click',function(){me.add_filter();});},show_filters:function(){this.$w.find('.show_filters').slideToggle();if(!this.filters.length) -this.add_filter();},add_filter:function(fieldname,condition,value){this.filters.push(new wn.ui.Filter({flist:this,fieldname:fieldname,condition:condition,value:value}));if(fieldname){this.$w.find('.show_filters').slideDown();}},get_filters:function(){var values=[];$.each(this.filters,function(i,f){if(f.field) +wn.ui.FilterList=Class.extend({init:function(opts){wn.require('lib/js/legacy/widgets/form/fields.js');$.extend(this,opts);this.filters=[];this.$w=this.$parent;this.set_events();},set_events:function(){var me=this;this.$w.find('.add-filter-btn').bind('click',function(){me.add_filter();});},show_filters:function(){this.$w.find('.show_filters').toggle();if(!this.filters.length) +this.add_filter();},add_filter:function(fieldname,condition,value){this.filters.push(new wn.ui.Filter({flist:this,fieldname:fieldname,condition:condition,value:value}));if(fieldname){this.$w.find('.show_filters').toggle(true);}},get_filters:function(){var values=[];$.each(this.filters,function(i,f){if(f.field) values.push(f.get_value());}) return values;},update_filters:function(){var fl=[];$.each(this.filters,function(i,f){if(f.field)fl.push(f);}) this.filters=fl;},get_filter:function(fieldname){for(var i in this.filters){if(this.filters[i].field.df.fieldname==fieldname) @@ -1045,7 +1045,7 @@ $(me.loading_img).toggle(false);}});this.make();} /* * lib/js/wn/ui/search.js */ -wn.ui.Search=Class.extend({init:function(opts){$.extend(this,opts);var me=this;wn.model.with_doctype(this.doctype,function(r){me.make();me.dialog.show();});},make:function(){var me=this;this.dialog=new wn.ui.Dialog({title:this.doctype+' Search',width:500});this.list=new wn.ui.Listing({parent:$(this.dialog.body),appframe:this.dialog.appframe,new_doctype:this.doctype,doctype:this.doctype,method:'webnotes.widgets.doclistview.get',show_filters:true,style:'compact',get_args:function(){if(me.query){me.page_length=50;return{query:me.query}}else{return{doctype:me.doctype,fields:['`tab'+me.doctype+'`.name'],filters:me.list.filter_list.get_filters(),docstatus:['0','1']}}},render_row:function(parent,data){$ln=$('' +wn.ui.Search=Class.extend({init:function(opts){$.extend(this,opts);var me=this;wn.model.with_doctype(this.doctype,function(r){me.make();me.dialog.show();me.list.$w.find('.list-filters input[type="text"]').focus();});},make:function(){var me=this;this.dialog=new wn.ui.Dialog({title:this.doctype+' Search',width:500});this.list=new wn.ui.Listing({parent:$(this.dialog.body),appframe:this.dialog.appframe,new_doctype:this.doctype,doctype:this.doctype,method:'webnotes.widgets.doclistview.get',show_filters:true,style:'compact',get_args:function(){if(me.query){me.page_length=50;return{query:me.query}}else{return{doctype:me.doctype,fields:['`tab'+me.doctype+'`.name'],filters:me.list.filter_list.get_filters(),docstatus:['0','1']}}},render_row:function(parent,data){$ln=$('' +data.name+'').appendTo(parent).click(function(){var val=$(this).attr('data-name');me.dialog.hide();if(me.callback) me.callback(val);else wn.set_route('Form',me.doctype,val);});}});this.list.filter_list.add_filter('name','like');this.list.run();}}) diff --git a/js/all-web.js b/js/all-web.js index 2430e89507..f90f6148bc 100644 --- a/js/all-web.js +++ b/js/all-web.js @@ -218,8 +218,8 @@ if(this.onrun)this.onrun();if(this.callback)this.callback(r);},render_list:funct /* * lib/js/wn/ui/filters.js */ -wn.ui.FilterList=Class.extend({init:function(opts){wn.require('lib/js/legacy/widgets/form/fields.js');$.extend(this,opts);this.filters=[];this.$w=this.$parent;this.set_events();},set_events:function(){var me=this;this.$w.find('.add-filter-btn').bind('click',function(){me.add_filter();});},show_filters:function(){this.$w.find('.show_filters').slideToggle();if(!this.filters.length) -this.add_filter();},add_filter:function(fieldname,condition,value){this.filters.push(new wn.ui.Filter({flist:this,fieldname:fieldname,condition:condition,value:value}));if(fieldname){this.$w.find('.show_filters').slideDown();}},get_filters:function(){var values=[];$.each(this.filters,function(i,f){if(f.field) +wn.ui.FilterList=Class.extend({init:function(opts){wn.require('lib/js/legacy/widgets/form/fields.js');$.extend(this,opts);this.filters=[];this.$w=this.$parent;this.set_events();},set_events:function(){var me=this;this.$w.find('.add-filter-btn').bind('click',function(){me.add_filter();});},show_filters:function(){this.$w.find('.show_filters').toggle();if(!this.filters.length) +this.add_filter();},add_filter:function(fieldname,condition,value){this.filters.push(new wn.ui.Filter({flist:this,fieldname:fieldname,condition:condition,value:value}));if(fieldname){this.$w.find('.show_filters').toggle(true);}},get_filters:function(){var values=[];$.each(this.filters,function(i,f){if(f.field) values.push(f.get_value());}) return values;},update_filters:function(){var fl=[];$.each(this.filters,function(i,f){if(f.field)fl.push(f);}) this.filters=fl;},get_filter:function(fieldname){for(var i in this.filters){if(this.filters[i].field.df.fieldname==fieldname) From f9c766ad3a1786dba7e7aa34a8937d3138cf11e6 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Fri, 4 May 2012 11:41:57 +0530 Subject: [PATCH 4/4] login-topbar id fix --- erpnext/website/js/topbar.js | 2 +- js/all-web.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/website/js/topbar.js b/erpnext/website/js/topbar.js index b093faab5d..24af3e95c7 100644 --- a/erpnext/website/js/topbar.js +++ b/erpnext/website/js/topbar.js @@ -40,7 +40,7 @@ erpnext.navbar.Navbar = Class.extend({ \ \ \ \ \ diff --git a/js/all-web.js b/js/all-web.js index f90f6148bc..24ee8f4aaf 100644 --- a/js/all-web.js +++ b/js/all-web.js @@ -879,7 +879,7 @@ wn.provide('erpnext.navbar');erpnext.navbar.Navbar=Class.extend({init:function() \ \ \ \ \