[MIG] base_exception: Migration to 15.0

pull/2463/head
Cesar Andres Sanchez 2022-06-29 00:04:00 +02:00 committed by matiasperalta1
parent 15f1c01227
commit 9810c79870
7 changed files with 79 additions and 212 deletions

View File

@ -5,7 +5,8 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
{ {
"name": "Exception Rule", "name": "Exception Rule",
"version": "14.0.2.1.0", "version": "15.0.1.0.0",
"development_status": "Mature",
"category": "Generic Modules", "category": "Generic Modules",
"summary": """ "summary": """
This module provide an abstract model to manage customizable This module provide an abstract model to manage customizable

View File

@ -4,8 +4,10 @@
# #
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 14.0\n" "Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-06-28 22:06+0000\n"
"PO-Revision-Date: 2022-06-28 22:06+0000\n"
"Last-Translator: \n" "Last-Translator: \n"
"Language-Team: \n" "Language-Team: \n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
@ -68,38 +70,6 @@ msgid ""
"By method: allow to select an existing check method" "By method: allow to select an existing check method"
msgstr "" msgstr ""
#. module: base_exception
#: model:ir.model.fields,field_description:base_exception.field_base_exception__changeset_change_ids
#: model:ir.model.fields,field_description:base_exception.field_base_exception_method__changeset_change_ids
#: model:ir.model.fields,field_description:base_exception.field_exception_rule__changeset_change_ids
#: model:ir.model.fields,field_description:base_exception.field_exception_rule_confirm__changeset_change_ids
msgid "Changeset Changes"
msgstr ""
#. module: base_exception
#: model:ir.model.fields,field_description:base_exception.field_base_exception__changeset_ids
#: model:ir.model.fields,field_description:base_exception.field_base_exception_method__changeset_ids
#: model:ir.model.fields,field_description:base_exception.field_exception_rule__changeset_ids
#: model:ir.model.fields,field_description:base_exception.field_exception_rule_confirm__changeset_ids
msgid "Changesets"
msgstr ""
#. module: base_exception
#: model:ir.model.fields,field_description:base_exception.field_base_exception__count_pending_changeset_changes
#: model:ir.model.fields,field_description:base_exception.field_base_exception_method__count_pending_changeset_changes
#: model:ir.model.fields,field_description:base_exception.field_exception_rule__count_pending_changeset_changes
#: model:ir.model.fields,field_description:base_exception.field_exception_rule_confirm__count_pending_changeset_changes
msgid "Count Pending Changeset Changes"
msgstr ""
#. module: base_exception
#: model:ir.model.fields,field_description:base_exception.field_base_exception__count_pending_changesets
#: model:ir.model.fields,field_description:base_exception.field_base_exception_method__count_pending_changesets
#: model:ir.model.fields,field_description:base_exception.field_exception_rule__count_pending_changesets
#: model:ir.model.fields,field_description:base_exception.field_exception_rule_confirm__count_pending_changesets
msgid "Count Pending Changesets"
msgstr ""
#. module: base_exception #. module: base_exception
#: model:ir.model.fields,field_description:base_exception.field_exception_rule__create_uid #: model:ir.model.fields,field_description:base_exception.field_exception_rule__create_uid
msgid "Created by" msgid "Created by"
@ -116,10 +86,7 @@ msgid "Description"
msgstr "" msgstr ""
#. module: base_exception #. module: base_exception
#: model:ir.model.fields,field_description:base_exception.field_base_exception__display_name
#: model:ir.model.fields,field_description:base_exception.field_base_exception_method__display_name
#: model:ir.model.fields,field_description:base_exception.field_exception_rule__display_name #: model:ir.model.fields,field_description:base_exception.field_exception_rule__display_name
#: model:ir.model.fields,field_description:base_exception.field_exception_rule_confirm__display_name
msgid "Display Name" msgid "Display Name"
msgstr "" msgstr ""
@ -140,8 +107,8 @@ msgstr ""
#, python-format #, python-format
msgid "" msgid ""
"Error when evaluating the exception.rule rule:\n" "Error when evaluating the exception.rule rule:\n"
" %s \n" " %(rule_name)s \n"
"(%s)" "(%(error)s)"
msgstr "" msgstr ""
#. module: base_exception #. module: base_exception
@ -156,7 +123,6 @@ msgstr ""
#. module: base_exception #. module: base_exception
#: model:ir.model,name:base_exception.model_exception_rule #: model:ir.model,name:base_exception.model_exception_rule
#: model_terms:ir.ui.view,arch_db:base_exception.view_exception_rule_tree
msgid "Exception Rule" msgid "Exception Rule"
msgstr "" msgstr ""
@ -196,11 +162,6 @@ msgstr ""
msgid "Exceptions" msgid "Exceptions"
msgstr "" msgstr ""
#. module: base_exception
#: model_terms:ir.ui.view,arch_db:base_exception.view_exception_rule_confirm
msgid "Exceptions Rules"
msgstr ""
#. module: base_exception #. module: base_exception
#: model:ir.model.fields,field_description:base_exception.field_base_exception__exceptions_summary #: model:ir.model.fields,field_description:base_exception.field_base_exception__exceptions_summary
msgid "Exceptions Summary" msgid "Exceptions Summary"
@ -227,10 +188,7 @@ msgid "Help with Python expressions"
msgstr "" msgstr ""
#. module: base_exception #. module: base_exception
#: model:ir.model.fields,field_description:base_exception.field_base_exception__id
#: model:ir.model.fields,field_description:base_exception.field_base_exception_method__id
#: model:ir.model.fields,field_description:base_exception.field_exception_rule__id #: model:ir.model.fields,field_description:base_exception.field_exception_rule__id
#: model:ir.model.fields,field_description:base_exception.field_exception_rule_confirm__id
msgid "ID" msgid "ID"
msgstr "" msgstr ""
@ -242,14 +200,11 @@ msgstr ""
#. module: base_exception #. module: base_exception
#: model:ir.model.fields,field_description:base_exception.field_exception_rule__is_blocking #: model:ir.model.fields,field_description:base_exception.field_exception_rule__is_blocking
msgid "Is blocking" msgid "Is Blocking"
msgstr "" msgstr ""
#. module: base_exception #. module: base_exception
#: model:ir.model.fields,field_description:base_exception.field_base_exception____last_update
#: model:ir.model.fields,field_description:base_exception.field_base_exception_method____last_update
#: model:ir.model.fields,field_description:base_exception.field_exception_rule____last_update #: model:ir.model.fields,field_description:base_exception.field_exception_rule____last_update
#: model:ir.model.fields,field_description:base_exception.field_exception_rule_confirm____last_update
msgid "Last Modified on" msgid "Last Modified on"
msgstr "" msgstr ""
@ -312,14 +267,6 @@ msgstr ""
msgid "Sequence" msgid "Sequence"
msgstr "" msgstr ""
#. module: base_exception
#: model:ir.model.fields,field_description:base_exception.field_base_exception__smart_search
#: model:ir.model.fields,field_description:base_exception.field_base_exception_method__smart_search
#: model:ir.model.fields,field_description:base_exception.field_exception_rule__smart_search
#: model:ir.model.fields,field_description:base_exception.field_exception_rule_confirm__smart_search
msgid "Smart Search"
msgstr ""
#. module: base_exception #. module: base_exception
#: code:addons/base_exception/models/base_exception.py:0 #: code:addons/base_exception/models/base_exception.py:0
#, python-format #, python-format
@ -339,14 +286,6 @@ msgstr ""
msgid "To block the exception use: <code>failed = True</code>" msgid "To block the exception use: <code>failed = True</code>"
msgstr "" msgstr ""
#. module: base_exception
#: model:ir.model.fields,field_description:base_exception.field_base_exception__user_can_see_changeset
#: model:ir.model.fields,field_description:base_exception.field_base_exception_method__user_can_see_changeset
#: model:ir.model.fields,field_description:base_exception.field_exception_rule__user_can_see_changeset
#: model:ir.model.fields,field_description:base_exception.field_exception_rule_confirm__user_can_see_changeset
msgid "User Can See Changeset"
msgstr ""
#. module: base_exception #. module: base_exception
#: model_terms:ir.ui.view,arch_db:base_exception.view_exception_rule_form #: model_terms:ir.ui.view,arch_db:base_exception.view_exception_rule_form
msgid "" msgid ""

View File

@ -1,23 +1,19 @@
# Translation of Odoo Server. # Translation of Odoo Server.
# This file contains the translation of the following modules: # This file contains the translation of the following modules:
# * base_exception # * base_exception
# #
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 2017
# enjolras <yo@miguelrevilla.com>, 2018
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 11.0\n" "Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-03-03 10:08+0000\n" "POT-Creation-Date: 2022-06-28 22:06+0000\n"
"PO-Revision-Date: 2018-03-03 10:08+0000\n" "PO-Revision-Date: 2022-06-28 22:06+0000\n"
"Last-Translator: enjolras <yo@miguelrevilla.com>, 2018\n" "Last-Translator: \n"
"Language-Team: Spanish (https://www.transifex.com/oca/teams/23907/es/)\n" "Language-Team: \n"
"Language: es\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n" "Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n" "Plural-Forms: \n"
#. module: base_exception #. module: base_exception
#: code:addons/base_exception/models/base_exception.py:0 #: code:addons/base_exception/models/base_exception.py:0
@ -62,7 +58,6 @@ msgstr ""
#. module: base_exception #. module: base_exception
#: model:ir.model.fields.selection,name:base_exception.selection__exception_rule__exception_type__by_py_code #: model:ir.model.fields.selection,name:base_exception.selection__exception_rule__exception_type__by_py_code
#, fuzzy
msgid "By python code" msgid "By python code"
msgstr "Código python" msgstr "Código python"
@ -71,43 +66,10 @@ msgstr "Código python"
msgid "" msgid ""
"By python code: allow to define any arbitrary check\n" "By python code: allow to define any arbitrary check\n"
"By domain: limited to a selection by an odoo domain:\n" "By domain: limited to a selection by an odoo domain:\n"
" performance can be better when exceptions are evaluated " " performance can be better when exceptions are evaluated with several records\n"
"with several records\n"
"By method: allow to select an existing check method" "By method: allow to select an existing check method"
msgstr "" msgstr ""
#. module: base_exception
#: model:ir.model.fields,field_description:base_exception.field_base_exception__changeset_change_ids
#: model:ir.model.fields,field_description:base_exception.field_base_exception_method__changeset_change_ids
#: model:ir.model.fields,field_description:base_exception.field_exception_rule__changeset_change_ids
#: model:ir.model.fields,field_description:base_exception.field_exception_rule_confirm__changeset_change_ids
msgid "Changeset Changes"
msgstr ""
#. module: base_exception
#: model:ir.model.fields,field_description:base_exception.field_base_exception__changeset_ids
#: model:ir.model.fields,field_description:base_exception.field_base_exception_method__changeset_ids
#: model:ir.model.fields,field_description:base_exception.field_exception_rule__changeset_ids
#: model:ir.model.fields,field_description:base_exception.field_exception_rule_confirm__changeset_ids
msgid "Changesets"
msgstr ""
#. module: base_exception
#: model:ir.model.fields,field_description:base_exception.field_base_exception__count_pending_changeset_changes
#: model:ir.model.fields,field_description:base_exception.field_base_exception_method__count_pending_changeset_changes
#: model:ir.model.fields,field_description:base_exception.field_exception_rule__count_pending_changeset_changes
#: model:ir.model.fields,field_description:base_exception.field_exception_rule_confirm__count_pending_changeset_changes
msgid "Count Pending Changeset Changes"
msgstr ""
#. module: base_exception
#: model:ir.model.fields,field_description:base_exception.field_base_exception__count_pending_changesets
#: model:ir.model.fields,field_description:base_exception.field_base_exception_method__count_pending_changesets
#: model:ir.model.fields,field_description:base_exception.field_exception_rule__count_pending_changesets
#: model:ir.model.fields,field_description:base_exception.field_exception_rule_confirm__count_pending_changesets
msgid "Count Pending Changesets"
msgstr ""
#. module: base_exception #. module: base_exception
#: model:ir.model.fields,field_description:base_exception.field_exception_rule__create_uid #: model:ir.model.fields,field_description:base_exception.field_exception_rule__create_uid
msgid "Created by" msgid "Created by"
@ -124,10 +86,7 @@ msgid "Description"
msgstr "Descripción" msgstr "Descripción"
#. module: base_exception #. module: base_exception
#: model:ir.model.fields,field_description:base_exception.field_base_exception__display_name
#: model:ir.model.fields,field_description:base_exception.field_base_exception_method__display_name
#: model:ir.model.fields,field_description:base_exception.field_exception_rule__display_name #: model:ir.model.fields,field_description:base_exception.field_exception_rule__display_name
#: model:ir.model.fields,field_description:base_exception.field_exception_rule_confirm__display_name
msgid "Display Name" msgid "Display Name"
msgstr "Nombre a mostrar" msgstr "Nombre a mostrar"
@ -145,19 +104,15 @@ msgstr ""
#. module: base_exception #. module: base_exception
#: code:addons/base_exception/models/base_exception.py:0 #: code:addons/base_exception/models/base_exception.py:0
#, fuzzy, python-format #, python-format
msgid "" msgid ""
"Error when evaluating the exception.rule rule:\n" "Error when evaluating the exception.rule rule:\n"
" %s \n" " %(rule_name)s \n"
"(%s)" "(%(error)s)"
msgstr "" msgstr ""
"Error al evaluar la regla exception.rule:\n"
"%s\n"
"(%s)"
#. module: base_exception #. module: base_exception
#: model:ir.model,name:base_exception.model_base_exception #: model:ir.model,name:base_exception.model_base_exception
#, fuzzy
msgid "Exception" msgid "Exception"
msgstr "Excepciones" msgstr "Excepciones"
@ -168,19 +123,16 @@ msgstr "Nombre de la excepción"
#. module: base_exception #. module: base_exception
#: model:ir.model,name:base_exception.model_exception_rule #: model:ir.model,name:base_exception.model_exception_rule
#: model_terms:ir.ui.view,arch_db:base_exception.view_exception_rule_tree
msgid "Exception Rule" msgid "Exception Rule"
msgstr "Regla de excepción" msgstr "Regla de excepción"
#. module: base_exception #. module: base_exception
#: model:ir.model,name:base_exception.model_exception_rule_confirm #: model:ir.model,name:base_exception.model_exception_rule_confirm
#, fuzzy
msgid "Exception Rule Confirm Wizard" msgid "Exception Rule Confirm Wizard"
msgstr "exception.rule.confirm" msgstr "exception.rule.confirm"
#. module: base_exception #. module: base_exception
#: model:ir.model,name:base_exception.model_base_exception_method #: model:ir.model,name:base_exception.model_base_exception_method
#, fuzzy
msgid "Exception Rule Methods" msgid "Exception Rule Methods"
msgstr "Reglas de excepción" msgstr "Reglas de excepción"
@ -197,7 +149,6 @@ msgstr "Reglas de excepción"
#. module: base_exception #. module: base_exception
#: model:ir.model.fields,field_description:base_exception.field_exception_rule__exception_type #: model:ir.model.fields,field_description:base_exception.field_exception_rule__exception_type
#, fuzzy
msgid "Exception Type" msgid "Exception Type"
msgstr "Nombre de la excepción" msgstr "Nombre de la excepción"
@ -211,14 +162,8 @@ msgstr "Administrador de excepciones"
msgid "Exceptions" msgid "Exceptions"
msgstr "Excepciones" msgstr "Excepciones"
#. module: base_exception
#: model_terms:ir.ui.view,arch_db:base_exception.view_exception_rule_confirm
msgid "Exceptions Rules"
msgstr "Reglas de excepción"
#. module: base_exception #. module: base_exception
#: model:ir.model.fields,field_description:base_exception.field_base_exception__exceptions_summary #: model:ir.model.fields,field_description:base_exception.field_base_exception__exceptions_summary
#, fuzzy
msgid "Exceptions Summary" msgid "Exceptions Summary"
msgstr "Administrador de excepciones" msgstr "Administrador de excepciones"
@ -243,12 +188,9 @@ msgid "Help with Python expressions"
msgstr "" msgstr ""
#. module: base_exception #. module: base_exception
#: model:ir.model.fields,field_description:base_exception.field_base_exception__id
#: model:ir.model.fields,field_description:base_exception.field_base_exception_method__id
#: model:ir.model.fields,field_description:base_exception.field_exception_rule__id #: model:ir.model.fields,field_description:base_exception.field_exception_rule__id
#: model:ir.model.fields,field_description:base_exception.field_exception_rule_confirm__id
msgid "ID" msgid "ID"
msgstr "ID" msgstr ""
#. module: base_exception #. module: base_exception
#: model:ir.model.fields,field_description:base_exception.field_base_exception__ignore_exception #: model:ir.model.fields,field_description:base_exception.field_base_exception__ignore_exception
@ -258,14 +200,11 @@ msgstr "Ignorar excepciones"
#. module: base_exception #. module: base_exception
#: model:ir.model.fields,field_description:base_exception.field_exception_rule__is_blocking #: model:ir.model.fields,field_description:base_exception.field_exception_rule__is_blocking
msgid "Is blocking" msgid "Is Blocking"
msgstr "" msgstr ""
#. module: base_exception #. module: base_exception
#: model:ir.model.fields,field_description:base_exception.field_base_exception____last_update
#: model:ir.model.fields,field_description:base_exception.field_base_exception_method____last_update
#: model:ir.model.fields,field_description:base_exception.field_exception_rule____last_update #: model:ir.model.fields,field_description:base_exception.field_exception_rule____last_update
#: model:ir.model.fields,field_description:base_exception.field_exception_rule_confirm____last_update
msgid "Last Modified on" msgid "Last Modified on"
msgstr "Última actualización por" msgstr "Última actualización por"
@ -287,7 +226,7 @@ msgstr "Excepción principal"
#. module: base_exception #. module: base_exception
#: model:ir.model.fields,field_description:base_exception.field_exception_rule__method #: model:ir.model.fields,field_description:base_exception.field_exception_rule__method
msgid "Method" msgid "Method"
msgstr "" msgstr "Método"
#. module: base_exception #. module: base_exception
#: code:addons/base_exception/wizard/base_exception_confirm.py:0 #: code:addons/base_exception/wizard/base_exception_confirm.py:0
@ -298,12 +237,12 @@ msgstr ""
#. module: base_exception #. module: base_exception
#: model:ir.actions.act_window,name:base_exception.action_exception_rule_confirm #: model:ir.actions.act_window,name:base_exception.action_exception_rule_confirm
msgid "Outstanding exceptions to manage" msgid "Outstanding exceptions to manage"
msgstr "" msgstr "Excepciones pendientes de administrar"
#. module: base_exception #. module: base_exception
#: model_terms:ir.ui.view,arch_db:base_exception.view_exception_rule_confirm #: model_terms:ir.ui.view,arch_db:base_exception.view_exception_rule_confirm
msgid "Outstanding exceptions to manager" msgid "Outstanding exceptions to manager"
msgstr "" msgstr "Excepciones pendientes al gestor"
#. module: base_exception #. module: base_exception
#: model:ir.model.fields,field_description:base_exception.field_exception_rule__code #: model:ir.model.fields,field_description:base_exception.field_exception_rule__code
@ -321,26 +260,18 @@ msgstr ""
#. module: base_exception #. module: base_exception
#: model:ir.model.fields,field_description:base_exception.field_exception_rule_confirm__related_model_id #: model:ir.model.fields,field_description:base_exception.field_exception_rule_confirm__related_model_id
msgid "Related Model" msgid "Related Model"
msgstr "" msgstr "Modelo relacionado"
#. module: base_exception #. module: base_exception
#: model:ir.model.fields,field_description:base_exception.field_exception_rule__sequence #: model:ir.model.fields,field_description:base_exception.field_exception_rule__sequence
msgid "Sequence" msgid "Sequence"
msgstr "Secuencia" msgstr "Secuencia"
#. module: base_exception
#: model:ir.model.fields,field_description:base_exception.field_base_exception__smart_search
#: model:ir.model.fields,field_description:base_exception.field_base_exception_method__smart_search
#: model:ir.model.fields,field_description:base_exception.field_exception_rule__smart_search
#: model:ir.model.fields,field_description:base_exception.field_exception_rule_confirm__smart_search
msgid "Smart Search"
msgstr ""
#. module: base_exception #. module: base_exception
#: code:addons/base_exception/models/base_exception.py:0 #: code:addons/base_exception/models/base_exception.py:0
#, python-format #, python-format
msgid "The exceptions can not be ignored, because some of them are blocking." msgid "The exceptions can not be ignored, because some of them are blocking."
msgstr "" msgstr "Las excepciones no se pueden ignorar, porque algunas de ellas están bloqueando."
#. module: base_exception #. module: base_exception
#: code:addons/base_exception/models/base_exception.py:0 #: code:addons/base_exception/models/base_exception.py:0
@ -348,43 +279,26 @@ msgstr ""
msgid "" msgid ""
"There is a problem of configuration, python code, domain or method is " "There is a problem of configuration, python code, domain or method is "
"missing to match the exception type." "missing to match the exception type."
msgstr "" msgstr "Hay un problema de configuración, código python, match exception type"
#. module: base_exception #. module: base_exception
#: model_terms:ir.ui.view,arch_db:base_exception.view_exception_rule_form #: model_terms:ir.ui.view,arch_db:base_exception.view_exception_rule_form
msgid "To block the exception use: <code>failed = True</code>" msgid "To block the exception use: <code>failed = True</code>"
msgstr "" msgstr "Para bloquear el uso de excepción: <code>failed = True</code>"
#. module: base_exception
#: model:ir.model.fields,field_description:base_exception.field_base_exception__user_can_see_changeset
#: model:ir.model.fields,field_description:base_exception.field_base_exception_method__user_can_see_changeset
#: model:ir.model.fields,field_description:base_exception.field_exception_rule__user_can_see_changeset
#: model:ir.model.fields,field_description:base_exception.field_exception_rule_confirm__user_can_see_changeset
msgid "User Can See Changeset"
msgstr ""
#. module: base_exception #. module: base_exception
#: model_terms:ir.ui.view,arch_db:base_exception.view_exception_rule_form #: model_terms:ir.ui.view,arch_db:base_exception.view_exception_rule_form
msgid "" msgid ""
"Various fields may use Python code or Python expressions. The following " "Various fields may use Python code or Python expressions. The following "
"variables can be used:" "variables can be used:"
msgstr "" msgstr "Varios campos pueden usar código de Python o expresiones de Python. A continuación se muestran las variables que pueden ser usadas."
#. module: base_exception #. module: base_exception
#: model:ir.model.fields,help:base_exception.field_exception_rule__is_blocking #: model:ir.model.fields,help:base_exception.field_exception_rule__is_blocking
msgid "When checked the exception can not be ignored" msgid "When checked the exception can not be ignored"
msgstr "" msgstr "Cuando está marcada, la excepción no se puede ignorar"
#. module: base_exception #. module: base_exception
#: model_terms:ir.ui.view,arch_db:base_exception.view_exception_rule_confirm #: model_terms:ir.ui.view,arch_db:base_exception.view_exception_rule_confirm
msgid "_Close" msgid "_Close"
msgstr "" msgstr "_Cerrar"
#~ msgid "Next state"
#~ msgstr "Estado siguiente"
#~ msgid "Rule Group"
#~ msgstr "Grupo de reglas"
#~ msgid "base.exception"
#~ msgstr "base.exception"

View File

@ -21,10 +21,8 @@ class ExceptionRule(models.Model):
_order = "active desc, sequence asc" _order = "active desc, sequence asc"
name = fields.Char("Exception Name", required=True, translate=True) name = fields.Char("Exception Name", required=True, translate=True)
description = fields.Text("Description", translate=True) description = fields.Text(translate=True)
sequence = fields.Integer( sequence = fields.Integer(help="Gives the sequence order when applying the test")
string="Sequence", help="Gives the sequence order when applying the test"
)
model = fields.Selection(selection=[], string="Apply on", required=True) model = fields.Selection(selection=[], string="Apply on", required=True)
exception_type = fields.Selection( exception_type = fields.Selection(
@ -33,7 +31,6 @@ class ExceptionRule(models.Model):
("by_py_code", "By python code"), ("by_py_code", "By python code"),
("by_method", "By method"), ("by_method", "By method"),
], ],
string="Exception Type",
required=True, required=True,
default="by_py_code", default="by_py_code",
help="By python code: allow to define any arbitrary check\n" help="By python code: allow to define any arbitrary check\n"
@ -42,16 +39,15 @@ class ExceptionRule(models.Model):
" are evaluated with several records\n" " are evaluated with several records\n"
"By method: allow to select an existing check method", "By method: allow to select an existing check method",
) )
domain = fields.Char("Domain") domain = fields.Char()
method = fields.Selection(selection=[], string="Method", readonly=True) method = fields.Selection(selection=[], readonly=True)
active = fields.Boolean("Active", default=True) active = fields.Boolean(default=True)
code = fields.Text( code = fields.Text(
"Python Code", "Python Code",
help="Python code executed to check if the exception apply or " help="Python code executed to check if the exception apply or "
"not. Use failed = True to block the exception", "not. Use failed = True to block the exception",
) )
is_blocking = fields.Boolean( is_blocking = fields.Boolean(
string="Is blocking",
help="When checked the exception can not be ignored", help="When checked the exception can not be ignored",
) )
@ -163,11 +159,11 @@ class BaseExceptionMethod(models.AbstractModel):
_logger.exception(e) _logger.exception(e)
raise UserError( raise UserError(
_( _(
"Error when evaluating the exception.rule rule:\n %s \n(%s)", "Error when evaluating the exception.rule"
rule.name, " rule:\n %(rule_name)s \n(%(error)s)"
e,
) )
) % {"rule_name": rule.name, "error": e}
) from e
return space.get("failed", False) return space.get("failed", False)
def _detect_exceptions(self, rule): def _detect_exceptions(self, rule):
@ -223,9 +219,7 @@ class BaseExceptionModel(models.AbstractModel):
string="Main Exception", string="Main Exception",
store=True, store=True,
) )
exceptions_summary = fields.Html( exceptions_summary = fields.Html(compute="_compute_exceptions_summary")
"Exceptions Summary", compute="_compute_exceptions_summary"
)
exception_ids = fields.Many2many("exception.rule", string="Exceptions", copy=False) exception_ids = fields.Many2many("exception.rule", string="Exceptions", copy=False)
ignore_exception = fields.Boolean("Ignore Exceptions", copy=False) ignore_exception = fields.Boolean("Ignore Exceptions", copy=False)
@ -271,19 +265,6 @@ class BaseExceptionModel(models.AbstractModel):
else: else:
rec.exceptions_summary = False rec.exceptions_summary = False
def _popup_exceptions(self):
action = self._get_popup_action().sudo().read()[0]
action.update(
{
"context": {
"active_id": self.ids[0],
"active_ids": self.ids,
"active_model": self._name,
}
}
)
return action
@api.model @api.model
def _get_popup_action(self): def _get_popup_action(self):
return self.env.ref("base_exception.action_exception_rule_confirm") return self.env.ref("base_exception.action_exception_rule_confirm")

View File

@ -19,12 +19,10 @@ class TestBaseException(SavepointCase):
from .purchase_test import ExceptionRule, LineTest, PurchaseTest from .purchase_test import ExceptionRule, LineTest, PurchaseTest
cls.loader.update_registry((ExceptionRule, LineTest, PurchaseTest)) cls.loader.update_registry((ExceptionRule, LineTest, PurchaseTest))
cls.partner = cls.env["res.partner"].create({"name": "Foo"})
cls.po = cls.env["base.exception.test.purchase"].create( cls.po = cls.env["base.exception.test.purchase"].create(
{ {
"name": "Test base exception to basic purchase", "name": "Test base exception to basic purchase",
"partner_id": cls.partner.id, "partner_id": cls.env["res.partner"].create({"name": "Foo"}).id,
"line_ids": [ "line_ids": [
(0, 0, {"name": "line test", "amount": 120.0, "qty": 1.5}) (0, 0, {"name": "line test", "amount": 120.0, "qty": 1.5})
], ],
@ -39,17 +37,29 @@ class TestBaseException(SavepointCase):
"exception_type": "by_py_code", "exception_type": "by_py_code",
} }
) )
cls.exception_rule_confirm_obj = cls.env["exception.rule.confirm"]
cls.exception_rule_confirm = cls.exception_rule_confirm.create(
{
"related_model_id": cls.po.id,
"exception_ids": [(4, cls.exception_rule.id)],
"ignore": False,
}
)
@classmethod @classmethod
def tearDownClass(cls): def tearDownClass(cls):
cls.loader.restore_registry() cls.loader.restore_registry()
super().tearDownClass() return super().tearDownClass()
def test_valid(self): def test_valid(self):
self.exception_rule.active = False self.exception_rule.active = False
self.po.button_confirm() self.po.button_confirm()
self.assertFalse(self.po.exception_ids) self.assertFalse(self.po.exception_ids)
def test_exception_rule_confirm(self):
self.exception_rule_confirm.action_confirm()
self.assertFalse(self.exception_rule_confirm.exception_ids)
def test_fail_by_py(self): def test_fail_by_py(self):
with self.assertRaises(ValidationError): with self.assertRaises(ValidationError):
self.po.button_confirm() self.po.button_confirm()
@ -90,6 +100,28 @@ class TestBaseException(SavepointCase):
self.po.button_confirm() self.po.button_confirm()
self.assertEqual(self.po.state, "purchase") self.assertEqual(self.po.state, "purchase")
def test_purchase_check_exception(self):
self.po.test_purchase_check_exception()
def test_purchase_check_button_approve(self):
self.po.button_approve()
self.assertEqual(self.po.state, "to approve")
def test_purchase_check_button_draft(self):
self.po.button_draft()
self.assertEqual(self.po.state, "draft")
def test_purchase_check_button_confirm(self):
self.po.button_confirm()
self.assertEqual(self.po.state, "purchase")
def test_purchase_check_button_cancel(self):
self.po.button_cancel()
self.assertEqual(self.po.state, "cancel")
def test_detect_exceptions(self):
self.po.detect_exceptions()
def test_blocking_exception(self): def test_blocking_exception(self):
self.exception_rule.is_blocking = True self.exception_rule.is_blocking = True
# Block because of exception during validation # Block because of exception during validation

View File

@ -4,7 +4,7 @@
<field name="name">exception.rule.tree</field> <field name="name">exception.rule.tree</field>
<field name="model">exception.rule</field> <field name="model">exception.rule</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<tree string="Exception Rule"> <tree>
<field name="sequence" widget="handle" /> <field name="sequence" widget="handle" />
<field name="name" /> <field name="name" />
<field name="description" /> <field name="description" />

View File

@ -7,7 +7,7 @@
<form string="Outstanding exceptions to manager" version="7.0"> <form string="Outstanding exceptions to manager" version="7.0">
<group> <group>
<field name="exception_ids" nolabel="1" colspan="4"> <field name="exception_ids" nolabel="1" colspan="4">
<tree string="Exceptions Rules"> <tree>
<field name="name" /> <field name="name" />
<field name="description" /> <field name="description" />
</tree> </tree>