Skip to content

Commit

Permalink
[MIG] sale_exception: Migration to 18.0
Browse files Browse the repository at this point in the history
  • Loading branch information
matiasperalta1 committed Dec 5, 2024
1 parent aecf8c3 commit b44e26b
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 29 deletions.
10 changes: 5 additions & 5 deletions sale_exception/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ Sale Exception
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsale--workflow-lightgray.png?logo=github
:target: https://github.com/OCA/sale-workflow/tree/17.0/sale_exception
:target: https://github.com/OCA/sale-workflow/tree/18.0/sale_exception
:alt: OCA/sale-workflow
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/sale-workflow-17-0/sale-workflow-17-0-sale_exception
:target: https://translation.odoo-community.org/projects/sale-workflow-18-0/sale-workflow-18-0-sale_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/sale-workflow&target_branch=17.0
:target: https://runboat.odoo-community.org/builds?repo=OCA/sale-workflow&target_branch=18.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|
Expand Down Expand Up @@ -84,7 +84,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/sale-workflow/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/sale-workflow/issues/new?body=module:%20sale_exception%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/sale-workflow/issues/new?body=module:%20sale_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 @@ -127,6 +127,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/sale-workflow <https://github.com/OCA/sale-workflow/tree/17.0/sale_exception>`_ project on GitHub.
This module is part of the `OCA/sale-workflow <https://github.com/OCA/sale-workflow/tree/18.0/sale_exception>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 1 addition & 1 deletion sale_exception/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{
"name": "Sale Exception",
"summary": "Custom exceptions on sale order",
"version": "17.0.1.0.0",
"version": "18.0.1.0.0",
"category": "Generic Modules/Sale",
"author": "Akretion, "
"Sodexis, "
Expand Down
2 changes: 0 additions & 2 deletions sale_exception/data/sale_exception_data.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
<field name="user_id" ref="base.user_root" />
<field name="interval_number">20</field>
<field name="interval_type">minutes</field>
<field name="numbercall">-1</field>
<field eval="False" name="doall" />
<field name="model_id" ref="sale.model_sale_order" />
<field name="state">code</field>
<field name="code">model.test_all_draft_orders()</field>
Expand Down
13 changes: 6 additions & 7 deletions sale_exception/models/sale_order_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,11 @@ def _compute_exceptions_summary(self):
rec.exceptions_summary = False

def _get_exception_summary(self):
return "<ul>%s</ul>" % "".join(
[
f"<li>{html.escape(e.name)}: <i>{html.escape(e.description)}</i></li>"
for e in self.exception_ids
]
items = "".join(
f"<li>{html.escape(e.name)}: <i>{html.escape(e.description)}</i></li>"
for e in self.exception_ids
)
return f"<ul>{items}</ul>"

def _get_main_records(self):
return self.mapped("order_id")
Expand All @@ -56,6 +55,6 @@ def _detect_exceptions(self, rule):
# Thanks to the new flush of odoo 13.0, queries will be optimized
# together at the end even if we update the exception_ids many times.
# On previous versions, this could be unoptimized.
(self - records).exception_ids = [(3, rule.id)]
records.exception_ids = [(4, rule.id)]
(self - records).exception_ids = [fields.Command.delete(rule.id)]
records.exception_ids = [fields.Command.set(rule.id)]
return records.mapped("order_id")
17 changes: 10 additions & 7 deletions sale_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">Sale Exception</h1>
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:02cf45502a42ed74a7de2eeb75f68950616d8d807656bff404181daeb39b6558
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.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/sale-workflow/tree/17.0/sale_exception"><img alt="OCA/sale-workflow" src="https://img.shields.io/badge/github-OCA%2Fsale--workflow-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/sale-workflow-17-0/sale-workflow-17-0-sale_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/sale-workflow&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="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.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/sale-workflow/tree/18.0/sale_exception"><img alt="OCA/sale-workflow" src="https://img.shields.io/badge/github-OCA%2Fsale--workflow-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/sale-workflow-18-0/sale-workflow-18-0-sale_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/sale-workflow&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 allows you attach several customizable exceptions to your
sale order in a way that you can filter orders by exceptions type and
fix them.</p>
Expand Down Expand Up @@ -427,7 +428,7 @@ <h1><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/sale-workflow/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/sale-workflow/issues/new?body=module:%20sale_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/sale-workflow/issues/new?body=module:%20sale_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 @@ -460,11 +461,13 @@ <h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
<div class="section" id="maintainers">
<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>This module is part of the <a class="reference external" href="https://github.com/OCA/sale-workflow/tree/17.0/sale_exception">OCA/sale-workflow</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/sale-workflow/tree/18.0/sale_exception">OCA/sale-workflow</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
2 changes: 1 addition & 1 deletion sale_exception/tests/test_sale_exception.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def test_sale_order_exception(self):
# Simulation the opening of the wizard sale_exception_confirm and
# set ignore_exception to True
so_except_confirm = self.sale_exception_confirm.with_context(
**{"active_id": so1.id, "active_ids": [so1.id], "active_model": so1._name}
active_id=so1.id, active_ids=so1.ids, active_model=so1._name
).create({"ignore": True})
so_except_confirm.action_confirm()
self.assertTrue(so1.ignore_exception)
Expand Down
8 changes: 4 additions & 4 deletions sale_exception/views/sale_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<record id="action_sale_test_tree" model="ir.actions.act_window">
<field name="name">Sale Exception Rules</field>
<field name="res_model">exception.rule</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="base_exception.view_exception_rule_tree" />
<field name="view_mode">list,form</field>
<field name="view_id" ref="base_exception.view_exception_rule_list" />
<field
name="domain"
>[('model', 'in', ['sale.order', 'sale.order.line'])]</field>
Expand Down Expand Up @@ -64,10 +64,10 @@
<field name="exceptions_summary" />
</div>
</xpath>
<xpath expr="//field[@name='order_line']/tree" position="inside">
<xpath expr="//field[@name='order_line']/list" position="inside">
<field name="is_exception_danger" column_invisible="1" />
</xpath>
<xpath expr="//field[@name='order_line']/tree" position="attributes">
<xpath expr="//field[@name='order_line']/list" position="attributes">
<attribute name="decoration-danger">is_exception_danger</attribute>
</xpath>
</field>
Expand Down
4 changes: 2 additions & 2 deletions sale_exception/wizard/sale_exception_confirm_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
<form string="Blocked in draft due to exceptions">
<group>
<field name="exception_ids" nolabel="1" colspan="2">
<tree>
<list>
<field name="name" />
<field name="description" />
</tree>
</list>
</field>
<newline />
<field name="ignore" groups='sales_team.group_sale_manager' />
Expand Down

0 comments on commit b44e26b

Please sign in to comment.