From 9767f79845262c54f4782b815e65c14eaf1f4371 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Wed, 28 Mar 2012 19:25:29 +0530 Subject: [PATCH] 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'""")