From db0df4fd53a3653601cad151bcdf11e7a2361af7 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 17 Feb 2012 15:55:51 +0530 Subject: [PATCH 1/3] over-wrinting of child tables data in import_data --- .../setup/page/import_data/import_data.html | 30 ++++++++++++------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/erpnext/setup/page/import_data/import_data.html b/erpnext/setup/page/import_data/import_data.html index d227c2c0be..5f9556b5af 100644 --- a/erpnext/setup/page/import_data/import_data.html +++ b/erpnext/setup/page/import_data/import_data.html @@ -10,7 +10,7 @@

Step 1. Download Template

-
Over-write records with same name?
+
Do you want to over-write records?
Warning: Over-writing the data of child tables, will delete all old data. For more info see below

Step 2. Upload and Import

@@ -33,23 +33,31 @@
-

Data Import Guide

-
    -
  1. Get the template of the DocType for which you want to import in CSV (Comma seperated values) format.
  2. -
  3. Fill in the data in the template. You can remove columns that are not relevant
  4. -
  5. Save the template in CSV format
  6. -
  7. Select the saved CSV file, identify the date format if any
  8. -
  9. Click on "Import"
  10. -
+

Data Import Guide

+
    +
  1. Get the template of the DocType for which you want to import in CSV (Comma seperated values) format.
  2. +
  3. Fill in the data in the template. You can remove columns that are not relevant
  4. +
  5. Save the template in CSV format
  6. +
  7. Select the saved CSV file, identify the date format if any
  8. +
  9. Click on "Import"
  10. +
+

Over-writing Guide

+
    +
  1. To over-write data, click on "Do you want to over-write records?" and then download template
  2. +
  3. To over-write parent table data, mention existing ID in "Name" column
  4. +
  5. Over-writing of child table data will delete all previous data of child table and re-import. so before over-writing child tables, export all data from system, modify them and then re-import
  6. +
  7. Over-write checkbox will be checked while importing
  8. +
+

Import Log:

- +
- \ No newline at end of file + From 13531b73eb35e4a880a58c16ac28ca7838e7bd7a Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Mon, 20 Feb 2012 12:35:23 +0530 Subject: [PATCH 2/3] form bugfix and otehr minor fixes --- css/all-web.css | 8 +++--- erpnext/website/css/website.css | 8 +++--- .../website_settings/website_settings.js | 28 +++++++++++++++++++ index.cgi | 2 +- js/all-app.js | 9 +++--- js/all-web.js | 7 +++-- version.num | 2 +- 7 files changed, 47 insertions(+), 17 deletions(-) create mode 100644 erpnext/website/doctype/website_settings/website_settings.js diff --git a/css/all-web.css b/css/all-web.css index f576a1a06c..33501000a6 100644 --- a/css/all-web.css +++ b/css/all-web.css @@ -1079,14 +1079,14 @@ header .topbar .container { margin: auto; } -.web-head-section { - margin-bottom: 20px -} - .web-content input[type="text"], .web-content input[type="password"], .web-content select { min-width: 180px; } +.web-head-section { + margin-bottom: 20px +} + .web-main-section { width: 65%; float: left; diff --git a/erpnext/website/css/website.css b/erpnext/website/css/website.css index 6c891306c8..9fd7f12a7d 100644 --- a/erpnext/website/css/website.css +++ b/erpnext/website/css/website.css @@ -39,14 +39,14 @@ header .topbar .container { margin: auto; } -.web-head-section { - margin-bottom: 20px -} - .web-content input[type="text"], .web-content input[type="password"], .web-content select { min-width: 180px; } +.web-head-section { + margin-bottom: 20px +} + .web-main-section { width: 65%; float: left; diff --git a/erpnext/website/doctype/website_settings/website_settings.js b/erpnext/website/doctype/website_settings/website_settings.js new file mode 100644 index 0000000000..9aaba62165 --- /dev/null +++ b/erpnext/website/doctype/website_settings/website_settings.js @@ -0,0 +1,28 @@ +// update parent select + +$.extend(cur_frm.cscript, { + + onload_post_render: function(doc) { + // get labels of parent items + var get_parent_options = function(table_field) { + var items = getchildren('Top Bar Item', doc.name, table_field); + var main_items = ['']; + for(var i in items) { + var d = items[i]; + if(!d.parent_label) { + main_items.push(d.label); + } + } + return main_items.join('\n'); + } + + // bind function to refresh fields + // when "Parent Label" is select, it + // should automatically update + // options + $(cur_frm.fields_dict['top_bar_items'].grid.get_field('parent_label').wrapper) + .bind('refresh', function() { + this.fieldobj.refresh_options(get_parent_options('top_bar_items')); + }); + } +}); \ No newline at end of file diff --git a/index.cgi b/index.cgi index d618250ae4..686ce057fc 100755 --- a/index.cgi +++ b/index.cgi @@ -24,7 +24,7 @@ def init(): webnotes.http_request = webnotes.auth.HTTPRequest() except webnotes.AuthenticationError, e: pass - except webnotes.defs.IllegalDomainException, e: + except webnotes.UnknownDomainError, e: print "Location: " + (webnotes.defs.redirect_404) def respond(): diff --git a/js/all-app.js b/js/all-app.js index 2b03e1fe18..839b8ef6c0 100644 --- a/js/all-app.js +++ b/js/all-app.js @@ -216,13 +216,14 @@ throw new SyntaxError('JSON.parse');};}}()); /* * lib/js/core.js */ +if(!console){var console={log:function(txt){errprint(txt);}}} wn.versions.check();$(document).bind('ready',function(){var base=window.location.href.split('#')[0];$.each($('a[softlink!="false"]'),function(i,v){if(v.href.substr(0,base.length)==base){var path=(v.href.substr(base.length));if(path.substr(0,1)!='#'){v.href=base+'#'+path;}}});if(!wn.settings.no_history&&window.location.hash){wn.page.set(window.location.hash.substr(1));}}); /* * lib/js/legacy/globals.js */ wn.provide('wn.widgets.form');wn.provide('wn.widgets.report');wn.provide('wn.utils');wn.provide('wn.model');wn.provide('wn.profile');wn.provide('wn.session');wn.provide('_f');wn.provide('_p');wn.provide('_r');wn.provide('_c');wn.provide('_e');wn.provide('_startup_data') wn.settings.no_history=1;var NEWLINE='\n';var login_file='';var version='v170';var profile=null;var session={};var is_testing=false;var user=null;var user_defaults=null;var user_roles=null;var user_fullname=null;var user_email=null;var user_img={};var home_page=null;var hide_autosuggest=null;var page_body=null;var pscript={};var selector=null;var top_index=91;var _f={};var _p={};var _e={};var _r={};var FILTER_SEP='\1';var _c={};var widget_files={'_f.FrmContainer':'form.compressed.js','_c.CalendarPopup':'widgets/form/date_picker.js','_r.ReportContainer':'report.compressed.js','_p.PrintQuery':'widgets/print_query.js','Calendar':'widgets/calendar.js','Recommendation':'widgets/recommend.js','RatingWidget':'widgets/rating.js'} -var frms={};var cur_frm=null;var pscript={};var validated=true;var validation_message='';var tinymce_loaded=null;var cur_autosug=null;if(!console){var console={log:function(txt){errprint(txt);}}} +var frms={};var cur_frm=null;var pscript={};var validated=true;var validation_message='';var tinymce_loaded=null;var cur_autosug=null; /* * lib/js/legacy/utils/datatype.js */ @@ -935,9 +936,9 @@ this.show=function(){$ds(me.ldiv);}} /* * lib/js/legacy/webpage/page_header.js */ -var def_ph_style={wrapper:{marginBottom:'16px',backgroundColor:'#EEE'},main_heading:{},sub_heading:{marginBottom:'8px',color:'#555',display:'none'},separator:{borderTop:'3px solid #444'},toolbar_area:{padding:'3px 0px',display:'none',borderBottom:'1px solid #AAA'}} +var def_ph_style={wrapper:{marginBottom:'16px',backgroundColor:'#EEE'},main_heading:{},sub_heading:{marginBottom:'8px',color:'#555',display:'none'},separator:{borderTop:'3px solid #777'},toolbar_area:{padding:'3px 0px',display:'none',borderBottom:'1px solid #AAA'}} function PageHeader(parent,main_text,sub_text){this.wrapper=$a(parent,'div','page_header');this.t1=make_table($a(this.wrapper,'div','',def_ph_style.wrapper.backgroundColor),1,2,'100%',[null,'100px'],{padding:'2px'});$y(this.t1,{borderCollapse:'collapse'}) -this.lhs=$td(this.t1,0,0);this.main_head=$a(this.lhs,'h1','',def_ph_style.main_heading);this.sub_head=$a(this.lhs,'h4','',def_ph_style.sub_heading);this.separator=$a(this.wrapper,'div','',def_ph_style.separator);this.toolbar_area=$a(this.wrapper,'div','',def_ph_style.toolbar_area);this.padding_area=$a(this.wrapper,'div','',{padding:'3px'});$y($td(this.t1,0,1),{textAlign:'right',padding:'3px'});this.close_btn=$a($td(this.t1,0,1),'span','close',{},'×');this.close_btn.onclick=function(){nav_obj.show_last_open();};if(main_text)this.main_head.innerHTML=main_text;if(sub_text)this.sub_head.innerHTML=sub_text;this.buttons={};this.buttons2={};} +this.lhs=$td(this.t1,0,0);this.main_head=$a(this.lhs,'h1','',def_ph_style.main_heading);this.sub_head=$a(this.lhs,'h4','',def_ph_style.sub_heading);this.separator=$a(this.wrapper,'div','',def_ph_style.separator);this.toolbar_area=$a(this.wrapper,'div','',def_ph_style.toolbar_area);this.padding_area=$a(this.wrapper,'div','',{padding:'3px'});$y($td(this.t1,0,1),{textAlign:'right',padding:'3px'});this.close_btn=$a($td(this.t1,0,1),'span','close',{},'×');this.close_btn.onclick=function(){nav_obj.show_last_open();};if(main_text)this.main_head.innerHTML=main_text;if(sub_text)this.sub_head.innerHTML=sub_text;this.buttons={};this.buttons2={};} PageHeader.prototype.add_button=function(label,fn,bold,icon,green){var tb=this.toolbar_area;if(this.buttons[label])return;var btn=$btn(tb,label,fn,{marginRight:'4px'},(green?'primary':''));if(bold)$y(btn,{fontWeight:'bold'});this.buttons[label]=btn;$ds(this.toolbar_area);return btn;} PageHeader.prototype.clear_toolbar=function(){this.toolbar_area.innerHTML='';this.buttons={};} PageHeader.prototype.make_buttonset=function(){$(this.toolbar_area).buttonset();} @@ -1979,7 +1980,7 @@ _f.FormGrid.prototype.make_columns=function(){var gl=fields_list[this.field.df.o gl.sort(function(a,b){return a.idx-b.idx});var p=this.field.perm;for(var i=0;i'+label+'';c.cur_label=label;break;}}} _f.FormGrid.prototype.refresh=function(){var docset=getchildren(this.doctype,this.field.frm.docname,this.field.df.fieldname,this.field.frm.doctype);var data=[];for(var i=0;i Date: Mon, 20 Feb 2012 13:04:36 +0530 Subject: [PATCH 3/3] delete all cancelled gl entry on account deletion --- erpnext/accounts/doctype/account/account.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/erpnext/accounts/doctype/account/account.py b/erpnext/accounts/doctype/account/account.py index 6c8003a581..4cfd64d4a1 100644 --- a/erpnext/accounts/doctype/account/account.py +++ b/erpnext/accounts/doctype/account/account.py @@ -202,7 +202,6 @@ class DocType: self.update_nsm_model() # Add curret year balance self.set_year_balance() - # Check user role for approval process # ================================================================== @@ -232,7 +231,7 @@ class DocType: # ================================================================== def check_balance_before_trash(self): if self.check_gle_exists(): - msgprint("Account with existing transaction can not be trashed", raise_exception=1) + msgprint("Account with existing transaction (Sales Invoice / Purchase Invoice / Journal Voucher) can not be trashed", raise_exception=1) if self.check_if_child_exists(): msgprint("Child account exists for this account. You can not trash this account.", raise_exception=1) @@ -247,11 +246,15 @@ class DocType: # ================================================================== def on_trash(self): # Check balance before trash - self.check_balance_before_trash() + self.check_balance_before_trash() + # rebuild tree set(self.doc,'old_parent', '') self.update_nsm_model() + # delete all cancelled gl entry of this account + sql("delete from `tabGL Entry` where account = %s and ifnull(is_cancelled, 'No') = 'Yes'", self.doc.name) + #delete Account Balance sql("delete from `tabAccount Balance` where account = %s", self.doc.name) @@ -260,6 +263,8 @@ class DocType: def on_restore(self): # rebuild tree self.update_nsm_model() + # intiate balances + self.set_year_balance() # on rename # ---------