Initial commit: OCA Technical packages (595 packages)

This commit is contained in:
Ernad Husremovic 2025-08-29 15:43:03 +02:00
commit 2cc02aac6e
24950 changed files with 2318079 additions and 0 deletions

View file

@ -0,0 +1,4 @@
from . import maintenance_location
from . import maintenance_request
from . import maintenance_equipment
from . import maintenance_plan

View file

@ -0,0 +1,20 @@
# Copyright 2019 Creu Blanca
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models
class MaintenanceEquipment(models.Model):
_inherit = "maintenance.equipment"
location_id = fields.Many2one("maintenance.location", tracking=True)
location = fields.Char(string="Location Old")
def _prepare_request_from_plan(self, maintenance_plan, next_maintenance_date):
res = super()._prepare_request_from_plan(
maintenance_plan, next_maintenance_date
)
location = maintenance_plan.location_id or self.location_id
res.update({"location_id": location.id})
return res

View file

@ -0,0 +1,54 @@
# Copyright 2019 Creu Blanca
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import _, api, fields, models
from odoo.exceptions import ValidationError
class MaintenanceLocation(models.Model):
_name = "maintenance.location"
_description = "Maintenance Location"
_parent_name = "parent_id"
_parent_store = True
_parent_order = "name"
_rec_name = "complete_name"
_order = "complete_name,id"
name = fields.Char(required=True)
description = fields.Char()
complete_name = fields.Char(
compute="_compute_complete_name", store=True, recursive=True
)
partner_id = fields.Many2one("res.partner")
parent_id = fields.Many2one(
"maintenance.location",
"Parent Location",
index=True,
ondelete="cascade",
)
child_id = fields.One2many("maintenance.location", "parent_id", "Child Locations")
parent_path = fields.Char(index=True, unaccent=False)
latitude = fields.Float(digits=(16, 5))
longitude = fields.Float(digits=(16, 5))
sequence = fields.Integer(default=10)
active = fields.Boolean(default=True)
@api.depends("name", "parent_id.complete_name")
def _compute_complete_name(self):
for location in self:
if location.parent_id:
location.complete_name = "{} / {}".format(
location.parent_id.complete_name,
location.name,
)
else:
location.complete_name = location.name
@api.constrains("parent_id")
def _check_category_recursion(self):
if not self._check_recursion():
raise ValidationError(_("Error ! You cannot create recursive Locations."))
return True

View file

@ -0,0 +1,11 @@
# Copyright 2020 Creu Blanca
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models
class MaintenancePlan(models.Model):
_inherit = "maintenance.plan"
location_id = fields.Many2one("maintenance.location")

View file

@ -0,0 +1,22 @@
# Copyright 2019 Creu Blanca
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, fields, models
class MaintenanceRequest(models.Model):
_inherit = "maintenance.request"
location_id = fields.Many2one(
"maintenance.location",
compute="_compute_equipment_id",
store=True,
readonly=False,
)
@api.depends("equipment_id")
def _compute_equipment_id(self):
for record in self:
if record.equipment_id and record.equipment_id.location_id:
record.location_id = record.equipment_id.location_id