From 09a575a05ed473af3da97fd489731da67c6f4b61 Mon Sep 17 00:00:00 2001 From: "sbh (Open ERP)" Date: Mon, 5 Apr 2010 18:44:56 +0530 Subject: [PATCH] [IMP] point_of_sale,product: add the view_init in pos_discount and fix the problem of price bzr revid: sbh@tinyerp.com-20100405131456-rryojlpix96y62d0 --- addons/point_of_sale/wizard/pos_discount.py | 10 +++++++++- addons/point_of_sale/wizard/pos_payment.py | 2 +- addons/product/pricelist.py | 2 ++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/addons/point_of_sale/wizard/pos_discount.py b/addons/point_of_sale/wizard/pos_discount.py index f85a9d233ce..8b0f4b45fa4 100644 --- a/addons/point_of_sale/wizard/pos_discount.py +++ b/addons/point_of_sale/wizard/pos_discount.py @@ -35,6 +35,14 @@ class pos_discount(osv.osv_memory): 'discount': lambda *a: 5, } + + def view_init(self, cr, uid, fields_list, context=None): + res = super(pos_discount, self).view_init(cr, uid, fields_list, context=context) + record_id = context and context.get('active_id', False) or False + order = self.pool.get('pos.order').browse(cr, uid, record_id) + if not order.lines: + raise osv.except_osv('Error!','No Order Lines ') + True def apply_discount(self, cr, uid, ids, context): """ To give the discount of product and check the. @@ -52,7 +60,7 @@ class pos_discount(osv.osv_memory): order_ref = self.pool.get('pos.order') order_line_ref = self.pool.get('pos.order.line') - + for order in order_ref.browse(cr, uid, record_id, context=context): for line in order.lines: diff --git a/addons/point_of_sale/wizard/pos_payment.py b/addons/point_of_sale/wizard/pos_payment.py index c7b0da38168..c34e7fad9e1 100644 --- a/addons/point_of_sale/wizard/pos_payment.py +++ b/addons/point_of_sale/wizard/pos_payment.py @@ -84,7 +84,7 @@ class pos_make_payment(osv.osv_memory): record_id = context and context.get('active_id', False) or False order = self.pool.get('pos.order').browse(cr, uid, record_id) if not order.lines: - raise osv.except_osv('Error!','No Order Lines ') + raise osv.except_osv('Error!','No order lines defined for this sale ') True def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): diff --git a/addons/product/pricelist.py b/addons/product/pricelist.py index 001bee74055..bfd987d6f3d 100644 --- a/addons/product/pricelist.py +++ b/addons/product/pricelist.py @@ -136,6 +136,8 @@ class product_pricelist(osv.osv): 'date': Date of the pricelist (%Y-%m-%d), } ''' + price=False + item_id=0 context = context or {} currency_obj = self.pool.get('res.currency') product_obj = self.pool.get('product.product')