1
# -*- coding: utf-8 -*-
2
##############################################################################
4
# Copyright (C) 2004-2011 Pexego Sistemas Informáticos. All Rights Reserved
5
# $Omar Castiñeira Saavedra$
6
# $Marta Vázquez Rodríguez$
8
# This program is free software: you can redistribute it and/or modify
9
# it under the terms of the GNU General Public License as published by
10
# the Free Software Foundation, either version 3 of the License, or
11
# (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 General Public License for more details.
18
# You should have received a copy of the GNU General Public License
19
# along with this program. If not, see <http://www.gnu.org/licenses/>.
21
##############################################################################
22
from osv import osv, fields
24
class mrp_bom(osv.osv):
27
'employees_ids': fields.many2many('hr.employee', 'employee_mrp_rel', 'bom_id','employee_id', 'Employees')
32
class mrp_production(osv.osv):
33
_inherit = "mrp.production"
34
def explode_employees(self,cr,uid,ids,context=None):
35
if context is None: context = {}
37
for production in self.browse(cr,uid,ids):
38
if production.bom_id.employees_ids:
39
for employees_id in production.bom_id.employees_ids:
41
'employee_id': employees_id.id
44
def action_compute(self,cr,uid,ids,properties=[],context=None):
45
if context is None: context = {}
46
results = super(mrp_production, self).action_compute(cr, uid, ids, properties,context=context)
48
production_obj = self.pool.get('mrp.production')
49
bom_obj = self.pool.get('mrp.bom')
50
man_power_obj = self.pool.get('mrp.production.manpower')
51
for production in self.browse(cr,uid,ids):
52
employees = production_obj.explode_employees(cr,uid,ids)
53
for line in employees:
54
line['production_id'] = production.id
55
man_power_obj.create(cr, uid, line)
b'\\ No newline at end of file'