[REVERT]: stock: Reverted fix for bug#613286: revision-id: rha@tinyerp.com-20101229131420-k97xl7mrx9htvchi

bzr revid: rpa@tinyerp.com-20110112132338-yxa9erhkppt8yfno
This commit is contained in:
rpa (Open ERP) 2011-01-12 18:53:38 +05:30
parent 18ba46034c
commit 6ae2d39def
3 changed files with 5 additions and 19 deletions

View File

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

View File

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

View File

@ -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('<field name="return%s"/>\n<newline/>' % (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('<field name="return_price%s"/>\n<newline/>' % (m.id,))
res['fields']['return_price%s' % m.id]={'string':'Price', 'type':'float', 'required':True}
res.setdefault('returns', []).append(m.id)
arch_lst.append('<field name="invoice_state"/>\n<newline/>')
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: