Skip to content

Commit

Permalink
[IMP] machine_manager_hr: pre-commit stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
oihane committed Jun 26, 2024
1 parent 2c8d303 commit a8e8f42
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 77 deletions.
7 changes: 2 additions & 5 deletions machine_manager_hr/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright 2024 Alfredo de la Fuente - AvanzOSC
# Copyright 2015 Daniel Campos - AvanzOSC
# Copyright 2015 Esther Martín - AvanzOSC
Expand All @@ -7,17 +6,15 @@
"name": "Machine Manager Hr",
"version": "16.0.1.0.0",
"license": "AGPL-3",
"author": "OdooMRP team, "
"AvanzOSC, "
"Serv. Tecnol. Avanzados - Pedro M. Baeza",
"author": "OdooMRP team, " "AvanzOSC, " "Serv. Tecnol. Avanzados - Pedro M. Baeza",
"contributors": [
"Daniel Campos <danielcampos@avanzosc.es>",
"Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>",
"Ana Juaristi <ajuaristio@gmail.com>",
"Oihane Crucelaegui <oihanecrucelaegi@avanzosc.es>",
"Esther Martín <esthermartin@avanzosc.es>",
],
"website": "http://avanzosc.com",
"website": "https://github.com/avanzosc/hr-addons",
"depends": [
"hr",
"machine_manager",
Expand Down
9 changes: 5 additions & 4 deletions machine_manager_hr/models/hr_employee.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
# -*- coding: utf-8 -*-
# Copyright 2015 Daniel Campos - AvanzOSC
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from odoo import models, fields
from odoo import fields, models


class HrEmployee(models.Model):
_inherit = "hr.employee"

machine_ids = fields.Many2many(
string="Machines", comodel_name="machine",
relation="rel_machine_employee", column1="employee_id",
string="Machines",
comodel_name="machine",
relation="rel_machine_employee",
column1="employee_id",
column2="machine_id",
)
9 changes: 5 additions & 4 deletions machine_manager_hr/models/machine.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
# -*- coding: utf-8 -*-
# Copyright 2015 Daniel Campos - AvanzOSC
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from odoo import models, fields
from odoo import fields, models


class Machine(models.Model):
_inherit = "machine"

employee_ids = fields.Many2many(
string="Machine Users", comodel_name="hr.employee",
relation="rel_machine_employee", column1="machine_id",
string="Machine Users",
comodel_name="hr.employee",
relation="rel_machine_employee",
column1="machine_id",
column2="employee_id",
)
76 changes: 37 additions & 39 deletions machine_manager_hr/views/hr_employee_views.xml
Original file line number Diff line number Diff line change
@@ -1,46 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<data>
<record id="view_employee_form" model="ir.ui.view">
<field name="model">hr.employee</field>
<field name="inherit_id" ref="hr.view_employee_form" />
<field name="arch" type="xml">
<page name="hr_settings" position="after">
<page name="machines" string="Machines the employee works on">
<field name="machine_ids" nolabel="1">
<tree name="tree-machines" string="Machines">
<field name="name" />
</tree>
</field>
</page>
<record id="view_employee_form" model="ir.ui.view">
<field name="model">hr.employee</field>
<field name="inherit_id" ref="hr.view_employee_form" />
<field name="arch" type="xml">
<page name="hr_settings" position="after">
<page name="machines" string="Machines the employee works on">
<field name="machine_ids" nolabel="1">
<tree name="tree-machines">
<field name="name" />
</tree>
</field>
</page>
</field>
</record>
</page>
</field>
</record>

<record id="view_employee_tree" model="ir.ui.view">
<field name="model">hr.employee</field>
<field name="inherit_id" ref="hr.view_employee_tree" />
<field name="arch" type="xml">
<field name="company_id" position="after">
<field name="machine_ids" widget="many2many_tags" optional="show"/>
</field>
<record id="view_employee_tree" model="ir.ui.view">
<field name="model">hr.employee</field>
<field name="inherit_id" ref="hr.view_employee_tree" />
<field name="arch" type="xml">
<field name="company_id" position="after">
<field name="machine_ids" widget="many2many_tags" optional="show" />
</field>
</record>
</field>
</record>

<!--
<record id="view_employee_filter" model="ir.ui.view">
<field name="model">hr.employee</field>
<field name="inherit_id" ref="hr.view_employee_filter" />
<field name="arch" type="xml">
<field name="job_id" position="after">
<field name="machine_id"/>
</field>
<filter name="group_job" position="after">
<filter name="group_machine" string="Machine" domain="[]"
context="{'group_by': 'machine_id'}"/>
</filter>
<!--
<record id="view_employee_filter" model="ir.ui.view">
<field name="model">hr.employee</field>
<field name="inherit_id" ref="hr.view_employee_filter" />
<field name="arch" type="xml">
<field name="job_id" position="after">
<field name="machine_id"/>
</field>
</record>
-->
</data>
<filter name="group_job" position="after">
<filter name="group_machine" string="Machine" domain="[]"
context="{'group_by': 'machine_id'}"/>
</filter>
</field>
</record>
-->
</odoo>
48 changes: 23 additions & 25 deletions machine_manager_hr/views/machine_views.xml
Original file line number Diff line number Diff line change
@@ -1,30 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<data>
<record id="machine_form_view" model="ir.ui.view">
<field name="model">machine</field>
<field name="inherit_id" ref="machine_manager.machine_form_view" />
<field name="arch" type="xml">
<page name="finalcial-details" position="after">
<page name="machine-users" string="Machine Users">
<field name="employee_ids" nolabel="1">
<tree name="tree-employee" string="Machine User">
<field name="name" />
</tree>
</field>
</page>
<record id="machine_form_view" model="ir.ui.view">
<field name="model">machine</field>
<field name="inherit_id" ref="machine_manager.machine_form_view" />
<field name="arch" type="xml">
<page name="finalcial-details" position="after">
<page name="machine-users" string="Machine Users">
<field name="employee_ids" nolabel="1">
<tree name="tree-employee">
<field name="name" />
</tree>
</field>
</page>
</field>
</record>
</page>
</field>
</record>

<record id="machine_tree_view" model="ir.ui.view">
<field name="model">machine</field>
<field name="inherit_id" ref="machine_manager.machine_tree_view" />
<field name="arch" type="xml">
<field name="serial_id" position="after">
<field name="employee_ids" widget="many2many_tags" optional="show" />
</field>
<record id="machine_tree_view" model="ir.ui.view">
<field name="model">machine</field>
<field name="inherit_id" ref="machine_manager.machine_tree_view" />
<field name="arch" type="xml">
<field name="serial_id" position="after">
<field name="employee_ids" widget="many2many_tags" optional="show" />
</field>
</record>
</data>
</field>
</record>
</odoo>

0 comments on commit a8e8f42

Please sign in to comment.