Merge branch 'master' of github.com:webnotes/erpnext into dev

This commit is contained in:
Anand Doshi 2012-07-04 14:17:46 +05:30
commit 2cfe2d4616
12 changed files with 25 additions and 320 deletions

View File

@ -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'
}
]

View File

@ -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')

View File

@ -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"
},
]

View File

@ -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 <http://www.gnu.org/licenses/>.
# 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

View File

@ -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'
}
]

View File

@ -1,88 +0,0 @@
<div class="layout_wrapper">
<div id="di_header"></div>
<div style="margin: 8px">
<table style="border-collapse: collapse;" border="0">
<tbody>
<tr>
<td style="border: 1px solid #aaaaaa; padding: 4px; width: 60%;">
<form action="index.cgi" enctype="multipart/form-data" method="POST" target="ImportIFrame"> <input name="cmd" type="hidden" value="import_csv" />
<h3 style="background-color: #EEF; padding: 2px;">Step 1. Download Template</h3>
<select id="import_template" style="margin: 10px;"> <option>Select Master...</option> </select>
<div style="margin: 10px; margin-top: 0px;"><input name="overwrite" type="checkbox"/> Do you want to over-write records? <br><span style='color:orange'>Warning: Over-writing the data of child tables, will delete all old entries from child tables. For more info see below</span></div>
<div id="child_tab_lst"></div>
<h3 style="background-color: #EEF; padding: 2px;">Step 2. Upload and Import</h3>
<table style="width: 480px;" border="0" cellspacing="10px">
<tbody>
<tr>
<td width="200px">Select CSV File to be imported</td>
<td><input name="csv_file" type="file" /></td>
</tr>
<tr>
<td width="200px">Date format in source CSV</td>
<td><select name="dateformat"> <option value="yyyy-mm-dd">yyyy-mm-dd</option> <option value="mm/dd/yyyy">mm/dd/yyyy</option> <option value="mm/dd/yy">mm/dd/yy</option> <option value="dd-mm-yyyy">dd-mm-yyyy</option> <option value="dd/mm/yyyy">dd/mm/yyyy</option> </select></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>
<div id="import_btn"><input type="submit" value="Import" /></div>
</td>
</tr>
</tbody>
</table>
</form>
<div style="background-color: #FFE; padding: 13px; margin: 17px;">
<h3>Data Import Guide</h3>
<ol>
<li>Get the template of the DocType for which you want to import in CSV (Comma seperated values) format.</li>
<li>Fill in the data in the template. You can remove columns that are not relevant</li>
<li>Save the template in CSV format</li>
<li>Select the saved CSV file, identify the date format if any</li>
<li>Click on "Import"</li>
</ol>
<br />
<h4>Over-writing Guide</h4>
<ol>
<li>To over-write data, click on "Do you want to over-write records?" and then download template</li>
<li>To over-write parent table data, mention existing ID in "Name" column</li>
<li>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.<br>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.</li>
<li>Over-write checkbox will be checked while importing</li>
</ol>
<br />
<h4>Do you have Non-English data?</h4>
You may need to save the file with UTF-8 encoding for data to be imported correctly.
<br /><br />
Microsoft Excel Users:<br />
There is no obvious way of saving a CSV file with UTF-8 encoding.<br />
You will need to follow these steps:
<ol>
<li>In Excel, save the file in CSV (Comma Delimited) format</li>
<li>Open this saved file in Notepad</li>
<li>Click on File -&gt; Save As</li>
<li>File Name: &lt;your filename&gt;.csv<br />
Save as type: Text Documents (*.txt)<br />
Encoding: UTF-8
</li>
<li>Click on Save</li>
</ol>
<br />
OpenOffice or LibreOffice Users:<br />
<ol>
<li>While saving as CSV, check "Edit Filter Settings".</li>
<li>You will be prompted for Encoding.</li>
<li>Make sure it is "UTF-8" and click on OK.</li>
</ol>
</div>
</td>
<td style="border: 1px solid #AAA; padding: 4px;">
<h3>Import Log:</h3>
<div id="import_result_area">
<iframe name="ImportIFrame" style="border: 0px; height: 620px; width: 100%"></iframe>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>

View File

@ -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 <http://www.gnu.org/licenses/>.
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 = "<b>Download template(s) for importing "+sel_val(sel)+"</b>";
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<r.message.length;i++){
var dt= $a($td(tab,i,0), 'span', 'link_type');
dt.innerHTML = r.message[i];
dt.nm = r.message[i];
dt.onclick = function(){
var ovr = $('input[name="overwrite"]:checked').length;
window.location = wn.request.url + '?cmd=get_template&dt=' + this.nm + (ovr ? '&overwrite=1' : '');
}
}
}
);
}
}
}
// set the default (if given in url)
if(window.location.hash) {
var to_set = window.location.hash.split('/').slice(-1)[0];
if(in_list(r.message, to_set)) {
sel.value = to_set;
sel.onchange();
}
}
}
$c_obj('Import Data Control','get_master_lst','',callback);
}

View File

@ -1,72 +0,0 @@
# Page, Import Data
[
# These values are common in all dictionaries
{
'creation': '2010-12-14 10:23:18',
'docstatus': 0,
'modified': '2010-12-24 11:43:02',
'modified_by': 'Administrator',
'owner': 'Administrator'
},
# These values are common for all Page
{
'doctype': 'Page',
'module': 'Setup',
'name': '__common__',
'page_name': 'Import Data',
'show_in_menu': 0,
'standard': 'Yes'
},
# These values are common for all Page Role
{
'doctype': 'Page Role',
'name': '__common__',
'parent': 'Import Data',
'parentfield': 'roles',
'parenttype': 'Page'
},
# Page, Import Data
{
'doctype': 'Page',
'name': 'Import Data'
},
# Page Role
{
'doctype': 'Page Role',
'idx': 1,
'role': 'Administrator'
},
# Page Role
{
'doctype': 'Page Role',
'idx': 2,
'role': 'System Manager'
},
# Page Role
{
'doctype': 'Page Role',
'idx': 3,
'role': 'Sales Master Manager'
},
# Page Role
{
'doctype': 'Page Role',
'idx': 4,
'role': 'Purchase Master Manager'
},
# Page Role
{
'doctype': 'Page Role',
'idx': 5,
'role': 'Material Master Manager'
}
]

View File

@ -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 $('<li></li>').data('item.autocomplete',item).append(repl('<a>%(label)s<br><span style="font-size:10px">%(info)s</span></a>',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 $('<li></li>').data('item.autocomplete',item).append(repl('<a>%(label)s<br><span style="font-size:10px">%(info)s</span></a>',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);}

View File

@ -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 $('<li></li>').data('item.autocomplete',item).append(repl('<a>%(label)s<br><span style="font-size:10px">%(info)s</span></a>',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);}