-
Notifications
You must be signed in to change notification settings - Fork 243
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMP][ADD] Ticket #: 609, 608, 604 fsm_agreement
[IMP] Add to serviceprofile_ids on agreement [IMP] Github comments
- Loading branch information
1 parent
c57c61e
commit a270cf2
Showing
4 changed files
with
51 additions
and
2 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
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 |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
from . import ( | ||
agreement, | ||
fsm_equipment, | ||
fsm_location, | ||
fsm_order, | ||
fsm_person | ||
fsm_person, | ||
) |
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,26 @@ | ||
# 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 FSMLocation(models.Model): | ||
_inherit = 'fsm.location' | ||
|
||
serviceprofile_ids = fields.Many2many('agreement.serviceprofile', | ||
string="Service Profiles", | ||
compute='_compute_service_ids') | ||
|
||
@api.multi | ||
def _compute_service_ids(self): | ||
for loc in self: | ||
agreements = self.env['agreement'].\ | ||
search([('fsm_location_id', '=', self.name)]) | ||
ids = [] | ||
for agree in agreements: | ||
servpros = self.env['agreement.serviceprofile'].\ | ||
search([('agreement_id', '=', agree.id)]) | ||
for ser in servpros: | ||
if ser.id not in ids: | ||
ids.append(ser.id) | ||
self.serviceprofile_ids = ids |
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,21 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<odoo> | ||
|
||
<record id="fsm_location_agreement_serviceprofile" model="ir.ui.view"> | ||
<field name="name">fsm.location.agreement.serviceprofile</field> | ||
<field name="model">fsm.location</field> | ||
<field name="inherit_id" ref="fieldservice.fsm_location_form_view"/> | ||
<field name="arch" type="xml"> | ||
<notebook position="inside"> | ||
<page string="Service Profiles"> | ||
<field name="serviceprofile_ids"> | ||
<tree> | ||
<field name="name"/> | ||
<field name="agreement_id"/> | ||
</tree> | ||
</field> | ||
</page> | ||
</notebook> | ||
</field> | ||
</record> | ||
</odoo> |