From af539fa5bde1ab234374b4b840293514cfcdb774 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Tue, 3 Jul 2012 14:45:03 +0530 Subject: [PATCH 1/3] deprecate import data control --- .../deprecate_import_data_control.py | 10 +++ erpnext/patches/patch_list.py | 7 +- .../doctype/import_data_control/__init__.py | 0 .../import_data_control.py | 50 ----------- .../import_data_control.txt | 30 ------- erpnext/setup/page/import_data/__init__.py | 0 .../setup/page/import_data/import_data.html | 88 ------------------- erpnext/setup/page/import_data/import_data.js | 71 --------------- .../setup/page/import_data/import_data.txt | 72 --------------- 9 files changed, 16 insertions(+), 312 deletions(-) create mode 100644 erpnext/patches/july_2012/deprecate_import_data_control.py delete mode 100644 erpnext/setup/doctype/import_data_control/__init__.py delete mode 100644 erpnext/setup/doctype/import_data_control/import_data_control.py delete mode 100644 erpnext/setup/doctype/import_data_control/import_data_control.txt delete mode 100644 erpnext/setup/page/import_data/__init__.py delete mode 100644 erpnext/setup/page/import_data/import_data.html delete mode 100644 erpnext/setup/page/import_data/import_data.js delete mode 100644 erpnext/setup/page/import_data/import_data.txt diff --git a/erpnext/patches/july_2012/deprecate_import_data_control.py b/erpnext/patches/july_2012/deprecate_import_data_control.py new file mode 100644 index 0000000000..d0cd7de820 --- /dev/null +++ b/erpnext/patches/july_2012/deprecate_import_data_control.py @@ -0,0 +1,10 @@ +def execute(): + """ + deprecate: + * doctype - import data control + * page - import data (old) + """ + import webnotes + from webnotes.model import delete_doc + delete_doc('DocType', 'Import Data Control') + delete_doc('Page', 'Import Data') \ No newline at end of file diff --git a/erpnext/patches/patch_list.py b/erpnext/patches/patch_list.py index 0307a0fedb..ab95e9553d 100644 --- a/erpnext/patches/patch_list.py +++ b/erpnext/patches/patch_list.py @@ -481,5 +481,10 @@ patch_list = [ 'patch_module': 'patches.july_2012', 'patch_file': 'packing_list_cleanup_and_serial_no', 'description': "packing list cleanup and serial no status update" - }, + }, + { + 'patch_module': 'patches.july_2012', + 'patch_file': 'deprecate_import_data_control', + 'description': "deprecate doctype - Import Data Control and page - Import Data" + }, ] \ No newline at end of file diff --git a/erpnext/setup/doctype/import_data_control/__init__.py b/erpnext/setup/doctype/import_data_control/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/erpnext/setup/doctype/import_data_control/import_data_control.py b/erpnext/setup/doctype/import_data_control/import_data_control.py deleted file mode 100644 index 9e7461ec7e..0000000000 --- a/erpnext/setup/doctype/import_data_control/import_data_control.py +++ /dev/null @@ -1,50 +0,0 @@ -# ERPNext - web based ERP (http://erpnext.com) -# Copyright (C) 2012 Web Notes Technologies Pvt Ltd -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -# Please edit this list and import only required elements -import webnotes - -from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add -from webnotes.model import db_exists -from webnotes.model.doc import Document, addchild, getchildren, make_autoname -from webnotes.model.doclist import getlist, copy_doclist -from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax -from webnotes import session, form, is_testing, msgprint, errprint - -set = webnotes.conn.set -sql = webnotes.conn.sql -get_value = webnotes.conn.get_value -in_transaction = webnotes.conn.in_transaction -convert_to_lists = webnotes.conn.convert_to_lists - -# ----------------------------------------------------------------------------------------- - - -class DocType: - def __init__(self,d,dl): - self.doc, self.doclist = d,dl - - def get_master_lst(self): - - return [r[0] for r in sql("select name from `tabDocType` where document_type = 'Master'")] - - def get_child_lst(self,nm): - res = [nm] - - ret=sql("select options from `tabDocField` where parent='%s' and fieldtype = 'Table'"%nm) - for r in ret: - res.append(r[0]) - return res \ No newline at end of file diff --git a/erpnext/setup/doctype/import_data_control/import_data_control.txt b/erpnext/setup/doctype/import_data_control/import_data_control.txt deleted file mode 100644 index fa19e109c8..0000000000 --- a/erpnext/setup/doctype/import_data_control/import_data_control.txt +++ /dev/null @@ -1,30 +0,0 @@ -# DocType, Import Data Control -[ - - # These values are common in all dictionaries - { - 'creation': '2012-03-27 14:36:21', - 'docstatus': 0, - 'modified': '2012-03-27 14:36:21', - 'modified_by': u'Administrator', - 'owner': u'harshada@webnotestech.com' - }, - - # These values are common for all DocType - { - 'colour': u'White:FFF', - 'doctype': 'DocType', - 'issingle': 1, - 'module': u'Setup', - 'name': '__common__', - 'section_style': u'Simple', - 'server_code_error': u' ', - 'version': 12 - }, - - # DocType, Import Data Control - { - 'doctype': 'DocType', - 'name': u'Import Data Control' - } -] \ No newline at end of file diff --git a/erpnext/setup/page/import_data/__init__.py b/erpnext/setup/page/import_data/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/erpnext/setup/page/import_data/import_data.html b/erpnext/setup/page/import_data/import_data.html deleted file mode 100644 index b655442cef..0000000000 --- a/erpnext/setup/page/import_data/import_data.html +++ /dev/null @@ -1,88 +0,0 @@ -
-
-
- - - - - - - -
- -
-

Step 1. Download Template

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

Step 2. Upload and Import

- - - - - - - - - - - - - - - -
Select CSV File to be imported
Date format in source CSV
  -
-
-
-
-

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 from child table of those parents which you are importing. So before over-writing child tables, take a backup of the child table data by exporting from report builder. Re-import all rows of the child table for a particular parent.
    For example: If you want to overwrite tax rate for tax account "VAT" ifor item: ITEM001 and suppose there are 3 rows in "Item Tax" table for item : ITEM001. While overwriting the system will delete all 3 rows. So, you have to re-import all 3 rows for that item.
  6. -
  7. Over-write checkbox will be checked while importing
  8. -
-
-

Do you have Non-English data?

- You may need to save the file with UTF-8 encoding for data to be imported correctly. -

- Microsoft Excel Users:
- There is no obvious way of saving a CSV file with UTF-8 encoding.
- You will need to follow these steps: -
    -
  1. In Excel, save the file in CSV (Comma Delimited) format
  2. -
  3. Open this saved file in Notepad
  4. -
  5. Click on File -> Save As
  6. -
  7. File Name: <your filename>.csv
    - Save as type: Text Documents (*.txt)
    - Encoding: UTF-8 -
  8. -
  9. Click on Save
  10. -
-
- OpenOffice or LibreOffice Users:
-
    -
  1. While saving as CSV, check "Edit Filter Settings".
  2. -
  3. You will be prompted for Encoding.
  4. -
  5. Make sure it is "UTF-8" and click on OK.
  6. -
-
-
-

Import Log:

-
- -
-
-
-
diff --git a/erpnext/setup/page/import_data/import_data.js b/erpnext/setup/page/import_data/import_data.js deleted file mode 100644 index 734c16d6e7..0000000000 --- a/erpnext/setup/page/import_data/import_data.js +++ /dev/null @@ -1,71 +0,0 @@ -// ERPNext - web based ERP (http://erpnext.com) -// Copyright (C) 2012 Web Notes Technologies Pvt Ltd -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -pscript['onload_Import Data'] = function() { - - //alert(profile.can_get_report); - - callback = function(r,rt) { - var h = new PageHeader('di_header','Import Data','Tool to download template and upload data'); - var sel = $i('import_template'); - if(r.message){ - add_sel_options(sel, r.message); - - // please collapse here when editing :) - sel.onchange=function(){ - $i('child_tab_lst').innerHTML =''; - if(sel.value != 'Select Master...'){ - $c_obj('Import Data Control','get_child_lst',sel.value, - function(r,rt){ - var me = this; - $y($i('child_tab_lst'),{backgroundColor:'#EEEEEE', margin: '17px 17px', padding: '13px'}) - var desc = $a($i('child_tab_lst'), 'div', '', {padding:'4px'}); - - desc.innerHTML = "Download template(s) for importing "+sel_val(sel)+""; - - - var parent = $a($i('child_tab_lst'), 'div'); - var tab = make_table(parent,r.message.length,1,'100%',[],{padding:'3px',borderCollapse: 'collapse'}); - - for(var i=0;i Date: Wed, 4 Jul 2012 13:30:13 +0530 Subject: [PATCH 2/3] changed label of included in print rate to Is this Tax included in Basic Rate? --- .../sales_taxes_and_charges.txt | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/erpnext/accounts/doctype/sales_taxes_and_charges/sales_taxes_and_charges.txt b/erpnext/accounts/doctype/sales_taxes_and_charges/sales_taxes_and_charges.txt index b8c8a5ee03..2a25a6a61e 100644 --- a/erpnext/accounts/doctype/sales_taxes_and_charges/sales_taxes_and_charges.txt +++ b/erpnext/accounts/doctype/sales_taxes_and_charges/sales_taxes_and_charges.txt @@ -3,9 +3,9 @@ # These values are common in all dictionaries { - 'creation': '2012-03-27 14:35:48', + 'creation': '2012-05-15 12:14:34', 'docstatus': 0, - 'modified': '2012-03-27 14:35:48', + 'modified': '2012-07-04 13:27:05', 'modified_by': u'Administrator', 'owner': u'Administrator' }, @@ -23,7 +23,7 @@ 'section_style': u'Tray', 'server_code_error': u' ', 'show_in_menu': 0, - 'version': 20 + 'version': 1 }, # These values are common for all DocField @@ -213,11 +213,12 @@ 'doctype': u'DocField', 'fieldname': u'included_in_print_rate', 'fieldtype': u'Check', - 'label': u'Included in Print Rate', + 'label': u'Is this Tax included in Basic Rate?', 'no_column': 0, 'no_copy': 1, 'permlevel': 0, 'print_hide': 1, - 'report_hide': 1 + 'report_hide': 1, + 'width': u'150px' } ] \ No newline at end of file From 4764e70d09e5652acc201e80daf17c1a4664aab6 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 4 Jul 2012 10:46:26 +0200 Subject: [PATCH 3/3] changed timeout to 1000ms in linkfield change event --- public/js/all-app.js | 4 ++-- public/js/fields.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/public/js/all-app.js b/public/js/all-app.js index 791c0a3f44..ecbc5c37eb 100644 --- a/public/js/all-app.js +++ b/public/js/all-app.js @@ -736,7 +736,7 @@ $(me.btn2).css('display','inline-block');else $dh(me.btn2);}} me.txt.field_object=this;me.input.set_input=function(val){if(val==undefined)val='';me.txt.value=val;} me.get_value=function(){return me.txt.value;} $(me.txt).autocomplete({source:function(request,response){wn.call({method:'webnotes.widgets.search.search_link',args:{'txt':request.term,'dt':me.df.options,'query':me.get_custom_query()},callback:function(r){response(r.results);},});},select:function(event,ui){me.set_input_value(ui.item.value);}}).data('autocomplete')._renderItem=function(ul,item){return $('
  • ').data('item.autocomplete',item).append(repl('%(label)s
    %(info)s
    ',item)).appendTo(ul);};$(this.txt).change(function(){var val=$(this).val();me.set_input_value_executed=false;if(!val){if(selector&&selector.display) -return;me.set_input_value('');}else{setTimeout(function(){if(!me.set_input_value_executed){me.set_input_value(val);}},100);}})} +return;me.set_input_value('');}else{setTimeout(function(){if(!me.set_input_value_executed){me.set_input_value(val);}},1000);}})} LinkField.prototype.get_custom_query=function(){this.set_get_query();if(this.get_query){if(cur_frm) var doc=locals[cur_frm.doctype][cur_frm.docname];return this.get_query(doc,this.doctype,this.docname);}} LinkField.prototype.setup_buttons=function(){var me=this;me.btn.onclick=function(){selector.set(me,me.df.options,me.df.label);selector.show(me.txt);} @@ -1563,7 +1563,7 @@ $(me.btn2).css('display','inline-block');else $dh(me.btn2);}} me.txt.field_object=this;me.input.set_input=function(val){if(val==undefined)val='';me.txt.value=val;} me.get_value=function(){return me.txt.value;} $(me.txt).autocomplete({source:function(request,response){wn.call({method:'webnotes.widgets.search.search_link',args:{'txt':request.term,'dt':me.df.options,'query':me.get_custom_query()},callback:function(r){response(r.results);},});},select:function(event,ui){me.set_input_value(ui.item.value);}}).data('autocomplete')._renderItem=function(ul,item){return $('
  • ').data('item.autocomplete',item).append(repl('%(label)s
    %(info)s
    ',item)).appendTo(ul);};$(this.txt).change(function(){var val=$(this).val();me.set_input_value_executed=false;if(!val){if(selector&&selector.display) -return;me.set_input_value('');}else{setTimeout(function(){if(!me.set_input_value_executed){me.set_input_value(val);}},100);}})} +return;me.set_input_value('');}else{setTimeout(function(){if(!me.set_input_value_executed){me.set_input_value(val);}},1000);}})} LinkField.prototype.get_custom_query=function(){this.set_get_query();if(this.get_query){if(cur_frm) var doc=locals[cur_frm.doctype][cur_frm.docname];return this.get_query(doc,this.doctype,this.docname);}} LinkField.prototype.setup_buttons=function(){var me=this;me.btn.onclick=function(){selector.set(me,me.df.options,me.df.label);selector.show(me.txt);} diff --git a/public/js/fields.js b/public/js/fields.js index dbd77c015a..b9dca9027e 100644 --- a/public/js/fields.js +++ b/public/js/fields.js @@ -99,7 +99,7 @@ $(me.btn2).css('display','inline-block');else $dh(me.btn2);}} me.txt.field_object=this;me.input.set_input=function(val){if(val==undefined)val='';me.txt.value=val;} me.get_value=function(){return me.txt.value;} $(me.txt).autocomplete({source:function(request,response){wn.call({method:'webnotes.widgets.search.search_link',args:{'txt':request.term,'dt':me.df.options,'query':me.get_custom_query()},callback:function(r){response(r.results);},});},select:function(event,ui){me.set_input_value(ui.item.value);}}).data('autocomplete')._renderItem=function(ul,item){return $('
  • ').data('item.autocomplete',item).append(repl('%(label)s
    %(info)s
    ',item)).appendTo(ul);};$(this.txt).change(function(){var val=$(this).val();me.set_input_value_executed=false;if(!val){if(selector&&selector.display) -return;me.set_input_value('');}else{setTimeout(function(){if(!me.set_input_value_executed){me.set_input_value(val);}},100);}})} +return;me.set_input_value('');}else{setTimeout(function(){if(!me.set_input_value_executed){me.set_input_value(val);}},1000);}})} LinkField.prototype.get_custom_query=function(){this.set_get_query();if(this.get_query){if(cur_frm) var doc=locals[cur_frm.doctype][cur_frm.docname];return this.get_query(doc,this.doctype,this.docname);}} LinkField.prototype.setup_buttons=function(){var me=this;me.btn.onclick=function(){selector.set(me,me.df.options,me.df.label);selector.show(me.txt);}