-
-
Notifications
You must be signed in to change notification settings - Fork 167
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMP] maintenance_equipment_contract: Access requests from contract i…
…n order to verify that all has been processed
- Loading branch information
Showing
3 changed files
with
32 additions
and
1 deletion.
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,11 +1,28 @@ | ||
# Copyright 2019 Creu Blanca | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import fields, models | ||
from odoo import api, fields, models | ||
|
||
|
||
class ContractContract(models.Model): | ||
|
||
_inherit = "contract.contract" | ||
|
||
equipment_ids = fields.Many2many("maintenance.equipment", string="Equipments") | ||
equipment_count = fields.Integer(compute="_compute_equipment_count") | ||
|
||
@api.depends("equipment_ids") | ||
def _compute_equipment_count(self): | ||
for record in self: | ||
record.equipment_count = len(record.equipment_ids) | ||
|
||
def action_show_maintenance_requests(self): | ||
self.ensure_one() | ||
action = self.env["ir.actions.act_window"]._for_xml_id( | ||
"maintenance.hr_equipment_request_action" | ||
) | ||
action["domain"] = self._action_show_maintenance_requests_domain() | ||
return action | ||
|
||
def _action_show_maintenance_requests_domain(self): | ||
return [("equipment_id", "in", self.equipment_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 |
---|---|---|
@@ -1 +1,4 @@ | ||
* Jaime Arroyo <jaime.arroyo@creublanca.es> | ||
* `Dixmit <https://www.dixmit.com>`_: | ||
|
||
* Enric Tobella |
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