2
# -*- coding: utf-8 -*-
3
##############################################################################
5
# OpenERP, Open Source Management Solution
6
# Copyright (C) 2011 TeMPO Consulting, MSF
8
# This program is free software: you can redistribute it and/or modify
9
# it under the terms of the GNU Affero General Public License as
10
# published by the Free Software Foundation, either version 3 of the
11
# License, or (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 Affero General Public License for more details.
18
# You should have received a copy of the GNU Affero General Public License
19
# along with this program. If not, see <http://www.gnu.org/licenses/>.
21
##############################################################################
23
from osv import fields, osv
24
from tools.translate import _
27
class stock_partial_picking(osv.osv_memory):
28
_inherit = "stock.partial.picking"
30
def __create_partial_picking_memory(self, picking, pick_type):
32
add the composition_list_id
33
NOTE: the name used here : picking is WRONG. it is in fact a stock.move object
35
move_memory = super(stock_partial_picking, self).__create_partial_picking_memory(picking, pick_type)
36
assert move_memory is not None
38
move_memory.update({'composition_list_id' : picking.composition_list_id.id})
42
def do_partial_hook(self, cr, uid, context, *args, **kwargs):
44
add hook to do_partial
47
partial_datas = super(stock_partial_picking, self).do_partial_hook(cr, uid, context, *args, **kwargs)
48
assert partial_datas, 'partial_datas missing'
50
move = kwargs.get('move')
51
assert move, 'move is missing'
53
# update composition_list_id
54
partial_datas['move%s' % (move.move_id.id)].update({'composition_list_id': move.composition_list_id.id,})
58
stock_partial_picking()