-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX] mrp_repair_cancel_reason: wizard does not launch + permissions …
…+ dependencies
- Loading branch information
Showing
11 changed files
with
668 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,15 @@ | ||
# (c) 2015 Alfredo de la Fuente - AvanzOSC | ||
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html | ||
{ | ||
"name": "MRP Repair Cancel Reason", | ||
"name": "Repair Cancel Reason", | ||
"version": "16.0.1.0.0", | ||
"license": "AGPL-3", | ||
"author": "AvanzOSC", | ||
"website": "https://github.com/avanzosc/mrp-repair-addons", | ||
"contributors": [ | ||
"Ana Juaristi <[email protected]>", | ||
"Alfredo de la Fuente <[email protected]>", | ||
], | ||
"category": "Manufacturing", | ||
"category": "Inventory/Inventory", | ||
"depends": [ | ||
"product", | ||
"stock", | ||
"mrp", | ||
"repair", | ||
"stock", | ||
], | ||
"data": [ | ||
"security/ir.model.access.csv", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * mrp_repair_cancel_reason | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 16.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2024-09-18 11:58+0000\n" | ||
"PO-Revision-Date: 2024-09-18 11:58+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: mrp_repair_cancel_reason | ||
#: model:ir.model,name:mrp_repair_cancel_reason.model_wiz_repair_order_cancel_reason | ||
msgid "Ask a reason from the repair cancellation" | ||
msgstr "Preguntar la razón para cancelar la reparación" | ||
|
||
#. module: mrp_repair_cancel_reason | ||
#: model_terms:ir.ui.view,arch_db:mrp_repair_cancel_reason.wiz_repair_order_cancel_reason_form_view | ||
msgid "Cancel" | ||
msgstr "Cancelar" | ||
|
||
#. module: mrp_repair_cancel_reason | ||
#: model:repair.order.cancel.reason,name:mrp_repair_cancel_reason.mrp_cancel_reason_customer | ||
msgid "Canceled at customer request" | ||
msgstr "Cancelado por petición del cliente" | ||
|
||
#. module: mrp_repair_cancel_reason | ||
#: model_terms:ir.ui.view,arch_db:mrp_repair_cancel_reason.wiz_repair_order_cancel_reason_form_view | ||
msgid "Choose the reason for the cancellation of the repair." | ||
msgstr "Seleccione la razón de la cancelación de la reparación." | ||
|
||
#. module: mrp_repair_cancel_reason | ||
#: model_terms:ir.ui.view,arch_db:mrp_repair_cancel_reason.wiz_repair_order_cancel_reason_form_view | ||
msgid "Confirm" | ||
msgstr "Confirmar" | ||
|
||
#. module: mrp_repair_cancel_reason | ||
#: model:ir.model.fields,field_description:mrp_repair_cancel_reason.field_repair_order_cancel_reason__create_uid | ||
#: model:ir.model.fields,field_description:mrp_repair_cancel_reason.field_wiz_repair_order_cancel_reason__create_uid | ||
msgid "Created by" | ||
msgstr "Creado por" | ||
|
||
#. module: mrp_repair_cancel_reason | ||
#: model:ir.model.fields,field_description:mrp_repair_cancel_reason.field_repair_order_cancel_reason__create_date | ||
#: model:ir.model.fields,field_description:mrp_repair_cancel_reason.field_wiz_repair_order_cancel_reason__create_date | ||
msgid "Created on" | ||
msgstr "Creado el" | ||
|
||
#. module: mrp_repair_cancel_reason | ||
#: model:ir.model.fields,field_description:mrp_repair_cancel_reason.field_repair_order_cancel_reason__display_name | ||
#: model:ir.model.fields,field_description:mrp_repair_cancel_reason.field_wiz_repair_order_cancel_reason__display_name | ||
msgid "Display Name" | ||
msgstr "Nombre mostrado" | ||
|
||
#. module: mrp_repair_cancel_reason | ||
#: model:ir.model.fields,field_description:mrp_repair_cancel_reason.field_repair_order_cancel_reason__id | ||
#: model:ir.model.fields,field_description:mrp_repair_cancel_reason.field_wiz_repair_order_cancel_reason__id | ||
msgid "ID" | ||
msgstr "" | ||
|
||
#. module: mrp_repair_cancel_reason | ||
#: model:ir.model.fields,field_description:mrp_repair_cancel_reason.field_repair_order_cancel_reason____last_update | ||
#: model:ir.model.fields,field_description:mrp_repair_cancel_reason.field_wiz_repair_order_cancel_reason____last_update | ||
msgid "Last Modified on" | ||
msgstr "Última modificación el" | ||
|
||
#. module: mrp_repair_cancel_reason | ||
#: model:ir.model.fields,field_description:mrp_repair_cancel_reason.field_repair_order_cancel_reason__write_uid | ||
#: model:ir.model.fields,field_description:mrp_repair_cancel_reason.field_wiz_repair_order_cancel_reason__write_uid | ||
msgid "Last Updated by" | ||
msgstr "Última actualización por" | ||
|
||
#. module: mrp_repair_cancel_reason | ||
#: model:ir.model.fields,field_description:mrp_repair_cancel_reason.field_repair_order_cancel_reason__write_date | ||
#: model:ir.model.fields,field_description:mrp_repair_cancel_reason.field_wiz_repair_order_cancel_reason__write_date | ||
msgid "Last Updated on" | ||
msgstr "Última actualización el" | ||
|
||
#. module: mrp_repair_cancel_reason | ||
#: model:ir.model.fields,field_description:mrp_repair_cancel_reason.field_repair_order_cancel_reason__name | ||
#: model:ir.model.fields,field_description:mrp_repair_cancel_reason.field_wiz_repair_order_cancel_reason__reason_id | ||
msgid "Reason" | ||
msgstr "Razón" | ||
|
||
#. module: mrp_repair_cancel_reason | ||
#: model:ir.model.fields,field_description:mrp_repair_cancel_reason.field_repair_order__cancel_reason_id | ||
msgid "Reason for cancellation" | ||
msgstr "Razón para la cancelación" | ||
|
||
#. module: mrp_repair_cancel_reason | ||
#: model:ir.actions.act_window,name:mrp_repair_cancel_reason.action_repair_order_cancel_with_reason | ||
#: model_terms:ir.ui.view,arch_db:mrp_repair_cancel_reason.wiz_repair_order_cancel_reason_form_view | ||
msgid "Reason for the cancellation" | ||
msgstr "Razón para la cancelación" | ||
|
||
#. module: mrp_repair_cancel_reason | ||
#: model:ir.actions.act_window,name:mrp_repair_cancel_reason.action_repair_order_cancel_reason | ||
#: model:ir.model,name:mrp_repair_cancel_reason.model_repair_order_cancel_reason | ||
#: model:ir.ui.menu,name:mrp_repair_cancel_reason.menu_repair_order_cancel_reason | ||
msgid "Repair Cancel Reason" | ||
msgstr "Razón de cancelación de reparación" | ||
|
||
#. module: mrp_repair_cancel_reason | ||
#: model:ir.model,name:mrp_repair_cancel_reason.model_repair_order | ||
msgid "Repair Order" | ||
msgstr "Orden de reparación" | ||
|
||
#. module: mrp_repair_cancel_reason | ||
#. odoo-python | ||
#: code:addons/mrp_repair_cancel_reason/models/repair_order.py:0 | ||
#, python-format | ||
msgid "Repair must be canceled in order to reset it to draft." | ||
msgstr "" | ||
"La reparación debe de estar cancelada para poder ser puesta en borrador." | ||
|
||
#. module: mrp_repair_cancel_reason | ||
#. odoo-python | ||
#: code:addons/mrp_repair_cancel_reason/models/repair_order.py:0 | ||
#, python-format | ||
msgid "You cannot cancel a completed repair order." | ||
msgstr "No puede cancelar una orden de reparación completada." | ||
|
||
#. module: mrp_repair_cancel_reason | ||
#. odoo-python | ||
#: code:addons/mrp_repair_cancel_reason/models/repair_order.py:0 | ||
#, python-format | ||
msgid "You cannot cancel a repair order with done stock moves." | ||
msgstr "No puede cancelar una orden con movimientos de stock realizados." | ||
|
||
#. module: mrp_repair_cancel_reason | ||
#: model_terms:ir.ui.view,arch_db:mrp_repair_cancel_reason.wiz_repair_order_cancel_reason_form_view | ||
msgid "or" | ||
msgstr "o" |
138 changes: 138 additions & 0 deletions
138
mrp_repair_cancel_reason/i18n/mrp_repair_cancel_reason.pot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * mrp_repair_cancel_reason | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 16.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2024-09-18 11:58+0000\n" | ||
"PO-Revision-Date: 2024-09-18 11:58+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: mrp_repair_cancel_reason | ||
#: model:ir.model,name:mrp_repair_cancel_reason.model_wiz_repair_order_cancel_reason | ||
msgid "Ask a reason from the repair cancellation" | ||
msgstr "" | ||
|
||
#. module: mrp_repair_cancel_reason | ||
#: model_terms:ir.ui.view,arch_db:mrp_repair_cancel_reason.wiz_repair_order_cancel_reason_form_view | ||
msgid "Cancel" | ||
msgstr "" | ||
|
||
#. module: mrp_repair_cancel_reason | ||
#: model:repair.order.cancel.reason,name:mrp_repair_cancel_reason.mrp_cancel_reason_customer | ||
msgid "Canceled at customer request" | ||
msgstr "" | ||
|
||
#. module: mrp_repair_cancel_reason | ||
#: model_terms:ir.ui.view,arch_db:mrp_repair_cancel_reason.wiz_repair_order_cancel_reason_form_view | ||
msgid "Choose the reason for the cancellation of the repair." | ||
msgstr "" | ||
|
||
#. module: mrp_repair_cancel_reason | ||
#: model_terms:ir.ui.view,arch_db:mrp_repair_cancel_reason.wiz_repair_order_cancel_reason_form_view | ||
msgid "Confirm" | ||
msgstr "" | ||
|
||
#. module: mrp_repair_cancel_reason | ||
#: model:ir.model.fields,field_description:mrp_repair_cancel_reason.field_repair_order_cancel_reason__create_uid | ||
#: model:ir.model.fields,field_description:mrp_repair_cancel_reason.field_wiz_repair_order_cancel_reason__create_uid | ||
msgid "Created by" | ||
msgstr "" | ||
|
||
#. module: mrp_repair_cancel_reason | ||
#: model:ir.model.fields,field_description:mrp_repair_cancel_reason.field_repair_order_cancel_reason__create_date | ||
#: model:ir.model.fields,field_description:mrp_repair_cancel_reason.field_wiz_repair_order_cancel_reason__create_date | ||
msgid "Created on" | ||
msgstr "" | ||
|
||
#. module: mrp_repair_cancel_reason | ||
#: model:ir.model.fields,field_description:mrp_repair_cancel_reason.field_repair_order_cancel_reason__display_name | ||
#: model:ir.model.fields,field_description:mrp_repair_cancel_reason.field_wiz_repair_order_cancel_reason__display_name | ||
msgid "Display Name" | ||
msgstr "" | ||
|
||
#. module: mrp_repair_cancel_reason | ||
#: model:ir.model.fields,field_description:mrp_repair_cancel_reason.field_repair_order_cancel_reason__id | ||
#: model:ir.model.fields,field_description:mrp_repair_cancel_reason.field_wiz_repair_order_cancel_reason__id | ||
msgid "ID" | ||
msgstr "" | ||
|
||
#. module: mrp_repair_cancel_reason | ||
#: model:ir.model.fields,field_description:mrp_repair_cancel_reason.field_repair_order_cancel_reason____last_update | ||
#: model:ir.model.fields,field_description:mrp_repair_cancel_reason.field_wiz_repair_order_cancel_reason____last_update | ||
msgid "Last Modified on" | ||
msgstr "" | ||
|
||
#. module: mrp_repair_cancel_reason | ||
#: model:ir.model.fields,field_description:mrp_repair_cancel_reason.field_repair_order_cancel_reason__write_uid | ||
#: model:ir.model.fields,field_description:mrp_repair_cancel_reason.field_wiz_repair_order_cancel_reason__write_uid | ||
msgid "Last Updated by" | ||
msgstr "" | ||
|
||
#. module: mrp_repair_cancel_reason | ||
#: model:ir.model.fields,field_description:mrp_repair_cancel_reason.field_repair_order_cancel_reason__write_date | ||
#: model:ir.model.fields,field_description:mrp_repair_cancel_reason.field_wiz_repair_order_cancel_reason__write_date | ||
msgid "Last Updated on" | ||
msgstr "" | ||
|
||
#. module: mrp_repair_cancel_reason | ||
#: model:ir.model.fields,field_description:mrp_repair_cancel_reason.field_repair_order_cancel_reason__name | ||
#: model:ir.model.fields,field_description:mrp_repair_cancel_reason.field_wiz_repair_order_cancel_reason__reason_id | ||
msgid "Reason" | ||
msgstr "" | ||
|
||
#. module: mrp_repair_cancel_reason | ||
#: model:ir.model.fields,field_description:mrp_repair_cancel_reason.field_repair_order__cancel_reason_id | ||
msgid "Reason for cancellation" | ||
msgstr "" | ||
|
||
#. module: mrp_repair_cancel_reason | ||
#: model:ir.actions.act_window,name:mrp_repair_cancel_reason.action_repair_order_cancel_with_reason | ||
#: model_terms:ir.ui.view,arch_db:mrp_repair_cancel_reason.wiz_repair_order_cancel_reason_form_view | ||
msgid "Reason for the cancellation" | ||
msgstr "" | ||
|
||
#. module: mrp_repair_cancel_reason | ||
#: model:ir.actions.act_window,name:mrp_repair_cancel_reason.action_repair_order_cancel_reason | ||
#: model:ir.model,name:mrp_repair_cancel_reason.model_repair_order_cancel_reason | ||
#: model:ir.ui.menu,name:mrp_repair_cancel_reason.menu_repair_order_cancel_reason | ||
msgid "Repair Cancel Reason" | ||
msgstr "" | ||
|
||
#. module: mrp_repair_cancel_reason | ||
#: model:ir.model,name:mrp_repair_cancel_reason.model_repair_order | ||
msgid "Repair Order" | ||
msgstr "" | ||
|
||
#. module: mrp_repair_cancel_reason | ||
#. odoo-python | ||
#: code:addons/mrp_repair_cancel_reason/models/repair_order.py:0 | ||
#, python-format | ||
msgid "Repair must be canceled in order to reset it to draft." | ||
msgstr "" | ||
|
||
#. module: mrp_repair_cancel_reason | ||
#. odoo-python | ||
#: code:addons/mrp_repair_cancel_reason/models/repair_order.py:0 | ||
#, python-format | ||
msgid "You cannot cancel a completed repair order." | ||
msgstr "" | ||
|
||
#. module: mrp_repair_cancel_reason | ||
#. odoo-python | ||
#: code:addons/mrp_repair_cancel_reason/models/repair_order.py:0 | ||
#, python-format | ||
msgid "You cannot cancel a repair order with done stock moves." | ||
msgstr "" | ||
|
||
#. module: mrp_repair_cancel_reason | ||
#: model_terms:ir.ui.view,arch_db:mrp_repair_cancel_reason.wiz_repair_order_cancel_reason_form_view | ||
msgid "or" | ||
msgstr "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,56 @@ | ||
# (c) 2015 Alfredo de la Fuente - AvanzOSC | ||
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html | ||
from odoo import fields, models | ||
from odoo import _, fields, models | ||
from odoo.exceptions import UserError | ||
|
||
|
||
class MrpRepair(models.Model): | ||
_inherit = "repair.order" | ||
|
||
cancel_reason_id = fields.Many2one( | ||
"repair.order.cancel.reason", | ||
comodel_name="repair.order.cancel.reason", | ||
string="Reason for cancellation", | ||
readonly=True, | ||
copy=False, | ||
ondelete="restrict", | ||
) | ||
|
||
def action_repair_cancel(self): | ||
if any(move.state == "done" for move in self.mapped("move_id")): | ||
raise UserError( | ||
_("You cannot cancel a repair order if it is already finished.") | ||
) | ||
if any(move.state == "done" for move in self.mapped("operations.move_id")): | ||
raise UserError( | ||
_("You cannot cancel a repair order with done stock moves.") | ||
) | ||
if any(repair.state == "done" for repair in self): | ||
raise UserError(_("You cannot cancel a completed repair order.")) | ||
if not all(repair.cancel_reason_id for repair in self): | ||
action = self.env["ir.actions.actions"]._for_xml_id( | ||
"mrp_repair_cancel_reason.action_repair_order_cancel_with_reason" | ||
) | ||
action["context"] = dict(self._context, create=False) | ||
return action | ||
return super().action_repair_cancel() | ||
|
||
def action_repair_cancel_draft(self): | ||
if self.filtered(lambda repair: repair.state != "cancel"): | ||
raise UserError(_("Repair must be canceled in order to reset it to draft.")) | ||
self.write( | ||
{ | ||
"cancel_reason_id": False, | ||
} | ||
) | ||
return super().action_repair_cancel_draft() | ||
|
||
|
||
class MrpRepairCancelReason(models.Model): | ||
_name = "repair.order.cancel.reason" | ||
_description = "Repair Cancel Reason" | ||
|
||
name = fields.Char("Reason", required=True, translate=True) | ||
name = fields.Char( | ||
string="Reason", | ||
required=True, | ||
translate=True, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink | ||
access_repair_order_cancel_reason_user,access_repair_order_cancel_reason user,model_repair_order_cancel_reason,mrp.group_mrp_user,1,0,0,0 | ||
access_repair_order_cancel_reason_manager,access_repair_order_cancel_reason manager,model_repair_order_cancel_reason,mrp.group_mrp_manager,1,1,1,1 | ||
access_repair_order_cancel_reason_user,access_repair_order_cancel_reason user,model_repair_order_cancel_reason,stock.group_stock_user,1,0,0,0 | ||
access_repair_order_cancel_reason_manager,access_repair_order_cancel_reason manager,model_repair_order_cancel_reason,stock.group_stock_manager,1,1,1,1 | ||
access_wiz_repair_order_cancel_reason,access_wiz_repair_order_cancel_reason,mrp_repair_cancel_reason.model_wiz_repair_order_cancel_reason,stock.group_stock_user,1,1,1,1 |
Oops, something went wrong.