From 1732905db8154b907bccaeef92ea9e150c35004a Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 14 Mar 2012 12:04:16 +0530 Subject: [PATCH 01/14] rename dt error fixed --- erpnext/patches/jan_mar_2012/rename_dt.py | 13 ++++++++++--- wnf.py | 4 ++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/erpnext/patches/jan_mar_2012/rename_dt.py b/erpnext/patches/jan_mar_2012/rename_dt.py index 80cad952c8..368cb4fb9b 100644 --- a/erpnext/patches/jan_mar_2012/rename_dt.py +++ b/erpnext/patches/jan_mar_2012/rename_dt.py @@ -8,9 +8,13 @@ def execute(): # delete dt #------------- - deldt = ['Widget Control', 'Update Delivery Date Detail', 'Update Delivery Date', 'Tag Detail', 'Supplier rating', 'Stylesheet', 'Question Tag', 'PRO PP Detail', 'PRO Detail', 'PPW Detail', 'PF Detail', 'Personalize', 'Patch Util', 'Page Template', 'Module Def Role', 'Module Def Item', 'File Group', 'File Browser Control', 'File', 'Educational Qualifications', 'Earn Deduction Detail', 'DocType Property Setter', 'DocFormat', 'Contact Detail', 'BOM Report Detail', 'BOM Replace Utility Detail', 'BOM Replace Utility', 'Absent Days Detail', 'Activity Dashboard Control', 'Raw Materials Supplied', 'Setup Wizard Control', 'Company Group'] + del_mapper = ['Production Forecast-Production Planning Tool', 'Production Forecast-Production Plan'] + for d in del_mapper: + delete_doc('DocType Mapper', d) - for d in deldt: + del_dt = ['Widget Control', 'Update Delivery Date Detail', 'Update Delivery Date', 'Tag Detail', 'Supplier rating', 'Stylesheet', 'Question Tag', 'PRO PP Detail', 'PRO Detail', 'PPW Detail', 'PF Detail', 'Personalize', 'Patch Util', 'Page Template', 'Module Def Role', 'Module Def Item', 'File Group', 'File Browser Control', 'File', 'Educational Qualifications', 'Earn Deduction Detail', 'DocType Property Setter', 'Contact Detail', 'BOM Report Detail', 'BOM Replace Utility Detail', 'BOM Replace Utility', 'Absent Days Detail', 'Activity Dashboard Control', 'Raw Materials Supplied', 'Setup Wizard Control', 'Company Group'] # docformat + + for d in del_dt: delete_doc('DocType', d) @@ -82,7 +86,7 @@ def execute(): 'Bill Of Materials' : 'BOM', 'Appraisal Detail' : 'Appraisal Goal', 'Advance Allocation Detail' : 'Purchase Invoice Advance', - 'Advance Adjustment Detail' : 'Sales Invoice Advance' + 'Advance Adjustment Detail' : 'Sales Invoice Advance', 'Ledger Detail' : 'Multi Ledger Report Detail', 'TA Control' : 'Trend Analyzer Control', 'Sales and Purchase Return Wizard' : 'Sales and Purchase Return Tool', @@ -94,6 +98,8 @@ def execute(): } for d in rendt: + print d + ' --------> '+ rendt[d] + #rename rename('DocType', d, rendt[d], 1) @@ -105,6 +111,7 @@ def execute(): # RUN ONLY IN LOCAL ###################### + # replace dt in js/py file for extn in ['js', 'py', 'txt']: replace_code('/var/www/erpnext/', d, rendt[d], extn) diff --git a/wnf.py b/wnf.py index 463ecc41f2..3d26f5b68f 100755 --- a/wnf.py +++ b/wnf.py @@ -49,11 +49,11 @@ def search_replace_with_prompt(fpath, txt1, txt2): a = raw_input('Do you want to Change [y/n]?') if a=='y': c = c.replace(txt1, txt2) - tmp.append(c) + tmp.append(c) with open(fpath, 'w') as f: f.write(''.join(tmp)) - print colored('Updated in %s' % fpath, 'green') + print colored('Updated', 'green') def setup_options(): From 4af2c094ccb464de0ac8379078ceba5a9dcd6520 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 14 Mar 2012 12:12:23 +0530 Subject: [PATCH 02/14] rename dt error fixed --- erpnext/patches/jan_mar_2012/rename_dt.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/erpnext/patches/jan_mar_2012/rename_dt.py b/erpnext/patches/jan_mar_2012/rename_dt.py index 368cb4fb9b..b3bcc34c7e 100644 --- a/erpnext/patches/jan_mar_2012/rename_dt.py +++ b/erpnext/patches/jan_mar_2012/rename_dt.py @@ -17,10 +17,14 @@ def execute(): for d in del_dt: delete_doc('DocType', d) - + # Rename dt #------------- rendt = { + 'KRA Sheet' : 'Appraisal Template Goal' + } + + new = { 'Receivable Voucher' : 'Sales Invoice', 'RV Detail' : 'Sales Invoice Item', 'RV Tax Detail' : 'Sales Taxes and Charges', From 3ffca32ace19d4bf718cdf14a8b6c0a167d43339 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 16 Mar 2012 16:21:44 +0530 Subject: [PATCH 03/14] rename dt patch updated --- erpnext/patches/jan_mar_2012/rename_dt.py | 260 ++++++++++++++++++---- 1 file changed, 222 insertions(+), 38 deletions(-) diff --git a/erpnext/patches/jan_mar_2012/rename_dt.py b/erpnext/patches/jan_mar_2012/rename_dt.py index b3bcc34c7e..bd703a5da8 100644 --- a/erpnext/patches/jan_mar_2012/rename_dt.py +++ b/erpnext/patches/jan_mar_2012/rename_dt.py @@ -1,14 +1,74 @@ -def execute(): - import webnotes - from webnotes.model import rename, delete_doc - from webnotes.model.code import get_obj - from wnf import replace_code - import os - +import webnotes +from webnotes.model import rename, delete_doc +from webnotes.model.code import get_obj +from wnf import replace_code +from termcolor import colored +from webnotes.modules.module_manager import reload_doc +from webnotes.utils import make_esc +import os - # delete dt - #------------- - del_mapper = ['Production Forecast-Production Planning Tool', 'Production Forecast-Production Plan'] + + +def execute(): + # delete dt, mapper + delete_dt_and_mapper() + + #--------------------------------------------------- + # doctype renaming + rendt = get_dt_to_be_renamed() + # Rename dt in db + rename_in_db(rendt, 'DocType', 1) + # Upadte dt in records + update_dt_in_records(rendt) + + #--------------------------------------------------- + # Dt Mapper renaming + ren_mapper = get_mapper_to_be_renamed() + # Rename mapper in db + rename_in_db(ren_mapper, 'DocType Mapper', 0) + + #--------------------------------------------------- + # GL Mapper renaming + gl_mapper = {'Receivable Voucher': 'Sales Invoice', 'Payable Voucher': 'Purchase Invoice'} + rename_in_db(gl_mapper, 'GL Mapper', 0) + + + #--------------------------------------------------- + # remove dt label + webnotes.conn.sql("""delete from `tabDocType Label` where name in ('Ticket', 'Receivable Voucher', + 'QA Inspection Report', 'Payable Voucher', 'Manage Account', 'Indent', 'DocLayer')""") + + #--------------------------------------------------- + # Reload mapper from file + for d in ren_mapper: + mod = '_'.join(webnotes.conn.sql("select module from `tabDocType Mapper` where name = %s", ren_mapper[d])[0][0].lower().split()) + reload_doc(mod, 'DocType Mapper', ren_mapper[d]) + + # reload custom search criteria + for d in webnotes.conn.sql("""select name, module from `tabSearch Criteria` where ifnull(standard, 'Yes') = 'Yes' and ifnull(disabled, 0) = 0"""): + reload_doc(d[1], 'search_criteria', d[0]) + + # reload custom print format + for d in webnotes.conn.sql("select name, module from `tabPrint Format` where ifnull(standard, 'Yes') = 'Yes'"): + reload_doc(d[1], 'Print Format', d[0]) + + # Reload GL Mapper + for d in webnotes.conn.sql("select name from `tabGL Mapper`"): + reload_doc('accounts', 'GL Mapper', d[0]) + + #gl entry, stock ledger entry, + webnotes.conn.sql("update `tabDocField` set options =replace(options, %s, %s) where fieldtype = 'Select' and ") + select parent, fieldname from tabDocField where options like '%Receivable Voucher%' and fieldtype = 'Select' + + + + # T0-do-list + # gl mapper name + + + +def delete_dt_and_mapper(): + del_mapper = ['Production Forecast-Production Planning Tool', 'Production Forecast-Production Plan', 'Sales Order-Production Plan'] for d in del_mapper: delete_doc('DocType Mapper', d) @@ -17,12 +77,78 @@ def execute(): for d in del_dt: delete_doc('DocType', d) - - # Rename dt - #------------- + +def rename_in_db(ren_data, data_type, is_doctype): + for d in ren_data: + print colored('Renaming... ' + d + ' --> '+ ren_data[d], 'yellow') + #rename + try: + rename(data_type, d, ren_data[d], is_doctype) + except Exception, e: + print e + pass + + +def update_dt_in_records(rendt): + for d in rendt: + # Feed, property setter, search criteria, gl mapper, form 16A, naming series options, doclayer - dodtype is not mentioed in options + dt_list = webnotes.conn.sql("select parent, fieldname from tabDocField where fieldname in ('dt', 'doctype', 'doc_type', 'dt_type') and ifnull(options, '') = ''") + for dt in record_dt: + webnotes.conn.sql("update `tab%s` set %s = replace(%s, '%s', '%s') where %s = '%s'" % (dt[0], dt[1], dt[1], d, rendt[d], dt[1], d)) + + # gl mapper, gl entry + webnotes.conn.sql("update `tabGL Mapper Detail` set against_voucher_type = replace(against_voucher_type, %s, %s) where against_voucher_type like '%%%s%%'" % (d, rendt[d], d)) + webnotes.conn.sql("update `tabGL Entry` set against_voucher_type = replace(against_voucher_type, %s, %s) where against_voucher_type = '%s'" % (d, rendt[d], d)) + webnotes.conn.sql("update `tabGL Entry` set voucher_type = replace(voucher_type, %s, %s) where voucher_type = '%s'" % (d, rendt[d], d)) + + # Stock ledger entry + + # Custom fld: options + webnotes.conn.sql("update `tabCustom Field` set options = replace(options, %s, %s) where fieldtype in ('Link', 'Select')", (d, rendt[d])) + + #Property Setter: value (if property=options) + webnotes.conn.sql("update `tabProperty Setter` set value = replace(value, %s, %s) where property = 'Options'", (d, rendt[d])) + + # custom script: script + webnotes.conn.sql("update `tabCustom Script` set script = replace(script, %s, %s)", (d, rendt[d])) + + # print format: html + webnotes.conn.sql("update `tabPrint Format` set html = replace(html, %s, %s) where ifnull(standard, 'Yes') = 'No'", (d, rendt[d])) + + # custom report: doc_type, filters, columns, parent_doc_type, add_cond, add_col, add_tab, + # dis_filters, group_by, sort_by, report_script, server_script, custom_query + webnotes.conn.sql(""" + update + `tabSearch Criteria` + set + doc_type = replace(doc_type, %s, %s), + filters = replace(filters, %s, %s), + columns = replace(columns, %s, %s), + parent_doc_type = replace(parent_doc_type, %s, %s), + add_cond = replace(add_cond, %s, %s), + add_col = replace(add_col, %s, %s), + add_tab = replace(add_tab, %s, %s), + dis_filters = replace(dis_filters, %s, %s), + group_by = replace(group_by, %s, %s), + sort_by = replace(sort_by, %s, %s), + report_script = replace(report_script, %s, %s), + server_script = replace(server_script, %s, %s), + custom_query = replace(custom_query, %s, %s) + where + ifnull(standard, 'Yes') = 'No' + """, (d, rendt[d], d, rendt[d], d, rendt[d], d, rendt[d], d, rendt[d], d, rendt[d], d, rendt[d], + d, rendt[d], d, rendt[d], d, rendt[d], d, rendt[d], d, rendt[d], d, rendt[d], )) + + + + +def get_dt_to_be_renamed(): rendt = { - 'KRA Sheet' : 'Appraisal Template Goal' - } + 'Receivable Voucher' : 'Sales Invoice', + 'RV Detail' : 'Sales Invoice Item', + 'RV Tax Detail' : 'Sales Taxes and Charges', + 'Advance Adjustment Detail' : 'Sales Invoice Advance', +} new = { 'Receivable Voucher' : 'Sales Invoice', @@ -100,36 +226,94 @@ def execute(): 'Professional Training Details' : 'Employee Training', 'Previous Experience Detail' : 'Employee External Work History', } - - for d in rendt: - print d + ' --------> '+ rendt[d] - - #rename - rename('DocType', d, rendt[d], 1) - - # update txt - obj = get_obj('DocType', rendt[d]) - obj.doc.save() + return rendt - # RUN ONLY IN LOCAL - ###################### +def get_mapper_to_be_renamed(): + ren_mapper = { + 'Sales Order-Receivable Voucher' : 'Sales Order-Sales Invoice', + 'Receivable Voucher-Delivery Note' : 'Sales Invoice-Delivery Note', + 'Delivery Note-Receivable Voucher' : 'Delivery Note-Sales Invoice' + } - - # replace dt in js/py file - for extn in ['js', 'py', 'txt']: - replace_code('/var/www/erpnext/', d, rendt[d], extn) - - + ren_map = { + 'Sales Order-Receivable Voucher' : 'Sales Order-Sales Invoice', + 'Sales Order-Indent' : 'Sales Order-Purchase Request', + 'Receivable Voucher-Delivery Note' : 'Sales Invoice-Delivery Note', + 'Purchase Receipt-Payable Voucher' : 'Purchase Receipt-Purchase Invoice', + 'Purchase Order-Payable Voucher' : 'Purchase Order-Purchase Invoice', + 'Project-Receivable Voucher' : 'Project-Sales Invoice', + 'Lead-Enquiry' : 'Lead-Opportunity', + 'KRA Template-Appraisal' : 'Appraisal Template-Appraisal', + 'Indent-Purchase Order' : 'Purchase Request-Purchase Order', + 'Enquiry-Quotation' : 'Opportunity-Quotation', + 'Delivery Note-Receivable Voucher' : 'Delivery Note-Sales Invoice' + } + return ren_mapper +#-------------------------------------------------------------------------------------------------------- + +def update_local_file_system(): + """ RUN ONLY IN LOCAL""" + + # doctype renaming + rendt = get_dt_to_be_renamed() + + # replace dt in js/py file + update_file_content(rendt) + # git mv + rename_dt_files(rendt) + + + # Mapper renaming + ren_mapper = get_mapper_to_be_renamed() + + rename_mapper_files(ren_mapper) -#------TO-DO-------- -# remove dir -# git remove -# dt mapper rename -# change in gl mapper + # git rm production dt mapper + os.system('git rm -r erpnext/production/DocType\ Mapper/') + + + +def update_file_content(rendt): + for d in rendt: + for extn in ['js', 'py', 'txt']: + replace_code('/var/www/erpnext/', d, rendt[d], extn) + + +def rename_dt_files(rendt): + for d in rendt: + mod = webnotes.conn.sql("select module from tabDocType where name = %s", rendt[d])[0][0] + path = 'erpnext/' + '_'.join(mod.lower().split()) + '/doctype/' + old = '_'.join(d.lower().split()) + new = '_'.join(rendt[d].lower().split()) + + # rename old dir + os.system('git mv ' + path + old + ' ' + path + new) + print 'git mv ' + path + old + ' ' + path + new + + # rename all files in that dir + for extn in ['js', 'py', 'txt']: + if os.path.exists(path + new + '/'+ old + '.' +extn): + os.system('git mv ' + path + new + '/'+ old + '.' +extn + ' ' + path + new + '/' + new + '.' +extn) + print 'git mv ' + path + new + '/'+ old + '.' +extn + ' ' + path + new + '/' + new + '.' +extn + + +def rename_mapper_files(ren_mapper): + for d in ren_mapper: + # module + mod = '_'.join(webnotes.conn.sql("select module from `tabDocType Mapper` where name = %s", ren_mapper[d])[0][0].lower().split()) + path = 'erpnext/' + mod + '/DocType Mapper/' + + # rename old dir + esc = make_esc('$ ') + os.system('git mv ' + esc(path + d) + ' ' + esc(path + ren_mapper[d])) + print 'git mv ' + esc(path + d) + ' ' + esc(path + ren_mapper[d]) + os.system('git mv ' + esc(path + ren_mapper[d] + '/'+ d + '.' +extn) + ' ' + esc(path + ren_mapper[d] + '/' + ren_mapper[d] + '.' +extn)) + print 'git mv ' + esc(path + ren_mapper[d] + '/'+ d + '.txt') + ' ' + esc(path + ren_mapper[d] + '/' + ren_mapper[d] + '.txt') + From 19ee00b9893610d29cc4ca6879f7491ab4ad4ee8 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 16 Mar 2012 16:22:30 +0530 Subject: [PATCH 04/14] replace_code fn updated --- wnf.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/wnf.py b/wnf.py index 3d26f5b68f..428d6b0573 100755 --- a/wnf.py +++ b/wnf.py @@ -25,11 +25,12 @@ def replace_code(start, txt1, txt2, extn): for fn in wt[2]: if fn.split('.')[-1]==extn: fpath = os.path.join(wt[0], fn) - with open(fpath, 'r') as f: - content = f.read() + if fpath != '/var/www/erpnext/erpnext/patches/jan_mar_2012/rename_dt.py': # temporary + with open(fpath, 'r') as f: + content = f.read() - if re.search(txt1, content): - search_replace_with_prompt(fpath, txt1, txt2) + if re.search(txt1, content): + search_replace_with_prompt(fpath, txt1, txt2) @@ -45,9 +46,10 @@ def search_replace_with_prompt(fpath, txt1, txt2): if c.find(txt1) != -1: print '\n', fpath print colored(txt1, 'red').join(c[:-1].split(txt1)) - - a = raw_input('Do you want to Change [y/n]?') - if a=='y': + a = '' + while a not in ['y', 'n', 'Y', 'N']: + a = raw_input('Do you want to Change [y/n]?') + if a.lower() == 'y': c = c.replace(txt1, txt2) tmp.append(c) From bb6f10098edbe96f67b4f764354f5cfb23e30b71 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 26 Mar 2012 11:06:34 +0530 Subject: [PATCH 05/14] updated rename_dt --- erpnext/patches/jan_mar_2012/rename_dt.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/erpnext/patches/jan_mar_2012/rename_dt.py b/erpnext/patches/jan_mar_2012/rename_dt.py index bd703a5da8..559e8a5632 100644 --- a/erpnext/patches/jan_mar_2012/rename_dt.py +++ b/erpnext/patches/jan_mar_2012/rename_dt.py @@ -57,8 +57,6 @@ def execute(): reload_doc('accounts', 'GL Mapper', d[0]) #gl entry, stock ledger entry, - webnotes.conn.sql("update `tabDocField` set options =replace(options, %s, %s) where fieldtype = 'Select' and ") - select parent, fieldname from tabDocField where options like '%Receivable Voucher%' and fieldtype = 'Select' @@ -93,8 +91,9 @@ def update_dt_in_records(rendt): for d in rendt: # Feed, property setter, search criteria, gl mapper, form 16A, naming series options, doclayer - dodtype is not mentioed in options dt_list = webnotes.conn.sql("select parent, fieldname from tabDocField where fieldname in ('dt', 'doctype', 'doc_type', 'dt_type') and ifnull(options, '') = ''") - for dt in record_dt: - webnotes.conn.sql("update `tab%s` set %s = replace(%s, '%s', '%s') where %s = '%s'" % (dt[0], dt[1], dt[1], d, rendt[d], dt[1], d)) + print dt_list + for dt in dt_list: + webnotes.conn.sql("update `tab%s` set %s = replace(%s, '%s', '%s') where %s = '%s'" % (dt[0], dt[1], dt[1], d, rendt[d], dt[1], d), debug=1) # gl mapper, gl entry webnotes.conn.sql("update `tabGL Mapper Detail` set against_voucher_type = replace(against_voucher_type, %s, %s) where against_voucher_type like '%%%s%%'" % (d, rendt[d], d)) @@ -102,6 +101,7 @@ def update_dt_in_records(rendt): webnotes.conn.sql("update `tabGL Entry` set voucher_type = replace(voucher_type, %s, %s) where voucher_type = '%s'" % (d, rendt[d], d)) # Stock ledger entry + webnotes.conn.sql("update `tabStock ledger Entry` set voucher_type = replace(voucher_type, %s, %s) where voucher_type = '%s'" % (d, rendt[d], d)) # Custom fld: options webnotes.conn.sql("update `tabCustom Field` set options = replace(options, %s, %s) where fieldtype in ('Link', 'Select')", (d, rendt[d])) @@ -143,14 +143,14 @@ def update_dt_in_records(rendt): def get_dt_to_be_renamed(): - rendt = { + """rendt = { 'Receivable Voucher' : 'Sales Invoice', 'RV Detail' : 'Sales Invoice Item', 'RV Tax Detail' : 'Sales Taxes and Charges', 'Advance Adjustment Detail' : 'Sales Invoice Advance', -} +}""" - new = { + rendt = { 'Receivable Voucher' : 'Sales Invoice', 'RV Detail' : 'Sales Invoice Item', 'RV Tax Detail' : 'Sales Taxes and Charges', @@ -230,11 +230,11 @@ def get_dt_to_be_renamed(): def get_mapper_to_be_renamed(): - ren_mapper = { + """ren_mapper = { 'Sales Order-Receivable Voucher' : 'Sales Order-Sales Invoice', 'Receivable Voucher-Delivery Note' : 'Sales Invoice-Delivery Note', 'Delivery Note-Receivable Voucher' : 'Delivery Note-Sales Invoice' - } + }""" ren_map = { 'Sales Order-Receivable Voucher' : 'Sales Order-Sales Invoice', From 6ed0450dba393b53991b602695f156b5b847501b Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 28 Mar 2012 11:32:44 +0530 Subject: [PATCH 06/14] reload mapper for checking ref value --- .../Delivery Note-Receivable Voucher.txt | 12 +++++++++++- .../Sales Order-Receivable Voucher.txt | 12 +++++++++++- erpnext/patches/jan_mar_2012/reload_mapper.py | 7 +++++++ erpnext/patches/patch_list.py | 5 +++++ .../Sales Order-Delivery Note.txt | 6 +++--- 5 files changed, 37 insertions(+), 5 deletions(-) create mode 100644 erpnext/patches/jan_mar_2012/reload_mapper.py diff --git a/erpnext/accounts/DocType Mapper/Delivery Note-Receivable Voucher/Delivery Note-Receivable Voucher.txt b/erpnext/accounts/DocType Mapper/Delivery Note-Receivable Voucher/Delivery Note-Receivable Voucher.txt index 9ed756f023..185af99c26 100644 --- a/erpnext/accounts/DocType Mapper/Delivery Note-Receivable Voucher/Delivery Note-Receivable Voucher.txt +++ b/erpnext/accounts/DocType Mapper/Delivery Note-Receivable Voucher/Delivery Note-Receivable Voucher.txt @@ -134,6 +134,16 @@ 'to_field': 'serial_no' }, + # Field Mapper Detail + { + 'checking_operator': u'=', + 'doctype': u'Field Mapper Detail', + 'from_field': u'export_rate', + 'map': u'Yes', + 'match_id': 1, + 'to_field': u'export_rate' + }, + # Table Mapper Detail { 'doctype': 'Table Mapper Detail', @@ -186,4 +196,4 @@ 'to_table': 'Sales Team', 'validation_logic': 'name is not null' } -] \ No newline at end of file +] diff --git a/erpnext/accounts/DocType Mapper/Sales Order-Receivable Voucher/Sales Order-Receivable Voucher.txt b/erpnext/accounts/DocType Mapper/Sales Order-Receivable Voucher/Sales Order-Receivable Voucher.txt index 630fb1502a..fb180ff1f8 100644 --- a/erpnext/accounts/DocType Mapper/Sales Order-Receivable Voucher/Sales Order-Receivable Voucher.txt +++ b/erpnext/accounts/DocType Mapper/Sales Order-Receivable Voucher/Sales Order-Receivable Voucher.txt @@ -136,6 +136,16 @@ 'to_field': 'incentives' }, + # Field Mapper Detail + { + 'checking_operator': u'=', + 'doctype': u'Field Mapper Detail', + 'from_field': u'export_rate', + 'map': u'Yes', + 'match_id': 1, + 'to_field': u'export_rate' + }, + # Table Mapper Detail { 'doctype': 'Table Mapper Detail', @@ -188,4 +198,4 @@ 'to_table': 'Sales Team', 'validation_logic': 'name is not null' } -] \ No newline at end of file +] diff --git a/erpnext/patches/jan_mar_2012/reload_mapper.py b/erpnext/patches/jan_mar_2012/reload_mapper.py new file mode 100644 index 0000000000..3a43d871b9 --- /dev/null +++ b/erpnext/patches/jan_mar_2012/reload_mapper.py @@ -0,0 +1,7 @@ +def execute(): + import webnotes + from webnotes.modules.module_manager import reload_doc + + reload_doc('stock', 'DocType Mapper', 'Sales Order-Delivery Note') + reload_doc('accounts', 'DocType Mapper', 'Sales Order-Receivable Voucher') + reload_doc('accounts', 'DocType Mapper', 'Delivery Note-Receivable Voucher') diff --git a/erpnext/patches/patch_list.py b/erpnext/patches/patch_list.py index 3bf4b6a3ae..247f5d88ea 100644 --- a/erpnext/patches/patch_list.py +++ b/erpnext/patches/patch_list.py @@ -207,5 +207,10 @@ patch_list = [ 'patch_file': 'update_se_fld_options', 'description': 'Purpose SE: Others to Other' }, + { + 'patch_module': 'patches.jan_mar_2012', + 'patch_file': 'reload_mapper', + 'description': 'SO-DN, SO-Rv, DN-RV' + }, ] diff --git a/erpnext/stock/DocType Mapper/Sales Order-Delivery Note/Sales Order-Delivery Note.txt b/erpnext/stock/DocType Mapper/Sales Order-Delivery Note/Sales Order-Delivery Note.txt index fcadcd4245..43e800fef3 100644 --- a/erpnext/stock/DocType Mapper/Sales Order-Delivery Note/Sales Order-Delivery Note.txt +++ b/erpnext/stock/DocType Mapper/Sales Order-Delivery Note/Sales Order-Delivery Note.txt @@ -131,10 +131,10 @@ { 'checking_operator': u'=', 'doctype': u'Field Mapper Detail', - 'from_field': u'basic_rate', + 'from_field': u'export_rate', 'map': u'Yes', 'match_id': 1, - 'to_field': u'basic_rate' + 'to_field': u'export_rate' }, # Field Mapper Detail @@ -264,4 +264,4 @@ 'to_table': u'Delivery Note', 'validation_logic': u'docstatus = 1' } -] \ No newline at end of file +] From 13f789701efeb273de65985fbbaa07a3b0bfbb88 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 28 Mar 2012 11:33:25 +0530 Subject: [PATCH 07/14] erro fixed in reorder_item --- erpnext/stock/doctype/bin/bin.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/erpnext/stock/doctype/bin/bin.py b/erpnext/stock/doctype/bin/bin.py index dc847f6f6a..de2d1315c4 100644 --- a/erpnext/stock/doctype/bin/bin.py +++ b/erpnext/stock/doctype/bin/bin.py @@ -337,12 +337,12 @@ class DocType: and t1.docstatus != 2 """, self.doc.item_code) - if ((flt(ret[0]['re_order_level']) > flt(current_qty)) and ret[0]['re_order_level']): - self.create_auto_indent(ret[0], doc_type, doc_name) + if ((flt(ret[0]['re_order_level']) > flt(current_qty[0][0])) and ret[0]['re_order_level']): + self.create_auto_indent(ret[0], doc_type, doc_name, current_qty[0][0]) - def create_auto_indent(self, i , doc_type, doc_name): + def create_auto_indent(self, i , doc_type, doc_name, cur_qty): """ Create indent on reaching reorder level """ indent = Document('Indent') @@ -361,7 +361,7 @@ class DocType: indent_details_child.item_name = i['item_name'] indent_details_child.description = i['description'] indent_details_child.item_group = i['item_group'] - indent_details_child.qty = i['re_order_qty'] + indent_details_child.qty = i['re_order_qty'] or (flt(i['re_order_level']) - flt(cur_qty)) indent_details_child.brand = i['brand'] indent_details_child.save() indent_obj = get_obj('Indent',indent.name,with_children=1) From 5b00addaf777cbf708ba58f969ee676d36dee726 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 28 Mar 2012 11:38:25 +0530 Subject: [PATCH 08/14] reload mapper for checking ref value --- erpnext/patches/jan_mar_2012/reload_mapper.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/erpnext/patches/jan_mar_2012/reload_mapper.py b/erpnext/patches/jan_mar_2012/reload_mapper.py index 3a43d871b9..a6e3102bba 100644 --- a/erpnext/patches/jan_mar_2012/reload_mapper.py +++ b/erpnext/patches/jan_mar_2012/reload_mapper.py @@ -5,3 +5,5 @@ def execute(): reload_doc('stock', 'DocType Mapper', 'Sales Order-Delivery Note') reload_doc('accounts', 'DocType Mapper', 'Sales Order-Receivable Voucher') reload_doc('accounts', 'DocType Mapper', 'Delivery Note-Receivable Voucher') + + webnotes.conn.sql("delete from `tabField Mapper Detail` where parent = 'Sales Order-Delivery Note' and from_field = 'basic_rate' and to_field = 'basic_rate'") From e6340f26c2861545dfffb61177a2b9170d598101 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 28 Mar 2012 14:11:31 +0530 Subject: [PATCH 09/14] mapper fix in DN_RV --- .../Delivery Note-Receivable Voucher.txt | 11 ----------- erpnext/patches/jan_mar_2012/mapper_fix.py | 3 +++ erpnext/patches/patch_list.py | 5 +++++ 3 files changed, 8 insertions(+), 11 deletions(-) create mode 100644 erpnext/patches/jan_mar_2012/mapper_fix.py diff --git a/erpnext/accounts/DocType Mapper/Delivery Note-Receivable Voucher/Delivery Note-Receivable Voucher.txt b/erpnext/accounts/DocType Mapper/Delivery Note-Receivable Voucher/Delivery Note-Receivable Voucher.txt index 185af99c26..7a4544fff8 100644 --- a/erpnext/accounts/DocType Mapper/Delivery Note-Receivable Voucher/Delivery Note-Receivable Voucher.txt +++ b/erpnext/accounts/DocType Mapper/Delivery Note-Receivable Voucher/Delivery Note-Receivable Voucher.txt @@ -153,17 +153,6 @@ 'validation_logic': 'docstatus=1' }, - # Table Mapper Detail - { - 'doctype': 'Table Mapper Detail', - 'from_field': 'delivery_note_details', - 'from_table': 'Delivery Note Detail', - 'match_id': 1, - 'to_field': 'entries', - 'to_table': 'RV Detail', - 'validation_logic': 'amount > ifnull(billed_amt, 0) and docstatus = 1' - }, - # Table Mapper Detail { 'doctype': 'Table Mapper Detail', diff --git a/erpnext/patches/jan_mar_2012/mapper_fix.py b/erpnext/patches/jan_mar_2012/mapper_fix.py new file mode 100644 index 0000000000..c651c5ed74 --- /dev/null +++ b/erpnext/patches/jan_mar_2012/mapper_fix.py @@ -0,0 +1,3 @@ +def execute(): + import webnotes + webnotes.conn.sql("delete from `tabTable Mapper Detail` where to_table = 'RV Detail' and parent = 'Delivery Note-Receivable Voucher' and validation_logic = 'amount > ifnull(billed_amt, 0) and docstatus = 1'") diff --git a/erpnext/patches/patch_list.py b/erpnext/patches/patch_list.py index 247f5d88ea..5e6a50423d 100644 --- a/erpnext/patches/patch_list.py +++ b/erpnext/patches/patch_list.py @@ -212,5 +212,10 @@ patch_list = [ 'patch_file': 'reload_mapper', 'description': 'SO-DN, SO-Rv, DN-RV' }, + { + 'patch_module': 'patches.jan_mar_2012', + 'patch_file': 'mapper_fix', + 'description': 'DN-RV duplicate table entry' + }, ] From 79bc01e33d257f65f134ac6230e6c3384bc0c425 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 28 Mar 2012 16:19:01 +0530 Subject: [PATCH 10/14] updated rename_dt --- erpnext/patches/jan_mar_2012/rename_dt.py | 26 ++++++----------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/erpnext/patches/jan_mar_2012/rename_dt.py b/erpnext/patches/jan_mar_2012/rename_dt.py index 559e8a5632..2492720ca7 100644 --- a/erpnext/patches/jan_mar_2012/rename_dt.py +++ b/erpnext/patches/jan_mar_2012/rename_dt.py @@ -90,18 +90,17 @@ def rename_in_db(ren_data, data_type, is_doctype): def update_dt_in_records(rendt): for d in rendt: # Feed, property setter, search criteria, gl mapper, form 16A, naming series options, doclayer - dodtype is not mentioed in options - dt_list = webnotes.conn.sql("select parent, fieldname from tabDocField where fieldname in ('dt', 'doctype', 'doc_type', 'dt_type') and ifnull(options, '') = ''") - print dt_list + dt_list = webnotes.conn.sql("select t1.parent, t1.fieldname from tabDocField t1, tabDocType t2 where t1.parent = t2.name and t1.fieldname in ('dt', 'doctype', 'doc_type', 'dt_type') and ifnull(t1.options, '') = '' and ifnull(t2.issingle, 0) = 0") for dt in dt_list: - webnotes.conn.sql("update `tab%s` set %s = replace(%s, '%s', '%s') where %s = '%s'" % (dt[0], dt[1], dt[1], d, rendt[d], dt[1], d), debug=1) + webnotes.conn.sql("update `tab%s` set %s = replace(%s, '%s', '%s') where %s = '%s'" % (dt[0], dt[1], dt[1], d, rendt[d], dt[1], d)) # gl mapper, gl entry - webnotes.conn.sql("update `tabGL Mapper Detail` set against_voucher_type = replace(against_voucher_type, %s, %s) where against_voucher_type like '%%%s%%'" % (d, rendt[d], d)) - webnotes.conn.sql("update `tabGL Entry` set against_voucher_type = replace(against_voucher_type, %s, %s) where against_voucher_type = '%s'" % (d, rendt[d], d)) - webnotes.conn.sql("update `tabGL Entry` set voucher_type = replace(voucher_type, %s, %s) where voucher_type = '%s'" % (d, rendt[d], d)) + webnotes.conn.sql("update `tabGL Mapper Detail` set against_voucher_type = replace(against_voucher_type, '%s', '%s') where against_voucher_type like '%%%s%%'" % (d, rendt[d], d)) + webnotes.conn.sql("update `tabGL Entry` set against_voucher_type = replace(against_voucher_type, '%s', '%s') where against_voucher_type = '%s'" % (d, rendt[d], d)) + webnotes.conn.sql("update `tabGL Entry` set voucher_type = replace(voucher_type, '%s', '%s') where voucher_type = '%s'" % (d, rendt[d], d)) # Stock ledger entry - webnotes.conn.sql("update `tabStock ledger Entry` set voucher_type = replace(voucher_type, %s, %s) where voucher_type = '%s'" % (d, rendt[d], d)) + webnotes.conn.sql("update `tabStock ledger Entry` set voucher_type = replace(voucher_type, '%s', '%s') where voucher_type = '%s'" % (d, rendt[d], d)) # Custom fld: options webnotes.conn.sql("update `tabCustom Field` set options = replace(options, %s, %s) where fieldtype in ('Link', 'Select')", (d, rendt[d])) @@ -143,13 +142,6 @@ def update_dt_in_records(rendt): def get_dt_to_be_renamed(): - """rendt = { - 'Receivable Voucher' : 'Sales Invoice', - 'RV Detail' : 'Sales Invoice Item', - 'RV Tax Detail' : 'Sales Taxes and Charges', - 'Advance Adjustment Detail' : 'Sales Invoice Advance', -}""" - rendt = { 'Receivable Voucher' : 'Sales Invoice', 'RV Detail' : 'Sales Invoice Item', @@ -230,12 +222,6 @@ def get_dt_to_be_renamed(): def get_mapper_to_be_renamed(): - """ren_mapper = { - 'Sales Order-Receivable Voucher' : 'Sales Order-Sales Invoice', - 'Receivable Voucher-Delivery Note' : 'Sales Invoice-Delivery Note', - 'Delivery Note-Receivable Voucher' : 'Delivery Note-Sales Invoice' - }""" - ren_map = { 'Sales Order-Receivable Voucher' : 'Sales Order-Sales Invoice', 'Sales Order-Indent' : 'Sales Order-Purchase Request', From 779a365420fa0094fe8711c2f8196e7da8b29146 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Wed, 28 Mar 2012 18:31:26 +0530 Subject: [PATCH 11/14] fix in print hide of amount in words --- .../doctype/receivable_voucher/receivable_voucher.txt | 4 ++-- erpnext/selling/doctype/quotation/quotation.txt | 4 ++-- erpnext/selling/doctype/sales_order/sales_order.txt | 4 ++-- erpnext/setup/doctype/other_charges/other_charges.js | 6 +++++- erpnext/stock/doctype/delivery_note/delivery_note.txt | 4 ++-- 5 files changed, 13 insertions(+), 9 deletions(-) diff --git a/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.txt b/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.txt index 546d99781d..9d84f21d64 100644 --- a/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.txt +++ b/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.txt @@ -935,7 +935,7 @@ 'oldfieldname': u'in_words_export', 'oldfieldtype': u'Data', 'permlevel': 1, - 'print_hide': 1 + 'print_hide': 0 }, # DocField @@ -1518,4 +1518,4 @@ 'permlevel': 0, 'print_hide': 1 } -] \ No newline at end of file +] diff --git a/erpnext/selling/doctype/quotation/quotation.txt b/erpnext/selling/doctype/quotation/quotation.txt index c8e3ecb37f..39a7327728 100644 --- a/erpnext/selling/doctype/quotation/quotation.txt +++ b/erpnext/selling/doctype/quotation/quotation.txt @@ -875,7 +875,7 @@ 'oldfieldname': u'in_words_export', 'oldfieldtype': u'Data', 'permlevel': 1, - 'print_hide': 1, + 'print_hide': 0, 'width': u'200px' }, @@ -1199,4 +1199,4 @@ 'permlevel': 0, 'print_hide': 1 } -] \ No newline at end of file +] diff --git a/erpnext/selling/doctype/sales_order/sales_order.txt b/erpnext/selling/doctype/sales_order/sales_order.txt index a82f9704f2..7a11bda9ce 100644 --- a/erpnext/selling/doctype/sales_order/sales_order.txt +++ b/erpnext/selling/doctype/sales_order/sales_order.txt @@ -963,7 +963,7 @@ 'oldfieldname': u'in_words_export', 'oldfieldtype': u'Data', 'permlevel': 1, - 'print_hide': 1, + 'print_hide': 0, 'width': u'200px' }, @@ -1333,4 +1333,4 @@ 'permlevel': 0, 'print_hide': 1 } -] \ No newline at end of file +] diff --git a/erpnext/setup/doctype/other_charges/other_charges.js b/erpnext/setup/doctype/other_charges/other_charges.js index a6f457d8df..85bdb7968a 100644 --- a/erpnext/setup/doctype/other_charges/other_charges.js +++ b/erpnext/setup/doctype/other_charges/other_charges.js @@ -36,6 +36,10 @@ cur_frm.pformat.rounded_total_export = function(doc) { return ''; } +cur_frm.pformat.in_words_export = function(doc) { + return ''; +} + cur_frm.pformat.other_charges= function(doc){ //function to make row of table var make_row = function(title,val,bold){ @@ -89,7 +93,7 @@ cur_frm.pformat.other_charges= function(doc){ out += make_row('Rounded Total',fmt_money(doc.rounded_total_export),1); } - if(doc.in_words_export){ + if(doc.in_words_export && !print_hide_dict['in_words_export']){ out +=''; out += ''; out += '' diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.txt b/erpnext/stock/doctype/delivery_note/delivery_note.txt index 4878c36bad..7bbd7d58e7 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note.txt +++ b/erpnext/stock/doctype/delivery_note/delivery_note.txt @@ -869,7 +869,7 @@ 'oldfieldname': u'in_words_export', 'oldfieldtype': u'Data', 'permlevel': 1, - 'print_hide': 1, + 'print_hide': 0, 'width': u'150px' }, @@ -1346,4 +1346,4 @@ 'permlevel': 0, 'print_hide': 1 } -] \ No newline at end of file +] From 419260298bffcfe8080e92ece816c6c9223508c7 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Wed, 28 Mar 2012 19:12:36 +0530 Subject: [PATCH 12/14] fix in mapper --- erpnext/patches/mar_2012/so_rv_mapper_fix.py | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 erpnext/patches/mar_2012/so_rv_mapper_fix.py diff --git a/erpnext/patches/mar_2012/so_rv_mapper_fix.py b/erpnext/patches/mar_2012/so_rv_mapper_fix.py new file mode 100644 index 0000000000..9e7fc998d9 --- /dev/null +++ b/erpnext/patches/mar_2012/so_rv_mapper_fix.py @@ -0,0 +1,7 @@ +def execute(): + import webnotes + webnotes.conn.sql("""DELETE FROM `tabTable Mapper Detail` + WHERE parent='Sales Order-Receivable Voucher' + AND from_table='Sales Order Detail'""") + from webnotes.modules.module_manager import reload_doc + reload_doc('accounts', 'DocType Mapper', 'Sales Order-Receivable Voucher') From 9767f79845262c54f4782b815e65c14eaf1f4371 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Wed, 28 Mar 2012 19:25:29 +0530 Subject: [PATCH 13/14] fix in Sales Order-Receivable Voucher Mapper --- .../Sales Order-Receivable Voucher.txt | 173 ++++++++---------- erpnext/patches/mar_2012/so_rv_mapper_fix.py | 9 +- 2 files changed, 87 insertions(+), 95 deletions(-) diff --git a/erpnext/accounts/DocType Mapper/Sales Order-Receivable Voucher/Sales Order-Receivable Voucher.txt b/erpnext/accounts/DocType Mapper/Sales Order-Receivable Voucher/Sales Order-Receivable Voucher.txt index fb180ff1f8..d076d9f01d 100644 --- a/erpnext/accounts/DocType Mapper/Sales Order-Receivable Voucher/Sales Order-Receivable Voucher.txt +++ b/erpnext/accounts/DocType Mapper/Sales Order-Receivable Voucher/Sales Order-Receivable Voucher.txt @@ -3,137 +3,137 @@ # These values are common in all dictionaries { - 'creation': '2010-08-08 17:09:36', + 'creation': '2010-09-20 12:33:35', 'docstatus': 0, - 'modified': '2011-09-15 15:04:45', - 'modified_by': 'Administrator', - 'owner': 'Administrator' + 'modified': '2012-03-28 19:19:38', + 'modified_by': u'Administrator', + 'owner': u'Administrator' }, # These values are common for all Table Mapper Detail { - 'doctype': 'Table Mapper Detail', + 'doctype': u'Table Mapper Detail', 'name': '__common__', - 'parent': 'Sales Order-Receivable Voucher', - 'parentfield': 'table_mapper_details', - 'parenttype': 'DocType Mapper' + 'parent': u'Sales Order-Receivable Voucher', + 'parentfield': u'table_mapper_details', + 'parenttype': u'DocType Mapper' }, # These values are common for all Field Mapper Detail { - 'doctype': 'Field Mapper Detail', + 'doctype': u'Field Mapper Detail', 'name': '__common__', - 'parent': 'Sales Order-Receivable Voucher', - 'parentfield': 'field_mapper_details', - 'parenttype': 'DocType Mapper' + 'parent': u'Sales Order-Receivable Voucher', + 'parentfield': u'field_mapper_details', + 'parenttype': u'DocType Mapper' }, # These values are common for all DocType Mapper { 'doctype': u'DocType Mapper', - 'from_doctype': 'Sales Order', - 'module': 'Accounts', + 'from_doctype': u'Sales Order', + 'module': u'Accounts', 'name': '__common__', 'ref_doc_submitted': 1, - 'to_doctype': 'Receivable Voucher' + 'to_doctype': u'Receivable Voucher' }, # DocType Mapper, Sales Order-Receivable Voucher { 'doctype': u'DocType Mapper', - 'name': 'Sales Order-Receivable Voucher' + 'name': u'Sales Order-Receivable Voucher' }, # Field Mapper Detail { - 'checking_operator': '=', - 'doctype': 'Field Mapper Detail', - 'from_field': 'customer', - 'map': 'Yes', + 'checking_operator': u'=', + 'doctype': u'Field Mapper Detail', + 'from_field': u'customer', + 'map': u'Yes', 'match_id': 0, - 'to_field': 'customer' + 'to_field': u'customer' }, # Field Mapper Detail { - 'doctype': 'Field Mapper Detail', - 'from_field': 'eval: obj.basic_rate and (flt(obj.amount) - flt(obj.billed_amt))/flt(obj.basic_rate) or obj.qty', - 'map': 'Yes', + 'doctype': u'Field Mapper Detail', + 'from_field': u'eval: obj.basic_rate and (flt(obj.amount) - flt(obj.billed_amt))/flt(obj.basic_rate) or obj.qty', + 'map': u'Yes', 'match_id': 1, - 'to_field': 'qty' + 'to_field': u'qty' }, # Field Mapper Detail { - 'doctype': 'Field Mapper Detail', - 'from_field': 'parent', - 'map': 'Yes', + 'doctype': u'Field Mapper Detail', + 'from_field': u'parent', + 'map': u'Yes', 'match_id': 1, - 'to_field': 'sales_order' + 'to_field': u'sales_order' }, # Field Mapper Detail { - 'doctype': 'Field Mapper Detail', - 'from_field': 'name', - 'map': 'Yes', + 'doctype': u'Field Mapper Detail', + 'from_field': u'name', + 'map': u'Yes', 'match_id': 1, - 'to_field': 'so_detail' + 'to_field': u'so_detail' }, # Field Mapper Detail { - 'doctype': 'Field Mapper Detail', - 'from_field': 'eval:flt(obj.amount) - flt(obj.billed_amt)', - 'map': 'Yes', + 'doctype': u'Field Mapper Detail', + 'from_field': u'eval:flt(obj.amount) - flt(obj.billed_amt)', + 'map': u'Yes', 'match_id': 1, - 'to_field': 'amount' + 'to_field': u'amount' }, # Field Mapper Detail { - 'doctype': 'Field Mapper Detail', - 'from_field': 'eval: (flt(obj.amount) - flt(obj.billed_amt))* flt(obj.export_rate)/flt(obj.basic_rate)', - 'map': 'Yes', + 'doctype': u'Field Mapper Detail', + 'from_field': u'eval: (flt(obj.amount) - flt(obj.billed_amt))* flt(obj.export_rate)/flt(obj.basic_rate)', + 'map': u'Yes', 'match_id': 1, - 'to_field': 'export_amount' + 'to_field': u'export_amount' }, # Field Mapper Detail { - 'checking_operator': '=', - 'doctype': 'Field Mapper Detail', - 'from_field': 'project_name', - 'map': 'Yes', + 'checking_operator': u'=', + 'doctype': u'Field Mapper Detail', + 'from_field': u'project_name', + 'map': u'Yes', 'match_id': 0, - 'to_field': 'project_name' + 'to_field': u'project_name' }, # Field Mapper Detail { - 'doctype': 'Field Mapper Detail', - 'from_field': 'reserved_warehouse', - 'map': 'Yes', + 'doctype': u'Field Mapper Detail', + 'from_field': u'reserved_warehouse', + 'map': u'Yes', 'match_id': 1, - 'to_field': 'warehouse' + 'to_field': u'warehouse' }, # Field Mapper Detail { - 'doctype': 'Field Mapper Detail', - 'from_field': 'naming_series', - 'map': 'No', + 'doctype': u'Field Mapper Detail', + 'from_field': u'naming_series', + 'map': u'No', 'match_id': 0, - 'to_field': 'naming_series' + 'to_field': u'naming_series' }, # Field Mapper Detail { - 'doctype': 'Field Mapper Detail', - 'from_field': 'incentives', - 'map': 'No', + 'doctype': u'Field Mapper Detail', + 'from_field': u'incentives', + 'map': u'No', 'match_id': 3, - 'to_field': 'incentives' + 'to_field': u'incentives' }, # Field Mapper Detail @@ -148,54 +148,43 @@ # Table Mapper Detail { - 'doctype': 'Table Mapper Detail', - 'from_table': 'Sales Order', + 'doctype': u'Table Mapper Detail', + 'from_table': u'Sales Order', 'match_id': 0, - 'to_table': 'Receivable Voucher', - 'validation_logic': 'docstatus=1' + 'to_table': u'Receivable Voucher', + 'validation_logic': u'docstatus=1' }, # Table Mapper Detail { - 'doctype': 'Table Mapper Detail', - 'from_field': 'sales_order_detail', - 'from_table': 'Sales Order Detail', + 'doctype': u'Table Mapper Detail', + 'from_field': u'sales_order_detail', + 'from_table': u'Sales Order Detail', 'match_id': 1, - 'to_field': 'entries', - 'to_table': 'RV Detail', - 'validation_logic': 'docstatus = 1' + 'to_field': u'entries', + 'to_table': u'RV Detail', + 'validation_logic': u'(ifnull(amount, 0) = 0 or amount > ifnull(billed_amt, 0)) and docstatus = 1' }, # Table Mapper Detail { - 'doctype': 'Table Mapper Detail', - 'from_field': 'sales_order_detail', - 'from_table': 'Sales Order Detail', - 'match_id': 1, - 'to_field': 'entries', - 'to_table': 'RV Detail', - 'validation_logic': '(ifnull(amount, 0) = 0 or amount > ifnull(billed_amt, 0)) and docstatus = 1' - }, - - # Table Mapper Detail - { - 'doctype': 'Table Mapper Detail', - 'from_field': 'other_charges', - 'from_table': 'RV Tax Detail', + 'doctype': u'Table Mapper Detail', + 'from_field': u'other_charges', + 'from_table': u'RV Tax Detail', 'match_id': 2, - 'to_field': 'other_charges', - 'to_table': 'RV Tax Detail', - 'validation_logic': 'name is not null' + 'to_field': u'other_charges', + 'to_table': u'RV Tax Detail', + 'validation_logic': u'name is not null' }, # Table Mapper Detail { - 'doctype': 'Table Mapper Detail', - 'from_field': 'sales_team', - 'from_table': 'Sales Team', + 'doctype': u'Table Mapper Detail', + 'from_field': u'sales_team', + 'from_table': u'Sales Team', 'match_id': 3, - 'to_field': 'sales_team', - 'to_table': 'Sales Team', - 'validation_logic': 'name is not null' + 'to_field': u'sales_team', + 'to_table': u'Sales Team', + 'validation_logic': u'name is not null' } -] +] \ No newline at end of file diff --git a/erpnext/patches/mar_2012/so_rv_mapper_fix.py b/erpnext/patches/mar_2012/so_rv_mapper_fix.py index 9e7fc998d9..8844773a2c 100644 --- a/erpnext/patches/mar_2012/so_rv_mapper_fix.py +++ b/erpnext/patches/mar_2012/so_rv_mapper_fix.py @@ -1,7 +1,10 @@ def execute(): import webnotes - webnotes.conn.sql("""DELETE FROM `tabTable Mapper Detail` + count = webnotes.conn.sql("""SELECT COUNT(*) FROM `tabTable Mapper Detail` WHERE parent='Sales Order-Receivable Voucher' AND from_table='Sales Order Detail'""") - from webnotes.modules.module_manager import reload_doc - reload_doc('accounts', 'DocType Mapper', 'Sales Order-Receivable Voucher') + if count and count[0][0]==2: + webnotes.conn.sql("""DELETE FROM `tabTable Mapper Detail` + WHERE parent='Sales Order-Receivable Voucher' + AND from_table='Sales Order Detail' + AND validation_logic='docstatus = 1'""") From 8ac5ccae0ac7ca0cbcccbed08cafdd938db0eca0 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Wed, 28 Mar 2012 19:29:55 +0530 Subject: [PATCH 14/14] fix in Sales Order-Receivable Voucher Mapper --- erpnext/patches/patch_list.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/erpnext/patches/patch_list.py b/erpnext/patches/patch_list.py index 5e6a50423d..3099456f19 100644 --- a/erpnext/patches/patch_list.py +++ b/erpnext/patches/patch_list.py @@ -217,5 +217,10 @@ patch_list = [ 'patch_file': 'mapper_fix', 'description': 'DN-RV duplicate table entry' }, + { + 'patch_module': 'patches.mar_2012', + 'patch_file': 'so_rv_mapper_fix', + 'description': 'SO-RV duplicate mapper entry removal' + }, ]
In Words