Skip to content

Commit

Permalink
[MIG] base_exception: Migraion to 18.0
Browse files Browse the repository at this point in the history
  • Loading branch information
xaviedoanhduy committed Oct 2, 2024
1 parent 1de291b commit b2a9010
Show file tree
Hide file tree
Showing 9 changed files with 56 additions and 34 deletions.
17 changes: 12 additions & 5 deletions base_exception/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,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/17.0/base_exception
:target: https://github.com/OCA/server-tools/tree/18.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-17-0/server-tools-17-0-base_exception
:target: https://translation.odoo-community.org/projects/server-tools-18-0/server-tools-18-0-base_exception
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/server-tools&target_branch=17.0
:target: https://runboat.odoo-community.org/builds?repo=OCA/server-tools&target_branch=18.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|
Expand Down Expand Up @@ -53,7 +53,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/server-tools/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/server-tools/issues/new?body=module:%20base_exception%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/server-tools/issues/new?body=module:%20base_exception%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Expand Down Expand Up @@ -86,6 +86,13 @@ Contributors

- Kevin Khao <[email protected]>
- Laurent Mignon <[email protected]>
- Do Anh Duy <[email protected]>

Other credits
-------------

The migration of this module from 17.0 to 18.0 was financially supported
by Camptocamp.

Maintainers
-----------
Expand All @@ -111,6 +118,6 @@ Current `maintainers <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-hparfr| |maintainer-sebastienbeau|

This module is part of the `OCA/server-tools <https://github.com/OCA/server-tools/tree/17.0/base_exception>`_ project on GitHub.
This module is part of the `OCA/server-tools <https://github.com/OCA/server-tools/tree/18.0/base_exception>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
5 changes: 3 additions & 2 deletions base_exception/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
{
"name": "Exception Rule",
"version": "17.0.1.0.0",
"version": "18.0.1.0.0",
"development_status": "Mature",
"category": "Generic Modules",
"summary": """
This module provide an abstract model to manage customizable
exceptions to be applied on different models (sale order, invoice, ...)""",
"author": "Akretion, Sodexis, Camptocamp, ACSONE SA/NV, Odoo Community Association (OCA)",
"author": """Akretion, Sodexis, Camptocamp,
ACSONE SA/NV, Odoo Community Association (OCA)""",
"website": "https://github.com/OCA/server-tools",
"depends": ["base_setup"],
"maintainers": ["hparfr", "sebastienbeau"],
Expand Down
15 changes: 8 additions & 7 deletions base_exception/models/base_exception.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
# Copyright 2023 ACSONE SA/NV (http://acsone.eu)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

import html
import logging

from odoo import _, api, fields, models
from odoo.exceptions import UserError, ValidationError
from odoo.tools import html_escape

_logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -53,14 +53,15 @@ def _compute_main_error(self):
def _compute_exceptions_summary(self):
for rec in self:
if rec.exception_ids and not rec.ignore_exception:
rec.exceptions_summary = "<ul>%s</ul>" % "".join(
[
f"<li>{html.escape(e.name)}: <i>{html.escape(e.description or '')}</i> <b>"
+ _(
f"{'(Blocking exception)' if e.is_blocking else ''}</b></li>"
rec.exceptions_summary = "<ul>{}</ul>".format(
"".join(
"<li>{}: <i>{}</i> <b>{}</b></li>".format(
html_escape(e.name),
html_escape(e.description or ""),
"(Blocking exception)" if e.is_blocking else "",
)
for e in rec.exception_ids
]
)
)
else:
rec.exceptions_summary = False
Expand Down
1 change: 1 addition & 0 deletions base_exception/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@
- João Marques
- Kevin Khao \<<[email protected]>\>
- Laurent Mignon \<<[email protected]>\>
- Do Anh Duy \<<[email protected]>\>
1 change: 1 addition & 0 deletions base_exception/readme/CREDITS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The migration of this module from 17.0 to 18.0 was financially supported by Camptocamp.
28 changes: 19 additions & 9 deletions base_exception/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@

/*
:Author: David Goodger ([email protected])
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
Despite the name, some widely supported CSS2 features are used.
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
customize this style sheet.
Expand Down Expand Up @@ -274,7 +275,7 @@
margin-left: 2em ;
margin-right: 2em }

pre.code .ln { color: grey; } /* line numbers */
pre.code .ln { color: gray; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
Expand All @@ -300,7 +301,7 @@
span.pre {
white-space: pre }

span.problematic {
span.problematic, pre.problematic {
color: red }

span.section-subtitle {
Expand Down Expand Up @@ -368,7 +369,7 @@ <h1 class="title">Exception Rule</h1>
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:27862fe526d377f41fca08cd07aa13254640f79cca5f6247c0292af5e7e96276
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Mature" src="https://img.shields.io/badge/maturity-Mature-brightgreen.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/server-tools/tree/17.0/base_exception"><img alt="OCA/server-tools" src="https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/server-tools-17-0/server-tools-17-0-base_exception"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/server-tools&amp;target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Mature" src="https://img.shields.io/badge/maturity-Mature-brightgreen.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/server-tools/tree/18.0/base_exception"><img alt="OCA/server-tools" src="https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/server-tools-18-0/server-tools-18-0-base_exception"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/server-tools&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module provide an abstract model to manage customizable exceptions
to be applied on different models (sale order, invoice, …).</p>
<p>It is not useful by itself. You can see an example of implementation in
Expand All @@ -382,7 +383,8 @@ <h1 class="title">Exception Rule</h1>
<li><a class="reference internal" href="#credits" id="toc-entry-3">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="toc-entry-4">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="toc-entry-5">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="toc-entry-6">Maintainers</a></li>
<li><a class="reference internal" href="#other-credits" id="toc-entry-6">Other credits</a></li>
<li><a class="reference internal" href="#maintainers" id="toc-entry-7">Maintainers</a></li>
</ul>
</li>
</ul>
Expand All @@ -398,7 +400,7 @@ <h1><a class="toc-backref" href="#toc-entry-2">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/server-tools/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/server-tools/issues/new?body=module:%20base_exception%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/server-tools/issues/new?body=module:%20base_exception%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
Expand Down Expand Up @@ -430,18 +432,26 @@ <h2><a class="toc-backref" href="#toc-entry-5">Contributors</a></h2>
</li>
<li>Kevin Khao &lt;<a class="reference external" href="mailto:kevin.khao&#64;akretion.com">kevin.khao&#64;akretion.com</a>&gt;</li>
<li>Laurent Mignon &lt;<a class="reference external" href="mailto:laurent.mignon&#64;acsone.eu">laurent.mignon&#64;acsone.eu</a>&gt;</li>
<li>Do Anh Duy &lt;<a class="reference external" href="mailto:duyda&#64;trobz.com">duyda&#64;trobz.com</a>&gt;</li>
</ul>
</div>
<div class="section" id="other-credits">
<h2><a class="toc-backref" href="#toc-entry-6">Other credits</a></h2>
<p>The migration of this module from 17.0 to 18.0 was financially supported
by Camptocamp.</p>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h2>
<h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<a class="reference external image-reference" href="https://odoo-community.org">
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
</a>
<p>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.</p>
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainers</a>:</p>
<p><a class="reference external image-reference" href="https://github.com/hparfr"><img alt="hparfr" src="https://github.com/hparfr.png?size=40px" /></a> <a class="reference external image-reference" href="https://github.com/sebastienbeau"><img alt="sebastienbeau" src="https://github.com/sebastienbeau.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/server-tools/tree/17.0/base_exception">OCA/server-tools</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/server-tools/tree/18.0/base_exception">OCA/server-tools</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>
Expand Down
18 changes: 9 additions & 9 deletions base_exception/views/base_exception_view.xml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<?xml version="1.0" ?>
<odoo>
<record id="view_exception_rule_tree" model="ir.ui.view">
<field name="name">exception.rule.tree</field>
<record id="view_exception_rule_list" model="ir.ui.view">
<field name="name">exception.rule.list</field>
<field name="model">exception.rule</field>
<field name="arch" type="xml">
<tree>
<list>
<field name="sequence" widget="handle" />
<field name="name" />
<field name="description" />
<field name="model" />
<field name="active" widget="boolean_toggle" />
</tree>
</list>
</field>
</record>
<record id="view_exception_rule_form" model="ir.ui.view">
Expand Down Expand Up @@ -63,7 +63,7 @@
>
<field
name="code"
widget="ace"
widget="code"
options="{'mode': 'python'}"
placeholder="Enter Python code here. Help about Python expression is available in the help tab of this document."
/>
Expand Down Expand Up @@ -92,15 +92,15 @@
</form>
</field>
</record>
<record id="action_exception_rule_tree" model="ir.actions.act_window">
<record id="action_exception_rule_list" model="ir.actions.act_window">
<field name="name">Exception Rules</field>
<field name="res_model">exception.rule</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="view_exception_rule_tree" />
<field name="view_mode">list,form</field>
<field name="view_id" ref="view_exception_rule_list" />
<field name="context">{'active_test': False}</field>
</record>
<menuitem
action="action_exception_rule_tree"
action="action_exception_rule_list"
id="menu_action_exception"
parent="base.menu_custom"
sequence="90"
Expand Down
4 changes: 2 additions & 2 deletions base_exception/wizard/base_exception_confirm_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
<form string="Outstanding exceptions to manager" version="7.0">
<group>
<field name="exception_ids" nolabel="1" colspan="2">
<tree>
<list>
<field name="name" />
<field name="description" />
</tree>
</list>
</field>
<newline />
</group>
Expand Down
1 change: 1 addition & 0 deletions test-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
odoo_test_helper

0 comments on commit b2a9010

Please sign in to comment.