Skip to content

Commit a9acd03

Browse files
committed
[MIG] sale_block_no_stock: Migration to 17.0
1 parent 7baff58 commit a9acd03

File tree

8 files changed

+104
-96
lines changed

8 files changed

+104
-96
lines changed

sale_block_no_stock/README.rst

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ Sale Block no Stock
1717
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
1818
:alt: License: LGPL-3
1919
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsale--workflow-lightgray.png?logo=github
20-
:target: https://github.com/OCA/sale-workflow/tree/16.0/sale_block_no_stock
20+
:target: https://github.com/OCA/sale-workflow/tree/17.0/sale_block_no_stock
2121
:alt: OCA/sale-workflow
2222
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23-
:target: https://translation.odoo-community.org/projects/sale-workflow-16-0/sale-workflow-16-0-sale_block_no_stock
23+
:target: https://translation.odoo-community.org/projects/sale-workflow-17-0/sale-workflow-17-0-sale_block_no_stock
2424
:alt: Translate me on Weblate
2525
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26-
:target: https://runboat.odoo-community.org/builds?repo=OCA/sale-workflow&target_branch=16.0
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/sale-workflow&target_branch=17.0
2727
:alt: Try me on Runboat
2828

2929
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -78,10 +78,10 @@ To configure this module, you need to:
7878
2. Fill *Field to compare against the quantity demanded*. Possible
7979
values:
8080

81-
- *virtual_available_at_date*: Planned quantity to be in stock on the
82-
day of delivery
83-
- *qty_available_today*: Quantity available in stock today
84-
- *free_qty_today*: Quantity available without reserve in stock
81+
- *virtual_available_at_date*: Planned quantity to be in stock on the
82+
day of delivery
83+
- *qty_available_today*: Quantity available in stock today
84+
- *free_qty_today*: Quantity available without reserve in stock
8585

8686
3. Fill *Groups allowed to bypass the block*
8787

@@ -114,7 +114,7 @@ Bug Tracker
114114
Bugs are tracked on `GitHub Issues <https://github.com/OCA/sale-workflow/issues>`_.
115115
In case of trouble, please check there if your issue has already been reported.
116116
If you spotted it first, help us to smash it by providing a detailed and welcomed
117-
`feedback <https://github.com/OCA/sale-workflow/issues/new?body=module:%20sale_block_no_stock%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
117+
`feedback <https://github.com/OCA/sale-workflow/issues/new?body=module:%20sale_block_no_stock%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
118118

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

@@ -129,15 +129,15 @@ Authors
129129
Contributors
130130
------------
131131

132-
- Eduardo de Miguel (`Moduon <https://www.moduon.team/>`__)
133-
- Rafael Blasco (`Moduon <https://www.moduon.team/>`__)
132+
- Eduardo de Miguel (`Moduon <https://www.moduon.team/>`__)
133+
- Rafael Blasco (`Moduon <https://www.moduon.team/>`__)
134134

135135
Other credits
136136
-------------
137137

138138
The development of this module has been financially supported by:
139139

140-
- Ulzama
140+
- Ulzama
141141

142142
Maintainers
143143
-----------
@@ -160,6 +160,6 @@ Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
160160

161161
|maintainer-Shide|
162162

163-
This module is part of the `OCA/sale-workflow <https://github.com/OCA/sale-workflow/tree/16.0/sale_block_no_stock>`_ project on GitHub.
163+
This module is part of the `OCA/sale-workflow <https://github.com/OCA/sale-workflow/tree/17.0/sale_block_no_stock>`_ project on GitHub.
164164

165165
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

sale_block_no_stock/__manifest__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33

44
{
55
"name": "Sale Block no Stock",
6-
"summary": "Block Sales if products has not enough Quantity based on a chosen field",
7-
"version": "16.0.2.0.0",
6+
"summary": """Block Sales if products has not enough
7+
Quantity based on a chosen field""",
8+
"version": "17.0.1.0.0",
89
"development_status": "Alpha",
910
"category": "Sales/Sales",
1011
"website": "https://github.com/OCA/sale-workflow",

sale_block_no_stock/models/sale_order.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,8 @@ def action_confirm(self):
2828
if line.product_uom_qty > line[field_to_check.name]:
2929
blocked_lines |= line
3030
if blocked_lines:
31-
action = (
32-
self.env.ref("sale_block_no_stock.sale_order_block_wizard_action")
33-
.sudo()
34-
.read()[0]
31+
action = self.env["ir.actions.actions"]._for_xml_id(
32+
"sale_block_no_stock.sale_order_block_wizard_action"
3533
)
3634
action["context"] = {
3735
"default_sale_line_block_ids": [

sale_block_no_stock/static/description/index.html

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@
88

99
/*
1010
:Author: David Goodger (goodger@python.org)
11-
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
11+
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
1212
:Copyright: This stylesheet has been placed in the public domain.
1313
1414
Default cascading style sheet for the HTML output of Docutils.
15+
Despite the name, some widely supported CSS2 features are used.
1516
1617
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
1718
customize this style sheet.
@@ -274,7 +275,7 @@
274275
margin-left: 2em ;
275276
margin-right: 2em }
276277

277-
pre.code .ln { color: grey; } /* line numbers */
278+
pre.code .ln { color: gray; } /* line numbers */
278279
pre.code, code { background-color: #eeeeee }
279280
pre.code .comment, code .comment { color: #5C6576 }
280281
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
@@ -300,7 +301,7 @@
300301
span.pre {
301302
white-space: pre }
302303

303-
span.problematic {
304+
span.problematic, pre.problematic {
304305
color: red }
305306

306307
span.section-subtitle {
@@ -368,7 +369,7 @@ <h1 class="title">Sale Block no Stock</h1>
368369
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
369370
!! source digest: sha256:408792731be049ad77a018ccc6404bc72e66f817d177fa1cb510301be225d759
370371
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
371-
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Alpha" src="https://img.shields.io/badge/maturity-Alpha-red.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/licence-LGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/sale-workflow/tree/16.0/sale_block_no_stock"><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-16-0/sale-workflow-16-0-sale_block_no_stock"><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=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
372+
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Alpha" src="https://img.shields.io/badge/maturity-Alpha-red.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/licence-LGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/sale-workflow/tree/17.0/sale_block_no_stock"><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_block_no_stock"><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>
372373
<p>This module extends the functionality of Sales to support blocking sales
373374
and to allow you to ensure you are capable to send product you have in
374375
stock.</p>
@@ -460,7 +461,7 @@ <h1><a class="toc-backref" href="#toc-entry-4">Bug Tracker</a></h1>
460461
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/sale-workflow/issues">GitHub Issues</a>.
461462
In case of trouble, please check there if your issue has already been reported.
462463
If you spotted it first, help us to smash it by providing a detailed and welcomed
463-
<a class="reference external" href="https://github.com/OCA/sale-workflow/issues/new?body=module:%20sale_block_no_stock%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
464+
<a class="reference external" href="https://github.com/OCA/sale-workflow/issues/new?body=module:%20sale_block_no_stock%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
464465
<p>Do not contact contributors directly about support or help with technical issues.</p>
465466
</div>
466467
<div class="section" id="credits">
@@ -488,13 +489,15 @@ <h2><a class="toc-backref" href="#toc-entry-8">Other credits</a></h2>
488489
<div class="section" id="maintainers">
489490
<h2><a class="toc-backref" href="#toc-entry-9">Maintainers</a></h2>
490491
<p>This module is maintained by the OCA.</p>
491-
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
492+
<a class="reference external image-reference" href="https://odoo-community.org">
493+
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
494+
</a>
492495
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
493496
mission is to support the collaborative development of Odoo features and
494497
promote its widespread use.</p>
495498
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
496499
<p><a class="reference external image-reference" href="https://github.com/Shide"><img alt="Shide" src="https://github.com/Shide.png?size=40px" /></a></p>
497-
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/sale-workflow/tree/16.0/sale_block_no_stock">OCA/sale-workflow</a> project on GitHub.</p>
500+
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/sale-workflow/tree/17.0/sale_block_no_stock">OCA/sale-workflow</a> project on GitHub.</p>
498501
<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>
499502
</div>
500503
</div>

sale_block_no_stock/tests/test_sale_block_no_stock.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def setUpClass(cls):
100100
],
101101
}
102102
)
103-
cls.in_picking.move_ids[0].quantity_done = 11.0
103+
cls.in_picking.move_ids[0].quantity = 11.0
104104

105105
def _get_wizard(self, wizard_user, wizard_action):
106106
"""Returns a new wizard instance from the given action."""
@@ -189,6 +189,8 @@ def test_sale_blocking_virtual_available_at_date(self):
189189
self.assertEqual(len(wizard.sale_line_block_ids), 1)
190190
self.assertFalse(wizard.confirmation_allowed)
191191
self.sale.commitment_date = "2024-01-05"
192+
# Ensure incoming picking is in 'assigned' so forecast includes it
193+
self.in_picking.action_assign()
192194
# No Block: 1 Dozen on 2024-01-05
193195
self.sale.with_user(self.saleblock_user.id).action_confirm()
194196
self.assertNotEqual(self.sale.state, "draft")

sale_block_no_stock/views/res_config_settings_views.xml

Lines changed: 35 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -5,47 +5,41 @@
55
<field name="model">res.config.settings</field>
66
<field name="inherit_id" ref="sale.res_config_settings_view_form" />
77
<field name="arch" type="xml">
8-
<xpath expr="//div[@id='no_edit_order']" position="after">
9-
<div class="col-12 col-lg-6 o_setting_box">
10-
<div class="o_setting_right_pane">
11-
<label for="sale_line_field_block" string="Blocking sales due to lack of stock" />
12-
<span
13-
class="fa fa-lg fa-building-o"
14-
title="Values set here are company-specific."
15-
groups="base.group_multi_company"
16-
/>
17-
<div class="text-muted">
18-
Avoid selling more product than you have in stock or planned
19-
</div>
20-
<div class="content-group">
21-
<div class="mt-2">
22-
<label
23-
for="sale_line_field_block"
24-
string="Field to compare against the quantity demanded"
25-
class="w-100"
26-
/>
27-
<field
28-
name="sale_line_field_block"
29-
options="{'no_create': True, 'no_open': True}"
30-
class="w-75"
31-
/>
32-
</div>
33-
<div class="mt-1">
34-
<label
35-
for="sale_line_block_allowed_groups"
36-
string="Groups allowed to bypass the block"
37-
class="w-100"
38-
/>
39-
<field
40-
name="sale_line_block_allowed_groups"
41-
widget="many2many_tags"
42-
options="{'no_create': True, 'no_open': True}"
43-
class="w-100"
44-
/>
45-
</div>
46-
</div>
47-
</div>
48-
</div>
8+
<xpath expr="//setting[@id='no_edit_order']" position="after">
9+
<setting
10+
id="sale_line_field_block"
11+
string="Blocking sales due to lack of stock"
12+
help="Avoid selling more product than you have in stock or planned"
13+
company_dependent="1"
14+
>
15+
<div class="content-group">
16+
<div class="mt-2">
17+
<label
18+
for="sale_line_field_block"
19+
string="Field to compare against the quantity demanded"
20+
class="w-100"
21+
/>
22+
<field
23+
name="sale_line_field_block"
24+
options="{'no_create': True, 'no_open': True}"
25+
class="w-75"
26+
/>
27+
</div>
28+
<div class="mt-1">
29+
<label
30+
for="sale_line_block_allowed_groups"
31+
string="Groups allowed to bypass the block"
32+
class="w-100"
33+
/>
34+
<field
35+
name="sale_line_block_allowed_groups"
36+
widget="many2many_tags"
37+
options="{'no_create': True, 'no_open': True}"
38+
class="w-100"
39+
/>
40+
</div>
41+
</div>
42+
</setting>
4943
</xpath>
5044
</field>
5145
</record>

0 commit comments

Comments
 (0)