forked from OCA/field-service
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX] fieldservice_agreement (OCA#232)
- Loading branch information
1 parent
628a21c
commit a40aa97
Showing
4 changed files
with
54 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,24 @@ | ||
<!-- Copyright 2019 Open Source Integrators | ||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) --> | ||
<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"/> | ||
<field name="notes"/> | ||
</tree> | ||
</field> | ||
</page> | ||
</notebook> | ||
</field> | ||
</record> | ||
|
||
</odoo> |