From 6ed0450dba393b53991b602695f156b5b847501b Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 28 Mar 2012 11:32:44 +0530 Subject: [PATCH 1/4] 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 2/4] 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 3/4] 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 4/4] 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' + }, ]