From 9c043b2f5104fa27289461cc6fcba5446bbac438 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 29 Aug 2012 11:46:12 +0530 Subject: [PATCH] Billed amount in SO and DN based on export amount and patch for it --- erpnext/patches/august_2012/repost_billed_amt.py | 9 +++++++++ erpnext/selling/doctype/sales_common/sales_common.py | 12 ++++++------ 2 files changed, 15 insertions(+), 6 deletions(-) create mode 100644 erpnext/patches/august_2012/repost_billed_amt.py diff --git a/erpnext/patches/august_2012/repost_billed_amt.py b/erpnext/patches/august_2012/repost_billed_amt.py new file mode 100644 index 00000000000..e6b463c1571 --- /dev/null +++ b/erpnext/patches/august_2012/repost_billed_amt.py @@ -0,0 +1,9 @@ +def execute(): + import webnotes + from webnotes.model.code import get_obj + from selling.doctype.sales_common.sales_common import StatusUpdater + + invoices = webnotes.conn.sql("select name from `tabSales Invoice` where docstatus = 1") + for inv in invoices: + inv_obj = get_obj('Sales Invoice', inv[0], with_children=1) + StatusUpdater(inv_obj, 1).update_all_qty() \ No newline at end of file diff --git a/erpnext/selling/doctype/sales_common/sales_common.py b/erpnext/selling/doctype/sales_common/sales_common.py index 57724acb667..b3d9f4047cc 100644 --- a/erpnext/selling/doctype/sales_common/sales_common.py +++ b/erpnext/selling/doctype/sales_common/sales_common.py @@ -689,14 +689,14 @@ class StatusUpdater: self.validate_qty({ 'source_dt' :'Sales Invoice Item', 'compare_field' :'billed_amt', - 'compare_ref_field' :'amount', + 'compare_ref_field' :'export_amount', 'target_dt' :'Sales Order Item', 'join_field' :'so_detail' }) self.validate_qty({ 'source_dt' :'Sales Invoice Item', 'compare_field' :'billed_amt', - 'compare_ref_field' :'amount', + 'compare_ref_field' :'export_amount', 'target_dt' :'Delivery Note Item', 'join_field' :'dn_detail' }, no_tolerance =1) @@ -808,9 +808,9 @@ class StatusUpdater: 'target_dt' :'Sales Order Item', 'target_parent_dt' :'Sales Order', 'target_parent_field' :'per_billed', - 'target_ref_field' :'amount', + 'target_ref_field' :'export_amount', 'source_dt' :'Sales Invoice Item', - 'source_field' :'amount', + 'source_field' :'export_amount', 'join_field' :'so_detail', 'percent_join_field' :'sales_order', 'status_field' :'billing_status', @@ -822,9 +822,9 @@ class StatusUpdater: 'target_dt' :'Delivery Note Item', 'target_parent_dt' :'Delivery Note', 'target_parent_field' :'per_billed', - 'target_ref_field' :'amount', + 'target_ref_field' :'export_amount', 'source_dt' :'Sales Invoice Item', - 'source_field' :'amount', + 'source_field' :'export_amount', 'join_field' :'dn_detail', 'percent_join_field' :'delivery_note', 'status_field' :'billing_status',