diff --git a/addons/point_of_sale/wizard/pos_return.py b/addons/point_of_sale/wizard/pos_return.py
index fac55c593e7..cede85d1d38 100644
--- a/addons/point_of_sale/wizard/pos_return.py
+++ b/addons/point_of_sale/wizard/pos_return.py
@@ -91,85 +91,6 @@ class pos_return(osv.osv_memory):
'context': context,
'type': 'ir.actions.act_window',
}
- def create_returns2(self, cr, uid, ids, context=None):
-
- if context is None:
- context = {}
- active_id = context.get('active_id', False)
- order_obj =self.pool.get('pos.order')
- line_obj = self.pool.get('pos.order.line')
- picking_obj = self.pool.get('stock.picking')
- stock_move_obj = self.pool.get('stock.move')
- property_obj= self.pool.get("ir.property")
- uom_obj =self. pool.get('product.uom')
- statementl_obj = self.pool.get('account.bank.statement.line')
- #Todo :Need to clean the code
- if active_id:
- data = self.browse(cr, uid, ids, context=context)[0]
- date_cur = time.strftime('%Y-%m-%d %H:%M:%S')
-
- for order_id in order_obj.browse(cr, uid, [active_id], context=context):
- source_stock_id = property_obj.get(cr, uid, 'property_stock_customer', 'res.partner', context=context).id
- cr.execute("SELECT s.id FROM stock_location s, stock_warehouse w "
- "WHERE w.lot_stock_id=s.id AND w.id=%s ",
- (order_id.warehouse_id.id,))
- res = cr.fetchone()
- location_id = res and res[0] or None
- new_picking = picking_obj.copy(cr, uid, order_id.picking_id.id, {'name':'%s (return)' % order_id.name,
- 'move_lines': [],
- 'state':'draft',
- 'type': 'in',
- 'partner_id': order_id.partner_id.id,
- 'date': date_cur })
- new_order = order_obj.copy(cr, uid, order_id.id, {'name': 'Refund %s'%order_id.name,
- 'lines':[],
- 'statement_ids':[],
- 'picking_id':[]})
- account_def = property_obj.get(cr, uid, 'property_account_payable', 'res.partner', context=context)
- amount = 0.0
- for line in order_id.lines:
- for record in data.pos_moves_ids:
- if line.id == record.line_id:
- qty = record.quantity
- amount += qty * line.price_unit
- stock_move_obj.create(cr, uid, {
- 'product_uom_qty': qty,
- 'product_uos_qty': uom_obj._compute_qty(cr, uid, qty ,line.product_id.uom_id.id),
- 'picking_id': new_picking,
- 'product_uom': line.product_id.uom_id.id,
- 'location_id': source_stock_id,
- 'product_id': line.product_id.id,
- 'location_dest_id': location_id,
- 'name': '%s (return)' %order_id.name,
- 'date': date_cur
- })
- if qty != 0.0:
- line_obj.copy(cr, uid, line.id, {'qty': -qty, 'order_id': new_order})
- statementl_obj.create(cr, uid, {
- 'name': 'Refund %s'%order_id.name,
- 'statement_id': order_id.statement_ids[0].statement_id.id,
- 'pos_statement_id': new_order,
- 'date': fields.date.context_today(self, cr, uid, context=context),
- 'account_id': order_id.partner_id and order_id.partner_id.property_account_payable \
- and order_id.partner_id.property_account_payable.id or account_def.id,
- 'amount': -amount,
- })
- order_obj.write(cr,uid, [active_id,new_order], {'state': 'done'})
- picking_obj.signal_button_confirm(cr, uid, [new_picking])
- picking_obj.force_assign(cr, uid, [new_picking], context)
- act = {
- 'domain': "[('id', 'in', ["+str(new_order)+"])]",
- 'name': 'Refunded Orders',
- 'view_type': 'form',
- 'view_mode': 'tree,form',
- 'res_model': 'pos.order',
- 'auto_refresh':0,
- 'res_id':new_order,
- 'view_id': False,
- 'context':context,
- 'type': 'ir.actions.act_window'
- }
- return act
class add_product(osv.osv_memory):