diff --git a/base_exception/README.rst b/base_exception/README.rst
index 77de77e40..7bbe436c8 100644
--- a/base_exception/README.rst
+++ b/base_exception/README.rst
@@ -14,13 +14,13 @@ Exception Rule
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github
- :target: https://github.com/OCA/server-tools/tree/12.0/base_exception
+ :target: https://github.com/OCA/server-tools/tree/13.0/base_exception
:alt: OCA/server-tools
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
- :target: https://translation.odoo-community.org/projects/server-tools-12-0/server-tools-12-0-base_exception
+ :target: https://translation.odoo-community.org/projects/server-tools-13-0/server-tools-13-0-base_exception
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
- :target: https://runbot.odoo-community.org/runbot/149/12.0
+ :target: https://runbot.odoo-community.org/runbot/149/13.0
:alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -50,7 +50,7 @@ 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 smashing it by providing a detailed and welcomed
-`feedback `_.
+`feedback `_.
Do not contact contributors directly about support or help with technical issues.
@@ -77,6 +77,10 @@ Contributors
* Raphaël Reverdy
* Iván Todorovich
+* Tecnativa
+
+ * João Marques
+
Maintainers
~~~~~~~~~~~
@@ -90,6 +94,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
-This module is part of the `OCA/server-tools `_ project on GitHub.
+This module is part of the `OCA/server-tools `_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
diff --git a/base_exception/__manifest__.py b/base_exception/__manifest__.py
index 541784933..3581cda9e 100644
--- a/base_exception/__manifest__.py
+++ b/base_exception/__manifest__.py
@@ -1,10 +1,11 @@
# Copyright 2011 Raphaël Valyi, Renato Lima, Guewen Baconnier, Sodexis
# Copyright 2017 Akretion (http://www.akretion.com)
# Mourad EL HADJ MIMOUNE
+# Copyright 2020 Hibou Corp.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
{
"name": "Exception Rule",
- "version": "12.0.3.0.1",
+ "version": "13.0.1.0.0",
"category": "Generic Modules",
"summary": """
This module provide an abstract model to manage customizable
diff --git a/base_exception/models/base_exception.py b/base_exception/models/base_exception.py
index 7546f6333..2bcd93733 100644
--- a/base_exception/models/base_exception.py
+++ b/base_exception/models/base_exception.py
@@ -1,6 +1,7 @@
# Copyright 2011 Raphaël Valyi, Renato Lima, Guewen Baconnier, Sodexis
# Copyright 2017 Akretion (http://www.akretion.com)
# Mourad EL HADJ MIMOUNE
+# Copyright 2020 Hibou Corp.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
import html
@@ -55,7 +56,6 @@ class ExceptionRule(models.Model):
)
)
- @api.multi
def _get_domain(self):
""" override me to customize domains according exceptions cases """
self.ensure_one()
@@ -66,7 +66,6 @@ class BaseExceptionMethod(models.AbstractModel):
_name = "base.exception.method"
_description = "Exception Rule Methods"
- @api.multi
def _get_main_records(self):
"""
Used in case we check exceptions on a record but write these
@@ -76,7 +75,6 @@ class BaseExceptionMethod(models.AbstractModel):
"""
return self
- @api.multi
def _reverse_field(self):
raise NotImplementedError()
@@ -87,7 +85,6 @@ class BaseExceptionMethod(models.AbstractModel):
"""
return [("model", "=", self._name)]
- @api.multi
def detect_exceptions(self):
"""List all exception_ids applied on self
Exception ids are also written on records
@@ -160,18 +157,15 @@ class BaseExceptionMethod(models.AbstractModel):
)
return space.get("failed", False)
- @api.multi
def _detect_exceptions(self, rule):
if rule.exception_type == "by_py_code":
return self._detect_exceptions_by_py_code(rule)
elif rule.exception_type == "by_domain":
return self._detect_exceptions_by_domain(rule)
- @api.multi
def _get_base_domain(self):
return [("ignore_exception", "=", False), ("id", "in", self.ids)]
- @api.multi
def _detect_exceptions_by_py_code(self, rule):
"""
Find exceptions found on self.
@@ -184,7 +178,6 @@ class BaseExceptionMethod(models.AbstractModel):
records_with_exception |= record
return records_with_exception
- @api.multi
def _detect_exceptions_by_domain(self, rule):
"""
Find exceptions found on self.
@@ -195,7 +188,7 @@ class BaseExceptionMethod(models.AbstractModel):
return self.search(domain)
-class BaseException(models.AbstractModel):
+class BaseExceptionModel(models.AbstractModel):
_inherit = "base.exception.method"
_name = "base.exception"
_order = "main_exception_id asc"
@@ -213,7 +206,6 @@ class BaseException(models.AbstractModel):
exception_ids = fields.Many2many("exception.rule", string="Exceptions", copy=False)
ignore_exception = fields.Boolean("Ignore Exceptions", copy=False)
- @api.multi
def action_ignore_exceptions(self):
self.write({"ignore_exception": True})
return True
@@ -237,8 +229,9 @@ class BaseException(models.AbstractModel):
for e in rec.exception_ids
]
)
+ else:
+ rec.exceptions_summary = False
- @api.multi
def _popup_exceptions(self):
action = self._get_popup_action().read()[0]
action.update(
@@ -256,7 +249,6 @@ class BaseException(models.AbstractModel):
def _get_popup_action(self):
return self.env.ref("base_exception.action_exception_rule_confirm")
- @api.multi
def _check_exception(self):
"""
This method must be used in a constraint that must be created in the
diff --git a/base_exception/readme/CONTRIBUTORS.rst b/base_exception/readme/CONTRIBUTORS.rst
index 89e9f3f29..804f763fa 100644
--- a/base_exception/readme/CONTRIBUTORS.rst
+++ b/base_exception/readme/CONTRIBUTORS.rst
@@ -7,3 +7,7 @@
* Mourad EL HADJ MIMOUNE
* Raphaël Reverdy
* Iván Todorovich
+
+* Tecnativa
+
+ * João Marques
diff --git a/base_exception/security/base_exception_security.xml b/base_exception/security/base_exception_security.xml
index d69d3669b..4a6502e40 100644
--- a/base_exception/security/base_exception_security.xml
+++ b/base_exception/security/base_exception_security.xml
@@ -1,9 +1,7 @@
-
+
-
Exception manager
-
+
-
diff --git a/base_exception/static/description/index.html b/base_exception/static/description/index.html
index d06b5ac5e..38d85f791 100644
--- a/base_exception/static/description/index.html
+++ b/base_exception/static/description/index.html
@@ -367,7 +367,7 @@ ul.auto-toc {
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
-

+

This module provide an abstract model to manage customizable
exceptions to be applied on different models (sale order, invoice, …).
It is not useful for itself. You can see an example of implementation
@@ -396,7 +396,7 @@ in the ‘sale_exception’ module. (sale-workflow repository) or
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 smashing it by providing a detailed and welcomed
-feedback.
+feedback.
Do not contact contributors directly about support or help with technical issues.
@@ -430,7 +434,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
-
This module is part of the OCA/server-tools project on GitHub.
+
This module is part of the OCA/server-tools project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
diff --git a/base_exception/tests/common.py b/base_exception/tests/common.py
index 5721e6353..cd37e0d14 100644
--- a/base_exception/tests/common.py
+++ b/base_exception/tests/common.py
@@ -1,4 +1,5 @@
# Copyright 2017 ACSONE SA/NV ()
+# Copyright 2020 Hibou Corp.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
diff --git a/base_exception/tests/purchase_test.py b/base_exception/tests/purchase_test.py
index 025e9c16c..9d570460f 100644
--- a/base_exception/tests/purchase_test.py
+++ b/base_exception/tests/purchase_test.py
@@ -1,4 +1,5 @@
# Copyright 2016 Akretion Mourad EL HADJ MIMOUNE
+# Copyright 2020 Hibou Corp.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import api, fields, models
@@ -28,37 +29,32 @@ class PurchaseTest(models.Model):
amount_total = fields.Float(compute="_compute_amount_total", store=True)
@api.depends("line_ids")
- def _compute_amount_total(cls):
- for record in cls:
+ def _compute_amount_total(self):
+ for record in self:
for line in record.line_ids:
record.amount_total += line.amount * line.qty
@api.constrains("ignore_exception", "line_ids", "state")
- def test_purchase_check_exception(cls):
- orders = cls.filtered(lambda s: s.state == "purchase")
+ def test_purchase_check_exception(self):
+ orders = self.filtered(lambda s: s.state == "purchase")
if orders:
orders._check_exception()
- @api.multi
- def button_approve(cls, force=False):
- cls.write({"state": "to approve"})
+ def button_approve(self, force=False):
+ self.write({"state": "to approve"})
return {}
- @api.multi
- def button_draft(cls):
- cls.write({"state": "draft"})
+ def button_draft(self):
+ self.write({"state": "draft"})
return {}
- @api.multi
- def button_confirm(cls):
- cls.write({"state": "purchase"})
+ def button_confirm(self):
+ self.write({"state": "purchase"})
return True
- @api.multi
- def button_cancel(cls):
- cls.write({"state": "cancel"})
+ def button_cancel(self):
+ self.write({"state": "cancel"})
- @api.multi
def _reverse_field(self):
return "test_purchase_ids"
diff --git a/base_exception/tests/test_base_exception.py b/base_exception/tests/test_base_exception.py
index 4f37039b9..4c39fe4b1 100644
--- a/base_exception/tests/test_base_exception.py
+++ b/base_exception/tests/test_base_exception.py
@@ -1,4 +1,5 @@
# Copyright 2016 Akretion Mourad EL HADJ MIMOUNE
+# Copyright 2020 Hibou Corp.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
import logging
diff --git a/base_exception/views/base_exception_view.xml b/base_exception/views/base_exception_view.xml
index c1a399633..7a9adb98d 100644
--- a/base_exception/views/base_exception_view.xml
+++ b/base_exception/views/base_exception_view.xml
@@ -1,60 +1,86 @@
-
exception.rule.tree
exception.rule
-
-
-
-
-
+
+
+
+
+
-
exception.rule.form
exception.rule
-
Exception Rules
exception.rule
- form
tree,form
-
+
{'active_test': False}
-
-
diff --git a/base_exception/wizard/base_exception_confirm.py b/base_exception/wizard/base_exception_confirm.py
index 4289e2de5..60f4dc04f 100644
--- a/base_exception/wizard/base_exception_confirm.py
+++ b/base_exception/wizard/base_exception_confirm.py
@@ -1,6 +1,7 @@
# Copyright 2011 Raphaël Valyi, Renato Lima, Guewen Baconnier, Sodexis
# Copyright 2017 Akretion (http://www.akretion.com)
# Mourad EL HADJ MIMOUNE
+# Copyright 2020 Hibou Corp.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import _, api, fields, models
from odoo.exceptions import ValidationError
@@ -18,7 +19,7 @@ class ExceptionRuleConfirm(models.AbstractModel):
@api.model
def default_get(self, field_list):
- res = super(ExceptionRuleConfirm, self).default_get(field_list)
+ res = super().default_get(field_list)
current_model = self.env.context.get("active_model")
model_except_obj = self.env[current_model]
active_ids = self.env.context.get("active_ids")
@@ -31,7 +32,6 @@ class ExceptionRuleConfirm(models.AbstractModel):
res.update({"related_model_id": active_id})
return res
- @api.multi
def action_confirm(self):
self.ensure_one()
return {"type": "ir.actions.act_window_close"}
diff --git a/base_exception/wizard/base_exception_confirm_view.xml b/base_exception/wizard/base_exception_confirm_view.xml
index f0251d302..c93fe4c78 100644
--- a/base_exception/wizard/base_exception_confirm_view.xml
+++ b/base_exception/wizard/base_exception_confirm_view.xml
@@ -1,6 +1,5 @@
-
+
-
Exceptions Rules
exception.rule.confirm
@@ -9,31 +8,36 @@
-
-
+
+
-
+
-
+
-
Outstanding exceptions to manage
ir.actions.act_window
exception.rule.confirm
- form
form
-
+
new
-