1
# -*- coding: utf-8 -*-
2
##############################################################################
4
# OpenERP, Open Source Management Solution
5
# Copyright (C) 2004-2011 Pexego (<www.pexego.es>). All Rights Reserved
6
# $Omar Castiñeira Saavedra$
8
# This program is free software: you can redistribute it and/or modify
9
# it under the terms of the GNU General Public License as published by
10
# the Free Software Foundation, either version 3 of the License, or
11
# (at your option) any later version.
13
# This program is distributed in the hope that it will be useful,
14
# but WITHOUT ANY WARRANTY; without even the implied warranty of
15
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
# GNU General Public License for more details.
18
# You should have received a copy of the GNU General Public License
19
# along with this program. If not, see <http://www.gnu.org/licenses/>.
21
##############################################################################
25
class partial_picking(osv.osv_memory):
27
_inherit = 'stock.partial.picking'
29
def get_picking_type(self, cr, uid, picking, context=None):
30
if context is None: context = {}
31
picking_type = picking.type
33
if picking_type != "in":
34
for move in picking.move_lines:
35
if picking.type == 'in' and move.product_id.cost_method == 'lifo':
40
def do_partial(self, cr, uid, ids, context=None):
41
""" Makes partial moves and pickings done.
42
@param self: The object pointer.
43
@param cr: A database cursor
44
@param uid: ID of the user currently logged in
45
@param fields: List of fields for which we want default values
46
@param context: A standard dictionary
47
@return: A dictionary which of fields with values.
49
if context is None: context = {}
50
res = super(partial_picking, self).do_partial(cr, uid, ids, context=context)
51
pick_obj = self.pool.get('stock.picking')
53
picking_ids = context.get('active_ids', False)
54
partial = self.browse(cr, uid, ids[0], context=context)
56
for pick in pick_obj.browse(cr, uid, picking_ids, context=context):
57
picking_type = self.get_picking_type(cr, uid, pick, context=context)
58
moves_list = picking_type == 'in' and partial.move_ids or []
60
for move in moves_list:
61
if move.product_id.cost_method == 'lifo':
62
self.pool.get('product.product').write(cr, uid, [move.product_id.id], {'standard_price': move.cost})
b'\\ No newline at end of file'