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

This commit is contained in:
Rushabh Mehta 2012-02-07 14:32:20 +05:30
commit 5b625fa592
5 changed files with 168 additions and 109 deletions

View File

@ -5,7 +5,7 @@
{ {
'creation': '2010-08-08 17:09:35', 'creation': '2010-08-08 17:09:35',
'docstatus': 0, 'docstatus': 0,
'modified': '2012-02-06 15:25:06', 'modified': '2012-02-07 13:28:31',
'modified_by': u'Administrator', 'modified_by': u'Administrator',
'owner': u'Administrator' 'owner': u'Administrator'
}, },
@ -116,6 +116,15 @@
'to_field': u'total_tax' 'to_field': u'total_tax'
}, },
# Field Mapper Detail
{
'doctype': u'Field Mapper Detail',
'from_field': u'conversion_rate',
'map': u'Yes',
'match_id': 0,
'to_field': u'conversion_rate'
},
# Table Mapper Detail # Table Mapper Detail
{ {
'doctype': u'Table Mapper Detail', 'doctype': u'Table Mapper Detail',

View File

@ -0,0 +1,51 @@
import webnotes
from webnotes.model.code import get_obj
from webnotes.model.doc import addchild
def execute():
"""
* Maps conversion rate in doctype mapper PO-PR
* Maps conversion rate in doctype mapper PO-PV
"""
args = [
{
'parent': 'Purchase Order-Purchase Receipt',
'map': [{
'from_table': 'Purchase Order',
'to_table': 'Purchase Receipt',
'fields': [['conversion_rate', 'conversion_rate', 'Yes']]
}]
},
{
'parent': 'Purchase Order-Payable Voucher',
'map': [{
'from_table': 'Purchase Order',
'to_table': 'Payable Voucher',
'fields': [['conversion_rate', 'conversion_rate', 'Yes']]
}]
},
]
for a in args:
for m in a['map']:
match_id = webnotes.conn.sql("""\
SELECT match_id FROM `tabTable Mapper Detail`
WHERE parent=%s AND from_table=%s AND to_table=%s\
""", (a['parent'], m['from_table'], m['to_table']))[0][0]
for f in m['fields']:
res = webnotes.conn.sql("""\
SELECT name FROM `tabField Mapper Detail`
WHERE parent=%s AND from_field=%s AND to_field=%s
AND match_id=%s""", (a['parent'], f[0], f[1], match_id))
if not res:
max_idx = webnotes.conn.sql("""\
SELECT IFNULL(MAX(idx), 0) FROM `tabField Mapper Detail`
WHERE parent=%s""", a['parent'])[0][0]
obj = get_obj('DocType Mapper', a['parent'])
c = addchild(obj.doc, 'field_mapper_details', 'Field Mapper Detail', obj.doclist)
c.from_field = f[0]
c.to_field = f[1]
c.fields['map'] = f[2]
c.match_id = match_id
c.idx = max_idx + 1
c.save()

View File

@ -65,4 +65,9 @@ patch_list = [
'patch_file': 'deploy_packing_slip', 'patch_file': 'deploy_packing_slip',
'description': "Delete old packing slip fields & print format & deploy new doctypes related to Packing Slip" 'description': "Delete old packing slip fields & print format & deploy new doctypes related to Packing Slip"
}, },
{
'patch_module': 'patches.jan_mar_2012',
'patch_file': 'map_conversion_rate',
'description': "Maps conversion rate in doctype mappers PO-PR and PO-PV"
},
] ]

View File

@ -12,7 +12,17 @@ cur_frm.cscript.onload = function(doc,dt,dn){
} }
// make address, contact, shipping, history list body // make address, contact, shipping, history list body
cur_frm.cscript.make_hl_body(); cur_frm.cscript.make_hl_body();
//cur_frm.cscript.make_sl_body(); //cur_frm.cscript.make_sl_body();
cur_frm.cscript.load_defaults(doc, dt, dn);
}
cur_frm.cscript.load_defaults = function(doc, dt, dn) {
doc = locals[doc.doctype][doc.name];
if(!(doc.__islocal && doc.lead_name)) { return; }
var fields_to_refresh = LocalDB.set_default_values(doc);
if(fields_to_refresh) { refresh_many(fields_to_refresh); }
} }
cur_frm.add_fetch('lead_name', 'company_name', 'customer_name'); cur_frm.add_fetch('lead_name', 'company_name', 'customer_name');

View File

@ -5,233 +5,217 @@
{ {
'creation': '2010-08-08 17:09:35', 'creation': '2010-08-08 17:09:35',
'docstatus': 0, 'docstatus': 0,
'modified': '2012-01-05 11:21:23', 'modified': '2012-02-07 13:28:20',
'modified_by': 'Administrator', 'modified_by': u'Administrator',
'owner': 'Administrator' 'owner': u'Administrator'
}, },
# These values are common for all Table Mapper Detail # These values are common for all Table Mapper Detail
{ {
'doctype': 'Table Mapper Detail', 'doctype': u'Table Mapper Detail',
'name': '__common__', 'name': '__common__',
'parent': 'Purchase Order-Purchase Receipt', 'parent': u'Purchase Order-Purchase Receipt',
'parentfield': 'table_mapper_details', 'parentfield': u'table_mapper_details',
'parenttype': 'DocType Mapper' 'parenttype': u'DocType Mapper'
}, },
# These values are common for all Field Mapper Detail # These values are common for all Field Mapper Detail
{ {
'doctype': 'Field Mapper Detail', 'doctype': u'Field Mapper Detail',
'map': u'Yes',
'name': '__common__', 'name': '__common__',
'parent': 'Purchase Order-Purchase Receipt', 'parent': u'Purchase Order-Purchase Receipt',
'parentfield': 'field_mapper_details', 'parentfield': u'field_mapper_details',
'parenttype': 'DocType Mapper' 'parenttype': u'DocType Mapper'
}, },
# These values are common for all DocType Mapper # These values are common for all DocType Mapper
{ {
'doctype': u'DocType Mapper', 'doctype': u'DocType Mapper',
'from_doctype': 'Purchase Order', 'from_doctype': u'Purchase Order',
'module': 'Stock', 'module': u'Stock',
'name': '__common__', 'name': '__common__',
'ref_doc_submitted': 1, 'ref_doc_submitted': 1,
'to_doctype': 'Purchase Receipt' 'to_doctype': u'Purchase Receipt'
}, },
# DocType Mapper, Purchase Order-Purchase Receipt # DocType Mapper, Purchase Order-Purchase Receipt
{ {
'doctype': u'DocType Mapper', 'doctype': u'DocType Mapper',
'name': 'Purchase Order-Purchase Receipt' 'name': u'Purchase Order-Purchase Receipt'
}, },
# Field Mapper Detail # Field Mapper Detail
{ {
'checking_operator': '=', 'checking_operator': u'=',
'doctype': 'Field Mapper Detail', 'doctype': u'Field Mapper Detail',
'from_field': 'supplier', 'from_field': u'supplier',
'map': 'Yes',
'match_id': 0, 'match_id': 0,
'to_field': 'supplier' 'to_field': u'supplier'
}, },
# Field Mapper Detail # Field Mapper Detail
{ {
'checking_operator': '=', 'checking_operator': u'=',
'doctype': 'Field Mapper Detail', 'doctype': u'Field Mapper Detail',
'from_field': 'company', 'from_field': u'company',
'map': 'Yes',
'match_id': 0, 'match_id': 0,
'to_field': 'company' 'to_field': u'company'
}, },
# Field Mapper Detail # Field Mapper Detail
{ {
'checking_operator': '=', 'checking_operator': u'=',
'doctype': 'Field Mapper Detail', 'doctype': u'Field Mapper Detail',
'from_field': 'currency', 'from_field': u'currency',
'map': 'Yes',
'match_id': 0, 'match_id': 0,
'to_field': 'currency' 'to_field': u'currency'
}, },
# Field Mapper Detail # Field Mapper Detail
{ {
'doctype': 'Field Mapper Detail', 'doctype': u'Field Mapper Detail',
'from_field': 'name', 'from_field': u'name',
'map': 'Yes',
'match_id': 1, 'match_id': 1,
'to_field': 'prevdoc_detail_docname' 'to_field': u'prevdoc_detail_docname'
}, },
# Field Mapper Detail # Field Mapper Detail
{ {
'doctype': 'Field Mapper Detail', 'doctype': u'Field Mapper Detail',
'from_field': 'parent', 'from_field': u'parent',
'map': 'Yes',
'match_id': 1, 'match_id': 1,
'to_field': 'prevdoc_docname' 'to_field': u'prevdoc_docname'
}, },
# Field Mapper Detail # Field Mapper Detail
{ {
'doctype': 'Field Mapper Detail', 'doctype': u'Field Mapper Detail',
'from_field': 'parenttype', 'from_field': u'parenttype',
'map': 'Yes',
'match_id': 1, 'match_id': 1,
'to_field': 'prevdoc_doctype' 'to_field': u'prevdoc_doctype'
}, },
# Field Mapper Detail # Field Mapper Detail
{ {
'checking_operator': '=', 'checking_operator': u'=',
'doctype': 'Field Mapper Detail', 'doctype': u'Field Mapper Detail',
'from_field': 'item_code', 'from_field': u'item_code',
'map': 'Yes',
'match_id': 1, 'match_id': 1,
'to_field': 'item_code' 'to_field': u'item_code'
}, },
# Field Mapper Detail # Field Mapper Detail
{ {
'doctype': 'Field Mapper Detail', 'doctype': u'Field Mapper Detail',
'from_field': 'eval:(flt(obj.qty) - flt(obj.received_qty)) ', 'from_field': u'eval:(flt(obj.qty) - flt(obj.received_qty)) ',
'map': 'Yes',
'match_id': 1, 'match_id': 1,
'to_field': 'received_qty' 'to_field': u'received_qty'
}, },
# Field Mapper Detail # Field Mapper Detail
{ {
'doctype': 'Field Mapper Detail', 'doctype': u'Field Mapper Detail',
'from_field': 'eval:(flt(obj.qty) - flt(obj.received_qty)) ', 'from_field': u'eval:(flt(obj.qty) - flt(obj.received_qty)) ',
'map': 'Yes',
'match_id': 1, 'match_id': 1,
'to_field': 'qty' 'to_field': u'qty'
}, },
# Field Mapper Detail # Field Mapper Detail
{ {
'doctype': 'Field Mapper Detail', 'doctype': u'Field Mapper Detail',
'from_field': 'eval:(flt(obj.qty) - flt(obj.received_qty)) * flt(obj.conversion_factor)', 'from_field': u'eval:(flt(obj.qty) - flt(obj.received_qty)) * flt(obj.conversion_factor)',
'map': 'Yes',
'match_id': 1, 'match_id': 1,
'to_field': 'stock_qty' 'to_field': u'stock_qty'
}, },
# Field Mapper Detail # Field Mapper Detail
{ {
'doctype': 'Field Mapper Detail', 'doctype': u'Field Mapper Detail',
'from_field': 'eval:(flt(obj.qty) - flt(obj.received_qty)) * flt(obj.import_rate)', 'from_field': u'eval:(flt(obj.qty) - flt(obj.received_qty)) * flt(obj.import_rate)',
'map': 'Yes',
'match_id': 1, 'match_id': 1,
'to_field': 'import_amount' 'to_field': u'import_amount'
}, },
# Field Mapper Detail # Field Mapper Detail
{ {
'doctype': 'Field Mapper Detail', 'doctype': u'Field Mapper Detail',
'from_field': 'eval:(flt(obj.qty) - flt(obj.received_qty)) * flt(obj.purchase_rate)', 'from_field': u'eval:(flt(obj.qty) - flt(obj.received_qty)) * flt(obj.purchase_rate)',
'map': 'Yes',
'match_id': 1, 'match_id': 1,
'to_field': 'amount' 'to_field': u'amount'
}, },
# Field Mapper Detail # Field Mapper Detail
{ {
'doctype': 'Field Mapper Detail', 'doctype': u'Field Mapper Detail',
'from_field': 'schedule_date', 'from_field': u'schedule_date',
'map': 'Yes',
'match_id': 1, 'match_id': 1,
'to_field': 'schedule_date' 'to_field': u'schedule_date'
}, },
# Field Mapper Detail # Field Mapper Detail
{ {
'doctype': 'Field Mapper Detail', 'doctype': u'Field Mapper Detail',
'from_field': 'net_total', 'from_field': u'net_total',
'map': 'Yes',
'match_id': 0, 'match_id': 0,
'to_field': 'net_total' 'to_field': u'net_total'
}, },
# Field Mapper Detail # Field Mapper Detail
{ {
'doctype': 'Field Mapper Detail', 'doctype': u'Field Mapper Detail',
'from_field': 'grand_total', 'from_field': u'grand_total',
'map': 'Yes',
'match_id': 0, 'match_id': 0,
'to_field': 'grand_total' 'to_field': u'grand_total'
}, },
# Field Mapper Detail # Field Mapper Detail
{ {
'doctype': 'Field Mapper Detail', 'doctype': u'Field Mapper Detail',
'from_field': 'total_tax', 'from_field': u'total_tax',
'map': 'Yes',
'match_id': 0, 'match_id': 0,
'to_field': 'total_tax' 'to_field': u'total_tax'
}, },
# Field Mapper Detail # Field Mapper Detail
{ {
'doctype': 'Field Mapper Detail', 'doctype': u'Field Mapper Detail',
'from_field': 'transaction_date', 'from_field': u'conversion_rate',
'map': 'No',
'match_id': 0, 'match_id': 0,
'to_field': 'transaction_date' 'to_field': u'conversion_rate'
}, },
# Table Mapper Detail # Table Mapper Detail
{ {
'doctype': 'Table Mapper Detail', 'doctype': u'Table Mapper Detail',
'from_field': 'po_details', 'from_field': u'po_details',
'from_table': 'PO Detail', 'from_table': u'PO Detail',
'match_id': 1, 'match_id': 1,
'reference_doctype_key': 'prevdoc_doctype', 'reference_doctype_key': u'prevdoc_doctype',
'reference_key': 'prevdoc_detail_docname', 'reference_key': u'prevdoc_detail_docname',
'to_field': 'purchase_receipt_details', 'to_field': u'purchase_receipt_details',
'to_table': 'Purchase Receipt Detail', 'to_table': u'Purchase Receipt Detail',
'validation_logic': 'docstatus=1 and qty > ifnull(received_qty,0)' 'validation_logic': u'docstatus=1 and qty > ifnull(received_qty,0)'
}, },
# Table Mapper Detail # Table Mapper Detail
{ {
'doctype': 'Table Mapper Detail', 'doctype': u'Table Mapper Detail',
'from_table': 'Purchase Order', 'from_table': u'Purchase Order',
'match_id': 0, 'match_id': 0,
'reference_key': 'prevdoc_docname', 'reference_key': u'prevdoc_docname',
'to_table': 'Purchase Receipt', 'to_table': u'Purchase Receipt',
'validation_logic': 'docstatus = 1' 'validation_logic': u'docstatus = 1'
}, },
# Table Mapper Detail # Table Mapper Detail
{ {
'doctype': 'Table Mapper Detail', 'doctype': u'Table Mapper Detail',
'from_field': 'purchase_tax_details', 'from_field': u'purchase_tax_details',
'from_table': 'Purchase Tax Detail', 'from_table': u'Purchase Tax Detail',
'match_id': 2, 'match_id': 2,
'to_field': 'purchase_tax_details', 'to_field': u'purchase_tax_details',
'to_table': 'Purchase Tax Detail', 'to_table': u'Purchase Tax Detail',
'validation_logic': 'docstatus = 1' 'validation_logic': u'docstatus = 1'
} }
] ]