[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
This commit is contained in:
sbh (Open ERP) 2010-04-05 18:44:56 +05:30
parent eeff7f200e
commit 09a575a05e
3 changed files with 12 additions and 2 deletions

View File

@ -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:

View File

@ -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):

View File

@ -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')