1
# -*- coding: utf-8 -*-
2
##############################################################################
4
# OpenERP, Open Source Management Solution
5
# Copyright (C) 2011 MSF, TeMPO Consulting
7
# This program is free software: you can redistribute it and/or modify
8
# it under the terms of the GNU Affero General Public License as
9
# published by the Free Software Foundation, either version 3 of the
10
# License, or (at your option) any later version.
12
# This program is distributed in the hope that it will be useful,
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
# GNU Affero General Public License for more details.
17
# You should have received a copy of the GNU Affero General Public License
18
# along with this program. If not, see <http://www.gnu.org/licenses/>.
20
##############################################################################
22
from osv import osv, fields
23
from tools.translate import _
25
from datetime import datetime, timedelta
26
from dateutil.relativedelta import relativedelta
27
import decimal_precision as dp
32
class stock_picking(osv.osv):
34
add a check boolean for confirmation of delivery
36
_inherit = 'stock.picking'
41
('confirmed', 'Confirmed'),
42
('assigned', 'Available'),
44
('delivered', 'Delivered'),
45
('cancel', 'Cancelled'),
48
def _vals_get_out_step(self, cr, uid, ids, fields, arg, context=None):
53
for obj in self.browse(cr, uid, ids, context=context):
56
result[obj.id].update({f:False,})
59
result[obj.id]['delivered_hidden'] = obj.delivered
61
result[obj.id]['state_hidden'] = obj.state
62
if obj.state == 'done' and obj.delivered:
63
result[obj.id]['state_hidden'] = 'delivered'
68
'delivered': fields.boolean(string='Delivered', readonly=True,),
69
'delivered_hidden': fields.function(_vals_get_out_step, method=True, type='boolean', string='Delivered Hidden', multi='get_vals_out_step',),
70
'state_hidden': fields.function(_vals_get_out_step, method=True, type='selection', selection=PICKING_STATE, string='State', multi='get_vals_out_step',),
77
def copy_data(self, cr, uid, id, default=None, context=None):
79
set delivered to False
85
default.update(delivered=False)
86
res = super(stock_picking, self).copy_data(cr, uid, id, default=default, context=context)
89
def set_delivered(self, cr, uid, ids, context=None):
91
set the delivered flag
93
self.write(cr, uid, ids, {'delivered': True,}, context=context)