Skip to content

Commit

Permalink
[16.0][ADD] repair_order_internal: In repairs new menu option "Intern…
Browse files Browse the repository at this point in the history
…al Repair Orders".
  • Loading branch information
alfredoavanzosc authored and anajuaristi committed Oct 2, 2024
1 parent c518729 commit e7f1fb9
Show file tree
Hide file tree
Showing 15 changed files with 419 additions and 0 deletions.
33 changes: 33 additions & 0 deletions repair_order_internal/README.rst
Original file line number Diff line number Diff line change
@@ -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
<https://github.com/avanzosc/mrp-repair-addons/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 <anajuaristi@avanzosc.es>
* Alfredo de la Fuente <alfredodelafuente@avanzosc.es>
1 change: 1 addition & 0 deletions repair_order_internal/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
18 changes: 18 additions & 0 deletions repair_order_internal/__manifest__.py
Original file line number Diff line number Diff line change
@@ -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,
}
8 changes: 8 additions & 0 deletions repair_order_internal/data/repair_order_internal_sequence.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<odoo noupdate="1">
<record id="sequence_internal_repair_order" model="ir.sequence">
<field name="name">Internal Repair Order</field>
<field name="code">repair.order.internal</field>
<field eval="4" name="padding" />
<field name="prefix">RI/</field>
</record>
</odoo>
43 changes: 43 additions & 0 deletions repair_order_internal/i18n/ca_ES.po
Original file line number Diff line number Diff line change
@@ -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"
43 changes: 43 additions & 0 deletions repair_order_internal/i18n/en_GB.po
Original file line number Diff line number Diff line change
@@ -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 ""
43 changes: 43 additions & 0 deletions repair_order_internal/i18n/es.po
Original file line number Diff line number Diff line change
@@ -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"
43 changes: 43 additions & 0 deletions repair_order_internal/i18n/fr.po
Original file line number Diff line number Diff line change
@@ -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"
43 changes: 43 additions & 0 deletions repair_order_internal/i18n/repair_order_internal.pot
Original file line number Diff line number Diff line change
@@ -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 ""
2 changes: 2 additions & 0 deletions repair_order_internal/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import repair_order
from . import ir_sequence
18 changes: 18 additions & 0 deletions repair_order_internal/models/ir_sequence.py
Original file line number Diff line number Diff line change
@@ -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)
46 changes: 46 additions & 0 deletions repair_order_internal/models/repair_order.py
Original file line number Diff line number Diff line change
@@ -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)
Loading

0 comments on commit e7f1fb9

Please sign in to comment.