2
# -*- encoding: utf-8 -*-
3
###############################################################################
4
# Module Writen to OpenERP, Open Source Management Solution
5
# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>).
7
# Credits######################################################
8
# Coded by: Yanina Aular <yanina.aular@vauxoo.com>
9
# Katherine Zaoral <katherine.zaoral@vauxoo.com>
10
# Planified by: Yanina Aular <yanina.aular@vauxoo.com>
11
# Audited by: Humberto Arocha <humbertoarocha@gmail.com>
12
###############################################################################
13
# This program is free software: you can redistribute it and/or modify
14
# it under the terms of the GNU Affero General Public License as published
15
# by the Free Software Foundation, either version 3 of the License, or
16
# (at your option) any later version.
18
# This program is distributed in the hope that it will be useful,
19
# but WITHOUT ANY WARRANTY; without even the implied warranty of
20
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
# GNU Affero General Public License for more details.
23
# You should have received a copy of the GNU Affero General Public License
24
# along with this program. If not, see <http://www.gnu.org/licenses/>.
25
###############################################################################
27
from openerp.osv import fields, osv, orm
28
from openerp.tools.translate import _
30
# class mrp_workcenter(osv.Model):
32
# _inherit = "mrp.workcenter"
35
# "sequence": fields.integer("Sequence")
38
# _sql_constraints = [
39
# ("sequence_uniq", "unique(sequence)", "The sequence of the workcenter must be unique!")
43
class mrp_production_workcenter_line(osv.Model):
45
_inherit = "mrp.production.workcenter.line"
48
'routing_id': fields.related('production_id', 'routing_id', type='many2one', relation='mrp.routing', string='Routing', store=True),
51
def _read_group_workcenter_ids(self, cr, uid, ids, domain, read_group_order=None, access_rights_uid=None, context=None):
53
routing_obj = self.pool.get('mrp.routing')
54
workcenter_obj = self.pool.get('mrp.workcenter')
57
if context.get('active_id', False):
58
routing_brw = routing_obj.browse(cr, uid,
59
context.get('active_id', False), context=context)
61
for work_line in routing_brw.workcenter_lines:
62
workcenter_ids.append(work_line.workcenter_id.id)
63
workcenter_ids = map(lambda x: x, set(workcenter_ids))
64
work_orders_ids = self.search(cr, uid, [("workcenter_id", "in", workcenter_ids), (
65
"routing_id", "=", context.get('active_id', False))], context=context)
67
workcenter_ids = workcenter_obj.search(
68
cr, uid, [], context=context)
69
work_orders_ids = self.search(cr, uid, [(
70
"workcenter_id", "in", workcenter_ids)], context=context)
72
lista_workcenter = workcenter_obj.browse(
73
cr, uid, workcenter_ids, context=context)
74
# lista_workcenter.sort(key=lambda x: x.sequence)
75
# lista_workcenter.reverse()
77
# Lista de tuplas (id, name)
79
for i in lista_workcenter:
80
result.append((i.id, i.name))
82
# Si se despliega o no
84
for i in workcenter_ids:
87
return result, visible
90
'workcenter_id': _read_group_workcenter_ids,