1
# -*- coding: utf-8 -*-
2
##############################################################################
4
# Copyright (C) 2004-2011 Pexego Sistemas Informáticos. All Rights Reserved
5
# $Omar Castiñeira Saavedra$
7
# This program is free software: you can redistribute it and/or modify
8
# it under the terms of the GNU General Public License as published by
9
# the Free Software Foundation, either version 3 of the License, or
10
# (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 General Public License for more details.
17
# You should have received a copy of the GNU General Public License
18
# along with this program. If not, see <http://www.gnu.org/licenses/>.
20
##############################################################################
22
from osv import osv, fields
24
class mrp_bom(osv.osv):
27
_order = "bom_id,sequence"
30
'formula': fields.char('Formula', size=255),
31
'eval_type': fields.selection([('fixed', 'Fixed'),('computed','Computed')], 'Computation', help="Evaluation type, fixed quantity or quantity over formula field"),
32
'seq_lines_id': fields.many2one('ir.sequence', 'Sequence', readonly=True)
39
def create(self, cr, uid, vals, context=None):
40
if context is None: context = {}
42
seq_id = self.pool.get('ir.sequence').search(cr, uid, [('code', '=', 'mrp.bom.seq')], order="id")
44
vals['seq_lines_id'] = self.pool.get('ir.sequence').copy(cr, uid, seq_id[0], {'number_next': 1})
46
if vals.get('bom_id', False):
47
bom = self.browse(cr, uid, vals['bom_id'])
49
num = self.pool.get('ir.sequence').get_id(cr, uid, bom.seq_lines_id.id)
50
vals['sequence'] = num
52
return super(mrp_bom, self).create(cr, uid, vals, context=context)
b'\\ No newline at end of file'