Merge branch 'renamedt' into shf_rename

Conflicts:
	erpnext/patches/patch_list.py
This commit is contained in:
Anand Doshi 2012-03-29 15:31:17 +05:30
commit 7ff696fb12
15 changed files with 383 additions and 163 deletions

View File

@ -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',
@ -143,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',
@ -186,4 +185,4 @@
'to_table': 'Sales Team',
'validation_logic': 'name is not null'
}
]
]

View File

@ -3,189 +3,188 @@
# 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
{
'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',
'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'
}
]

View File

@ -914,7 +914,7 @@
'oldfieldname': u'in_words_export',
'oldfieldtype': u'Data',
'permlevel': 1,
'print_hide': 1
'print_hide': 0
},
# DocField
@ -1513,4 +1513,4 @@
'permlevel': 0,
'print_hide': 1
}
]
]

View File

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

View File

@ -0,0 +1,9 @@
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')
webnotes.conn.sql("delete from `tabField Mapper Detail` where parent = 'Sales Order-Delivery Note' and from_field = 'basic_rate' and to_field = 'basic_rate'")

View File

@ -1,21 +1,147 @@
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
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
# 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)
# 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']
#---------------------------------------------------
# Dt Mapper renaming
ren_mapper = get_mapper_to_be_renamed()
# Rename mapper in db
rename_in_db(ren_mapper, 'DocType Mapper', 0)
for d in deldt:
#---------------------------------------------------
# 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,
# 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)
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)
# 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 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))
# 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
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]))
#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 = {
'Receivable Voucher' : 'Sales Invoice',
'RV Detail' : 'Sales Invoice Item',
@ -82,7 +208,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',
@ -92,33 +218,88 @@ def execute():
'Professional Training Details' : 'Employee Training',
'Previous Experience Detail' : 'Employee External Work History',
}
for d in rendt:
#rename
rename('DocType', d, rendt[d], 1)
# update txt
obj = get_obj('DocType', rendt[d])
obj.doc.save()
return rendt
# 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)
def get_mapper_to_be_renamed():
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')

View File

@ -0,0 +1,10 @@
def execute():
import webnotes
count = webnotes.conn.sql("""SELECT COUNT(*) FROM `tabTable Mapper Detail`
WHERE parent='Sales Order-Receivable Voucher'
AND from_table='Sales Order Detail'""")
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'""")

View File

@ -232,5 +232,18 @@ patch_list = [
'patch_file': 'delete_docformat',
'description': 'Deletes DocFormat from database'
},
'patch_module': 'patches.jan_mar_2012',
'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'
},
{
'patch_module': 'patches.mar_2012',
'patch_file': 'so_rv_mapper_fix',
'description': 'SO-RV duplicate mapper entry removal'
},
]

View File

@ -895,7 +895,7 @@
'oldfieldname': u'in_words_export',
'oldfieldtype': u'Data',
'permlevel': 1,
'print_hide': 1,
'print_hide': 0,
'width': u'200px'
},
@ -1225,4 +1225,4 @@
'permlevel': 0,
'print_hide': 1
}
]
]

View File

@ -963,7 +963,7 @@
'oldfieldname': u'in_words_export',
'oldfieldtype': u'Data',
'permlevel': 1,
'print_hide': 1,
'print_hide': 0,
'width': u'200px'
},
@ -1345,4 +1345,4 @@
'permlevel': 0,
'print_hide': 1
}
]
]

View File

@ -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 +='</table></td></tr>';
out += '<tr><td colspan = "2">';
out += '<table><tr><td style="width:25%;"><b>In Words</b></td>'

View File

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

View File

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

View File

@ -888,7 +888,7 @@
'oldfieldname': u'in_words_export',
'oldfieldtype': u'Data',
'permlevel': 1,
'print_hide': 1,
'print_hide': 0,
'width': u'150px'
},
@ -1378,4 +1378,4 @@
'permlevel': 0,
'print_hide': 1
}
]
]

20
wnf.py
View File

@ -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,15 +46,16 @@ 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)
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():