From 6ae2d39defd6552f8d46c54fd4618e3c76849867 Mon Sep 17 00:00:00 2001 From: "rpa (Open ERP)" Date: Wed, 12 Jan 2011 18:53:38 +0530 Subject: [PATCH] [REVERT]: stock: Reverted fix for bug#613286: revision-id: rha@tinyerp.com-20101229131420-k97xl7mrx9htvchi bzr revid: rpa@tinyerp.com-20110112132338-yxa9erhkppt8yfno --- addons/sale/sale.py | 1 - addons/stock/stock.py | 3 --- addons/stock/wizard/stock_return_picking.py | 20 +++++--------------- 3 files changed, 5 insertions(+), 19 deletions(-) diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 60c5a1e263f..04068b5bd7e 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -705,7 +705,6 @@ class sale_order(osv.osv): #'state': 'waiting', 'note': line.notes, 'company_id': order.company_id.id, - 'returned_price': line.price_unit, }) if line.product_id: diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 4dea848c190..0c2a739761a 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -1223,8 +1223,6 @@ class stock_picking(osv.osv): {'price_unit': product_price, 'price_currency_id': product_currency}) - if not move.returned_price: - move_obj.write(cr, uid, [move.id], {'returned_price': move.price_unit}) for move in too_few: product_qty = move_product_qty[move.id] @@ -1545,7 +1543,6 @@ class stock_move(osv.osv): # used for colors in tree views: 'scrapped': fields.related('location_dest_id','scrap_location',type='boolean',relation='stock.location',string='Scrapped', readonly=True), - 'returned_price': fields.float('Returned product price', digits_compute= dp.get_precision('Sale Price')), } _constraints = [ (_check_tracking, diff --git a/addons/stock/wizard/stock_return_picking.py b/addons/stock/wizard/stock_return_picking.py index d71e6361b32..918c519a1e4 100644 --- a/addons/stock/wizard/stock_return_picking.py +++ b/addons/stock/wizard/stock_return_picking.py @@ -53,10 +53,8 @@ class stock_return_picking(osv.osv_memory): res['invoice_state'] = 'none' for line in pick.move_lines: return_id = 'return%s'%(line.id) - return_price = 'return_price%s'%(line.id) if return_id in fields: res[return_id] = line.product_qty - res[return_price]=line.price_unit return res def view_init(self, cr, uid, fields_list, context=None): @@ -88,11 +86,8 @@ class stock_return_picking(osv.osv_memory): valid_lines += 1 if 'return%s'%(m.id) not in self._columns: self._columns['return%s'%(m.id)] = fields.float(string=m.name, required=True) - if 'return_price%s'%(m.id) not in self._columns: - self._columns['return_price%s'%(m.id)] = fields.float(string=m.name, required=True) if 'invoice_state' not in self._columns: self._columns['invoice_state'] = fields.selection([('2binvoiced', 'To be refunded/invoiced'), ('none', 'No invoicing')], string='Invoicing', required=True) - if not valid_lines: raise osv.except_osv(_('Warning !'), _("There are no products to return (only lines in Done state and not fully returned yet can be returned)!")) return res @@ -126,10 +121,6 @@ class stock_return_picking(osv.osv_memory): if m.state=='done' and quantity > return_history[m.id]: arch_lst.append('\n' % (m.id,)) res['fields']['return%s' % m.id]={'string':m.name, 'type':'float', 'required':True} - - if m.product_id.cost_method == 'average' and pick.type == 'in': - arch_lst.append('\n' % (m.id,)) - res['fields']['return_price%s' % m.id]={'string':'Price', 'type':'float', 'required':True} res.setdefault('returns', []).append(m.id) arch_lst.append('\n') res['fields']['invoice_state']={'string':_('Invoicing'), 'type':'selection','required':True, 'selection':[('2binvoiced', _('To be refunded/invoiced')), ('none', _('No invoicing'))]} @@ -142,7 +133,7 @@ class stock_return_picking(osv.osv_memory): return res def create_returns(self, cr, uid, ids, context=None): - """ + """ Creates return picking. @param self: The object pointer. @param cr: A database cursor @@ -152,13 +143,13 @@ class stock_return_picking(osv.osv_memory): @return: A dictionary which of fields with values. """ if context is None: - context = {} + context = {} record_id = context and context.get('active_id', False) or False move_obj = self.pool.get('stock.move') pick_obj = self.pool.get('stock.picking') uom_obj = self.pool.get('product.uom') wf_service = netsvc.LocalService("workflow") - + pick = pick_obj.browse(cr, uid, record_id, context=context) data = self.read(cr, uid, ids[0]) new_picking = None @@ -180,7 +171,6 @@ class stock_return_picking(osv.osv_memory): new_location=move.location_dest_id.id if move.state=='done': new_qty = data['return%s' % move.id] - price_unit = data['return_price%s' % move.id] returned_qty = move.product_qty for rec in move.move_history_ids2: @@ -188,6 +178,7 @@ class stock_return_picking(osv.osv_memory): if returned_qty != new_qty: set_invoice_state_to_none = False + if new_qty: returned_lines += 1 new_move=move_obj.copy(cr, uid, move.id, { @@ -196,8 +187,7 @@ class stock_return_picking(osv.osv_memory): new_qty, move.product_uos.id), 'picking_id':new_picking, 'state':'draft', 'location_id':new_location, 'location_dest_id':move.location_id.id, - 'date':date_cur, - 'price_unit':price_unit}) + 'date':date_cur,}) move_obj.write(cr, uid, [move.id], {'move_history_ids2':[(4,new_move)]}) if not returned_lines: