[FIX] point_of_sale: Return product from POS previous session should be linked to current opened session, if not found an active session then raise a warning message. (Maintenance Case: 589810)

lp bug: https://launchpad.net/bugs/1123575 fixed

bzr revid: rgo@tinyerp.com-20130321132824-9lvtpbu7yse3cupl
This commit is contained in:
Ravi Gohil (OpenERP) 2013-03-21 18:58:24 +05:30
parent bfbdd94fa8
commit d7600ad56e
1 changed files with 6 additions and 1 deletions

View File

@ -772,9 +772,14 @@ class pos_order(osv.osv):
"""Create a copy of order for refund order"""
clone_list = []
line_obj = self.pool.get('pos.order.line')
for order in self.browse(cr, uid, ids, context=context):
pos_orders = self.browse(cr, uid, ids, context=context)
current_session = self.pool.get('pos.session').search(cr, uid, [('config_id', '=', pos_orders[0].session_id.config_id.id), ('state', '!=', 'closed')])
if not current_session:
raise osv.except_osv(_('Error!'), _('To return product(s), you need to open a session that belongs to the same "Point of Sale" as of the product(s) to be returned.'))
for order in pos_orders:
clone_id = self.copy(cr, uid, order.id, {
'name': order.name + ' REFUND',
'session_id': current_session[0]
}, context=context)
clone_list.append(clone_id)