From 7af597ffedea00dfe700c2876630f330e3cf16a7 Mon Sep 17 00:00:00 2001 From: Mantavya Gajjar Date: Mon, 7 Dec 2009 20:38:52 +0530 Subject: [PATCH] [FIX]: fix a problem Point of sale create outgoing shipments incl. service items lp bug: https://launchpad.net/bugs/433898 fixed bzr revid: mga@tinyerp.com-20091207150852-dax23h6nfa1t6640 --- addons/point_of_sale/pos.py | 43 +++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/addons/point_of_sale/pos.py b/addons/point_of_sale/pos.py index be588a156dd..88466970905 100644 --- a/addons/point_of_sale/pos.py +++ b/addons/point_of_sale/pos.py @@ -339,28 +339,29 @@ class pos_order(osv.osv): if new: for line in order.lines: - prop_ids = self.pool.get("ir.property").search(cr, uid, - [('name', '=', 'property_stock_customer')]) - val = self.pool.get("ir.property").browse(cr, uid, - prop_ids[0]).value - location_id = order.shop_id.warehouse_id.lot_stock_id.id - stock_dest_id = int(val.split(',')[1]) - if line.qty < 0: - (location_id, stock_dest_id)= (stock_dest_id, location_id) + if line.product_id.type != 'service': + prop_ids = self.pool.get("ir.property").search(cr, uid, + [('name', '=', 'property_stock_customer')]) + val = self.pool.get("ir.property").browse(cr, uid, + prop_ids[0]).value + location_id = order.shop_id.warehouse_id.lot_stock_id.id + stock_dest_id = int(val.split(',')[1]) + if line.qty < 0: + (location_id, stock_dest_id)= (stock_dest_id, location_id) - self.pool.get('stock.move').create(cr, uid, { - 'name': 'Stock move (POS %d)' % (order.id, ), - 'product_uom': line.product_id.uom_id.id, - 'product_uos': line.product_id.uom_id.id, - 'picking_id': picking_id, - 'product_id': line.product_id.id, - 'product_uos_qty': abs(line.qty), - 'product_qty': abs(line.qty), - 'tracking_id': False, - 'state': 'waiting', - 'location_id': location_id, - 'location_dest_id': stock_dest_id, - }) + self.pool.get('stock.move').create(cr, uid, { + 'name': 'Stock move (POS %d)' % (order.id, ), + 'product_uom': line.product_id.uom_id.id, + 'product_uos': line.product_id.uom_id.id, + 'picking_id': picking_id, + 'product_id': line.product_id.id, + 'product_uos_qty': abs(line.qty), + 'product_qty': abs(line.qty), + 'tracking_id': False, + 'state': 'waiting', + 'location_id': location_id, + 'location_dest_id': stock_dest_id, + }) wf_service = netsvc.LocalService("workflow") wf_service.trg_validate(uid, 'stock.picking',