Browse Source

[IMP] agreement_maintenance: Link Equipments and Service Profiles

pull/367/head
Maxime Chambreuil 5 years ago
parent
commit
fe6ec78bed
  1. 3
      agreement_maintenance/__init__.py
  2. 7
      agreement_maintenance/__manifest__.py
  3. 2
      agreement_maintenance/models/__init__.py
  4. 11
      agreement_maintenance/models/agreement_serviceprofile.py
  5. 12
      agreement_maintenance/models/maintenance_equipment.py
  6. 17
      agreement_maintenance/views/agreement_serviceprofile_view.xml
  7. 6
      agreement_maintenance/views/agreement_view.xml
  8. 47
      agreement_maintenance/views/maintenance_equipment_view.xml
  9. 4
      agreement_maintenance/views/maintenance_request_view.xml

3
agreement_maintenance/__init__.py

@ -1,4 +1,5 @@
# Copyright (C) 2018 - TODAY, Pavlov Media
# Copyright (C) 2018 Pavlov Media
# Copyright (C) 2019 Open Source Integrators
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import models from . import models

7
agreement_maintenance/__manifest__.py

@ -1,4 +1,5 @@
# Copyright (C) 2018 - TODAY, Pavlov Media
# Copyright (C) 2018 Pavlov Media
# Copyright (C) 2019 Open Source Integrators
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{ {
@ -10,14 +11,16 @@
'website': 'https://github.com/OCA/contract', 'website': 'https://github.com/OCA/contract',
'category': 'Maintenance', 'category': 'Maintenance',
'license': 'AGPL-3', 'license': 'AGPL-3',
'version': '12.0.1.0.0',
'version': '12.0.1.1.0',
'depends': [ 'depends': [
'maintenance', 'maintenance',
'agreement_serviceprofile', 'agreement_serviceprofile',
], ],
'data': [ 'data': [
'views/agreement_view.xml', 'views/agreement_view.xml',
'views/agreement_serviceprofile_view.xml',
'views/maintenance_request_view.xml', 'views/maintenance_request_view.xml',
'views/maintenance_equipment_view.xml',
], ],
'development_status': 'Beta', 'development_status': 'Beta',
'maintainers': ['max3903'], 'maintainers': ['max3903'],

2
agreement_maintenance/models/__init__.py

@ -2,5 +2,7 @@
from . import ( from . import (
agreement, agreement,
agreement_serviceprofile,
maintenance_request, maintenance_request,
maintenance_equipment,
) )

11
agreement_maintenance/models/agreement_serviceprofile.py

@ -0,0 +1,11 @@
# Copyright (C) 2018 - TODAY, Open Source Integrators
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, fields, models
class AgreementServiceProfile(models.Model):
_inherit = "agreement.serviceprofile"
equipment_id = fields.Many2one('maintenance.equipment',
string='Equipment')

12
agreement_maintenance/models/maintenance_equipment.py

@ -0,0 +1,12 @@
# Copyright (C) 2019 Open Source Integrators
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models
class MaintenanceEquipment(models.Model):
_inherit = 'maintenance.equipment'
agreement_id = fields.Many2one('agreement', string='Agreement')
serviceprofile_ids = fields.One2many(
'agreement.serviceprofile', 'equipment_id', string='Service Profiles')

17
agreement_maintenance/views/agreement_serviceprofile_view.xml

@ -0,0 +1,17 @@
<!-- # Copyright (C) 2018 Pavlov Media
# Copyright (C) 2019 Open Source Integrators
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>
<record id="partner_agreement_form_view" model="ir.ui.view">
<field name="name">agreement.serviceprofile.form.equipment</field>
<field name="model">agreement.serviceprofile</field>
<field name="inherit_id" ref="agreement_serviceprofile.agreement_serviceprofile_form"/>
<field name="arch" type="xml">
<field name="agreement_id" position="after">
<field name="equipment_id"/>
</field>
</field>
</record>
</odoo>

6
agreement_maintenance/views/agreement_view.xml

@ -1,9 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- # Copyright (C) 2018 Pavlov Media
# Copyright (C) 2019 Open Source Integrators
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo> <odoo>
<record model="ir.actions.act_window" <record model="ir.actions.act_window"
id="action_maintenance_request_agreement_specific"> id="action_maintenance_request_agreement_specific">
<field name="name">Maaintenance Requests</field>
<field name="name">Maintenance Requests</field>
<field name="type">ir.actions.act_window</field> <field name="type">ir.actions.act_window</field>
<field name="res_model">maintenance.request</field> <field name="res_model">maintenance.request</field>
<field name="view_type">form</field> <field name="view_type">form</field>

47
agreement_maintenance/views/maintenance_equipment_view.xml

@ -0,0 +1,47 @@
<!-- # Copyright (C) 2018 Pavlov Media
# Copyright (C) 2019 Open Source Integrators
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>
<record id="maintenance_equipment_form_view_agreement" model="ir.ui.view">
<field name="name">maintenance.equipment.form.agreement</field>
<field name="model">maintenance.equipment</field>
<field name="inherit_id"
ref="maintenance.hr_equipment_view_form"/>
<field name="arch" type="xml">
<field name="owner_user_id" position="after">
<field name="agreement_id"/>
</field>
<xpath expr="//notebook" position="inside">
<page string="Services" id="services">
<field name="serviceprofile_ids"
domain="[('active', '=', True),
('equipment_id', '=', False)]"
widget="many2many">
<tree>
<field name="name"/>
<field name="partner_id"/>
<field name="product_id"/>
<field name="stage_id"/>
</tree>
</field>
</page>
</xpath>
</field>
</record>
<!-- Inherit maintenance equipment search view-->
<record id="view_maintenance_equipment_filter_agreement" model="ir.ui.view">
<field name="name">maintenance.equipment.select.agreement</field>
<field name="model">maintenance.equipment</field>
<field name="inherit_id"
ref="maintenance.hr_equipment_view_search"/>
<field name="arch" type="xml">
<xpath expr="//group" position="inside">
<filter string="Agreement" name="agreement_id" domain="[]"
context="{'group_by': 'agreement_id'}"/>
</xpath>
</field>
</record>
</odoo>

4
agreement_maintenance/views/maintenance_request_view.xml

@ -1,4 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- # Copyright (C) 2018 Pavlov Media
# Copyright (C) 2019 Open Source Integrators
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo> <odoo>
<record id="maintenance_request_form_view_agreement" model="ir.ui.view"> <record id="maintenance_request_form_view_agreement" model="ir.ui.view">

Loading…
Cancel
Save