-
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
333 additions
and
68 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,124 @@ | ||
# 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-10 12:49+0000\n" | ||
"PO-Revision-Date: 2024-09-10 12:49+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_terms:ir.ui.view,arch_db:mrp_repair_cancel_reason.view_repair_order_form_inh_cancel_reason | ||
msgid "Cancel Repair" | ||
msgstr "Cancelar reparación" | ||
|
||
#. 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\n" | ||
" 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 "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 "" | ||
|
||
#. 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 "Orden de 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 "or" | ||
msgstr "" |
124 changes: 124 additions & 0 deletions
124
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,124 @@ | ||
# 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-10 12:49+0000\n" | ||
"PO-Revision-Date: 2024-09-10 12:49+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_terms:ir.ui.view,arch_db:mrp_repair_cancel_reason.view_repair_order_form_inh_cancel_reason | ||
msgid "Cancel Repair" | ||
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\n" | ||
" 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 | ||
#: 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,52 @@ | ||
# (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(operation.state == "done" for operation in self.mapped("operations")): | ||
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.