forked from OCA/contract
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMP] agreement_maintenance: Link Equipments and Service Profiles
- Loading branch information
1 parent
a4a6fb4
commit 4494b62
Showing
9 changed files
with
103 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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). | ||
|
||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,7 @@ | |
|
||
from . import ( | ||
agreement, | ||
agreement_serviceprofile, | ||
maintenance_request, | ||
maintenance_equipment, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 changes: 17 additions & 0 deletions
17
agreement_maintenance/views/agreement_serviceprofile_view.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
agreement_maintenance/views/maintenance_equipment_view.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters