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_equipment
from . import product_category
from . import product_product
from . import product_template

View file

@ -0,0 +1,43 @@
# Copyright 2022 Tecnativa - Víctor Martínez
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import api, fields, models
class MaintenanceEquipment(models.Model):
_inherit = "maintenance.equipment"
product_id = fields.Many2one(
comodel_name="product.product",
string="Product",
tracking=True,
domain="[('categ_id','=',product_category_id),('maintenance_ok','=',True)]",
)
product_category_id = fields.Many2one(
comodel_name="product.category", related="category_id.product_category_id"
)
@api.onchange("product_id")
def _onchange_product_id(self):
"""If product is set, equipment name, seller, seller ref and cost defaults
to product ones.
"""
if self.product_id:
self.name = self.product_id.name
self.cost = self.product_id.standard_price
if self.product_id.seller_ids:
first_seller = fields.first(self.product_id.seller_ids)
self.partner_id = first_seller.partner_id
self.partner_ref = first_seller.product_code
class MaintenanceEquipmentCategory(models.Model):
_inherit = "maintenance.equipment.category"
product_category_id = fields.Many2one(
comodel_name="product.category", string="Product Category", tracking=True
)
@api.onchange("product_category_id")
def _onchange_product_category_id(self):
if self.product_category_id:
self.name = self.product_category_id.name

View file

@ -0,0 +1,13 @@
# Copyright 2022 Tecnativa - Víctor Martínez
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import fields, models
class ProductCategory(models.Model):
_inherit = "product.category"
equipment_category_ids = fields.One2many(
comodel_name="maintenance.equipment.category",
inverse_name="product_category_id",
string="Equipment Categories",
)

View file

@ -0,0 +1,13 @@
# Copyright 2022 Tecnativa - Víctor Martínez
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import fields, models
class ProductProduct(models.Model):
_inherit = "product.product"
equipment_ids = fields.One2many(
comodel_name="maintenance.equipment",
inverse_name="product_id",
string="Equipments",
)

View file

@ -0,0 +1,9 @@
# Copyright 2022 Tecnativa - Víctor Martínez
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import fields, models
class ProductTemplate(models.Model):
_inherit = "product.template"
maintenance_ok = fields.Boolean(string="Can be Maintenance")