From 1ef27296f46e06f063a8c42a5272253a4b199b91 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 16 Apr 2013 12:29:27 +0530 Subject: [PATCH 1/2] fixes in packing slip --- .../Delivery Note-Packing Slip.txt | 9 ++++++++- stock/doctype/packing_slip/packing_slip.py | 11 ----------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/stock/DocType Mapper/Delivery Note-Packing Slip/Delivery Note-Packing Slip.txt b/stock/DocType Mapper/Delivery Note-Packing Slip/Delivery Note-Packing Slip.txt index 79b17c2e10..fc88bba000 100644 --- a/stock/DocType Mapper/Delivery Note-Packing Slip/Delivery Note-Packing Slip.txt +++ b/stock/DocType Mapper/Delivery Note-Packing Slip/Delivery Note-Packing Slip.txt @@ -2,7 +2,7 @@ { "creation": "2012-02-02 11:50:33", "docstatus": 0, - "modified": "2013-04-05 16:08:22", + "modified": "2013-04-16 12:26:28", "modified_by": "Administrator", "owner": "Administrator" }, @@ -60,6 +60,13 @@ "match_id": 1, "to_field": "dn_detail" }, + { + "doctype": "Field Mapper Detail", + "from_field": "eval: flt(obj.qty) - flt(obj.packed_qty)", + "map": "Yes", + "match_id": 1, + "to_field": "qty" + }, { "doctype": "Table Mapper Detail", "from_table": "Delivery Note", diff --git a/stock/doctype/packing_slip/packing_slip.py b/stock/doctype/packing_slip/packing_slip.py index 161c9bd911..2632199340 100644 --- a/stock/doctype/packing_slip/packing_slip.py +++ b/stock/doctype/packing_slip/packing_slip.py @@ -185,17 +185,6 @@ class DocType: def set_item_details(self, row): - res = webnotes.conn.sql("""SELECT item_name, SUM(IFNULL(qty, 0)) as total_qty, - IFNULL(packed_qty, 0) as packed_qty, stock_uom - FROM `tabDelivery Note Item` - WHERE parent=%s AND item_code=%s GROUP BY item_code""", - (self.doc.delivery_note, row.item_code), as_dict=1) - - if res and len(res)>0: - qty = res[0]['total_qty'] - res[0]['packed_qty'] - if not row.qty: - row.qty = qty >= 0 and qty or 0 - res = webnotes.conn.sql("""SELECT net_weight, weight_uom FROM `tabItem` WHERE name=%s""", row.item_code, as_dict=1) From 8f148249aceae3fb938869f60a37c82b069c097a Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 16 Apr 2013 12:36:59 +0530 Subject: [PATCH 2/2] reload doctype mapper patch --- patches/patch_list.py | 1 + 1 file changed, 1 insertion(+) diff --git a/patches/patch_list.py b/patches/patch_list.py index be7e5cb3b9..57dde996d7 100644 --- a/patches/patch_list.py +++ b/patches/patch_list.py @@ -242,4 +242,5 @@ patch_list = [ "execute:webnotes.delete_doc('Search Criteria', 'time_log_summary')", "patches.april_2013.p04_update_role_in_pages", "patches.april_2013.p05_fixes_in_reverse_modules", + "execute:webnotes.reload_doc('stock', 'DocType Mapper', 'Delivery Note-Packing Slip')" ] \ No newline at end of file