diff --git a/repair_order_internal/README.rst b/repair_order_internal/README.rst new file mode 100644 index 0000000..24e3537 --- /dev/null +++ b/repair_order_internal/README.rst @@ -0,0 +1,33 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +===================== +Repair order internal +===================== + +* In repairs new menu option "Internal Repair Orders", with its new sequence + Internal Repair Order". +* For normal repair orders, customers will only be able to pick up contacts that + are not from the company. +* For internal repair orders, clients will only be able to take contacts that + are from the company. + +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 smash it by providing detailed and welcomed feedback. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Contributors +------------ + +* Ana Juaristi +* Alfredo de la Fuente diff --git a/repair_order_internal/__init__.py b/repair_order_internal/__init__.py new file mode 100644 index 0000000..0650744 --- /dev/null +++ b/repair_order_internal/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/repair_order_internal/__manifest__.py b/repair_order_internal/__manifest__.py new file mode 100644 index 0000000..c308553 --- /dev/null +++ b/repair_order_internal/__manifest__.py @@ -0,0 +1,18 @@ +# Copyright 2024 Alfredo de la Fuente - AvanzOSC +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). +{ + "name": "Repair Order Internal", + "version": "16.0.1.0.0", + "category": "Inventory/Inventory", + "license": "AGPL-3", + "author": "AvanzOSC", + "website": "https://github.com/avanzosc/mrp-repair-addons", + "depends": [ + "repair", + ], + "data": [ + "data/repair_order_internal_sequence.xml", + "views/repair_order_views.xml", + ], + "installable": True, +} diff --git a/repair_order_internal/data/repair_order_internal_sequence.xml b/repair_order_internal/data/repair_order_internal_sequence.xml new file mode 100644 index 0000000..c6325e8 --- /dev/null +++ b/repair_order_internal/data/repair_order_internal_sequence.xml @@ -0,0 +1,8 @@ + + + Internal Repair Order + repair.order.internal + + RI/ + + diff --git a/repair_order_internal/i18n/ca_ES.po b/repair_order_internal/i18n/ca_ES.po new file mode 100644 index 0000000..24f3eda --- /dev/null +++ b/repair_order_internal/i18n/ca_ES.po @@ -0,0 +1,43 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * repair_order_internal +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-09-30 10:52+0000\n" +"PO-Revision-Date: 2024-09-30 10:52+0000\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: repair_order_internal +#: model:ir.actions.act_window,name:repair_order_internal.action_internal_repair_order_graph +#: model:ir.actions.act_window,name:repair_order_internal.action_internal_repair_order_tree +msgid "Intenal Repair Orders" +msgstr "" + +#. module: repair_order_internal +#: model:ir.model.fields,field_description:repair_order_internal.field_repair_order__internal_repair +msgid "Internal Repair" +msgstr "" + +#. module: repair_order_internal +#: model:ir.ui.menu,name:repair_order_internal.menu_internal_repair_order_graph +#: model:ir.ui.menu,name:repair_order_internal.menu_internal_repair_order_tree +msgid "Internal Repair Orders" +msgstr "" + +#. module: repair_order_internal +#: model:ir.model,name:repair_order_internal.model_repair_order +msgid "Repair Order" +msgstr "Ordre de reparació" + +#. module: repair_order_internal +#: model:ir.model,name:repair_order_internal.model_ir_sequence +msgid "Sequence" +msgstr "Seqüència" diff --git a/repair_order_internal/i18n/en_GB.po b/repair_order_internal/i18n/en_GB.po new file mode 100644 index 0000000..ffb8009 --- /dev/null +++ b/repair_order_internal/i18n/en_GB.po @@ -0,0 +1,43 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * repair_order_internal +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-09-30 10:52+0000\n" +"PO-Revision-Date: 2024-09-30 10:52+0000\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: repair_order_internal +#: model:ir.actions.act_window,name:repair_order_internal.action_internal_repair_order_graph +#: model:ir.actions.act_window,name:repair_order_internal.action_internal_repair_order_tree +msgid "Intenal Repair Orders" +msgstr "" + +#. module: repair_order_internal +#: model:ir.model.fields,field_description:repair_order_internal.field_repair_order__internal_repair +msgid "Internal Repair" +msgstr "" + +#. module: repair_order_internal +#: model:ir.ui.menu,name:repair_order_internal.menu_internal_repair_order_graph +#: model:ir.ui.menu,name:repair_order_internal.menu_internal_repair_order_tree +msgid "Internal Repair Orders" +msgstr "" + +#. module: repair_order_internal +#: model:ir.model,name:repair_order_internal.model_repair_order +msgid "Repair Order" +msgstr "" + +#. module: repair_order_internal +#: model:ir.model,name:repair_order_internal.model_ir_sequence +msgid "Sequence" +msgstr "" diff --git a/repair_order_internal/i18n/es.po b/repair_order_internal/i18n/es.po new file mode 100644 index 0000000..e4c5e63 --- /dev/null +++ b/repair_order_internal/i18n/es.po @@ -0,0 +1,43 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * repair_order_internal +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-09-30 10:53+0000\n" +"PO-Revision-Date: 2024-09-30 10:53+0000\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: repair_order_internal +#: model:ir.actions.act_window,name:repair_order_internal.action_internal_repair_order_graph +#: model:ir.actions.act_window,name:repair_order_internal.action_internal_repair_order_tree +msgid "Intenal Repair Orders" +msgstr "Reparaciones internas" + +#. module: repair_order_internal +#: model:ir.model.fields,field_description:repair_order_internal.field_repair_order__internal_repair +msgid "Internal Repair" +msgstr "Reparación interna" + +#. module: repair_order_internal +#: model:ir.ui.menu,name:repair_order_internal.menu_internal_repair_order_graph +#: model:ir.ui.menu,name:repair_order_internal.menu_internal_repair_order_tree +msgid "Internal Repair Orders" +msgstr "Reparaciones internas" + +#. module: repair_order_internal +#: model:ir.model,name:repair_order_internal.model_repair_order +msgid "Repair Order" +msgstr "Orden reparación" + +#. module: repair_order_internal +#: model:ir.model,name:repair_order_internal.model_ir_sequence +msgid "Sequence" +msgstr "Secuencia" diff --git a/repair_order_internal/i18n/fr.po b/repair_order_internal/i18n/fr.po new file mode 100644 index 0000000..43a88ab --- /dev/null +++ b/repair_order_internal/i18n/fr.po @@ -0,0 +1,43 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * repair_order_internal +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-09-30 10:52+0000\n" +"PO-Revision-Date: 2024-09-30 10:52+0000\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: repair_order_internal +#: model:ir.actions.act_window,name:repair_order_internal.action_internal_repair_order_graph +#: model:ir.actions.act_window,name:repair_order_internal.action_internal_repair_order_tree +msgid "Intenal Repair Orders" +msgstr "" + +#. module: repair_order_internal +#: model:ir.model.fields,field_description:repair_order_internal.field_repair_order__internal_repair +msgid "Internal Repair" +msgstr "" + +#. module: repair_order_internal +#: model:ir.ui.menu,name:repair_order_internal.menu_internal_repair_order_graph +#: model:ir.ui.menu,name:repair_order_internal.menu_internal_repair_order_tree +msgid "Internal Repair Orders" +msgstr "" + +#. module: repair_order_internal +#: model:ir.model,name:repair_order_internal.model_repair_order +msgid "Repair Order" +msgstr "Ordre de réparation" + +#. module: repair_order_internal +#: model:ir.model,name:repair_order_internal.model_ir_sequence +msgid "Sequence" +msgstr "Séquence" diff --git a/repair_order_internal/i18n/repair_order_internal.pot b/repair_order_internal/i18n/repair_order_internal.pot new file mode 100644 index 0000000..241732b --- /dev/null +++ b/repair_order_internal/i18n/repair_order_internal.pot @@ -0,0 +1,43 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * repair_order_internal +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-09-30 10:51+0000\n" +"PO-Revision-Date: 2024-09-30 10:51+0000\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: repair_order_internal +#: model:ir.actions.act_window,name:repair_order_internal.action_internal_repair_order_graph +#: model:ir.actions.act_window,name:repair_order_internal.action_internal_repair_order_tree +msgid "Intenal Repair Orders" +msgstr "" + +#. module: repair_order_internal +#: model:ir.model.fields,field_description:repair_order_internal.field_repair_order__internal_repair +msgid "Internal Repair" +msgstr "" + +#. module: repair_order_internal +#: model:ir.ui.menu,name:repair_order_internal.menu_internal_repair_order_graph +#: model:ir.ui.menu,name:repair_order_internal.menu_internal_repair_order_tree +msgid "Internal Repair Orders" +msgstr "" + +#. module: repair_order_internal +#: model:ir.model,name:repair_order_internal.model_repair_order +msgid "Repair Order" +msgstr "" + +#. module: repair_order_internal +#: model:ir.model,name:repair_order_internal.model_ir_sequence +msgid "Sequence" +msgstr "" diff --git a/repair_order_internal/models/__init__.py b/repair_order_internal/models/__init__.py new file mode 100644 index 0000000..02b09fa --- /dev/null +++ b/repair_order_internal/models/__init__.py @@ -0,0 +1,2 @@ +from . import repair_order +from . import ir_sequence diff --git a/repair_order_internal/models/ir_sequence.py b/repair_order_internal/models/ir_sequence.py new file mode 100644 index 0000000..988cc52 --- /dev/null +++ b/repair_order_internal/models/ir_sequence.py @@ -0,0 +1,18 @@ +# Copyright 2024 Alfredo de la Fuente - AvanzOSC +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). +from odoo import api, models + + +class IrSequence(models.Model): + _inherit = "ir.sequence" + + @api.model + def next_by_code(self, sequence_code, sequence_date=None): + if ( + sequence_code == "repair.order" + and "with_internal_repair_order_sequence" in self.env.context + ): + return super().next_by_code( + "repair.order.internal", sequence_date=sequence_date + ) + return super().next_by_code(sequence_code, sequence_date=sequence_date) diff --git a/repair_order_internal/models/repair_order.py b/repair_order_internal/models/repair_order.py new file mode 100644 index 0000000..2f1cb46 --- /dev/null +++ b/repair_order_internal/models/repair_order.py @@ -0,0 +1,46 @@ +# Copyright 2024 Alfredo de la Fuente - AvanzOSC +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). +from odoo import api, fields, models + + +class RepairOrder(models.Model): + _inherit = "repair.order" + + internal_repair = fields.Boolean() + + @api.onchange("internal_repair") + def onchange_internal_claim(self): + domain = {} + if self.internal_repair: + domain = { + "domain": { + "partner_id": [ + "|", + ("id", "=", self.env.company.id), + ("parent_id", "=", self.env.company.id), + ] + } + } + else: + domain = { + "domain": { + "partner_id": [ + ("id", "!=", self.env.company.id), + ("parent_id", "!=", self.env.company.id), + ] + } + } + return domain + + @api.model_create_multi + def create(self, vals_list): + found = False + for vals in vals_list: + if "internal_repair" in vals and vals.get("internal_repair", False): + found = True + if not found: + return super().create(vals_list) + else: + return super( + RepairOrder, self.with_context(with_internal_repair_order_sequence=True) + ).create(vals_list) diff --git a/repair_order_internal/views/repair_order_views.xml b/repair_order_internal/views/repair_order_views.xml new file mode 100644 index 0000000..b854569 --- /dev/null +++ b/repair_order_internal/views/repair_order_views.xml @@ -0,0 +1,71 @@ + + + + repair.order + + + + + + + + + + Repair Orders + { + 'search_default_product': 1, + 'search_default_createDate': 1, + 'default_internal_repair': False, + } + + [('internal_repair', '=', False)] + ir.actions.act_window + repair.order + tree,kanban,graph,pivot,form + + + + + Intenal Repair Orders + { + 'default_internal_repair': True, + } + + [('internal_repair', '=', True)] + ir.actions.act_window + repair.order + tree,kanban,graph,pivot,form + + + + + Intenal Repair Orders + { + 'search_default_product': 1, + 'search_default_createDate': 1, + 'default_internal_repair': True, + } + + [('internal_repair', '=', True)] + ir.actions.act_window + repair.order + tree,kanban,graph,pivot,form + + + + + + + diff --git a/setup/repair_order_internal/odoo/addons/repair_order_internal b/setup/repair_order_internal/odoo/addons/repair_order_internal new file mode 120000 index 0000000..dbabebe --- /dev/null +++ b/setup/repair_order_internal/odoo/addons/repair_order_internal @@ -0,0 +1 @@ +../../../../repair_order_internal \ No newline at end of file diff --git a/setup/repair_order_internal/setup.py b/setup/repair_order_internal/setup.py new file mode 100644 index 0000000..28c57bb --- /dev/null +++ b/setup/repair_order_internal/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)