1
##############################################################################
3
# Copyright (c) 2005-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
7
# WARNING: This program as such is intended to be used by professional
8
# programmers who take the whole responsability of assessing all potential
9
# consequences resulting from its eventual inadequacies and bugs
10
# End users who are looking for a ready-to-use solution with commercial
11
# garantees and support are strongly adviced to contract a Free Software
14
# This program is Free Software; you can redistribute it and/or
15
# modify it under the terms of the GNU General Public License
16
# as published by the Free Software Foundation; either version 2
17
# of the License, or (at your option) any later version.
19
# This program is distributed in the hope that it will be useful,
20
# but WITHOUT ANY WARRANTY; without even the implied warranty of
21
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22
# GNU General Public License for more details.
24
# You should have received a copy of the GNU General Public License
25
# along with this program; if not, write to the Free Software
26
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
28
##############################################################################
31
from osv import fields,osv
34
class stock_production_lot(osv.osv):
35
_name = 'stock.production.lot'
36
_inherit = 'stock.production.lot'
39
def calc_date(self, cr, uid, context={}):
40
if context.get('product_id', False):
41
product = pooler.get_pool(cr.dbname).get('product.product').browse(cr, uid, [context['product_id']])[0]
42
duree = getattr(product, dtype) or 0
43
date = datetime.datetime.today() + datetime.timedelta(days=duree)
44
return date.strftime('%Y-%m-%d %H:%M:%S')
50
'dlc': fields.datetime('Product usetime'),
51
'dluo': fields.datetime('DLUO'),
52
'removal_date': fields.datetime('Removal date'),
53
'alert_date': fields.datetime('Alert date'),
57
'dlc': _get_date('life_time'),
58
'dluo': _get_date('use_time'),
59
'removal_date': _get_date('removal_time'),
60
'alert_date': _get_date('alert_time'),
62
stock_production_lot()
64
class product_product(osv.osv):
65
_inherit = 'product.product'
66
_name = 'product.product'
68
'life_time': fields.integer('Product lifetime'),
69
'use_time': fields.integer('Product usetime'),
70
'removal_time': fields.integer('Product removal time'),
71
'alert_time': fields.integer('Product alert time'),