diff --git a/maintenance_product/README.rst b/maintenance_product/README.rst new file mode 100644 index 000000000..3289b1403 --- /dev/null +++ b/maintenance_product/README.rst @@ -0,0 +1,102 @@ +=================== +Maintenance Product +=================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fmaintenance-lightgray.png?logo=github + :target: https://github.com/OCA/maintenance/tree/15.0/maintenance_product + :alt: OCA/maintenance +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/maintenance-15-0/maintenance-15-0-maintenance_product + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/240/15.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module links *Maintenance Equipments* and *Products*, easing creation of new equipments. + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +Equipment Categories: + +* Go to *Maintenance > Configuration > Equipment Categories* and create a new one (or modify an existing one) filling in the new field *Product Category*. +* The name of the *Equipment Category* is set to the name of the *Product Category*. + +Equipment: + +* Go to *Maintenance > Equipments* and create a new one filling in the new field *Product*. +* The name of the *Equipment* is set to the name of the *Product*. +* The vendor of the *Equipment* is set to the seller of the *Product* (if only one is set). +* The vendor reference of the *Equipment* is set to the seller reference of the *Product* (if only one is set). +* The cost of the *Equipment* is set to the standard cost of the *Product*. + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Tecnativa + +Contributors +~~~~~~~~~~~~ + +* César Fernández Domínguez + +* `Tecnativa `_: + + * Víctor Martínez + * Pedro M. Baeza + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +.. |maintainer-victoralmau| image:: https://github.com/victoralmau.png?size=40px + :target: https://github.com/victoralmau + :alt: victoralmau + +Current `maintainer `__: + +|maintainer-victoralmau| + +This module is part of the `OCA/maintenance `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/maintenance_product/__init__.py b/maintenance_product/__init__.py new file mode 100644 index 000000000..0650744f6 --- /dev/null +++ b/maintenance_product/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/maintenance_product/__manifest__.py b/maintenance_product/__manifest__.py new file mode 100644 index 000000000..475e77f26 --- /dev/null +++ b/maintenance_product/__manifest__.py @@ -0,0 +1,17 @@ +# Copyright 2022 Tecnativa - Víctor Martínez +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +{ + "name": "Maintenance Product", + "version": "16.0.1.0.0", + "category": "Maintenance", + "website": "https://github.com/OCA/maintenance", + "author": "Tecnativa, Odoo Community Association (OCA)", + "license": "AGPL-3", + "depends": ["maintenance", "product"], + "installable": True, + "data": [ + "views/maintenance_equipment_view.xml", + "views/product_template_view.xml", + ], + "maintainers": ["victoralmau"], +} diff --git a/maintenance_product/i18n/es.po b/maintenance_product/i18n/es.po new file mode 100644 index 000000000..5219309e9 --- /dev/null +++ b/maintenance_product/i18n/es.po @@ -0,0 +1,89 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * maintenance_product +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2022-03-23 13:57+0000\n" +"PO-Revision-Date: 2023-02-21 14:22+0000\n" +"Last-Translator: Víctor Martínez \n" +"Language-Team: \n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.14.1\n" + +#. module: maintenance_product +#: model:ir.model.fields,field_description:maintenance_product.field_product_product__maintenance_ok +#: model:ir.model.fields,field_description:maintenance_product.field_product_template__maintenance_ok +msgid "Can be Maintenance" +msgstr "Puede ser un mantenimiento" + +#. module: maintenance_product +#: model:ir.model.fields,field_description:maintenance_product.field_maintenance_equipment__display_name +#: model:ir.model.fields,field_description:maintenance_product.field_maintenance_equipment_category__display_name +#: model:ir.model.fields,field_description:maintenance_product.field_product_category__display_name +#: model:ir.model.fields,field_description:maintenance_product.field_product_product__display_name +#: model:ir.model.fields,field_description:maintenance_product.field_product_template__display_name +msgid "Display Name" +msgstr "Nombre mostrado" + +#. module: maintenance_product +#: model:ir.model.fields,field_description:maintenance_product.field_product_category__equipment_category_ids +msgid "Equipment Categories" +msgstr "Categorías de equipamiento" + +#. module: maintenance_product +#: model:ir.model.fields,field_description:maintenance_product.field_product_product__equipment_ids +msgid "Equipments" +msgstr "Equipos" + +#. module: maintenance_product +#: model:ir.model.fields,field_description:maintenance_product.field_maintenance_equipment__id +#: model:ir.model.fields,field_description:maintenance_product.field_maintenance_equipment_category__id +#: model:ir.model.fields,field_description:maintenance_product.field_product_category__id +#: model:ir.model.fields,field_description:maintenance_product.field_product_product__id +#: model:ir.model.fields,field_description:maintenance_product.field_product_template__id +msgid "ID" +msgstr "ID" + +#. module: maintenance_product +#: model:ir.model.fields,field_description:maintenance_product.field_maintenance_equipment____last_update +#: model:ir.model.fields,field_description:maintenance_product.field_maintenance_equipment_category____last_update +#: model:ir.model.fields,field_description:maintenance_product.field_product_category____last_update +#: model:ir.model.fields,field_description:maintenance_product.field_product_product____last_update +#: model:ir.model.fields,field_description:maintenance_product.field_product_template____last_update +msgid "Last Modified on" +msgstr "Última modificación el" + +#. module: maintenance_product +#: model:ir.model,name:maintenance_product.model_maintenance_equipment +msgid "Maintenance Equipment" +msgstr "Equipo de mantenimiento" + +#. module: maintenance_product +#: model:ir.model,name:maintenance_product.model_maintenance_equipment_category +msgid "Maintenance Equipment Category" +msgstr "Categoría Equipo de mantenimiento" + +#. module: maintenance_product +#: model:ir.model,name:maintenance_product.model_product_product +#: model:ir.model.fields,field_description:maintenance_product.field_maintenance_equipment__product_id +msgid "Product" +msgstr "Producto" + +#. module: maintenance_product +#: model:ir.model,name:maintenance_product.model_product_category +#: model:ir.model.fields,field_description:maintenance_product.field_maintenance_equipment__product_category_id +#: model:ir.model.fields,field_description:maintenance_product.field_maintenance_equipment_category__product_category_id +msgid "Product Category" +msgstr "Categoría de producto" + +#. module: maintenance_product +#: model:ir.model,name:maintenance_product.model_product_template +msgid "Product Template" +msgstr "Plantilla de producto" diff --git a/maintenance_product/i18n/it.po b/maintenance_product/i18n/it.po new file mode 100644 index 000000000..5e1c112dd --- /dev/null +++ b/maintenance_product/i18n/it.po @@ -0,0 +1,88 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * maintenance_product +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2022-10-24 11:43+0000\n" +"Last-Translator: mymage \n" +"Language-Team: none\n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.14.1\n" + +#. module: maintenance_product +#: model:ir.model.fields,field_description:maintenance_product.field_product_product__maintenance_ok +#: model:ir.model.fields,field_description:maintenance_product.field_product_template__maintenance_ok +msgid "Can be Maintenance" +msgstr "Manutenibile" + +#. module: maintenance_product +#: model:ir.model.fields,field_description:maintenance_product.field_maintenance_equipment__display_name +#: model:ir.model.fields,field_description:maintenance_product.field_maintenance_equipment_category__display_name +#: model:ir.model.fields,field_description:maintenance_product.field_product_category__display_name +#: model:ir.model.fields,field_description:maintenance_product.field_product_product__display_name +#: model:ir.model.fields,field_description:maintenance_product.field_product_template__display_name +msgid "Display Name" +msgstr "Nome visualizzato" + +#. module: maintenance_product +#: model:ir.model.fields,field_description:maintenance_product.field_product_category__equipment_category_ids +msgid "Equipment Categories" +msgstr "Categorie attrezzatura" + +#. module: maintenance_product +#: model:ir.model.fields,field_description:maintenance_product.field_product_product__equipment_ids +msgid "Equipments" +msgstr "Attrezzature" + +#. module: maintenance_product +#: model:ir.model.fields,field_description:maintenance_product.field_maintenance_equipment__id +#: model:ir.model.fields,field_description:maintenance_product.field_maintenance_equipment_category__id +#: model:ir.model.fields,field_description:maintenance_product.field_product_category__id +#: model:ir.model.fields,field_description:maintenance_product.field_product_product__id +#: model:ir.model.fields,field_description:maintenance_product.field_product_template__id +msgid "ID" +msgstr "ID" + +#. module: maintenance_product +#: model:ir.model.fields,field_description:maintenance_product.field_maintenance_equipment____last_update +#: model:ir.model.fields,field_description:maintenance_product.field_maintenance_equipment_category____last_update +#: model:ir.model.fields,field_description:maintenance_product.field_product_category____last_update +#: model:ir.model.fields,field_description:maintenance_product.field_product_product____last_update +#: model:ir.model.fields,field_description:maintenance_product.field_product_template____last_update +msgid "Last Modified on" +msgstr "Ultima modifica il" + +#. module: maintenance_product +#: model:ir.model,name:maintenance_product.model_maintenance_equipment +msgid "Maintenance Equipment" +msgstr "Attrezzatura manutenzione" + +#. module: maintenance_product +#: model:ir.model,name:maintenance_product.model_maintenance_equipment_category +msgid "Maintenance Equipment Category" +msgstr "Categoria attrezzatura manutenzione" + +#. module: maintenance_product +#: model:ir.model,name:maintenance_product.model_product_product +#: model:ir.model.fields,field_description:maintenance_product.field_maintenance_equipment__product_id +msgid "Product" +msgstr "Prodotto" + +#. module: maintenance_product +#: model:ir.model,name:maintenance_product.model_product_category +#: model:ir.model.fields,field_description:maintenance_product.field_maintenance_equipment__product_category_id +#: model:ir.model.fields,field_description:maintenance_product.field_maintenance_equipment_category__product_category_id +msgid "Product Category" +msgstr "Categoria prodotto" + +#. module: maintenance_product +#: model:ir.model,name:maintenance_product.model_product_template +msgid "Product Template" +msgstr "Modello prodotto" diff --git a/maintenance_product/i18n/maintenance_product.pot b/maintenance_product/i18n/maintenance_product.pot new file mode 100644 index 000000000..5b23abe26 --- /dev/null +++ b/maintenance_product/i18n/maintenance_product.pot @@ -0,0 +1,58 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * maintenance_product +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 15.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: maintenance_product +#: model:ir.model.fields,field_description:maintenance_product.field_product_product__maintenance_ok +#: model:ir.model.fields,field_description:maintenance_product.field_product_template__maintenance_ok +msgid "Can be Maintenance" +msgstr "" + +#. module: maintenance_product +#: model:ir.model.fields,field_description:maintenance_product.field_product_category__equipment_category_ids +msgid "Equipment Categories" +msgstr "" + +#. module: maintenance_product +#: model:ir.model.fields,field_description:maintenance_product.field_product_product__equipment_ids +msgid "Equipments" +msgstr "" + +#. module: maintenance_product +#: model:ir.model,name:maintenance_product.model_maintenance_equipment +msgid "Maintenance Equipment" +msgstr "" + +#. module: maintenance_product +#: model:ir.model,name:maintenance_product.model_maintenance_equipment_category +msgid "Maintenance Equipment Category" +msgstr "" + +#. module: maintenance_product +#: model:ir.model,name:maintenance_product.model_product_product +#: model:ir.model.fields,field_description:maintenance_product.field_maintenance_equipment__product_id +msgid "Product" +msgstr "" + +#. module: maintenance_product +#: model:ir.model,name:maintenance_product.model_product_category +#: model:ir.model.fields,field_description:maintenance_product.field_maintenance_equipment__product_category_id +#: model:ir.model.fields,field_description:maintenance_product.field_maintenance_equipment_category__product_category_id +msgid "Product Category" +msgstr "" + +#. module: maintenance_product +#: model:ir.model,name:maintenance_product.model_product_template +msgid "Product Template" +msgstr "" diff --git a/maintenance_product/models/__init__.py b/maintenance_product/models/__init__.py new file mode 100644 index 000000000..e5f36ac8c --- /dev/null +++ b/maintenance_product/models/__init__.py @@ -0,0 +1,4 @@ +from . import maintenance_equipment +from . import product_category +from . import product_product +from . import product_template diff --git a/maintenance_product/models/maintenance_equipment.py b/maintenance_product/models/maintenance_equipment.py new file mode 100644 index 000000000..c8b2375a7 --- /dev/null +++ b/maintenance_product/models/maintenance_equipment.py @@ -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 diff --git a/maintenance_product/models/product_category.py b/maintenance_product/models/product_category.py new file mode 100644 index 000000000..9017f52e1 --- /dev/null +++ b/maintenance_product/models/product_category.py @@ -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", + ) diff --git a/maintenance_product/models/product_product.py b/maintenance_product/models/product_product.py new file mode 100644 index 000000000..6daa80598 --- /dev/null +++ b/maintenance_product/models/product_product.py @@ -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", + ) diff --git a/maintenance_product/models/product_template.py b/maintenance_product/models/product_template.py new file mode 100644 index 000000000..b00daf997 --- /dev/null +++ b/maintenance_product/models/product_template.py @@ -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") diff --git a/maintenance_product/readme/CONTRIBUTORS.rst b/maintenance_product/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..536c58907 --- /dev/null +++ b/maintenance_product/readme/CONTRIBUTORS.rst @@ -0,0 +1,6 @@ +* César Fernández Domínguez + +* `Tecnativa `_: + + * Víctor Martínez + * Pedro M. Baeza diff --git a/maintenance_product/readme/DESCRIPTION.rst b/maintenance_product/readme/DESCRIPTION.rst new file mode 100644 index 000000000..36f73bfab --- /dev/null +++ b/maintenance_product/readme/DESCRIPTION.rst @@ -0,0 +1 @@ +This module links *Maintenance Equipments* and *Products*, easing creation of new equipments. diff --git a/maintenance_product/readme/USAGE.rst b/maintenance_product/readme/USAGE.rst new file mode 100644 index 000000000..871d4e656 --- /dev/null +++ b/maintenance_product/readme/USAGE.rst @@ -0,0 +1,12 @@ +Equipment Categories: + +* Go to *Maintenance > Configuration > Equipment Categories* and create a new one (or modify an existing one) filling in the new field *Product Category*. +* The name of the *Equipment Category* is set to the name of the *Product Category*. + +Equipment: + +* Go to *Maintenance > Equipments* and create a new one filling in the new field *Product*. +* The name of the *Equipment* is set to the name of the *Product*. +* The vendor of the *Equipment* is set to the seller of the *Product* (if only one is set). +* The vendor reference of the *Equipment* is set to the seller reference of the *Product* (if only one is set). +* The cost of the *Equipment* is set to the standard cost of the *Product*. diff --git a/maintenance_product/static/description/icon.png b/maintenance_product/static/description/icon.png new file mode 100644 index 000000000..3a0328b51 Binary files /dev/null and b/maintenance_product/static/description/icon.png differ diff --git a/maintenance_product/static/description/index.html b/maintenance_product/static/description/index.html new file mode 100644 index 000000000..b4598488e --- /dev/null +++ b/maintenance_product/static/description/index.html @@ -0,0 +1,443 @@ + + + + + + +Maintenance Product + + + +
+

Maintenance Product

+ + +

Beta License: AGPL-3 OCA/maintenance Translate me on Weblate Try me on Runbot

+

This module links Maintenance Equipments and Products, easing creation of new equipments.

+

Table of contents

+ +
+

Usage

+

Equipment Categories:

+
    +
  • Go to Maintenance > Configuration > Equipment Categories and create a new one (or modify an existing one) filling in the new field Product Category.
  • +
  • The name of the Equipment Category is set to the name of the Product Category.
  • +
+

Equipment:

+
    +
  • Go to Maintenance > Equipments and create a new one filling in the new field Product.
  • +
  • The name of the Equipment is set to the name of the Product.
  • +
  • The vendor of the Equipment is set to the seller of the Product (if only one is set).
  • +
  • The vendor reference of the Equipment is set to the seller reference of the Product (if only one is set).
  • +
  • The cost of the Equipment is set to the standard cost of the Product.
  • +
+
+
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Tecnativa
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

+

Current maintainer:

+

victoralmau

+

This module is part of the OCA/maintenance project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/maintenance_product/tests/__init__.py b/maintenance_product/tests/__init__.py new file mode 100644 index 000000000..a0bf7c8e8 --- /dev/null +++ b/maintenance_product/tests/__init__.py @@ -0,0 +1,4 @@ +# Copyright 2022 Tecnativa - Víctor Martínez +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import test_maintenance_product diff --git a/maintenance_product/tests/common.py b/maintenance_product/tests/common.py new file mode 100644 index 000000000..6a794d7dc --- /dev/null +++ b/maintenance_product/tests/common.py @@ -0,0 +1,23 @@ +# Copyright 2022 Tecnativa - Víctor Martínez +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo.tests import common + + +class TestMaintenanceProductBase(common.TransactionCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.product_category = cls.env["product.category"].create( + {"name": "test-product-category"} + ) + cls.partner = cls.env["res.partner"].create({"name": "Mr Odoo"}) + cls.product = cls.env["product.product"].create( + { + "name": "test-product", + "categ_id": cls.product_category.id, + "standard_price": 10, + "maintenance_ok": True, + "seller_ids": [(0, 0, {"partner_id": cls.partner.id})], + } + ) diff --git a/maintenance_product/tests/test_maintenance_product.py b/maintenance_product/tests/test_maintenance_product.py new file mode 100644 index 000000000..d288365bd --- /dev/null +++ b/maintenance_product/tests/test_maintenance_product.py @@ -0,0 +1,30 @@ +# Copyright 2022 Tecnativa - Víctor Martínez +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo.tests import Form + +from .common import TestMaintenanceProductBase + + +class TestMaintenanceProduct(TestMaintenanceProductBase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.category = cls.env["maintenance.equipment.category"].create( + {"name": "test-maintenance-equipment-category"} + ) + cls.equipment = cls.env["maintenance.equipment"].create( + {"name": "test-maintenance-equipment"} + ) + + def test_maintenance_equipment_category(self): + category_form = Form(self.category) + category_form.product_category_id = self.product_category + self.assertEqual(category_form.name, "test-product-category") + + def test_maintenance_equipment(self): + equipment_form = Form(self.equipment) + equipment_form.product_id = self.product + self.assertEqual(equipment_form.name, "test-product") + self.assertEqual(equipment_form.cost, 10) + self.assertEqual(equipment_form.partner_id, self.partner) diff --git a/maintenance_product/views/maintenance_equipment_view.xml b/maintenance_product/views/maintenance_equipment_view.xml new file mode 100644 index 000000000..f8c5bec21 --- /dev/null +++ b/maintenance_product/views/maintenance_equipment_view.xml @@ -0,0 +1,34 @@ + + + + pm.maintenance.equipment.form.view + maintenance.equipment + + + + + + + + + + pm.maintenance.equipment.search.view + maintenance.equipment + + + + + + + + + pm.maintenance.equipment.category.form.view + maintenance.equipment.category + + + + + + + + diff --git a/maintenance_product/views/product_template_view.xml b/maintenance_product/views/product_template_view.xml new file mode 100644 index 000000000..79992a477 --- /dev/null +++ b/maintenance_product/views/product_template_view.xml @@ -0,0 +1,16 @@ + + + + product.template.common.form + product.template + + + +
+ +
+
+
+
+
diff --git a/setup/maintenance_product/odoo/addons/maintenance_product b/setup/maintenance_product/odoo/addons/maintenance_product new file mode 120000 index 000000000..2a4293551 --- /dev/null +++ b/setup/maintenance_product/odoo/addons/maintenance_product @@ -0,0 +1 @@ +../../../../maintenance_product \ No newline at end of file diff --git a/setup/maintenance_product/setup.py b/setup/maintenance_product/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/maintenance_product/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)