diff --git a/addons/hr_equipment/__init__.py b/addons/hr_equipment/__init__.py new file mode 100644 index 00000000000..b0813b00fc7 --- /dev/null +++ b/addons/hr_equipment/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Odoo (formerly OpenERP), Open Source Management Solution +# Copyright (C) 2014-Today Odoo S.A (). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +import models diff --git a/addons/hr_equipment/__openerp__.py b/addons/hr_equipment/__openerp__.py new file mode 100644 index 00000000000..a57a191b65e --- /dev/null +++ b/addons/hr_equipment/__openerp__.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- + +{ + 'name': 'Track Employees Equipment', + 'version': '1.0', + 'description': """ + Track employees' equipment and manage its allocation """, + 'author': 'Odoo S.A.', + 'depends': ['hr'], + 'data': [ + 'security/hr_equipment.xml', + 'security/ir.model.access.csv', + 'data/hr_equipment_data.xml', + 'views/res_config_views.xml', + 'views/hr_equipment_views.xml', + ], + 'demo': ['data/hr_equipment_demo.xml'], + 'installable': True, + 'application': True, +} diff --git a/addons/hr_equipment/data/hr_equipment_data.xml b/addons/hr_equipment/data/hr_equipment_data.xml new file mode 100644 index 00000000000..9935b5731de --- /dev/null +++ b/addons/hr_equipment/data/hr_equipment_data.xml @@ -0,0 +1,87 @@ + + + + + + + New Request + + + + + In Progress + + + + + Repaired + + + + + Scrap + + + + + Cancelled + + + + + + + helpdesk + + + + + + + Request Created + hr.equipment.request + + Maintenance Request created + + + Status Changed + hr.equipment.request + + Status changed + + + + + Equipment Assigned + hr.equipment + Equipment Assigned + + + + + Maintenance Request Created + hr.equipment.category + + + category_id + + + Equipment Assigned + hr.equipment.category + + + category_id + + + + + Open HR Menu + reload + + + + + open + + + diff --git a/addons/hr_equipment/data/hr_equipment_demo.xml b/addons/hr_equipment/data/hr_equipment_demo.xml new file mode 100644 index 00000000000..f2c277933f0 --- /dev/null +++ b/addons/hr_equipment/data/hr_equipment_demo.xml @@ -0,0 +1,143 @@ + + + + + + + Computers + + + + Monitors + + 3 + + + Softwares + + + + Printers + + + + Phones + + + + + + Samsung Monitor 15" + + + + + MT/122/11112222 + NP300E5X + + + Samsung Monitor 15" + + + + + MT/125/22778837 + NP355E5X + + + Samsung Monitor 15" + + + + + MT/127/18291018 + NP355E5X + 3 + + + Acer Laptop + + + + + LP/203/19281928 + NE56R + + + Acer Laptop + + + + + LP/205/12928291 + V5131 + + + HP Laptop + + + + + LP/303/28292090 + 17-j059nr + + + HP Laptop + + + + + LP/305/17281718 + + + HP Inkjet printer + + + PR/011/2928191889 + + + + + + Resolution is bad + + + + + 7 + + + + Some keys are not working + + + + + + + + Motherboard failed + + + + + + + + Battery drains fast + + + + + + + + Touchpad not working + + + + + + + + diff --git a/addons/hr_equipment/models/__init__.py b/addons/hr_equipment/models/__init__.py new file mode 100644 index 00000000000..96f730a43a9 --- /dev/null +++ b/addons/hr_equipment/models/__init__.py @@ -0,0 +1,4 @@ +# -*- coding: utf-8 -*- + +import hr_equipment +import res_config diff --git a/addons/hr_equipment/models/hr_equipment.py b/addons/hr_equipment/models/hr_equipment.py new file mode 100644 index 00000000000..929a35532f0 --- /dev/null +++ b/addons/hr_equipment/models/hr_equipment.py @@ -0,0 +1,350 @@ +# -*- coding: utf-8 -*- + +from openerp import api, fields, models, fields +from openerp import _, tools +from openerp.exceptions import UserError + + +class HrEquipmentStage(models.Model): + """ Model for case stages. This models the main stages of a Maintenance Request management flow. """ + + _name = 'hr.equipment.stage' + _description = 'Equipment Stage' + _order = 'sequence, id' + + name = fields.Char('Name', required=True, translate=True) + sequence = fields.Integer('Sequence', default=20) + fold = fields.Boolean('Folded in Kanban View') + + +class HrEquipmentCategory(models.Model): + _name = 'hr.equipment.category' + _inherits = {"mail.alias": "alias_id"} + _inherit = ['mail.thread'] + _description = 'Equipment Category' + + @api.one + @api.depends('equipment_ids') + def _compute_fold(self): + self.fold = False if self.equipment_count else True + + name = fields.Char('Category Name', required=True, translate=True) + user_id = fields.Many2one('res.users', 'Responsible', track_visibility='onchange', default=lambda self: self.env.uid) + color = fields.Integer('Color Index') + note = fields.Text('Comments', translate=True) + equipment_ids = fields.One2many('hr.equipment', 'category_id', string='Equipments', copy=False) + equipment_count = fields.Integer(string="Equipment", compute='_compute_equipment_count') + maintenance_ids = fields.One2many('hr.equipment.request', 'category_id', copy=False, domain=[('stage_id.fold', '=', False)]) + maintenance_count = fields.Integer(string="Maintenance", compute='_compute_maintenance_count') + alias_id = fields.Many2one( + 'mail.alias', 'Alias', ondelete='cascade', required=True, + help="Email alias for this equipment category. New emails will automatically " + "create new maintenance request for this equipment category.") + fold = fields.Boolean(string='Folded in Kanban View', compute='_compute_fold', store=True) + + @api.multi + def _compute_equipment_count(self): + equipment_data = self.env['hr.equipment'].read_group([('category_id', 'in', self.ids)], ['category_id'], ['category_id']) + mapped_data = dict([(m['category_id'][0], m['category_id_count']) for m in equipment_data]) + for category in self: + category.equipment_count = mapped_data.get(category.id, 0) + + @api.multi + def _compute_maintenance_count(self): + maintenance_data = self.env['hr.equipment.request'].read_group([('category_id', 'in', self.ids)], ['category_id'], ['category_id']) + mapped_data = dict([(m['category_id'][0], m['category_id_count']) for m in maintenance_data]) + for category in self: + category.maintenance_count = mapped_data.get(category.id, 0) + + @api.model + def create(self, vals): + self = self.with_context(alias_model_name='hr.equipment.request', alias_parent_model_name=self._name) + category_id = super(HrEquipmentCategory, self).create(vals) + category_id.alias_id.write({'alias_parent_thread_id': category_id.id, 'alias_defaults': {'category_id': category_id.id}}) + return category_id + + @api.multi + def unlink(self): + for category in self: + if category.equipment_ids or category.maintenance_ids: + raise UserError(_("You cannot delete an equipment category containing equipments or maintenance requests.")) + res = super(HrEquipmentCategory, self).unlink() + return res + + +class HrEquipment(models.Model): + _name = 'hr.equipment' + _inherit = ['mail.thread'] + _description = 'Equipment' + + @api.multi + def _track_subtype(self, init_values): + self.ensure_one() + if ('employee_id' in init_values and self.employee_id) or ('department_id' in init_values and self.department_id): + return 'hr_equipment.mt_mat_assign' + return super(HrEquipment, self)._track_subtype(init_values) + + @api.multi + def name_get(self): + result = [] + for record in self: + if record.name and record.serial_no: + result.append((record.id, record.name + '/' + record.serial_no)) + if record.name and not record.serial_no: + result.append((record.id, record.name)) + return result + + @api.model + def name_search(self, name, args=None, operator='ilike', limit=100): + args = args or [] + recs = self.browse() + if name: + recs = self.search([('name', '=', name)] + args, limit=limit) + if not recs: + recs = self.search([('name', operator, name)] + args, limit=limit) + return recs.name_get() + + name = fields.Char('Name', required=True, translate=True) + user_id = fields.Many2one('res.users', string='Technician', track_visibility='onchange') + employee_id = fields.Many2one('hr.employee', string='Assigned to Employee', track_visibility='onchange') + department_id = fields.Many2one('hr.department', string='Assigned to Department', track_visibility='onchange') + category_id = fields.Many2one('hr.equipment.category', string='Equipment Category', track_visibility='onchange') + partner_id = fields.Many2one('res.partner', string='Supplier', domain="[('supplier', '=', 1)]") + model = fields.Char('Model') + serial_no = fields.Char('Serial Number', copy=False) + assign_date = fields.Date('Assigned Date', track_visibility='onchange') + cost = fields.Float('Cost') + note = fields.Text('Note') + color = fields.Integer('Color Index') + scrap_date = fields.Date('Scrap Date') + equipment_assign_to = fields.Selection( + [('department', 'By Department'), ('employee', 'By Employee')], + string='Allocate To', + help='By Employee: equipment assigned to individual Employee, By Department: equipment assigned to group of employees in department', + required=True, + default='employee') + maintenance_ids = fields.One2many('hr.equipment.request', 'equipment_id', domain=[('stage_id.fold', '=', False)]) + maintenance_count = fields.Integer(compute='_compute_maintenance_count', string="Maintenance") + + @api.one + @api.depends('maintenance_ids') + def _compute_maintenance_count(self): + self.maintenance_count = len(self.maintenance_ids) + + @api.onchange('equipment_assign_to') + def _onchange_equipment_assign_to(self): + if self.equipment_assign_to == 'employee': + self.department_id = False + if self.equipment_assign_to == 'department': + self.employee_id = False + self.assign_date = fields.Date.context_today(self) + + @api.onchange('category_id') + def _onchange_category_id(self): + self.user_id = self.category_id.user_id + + _sql_constraints = [ + ('serial_no', 'unique(serial_no)', "The serial number of this equipment must be unique !"), + ] + + @api.model + def create(self, vals): + equipment = super(HrEquipment, self).create(vals) + # subscribe employee or department manager when equipment assign to him. + user_ids = [] + if equipment.employee_id and equipment.employee_id.user_id: + user_ids.append(equipment.employee_id.user_id.id) + if equipment.department_id and equipment.department_id.manager_id and equipment.department_id.manager_id.user_id: + user_ids.append(equipment.department_id.manager_id.user_id.id) + if user_ids: + equipment.message_subscribe_users(user_ids=user_ids) + return equipment + + @api.multi + def write(self, vals): + user_ids = [] + # subscribe employee or department manager when equipment assign to employee or department. + if vals.get('employee_id'): + user_id = self.env['hr.employee'].browse(vals['employee_id'])['user_id'] + if user_id: + user_ids.append(user_id.id) + if vals.get('department_id'): + department = self.env['hr.department'].browse(vals['department_id']) + if department and department.manager_id and department.manager_id.user_id: + user_ids.append(department.manager_id.user_id.id) + if user_ids: + self.message_subscribe_users(user_ids=user_ids) + return super(HrEquipment, self).write(vals) + + @api.multi + def _read_group_category_ids(self, domain, read_group_order=None, access_rights_uid=None): + """ Read group customization in order to display all the category in the + kanban view, even if they are empty + """ + category_obj = self.env['hr.equipment.category'] + order = category_obj._order + access_rights_uid = access_rights_uid or self._uid + if read_group_order == 'category_id desc': + order = '%s desc' % order + + category_ids = category_obj._search([], order=order, access_rights_uid=access_rights_uid) + result = [category.name_get()[0] for category in category_obj.browse(category_ids)] + # restore order of the search + result.sort(lambda x, y: cmp(category_ids.index(x[0]), category_ids.index(y[0]))) + + fold = {} + for category in category_obj.browse(category_ids): + fold[category.id] = category.fold + return result, fold + + _group_by_full = { + 'category_id': _read_group_category_ids + } + + +class HrEquipmentRequest(models.Model): + _name = 'hr.equipment.request' + _inherit = ['mail.thread'] + _description = 'Equipment Request' + + @api.returns('self') + def _default_employee_get(self): + return self.env['hr.employee'].search([('user_id', '=', self.env.uid)], limit=1) + + @api.returns('self') + def _default_stage(self): + return self.env['hr.equipment.stage'].search([], limit=1) + + @api.multi + def _track_subtype(self, init_values): + self.ensure_one() + if 'stage_id' in init_values and self.stage_id.sequence <= 1: + return 'hr_equipment.mt_req_created' + elif 'stage_id' in init_values and self.stage_id.sequence > 1: + return 'hr_equipment.mt_req_status' + return super(HrEquipmentRequest, self)._track_subtype(init_values) + + name = fields.Char('Subjects', required=True) + description = fields.Text('Description') + request_date = fields.Date('Request Date', track_visibility='onchange', default=fields.Date.context_today) + employee_id = fields.Many2one('hr.employee', string='Employee', default=_default_employee_get) + department_id = fields.Many2one('hr.department', string='Department') + category_id = fields.Many2one('hr.equipment.category', string='Category') + equipment_id = fields.Many2one('hr.equipment', string='Equipment', select=True) + user_id = fields.Many2one('res.users', string='Assigned to', track_visibility='onchange') + stage_id = fields.Many2one('hr.equipment.stage', string='Stage', track_visibility='onchange', default=_default_stage) + priority = fields.Selection([('0', 'Very Low'), ('1', 'Low'), ('2', 'Normal'), ('3', 'High')], string='Priority') + color = fields.Integer('Color Index') + close_date = fields.Date('Close Date') + kanban_state = fields.Selection([('normal', 'In Progress'), ('blocked', 'Blocked'), ('done', 'Ready for next stage')], + string='Kanban State', required=True, default='normal', track_visibility='onchange') + + @api.onchange('employee_id', 'department_id') + def onchange_department_or_employee_id(self): + domain = [] + if self.department_id: + domain = [('department_id', '=', self.department_id.id)] + if self.employee_id and self.department_id: + domain = ['|'] + domain + if self.employee_id: + domain = domain + ['|', ('employee_id', '=', self.employee_id.id), ('employee_id', '=', None)] + equipment = self.env['hr.equipment'].search(domain, limit=2) + if len(equipment) == 1: + self.equipment_id = equipment + return {'domain': {'equipment_id': domain}} + + @api.onchange('equipment_id') + def onchange_equipment_id(self): + self.user_id = self.equipment_id.user_id if self.equipment_id.user_id else self.equipment_id.category_id.user_id + self.category_id = self.equipment_id.category_id + + @api.onchange('category_id') + def onchange_category_id(self): + if not self.user_id or not self.equipment_id or (self.user_id and not self.equipment_id.user_id): + self.user_id = self.category_id.user_id + + @api.model + def create(self, vals): + # context: no_log, because subtype already handle this + self = self.with_context(mail_create_nolog=True) + result = super(HrEquipmentRequest, self).create(vals) + if result.employee_id.user_id: + result.message_subscribe_users(user_ids=[result.employee_id.user_id.id]) + return result + + @api.multi + def write(self, vals): + # Overridden to reset the kanban_state to normal whenever + # the stage (stage_id) of the Maintenance Request changes. + if vals and 'kanban_state' not in vals and 'stage_id' in vals: + new_stage = vals.get('stage_id') + vals_reset_kstate = dict(vals, kanban_state='normal') + for equipment_request in self: + write_vals = vals_reset_kstate if equipment_request.stage_id.id != new_stage else vals + equipment_request.write(write_vals) + if vals.get('employee_id'): + user = False + employee = self.env['hr.employee'].browse(vals['employee_id']) + if employee: + user = employee.user + if user: + self.message_subscribe_users(user_ids=[user.id]) + return super(HrEquipmentRequest, self).write(vals) + + @api.multi + def _read_group_stage_ids(self, domain, read_group_order=None, access_rights_uid=None): + """ Read group customization in order to display all the stages in the + kanban view, even if they are empty + """ + stage_obj = self.env['hr.equipment.stage'] + order = stage_obj._order + access_rights_uid = access_rights_uid or self._uid + + if read_group_order == 'stage_id desc': + order = '%s desc' % order + + stage_ids = stage_obj._search([], order=order, access_rights_uid=access_rights_uid) + result = [stage.name_get()[0] for stage in stage_obj.browse(stage_ids)] + + # restore order of the search + result.sort(lambda x, y: cmp(stage_ids.index(x[0]), stage_ids.index(y[0]))) + + fold = {} + for stage in stage_obj.browse(stage_ids): + fold[stage.id] = stage.fold or False + return result, fold + + _group_by_full = { + 'stage_id': _read_group_stage_ids + } + + @api.model + def get_empty_list_help(self, help): + res = super(HrEquipmentRequest, self).get_empty_list_help(help) + alias_record = self.env.ref('hr_equipment.mail_alias_equipment') + check_alias_manage = self.env['ir.values'].get_default('hr.config.settings', 'alias_manage') + if alias_record and alias_record.alias_domain and alias_record.alias_name and res and check_alias_manage: + return _("""

+ Click to add a new maintenance request or send an email to: %(alias_name)s +

+

+ Follow the process of the request and communicate with the collaborator. +

""" + ) % {'alias_name': alias_record.alias_name + '@' + alias_record.alias_domain} + return res + + @api.model + def message_new(self, msg, custom_values=None): + """ Overrides mail_thread message_new that is called by the mailgateway + through message_process. + This override updates the document according to the email. + """ + if custom_values is None: + custom_values = {} + email = tools.email_split(msg.get('from')) and tools.email_split(msg.get('from'))[0] or False + user = self.env['res.users'].search([('login', '=', email)], limit=1) + if user: + employee = self.env['hr.employee'].search([('user_id', '=', user.id)], limit=1) + if employee: + custom_values['employee_id'] = employee and employee[0].id + return super(HrEquipmentRequest, self).message_new(msg, custom_values=custom_values) diff --git a/addons/hr_equipment/models/res_config.py b/addons/hr_equipment/models/res_config.py new file mode 100644 index 00000000000..cc7869124ee --- /dev/null +++ b/addons/hr_equipment/models/res_config.py @@ -0,0 +1,47 @@ +# -*- coding: utf-8 -*- + +from urlparse import urlsplit +from openerp import api, fields, models + + +class HrEquipmentConfigSettings(models.TransientModel): + _name = 'hr.equipment.config.settings' + _inherit = 'res.config.settings' + + alias_manage = fields.Boolean('Alias Manage') + equipment_alias_prefix = fields.Char('Use the following alias to report internal equipment issue') + alias_domain = fields.Char("Alias Domain") + + @api.multi + def get_default_alias_equipment(self): + alias_name = False + alias_id = self.env.ref('hr_equipment.mail_alias_equipment') + if alias_id: + alias_name = alias_id.alias_name + return {'equipment_alias_prefix': alias_name} + + @api.multi + def set_default_alias_equipment(self): + for record in self: + default_equipment_alias_prefix = record.get_default_alias_equipment()['equipment_alias_prefix'] + if record.equipment_alias_prefix != default_equipment_alias_prefix: + alias_id = self.env.ref('hr_equipment.mail_alias_equipment') + if alias_id: + alias_id.write({'alias_name': record.equipment_alias_prefix}) + return True + + @api.multi + def get_default_alias_domain(self): + alias_domain = self.env['ir.config_parameter'].get_param("mail.catchall.domain") + if not alias_domain: + domain = self.env["ir.config_parameter"].get_param("web.base.url") + try: + alias_domain = urlsplit(domain).netloc.split(':')[0] + except Exception: + pass + return {'alias_domain': alias_domain} + + @api.multi + def set_default_alias_manage(self): + config_value = self.alias_manage + self.env['ir.values'].set_default('hr.config.settings', 'alias_manage', config_value) diff --git a/addons/hr_equipment/security/hr_equipment.xml b/addons/hr_equipment/security/hr_equipment.xml new file mode 100644 index 00000000000..dc0d86a2c82 --- /dev/null +++ b/addons/hr_equipment/security/hr_equipment.xml @@ -0,0 +1,48 @@ + + + + + Equipment Manager + + + The user will be able to manage equipments. + + + + + + + + + + Employee is allowed to see its own maintenance requests + + ['|', ('user_id.id', '=', user.id), ('employee_id.user_id.id', '=', user.id)] + + + + + Employee is allowed to see its own equipments + + [('employee_id.user_id.id', '=', user.id)] + + + + + Administrator of maintenance requests + + [(1, '=', 1)] + + + + + Equipments administrator + + [(1, '=', 1)] + + + + diff --git a/addons/hr_equipment/security/ir.model.access.csv b/addons/hr_equipment/security/ir.model.access.csv new file mode 100644 index 00000000000..3748c9f79bb --- /dev/null +++ b/addons/hr_equipment/security/ir.model.access.csv @@ -0,0 +1,10 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_hr_equipment_user,hr.equipment.user,model_hr_equipment,base.group_hr_user,1,1,1,1 +access_hr_equipment_emp,hr.equipment.emp,model_hr_equipment,base.group_user,1,0,0,0 +access_hr_equipment_admin_user,hr.equipment.admin.user,model_hr_equipment,base.group_equipment_manager,1,1,1,1 +access_hr_maintenance_user,hr.equipment.request user,model_hr_equipment_request,base.group_hr_user,1,1,1,1 +access_hr_maintenance_system_user,hr.equipment.request system user,model_hr_equipment_request,base.group_user,1,1,1,1 +access_hr_equipment_category_user,hr.equipment.category.user,model_hr_equipment_category,base.group_hr_user,1,1,1,1 +access_maintenance_request_stage_user,hr.equipment.stage.user,model_hr_equipment_stage,base.group_hr_user,1,1,1,1 +access_hr_equipment_category_employee,hr.equipment.category.employee,model_hr_equipment_category,base.group_user,1,0,0,0 +access_maintenance_request_stage_employee,hr.equipment.stage.employee,model_hr_equipment_stage,base.group_user,1,0,0,0 diff --git a/addons/hr_equipment/static/description/icon.png b/addons/hr_equipment/static/description/icon.png new file mode 100644 index 00000000000..53055cf085c Binary files /dev/null and b/addons/hr_equipment/static/description/icon.png differ diff --git a/addons/hr_equipment/tests/__init__.py b/addons/hr_equipment/tests/__init__.py new file mode 100644 index 00000000000..a43ab866ebc --- /dev/null +++ b/addons/hr_equipment/tests/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +import test_hr_equipment diff --git a/addons/hr_equipment/tests/test_hr_equipment.py b/addons/hr_equipment/tests/test_hr_equipment.py new file mode 100644 index 00000000000..f1c9e923692 --- /dev/null +++ b/addons/hr_equipment/tests/test_hr_equipment.py @@ -0,0 +1,75 @@ +# -*- coding: utf-8 -*- + +from openerp.tests.common import TransactionCase +import time + + +class TestHrEquipment(TransactionCase): + """ Test used to check that when doing equipment/maintenance_request/equipment_category creation.""" + + def setUp(self): + super(TestHrEquipment, self).setUp() + self.equipment = self.env['hr.equipment'] + self.maintenance_request = self.env['hr.equipment.request'] + self.user = self.env['res.users'] + self.main_company = self.env.ref('base.main_company') + res_hr_user = self.env.ref('base.group_user') + res_hr_manager = self.env.ref('base.group_hr_manager') + + self.hr_user = self.user.create(dict( + name="Normal User/Employee", + company_id=self.main_company.id, + login="emp", + password="emp", + email="empuser@yourcompany.example.com", + groups_id=[(6, 0, [res_hr_user.id])] + )) + + self.hr_manager = self.user.create(dict( + name="HR Manager", + company_id=self.main_company.id, + login="hm", + password="hm", + email="hrmanager@yourcompany.example.com", + groups_id=[(6, 0, [res_hr_manager.id])] + )) + + def test_hr_equipment_request_category(self): + + # Create a new equipment + equipment_01 = self.equipment.sudo(self.hr_manager).create({ + 'name': 'Samsung Monitor "15', + 'category_id': self.ref('hr_equipment.hr_equipment_monitor'), + 'employee_id': self.ref('hr.employee_al'), + 'user_id': self.ref('base.user_root'), + 'assign_date': time.strftime('%Y-%m-%d'), + 'serial_no': 'MT/127/18291015', + 'model': 'NP355E5X', + 'color': 3, + }) + + # Check that equipment is created or not + assert equipment_01, "Equipment not created" + + # Create new maintenance request + maintenance_request_01 = self.maintenance_request.sudo(self.hr_user).create({ + 'name': 'Resolution is bad', + 'user_id': self.hr_user.id, + 'employee_id': self.ref('hr.employee_qdp'), + 'equipment_id': equipment_01.id, + 'category_id': self.ref('hr_equipment.hr_equipment_monitor'), + 'color': 7, + 'stage_id': self.ref('hr_equipment.stage_0') + }) + + # I check that maintenance_request is created or not + assert maintenance_request_01, "Maintenance Request not created" + + # I check that Initially maintenance request is in the "New Request" stage + self.assertEquals(maintenance_request_01.stage_id.id, self.ref('hr_equipment.stage_0')) + + # I check that change the maintenance_request stage on click statusbar + maintenance_request_01.sudo(self.hr_user).write({'stage_id': self.ref('hr_equipment.stage_1')}) + + # I check that maintenance request is in the "In Progress" stage + self.assertEquals(maintenance_request_01.stage_id.id, self.ref('hr_equipment.stage_1')) diff --git a/addons/hr_equipment/views/hr_equipment_views.xml b/addons/hr_equipment/views/hr_equipment_views.xml new file mode 100644 index 00000000000..64022a125a8 --- /dev/null +++ b/addons/hr_equipment/views/hr_equipment_views.xml @@ -0,0 +1,566 @@ + + + + + + hr.equipment.request.search + hr.equipment.request + + + + + + + + + + + + + + + + + + + + + + + + hr.equipment.request.form + hr.equipment.request + +
+
+ +
+ +
+ +
+
+
+ + + + + + + + + + + + + + +
+
+ + +
+
+
+
+ + + hr.equipment.request.kanban + hr.equipment.request + + + + + + + + + + + +
    +
  • Category:
  • +
  • Request to:
  • +
+
+ +
+
+ +
+
+
+
+
+
+
+
+ +
+ +
+ + +
+
+
+
+
+
+
+
+
+
+ + + hr.equipment.request.tree + hr.equipment.request + + + + + + + + + + + + + + + + Maintenance Requests + hr.equipment.request + kanban,tree,form + + +

+ Click to add a new maintenance request. +

+ Follow the process of the request and communicate with the collaborator. +

+
+
+ + + Maintenance Requests + hr.equipment.request + kanban,tree,form + + + { + 'search_default_category_id': [active_id], + 'default_category_id': active_id, + } + +

+ Click to add a new maintenance request. +

+ Follow the process of the request and communicate with the collaborator. +

+
+
+ + + Maintenance Requests + hr.equipment.request + hr.equipment + kanban,tree,form + { + 'default_equipment_id': active_id, + } + [('equipment_id', '=', active_id)] + + + + + hr.equipment.form + hr.equipment + +
+ +
+
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + +
+
+
+
+ + + hr.equipment.kanban + hr.equipment + + + + + + + + + + + + +
    +
  • Serial Number:
  • +
  • Model Number:
  • +
+
+ +
+
+ +
+
+
()
+
+
+
+ + Maintenance Request + + +
+
+ +
+ +
+
+
+
+
+
+
+
+ + + hr.equipment.tree + hr.equipment + + + + + + + + + + + + + + + + + hr.equipment.search + hr.equipment + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Equipments + hr.equipment + kanban,tree,form + + +

+ Click to add a new equipment. +

+ This application helps you to track all equipment allocated to employees. + Create some laptop, printer or phone and link each equipment to an employee or departement. + You will manage allocations, issues and maintenance of equipment. +

+
+
+ + + + Equipments + hr.equipment + kanban,tree,form + + + { + 'search_default_category_id': [active_id], + 'default_category_id': active_id, + } + +

+ Click to add a new Engine. +

+ This application helps you to track all equipment allocated to employees. + Create some laptop, printer or phone and link each equipment to an employee or departement. + You will manage allocations, issues and mainteannce of equipment. +

+
+
+ + + + hr.equipment.category.form + hr.equipment.category + +
+ +
+
+
+ + +
+ + + + + + + + +
+
+ + +
+
+
+
+ + + hr.equipment.category.tree + hr.equipment.category + + + + + + + + + + hr.equipment.category.search + hr.equipment.category + + + + + + + + + + + + + Equipment Categories + hr.equipment.category + tree,form + + +

+ Click to add a new equipment category. +

+
+
+ + + + hr.equipment.stage.search + hr.equipment.stage + + + + + + + + + hr.equipment.stage.tree + hr.equipment.stage + + + + + + + + + + + + Stages + hr.equipment.stage + tree + form + + +

+ Click to add a stage in the maintenance request. +

+
+
+ + + + + + + + + + + + + + + + + +
diff --git a/addons/hr_equipment/views/res_config_views.xml b/addons/hr_equipment/views/res_config_views.xml new file mode 100644 index 00000000000..ec31667b1ab --- /dev/null +++ b/addons/hr_equipment/views/res_config_views.xml @@ -0,0 +1,36 @@ + + + + hr.equipment.config.settings + hr.equipment.config.settings + +
+
+
+ + + + +
+
+ + + Configure Equipments + hr.equipment.config.settings + + form + inline + +