From 6ac363ae0149da9ae401f50c3abeeefdc238815d Mon Sep 17 00:00:00 2001 From: "sbh (Open ERP)" Date: Mon, 24 May 2010 11:00:38 +0530 Subject: [PATCH 1/5] [Fix] point_of_sale: fix the problem of pricelist bzr revid: sbh@tinyerp.com-20100524053038-tkavbvj42x7jgz1b --- addons/point_of_sale/pos.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/addons/point_of_sale/pos.py b/addons/point_of_sale/pos.py index dcc2086eb26..2ad9319e371 100644 --- a/addons/point_of_sale/pos.py +++ b/addons/point_of_sale/pos.py @@ -1086,17 +1086,18 @@ class pos_order_line(osv.osv): raise osv.except_osv(_('No Pricelist !'), _('You have to select a pricelist in the sale form !\n' \ 'Please set one before choosing a product.')) - p_obj = self.pool.get('product.product').browse(cr,uid,product_id).list_price + p_obj = self.pool.get('product.product').browse(cr,uid,[product_id])[0] + uom_id=p_obj.uom_po_id.id price = self.pool.get('product.pricelist').price_get(cr, uid, - [pricelist], product_id, qty or 1.0, partner_id)[pricelist] - # Todo need to check -# if price is False: -# raise osv.except_osv(_('No valid pricelist line found !'), -# _("Couldn't find a pricelist line matching this product" \ -# " and quantity.\nYou have to change either the product," \ -# " the quantity or the pricelist.")) - return price or p_obj - + [pricelist], product_id, qty or 1.0, partner_id,{'uom': uom_id})[pricelist] + + if price is False: + raise osv.except_osv(_('No valid pricelist line found !'), + _("Couldn't find a pricelist line matching this product" \ + " and quantity.\nYou have to change either the product," \ + " the quantity or the pricelist.")) + return price + def onchange_product_id(self, cr, uid, ids, pricelist, product_id, qty=0, partner_id=False): price = self.price_by_product(cr, uid, ids, pricelist, product_id, qty, partner_id) self.write(cr,uid,ids,{'price_unit':price}) From f59249fd8a5debe3cfed70913bdd8bf2302ccdcc Mon Sep 17 00:00:00 2001 From: "sbh (Open ERP)" Date: Mon, 24 May 2010 12:40:03 +0530 Subject: [PATCH 2/5] [IMP]:point_of_sale:small changed in pricelist bzr revid: sbh@tinyerp.com-20100524071003-345hzzt2e61mvrh4 --- addons/point_of_sale/pos.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/point_of_sale/pos.py b/addons/point_of_sale/pos.py index 2ad9319e371..c559f99c4ff 100644 --- a/addons/point_of_sale/pos.py +++ b/addons/point_of_sale/pos.py @@ -1090,7 +1090,7 @@ class pos_order_line(osv.osv): uom_id=p_obj.uom_po_id.id price = self.pool.get('product.pricelist').price_get(cr, uid, [pricelist], product_id, qty or 1.0, partner_id,{'uom': uom_id})[pricelist] - + price=price or p_obj.list_price if price is False: raise osv.except_osv(_('No valid pricelist line found !'), _("Couldn't find a pricelist line matching this product" \ From ccd6981b369e60c554a63a80cd399043f722c296 Mon Sep 17 00:00:00 2001 From: "sbh (Open ERP)" Date: Mon, 24 May 2010 12:46:41 +0530 Subject: [PATCH 3/5] [Fix] point_of_sale:Fix the name of picking bzr revid: sbh@tinyerp.com-20100524071641-81do5dwrhnnzq95e --- addons/point_of_sale/pos.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/point_of_sale/pos.py b/addons/point_of_sale/pos.py index c559f99c4ff..c5845afb984 100644 --- a/addons/point_of_sale/pos.py +++ b/addons/point_of_sale/pos.py @@ -463,12 +463,13 @@ class pos_order(osv.osv): """Create a picking for each order and validate it.""" picking_obj = self.pool.get('stock.picking') - + pick_name=self.pool.get('ir.sequence').get(cr, uid, 'stock.picking.out') orders = self.browse(cr, uid, ids, context) for order in orders: if not order.picking_id: new = True picking_id = picking_obj.create(cr, uid, { + 'name':pick_name, 'origin': order.name, 'type': 'out', 'state': 'draft', From 196972157a654519bffebb5ea5059f89fbc9476a Mon Sep 17 00:00:00 2001 From: "sbh (Open ERP)" Date: Mon, 24 May 2010 13:17:07 +0530 Subject: [PATCH 4/5] [Fix] point_of_sale:Fix the problem of stock_move bzr revid: sbh@tinyerp.com-20100524074707-1hb2so5bea1aatto --- addons/point_of_sale/pos.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/point_of_sale/pos.py b/addons/point_of_sale/pos.py index c5845afb984..97b5085139f 100644 --- a/addons/point_of_sale/pos.py +++ b/addons/point_of_sale/pos.py @@ -505,7 +505,7 @@ class pos_order(osv.osv): if line.qty < 0: location_id, stock_dest_id = stock_dest_id, location_id - self.pool.get('stock.move').create(cr, uid, { + 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, From bb793483f03be0bada99d18c265f463b618736d5 Mon Sep 17 00:00:00 2001 From: "sbh (Open ERP)" Date: Mon, 24 May 2010 13:32:24 +0530 Subject: [PATCH 5/5] [IMP] point_of_sale:small change price name bzr revid: sbh@tinyerp.com-20100524080224-4n3s0twr0j5ur07l --- addons/point_of_sale/pos.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/point_of_sale/pos.py b/addons/point_of_sale/pos.py index 97b5085139f..597be8eaea7 100644 --- a/addons/point_of_sale/pos.py +++ b/addons/point_of_sale/pos.py @@ -1091,13 +1091,13 @@ class pos_order_line(osv.osv): uom_id=p_obj.uom_po_id.id price = self.pool.get('product.pricelist').price_get(cr, uid, [pricelist], product_id, qty or 1.0, partner_id,{'uom': uom_id})[pricelist] - price=price or p_obj.list_price - if price is False: + unit_price=price or p_obj.list_price + if unit_price is False: raise osv.except_osv(_('No valid pricelist line found !'), _("Couldn't find a pricelist line matching this product" \ " and quantity.\nYou have to change either the product," \ " the quantity or the pricelist.")) - return price + return unit_price def onchange_product_id(self, cr, uid, ids, pricelist, product_id, qty=0, partner_id=False): price = self.price_by_product(cr, uid, ids, pricelist, product_id, qty, partner_id)