Skip to content

Commit b546d23

Browse files
ps-tubtimflorian-dacosta
authored andcommitted
[MIG] stock_available: Migration to 13.0
1 parent dd90188 commit b546d23

9 files changed

+144
-77
lines changed

stock_available/README.rst

+9-5
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ Stock available to promise
1414
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
1515
:alt: License: AGPL-3
1616
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fstock--logistics--warehouse-lightgray.png?logo=github
17-
:target: https://github.com/OCA/stock-logistics-warehouse/tree/12.0/stock_available
17+
:target: https://github.com/OCA/stock-logistics-warehouse/tree/13.0/stock_available
1818
:alt: OCA/stock-logistics-warehouse
1919
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
20-
:target: https://translation.odoo-community.org/projects/stock-logistics-warehouse-12-0/stock-logistics-warehouse-12-0-stock_available
20+
:target: https://translation.odoo-community.org/projects/stock-logistics-warehouse-13-0/stock-logistics-warehouse-13-0-stock_available
2121
:alt: Translate me on Weblate
2222
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
23-
:target: https://runbot.odoo-community.org/runbot/153/12.0
23+
:target: https://runbot.odoo-community.org/runbot/153/13.0
2424
:alt: Try me on Runbot
2525

2626
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -63,7 +63,7 @@ Bug Tracker
6363
Bugs are tracked on `GitHub Issues <https://github.com/OCA/stock-logistics-warehouse/issues>`_.
6464
In case of trouble, please check there if your issue has already been reported.
6565
If you spotted it first, help us smashing it by providing a detailed and welcomed
66-
`feedback <https://github.com/OCA/stock-logistics-warehouse/issues/new?body=module:%20stock_available%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
66+
`feedback <https://github.com/OCA/stock-logistics-warehouse/issues/new?body=module:%20stock_available%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
6767

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

@@ -95,6 +95,10 @@ Contributors
9595

9696
* Sergio Teruel <sergio.teruel@tecnativa.com>
9797

98+
* `Ecosoft <http://ecosoft.co.th/>`_:
99+
100+
* Pimolnat Suntian <pimolnats@ecosoft.co.th>
101+
98102
Maintainers
99103
~~~~~~~~~~~
100104

@@ -108,6 +112,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
108112
mission is to support the collaborative development of Odoo features and
109113
promote its widespread use.
110114

111-
This module is part of the `OCA/stock-logistics-warehouse <https://github.com/OCA/stock-logistics-warehouse/tree/12.0/stock_available>`_ project on GitHub.
115+
This module is part of the `OCA/stock-logistics-warehouse <https://github.com/OCA/stock-logistics-warehouse/tree/13.0/stock_available>`_ project on GitHub.
112116

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

stock_available/models/product_product.py

+2-5
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
from odoo import api, fields, models
66

7-
from odoo.addons import decimal_precision as dp
87
from odoo.addons.stock.models.product import OPERATORS
98

109

@@ -17,7 +16,6 @@ class ProductProduct(models.Model):
1716

1817
_inherit = "product.product"
1918

20-
@api.multi
2119
def _compute_available_quantities_dict(self):
2220
stock_dict = self._compute_quantities_dict(
2321
self._context.get("lot_id"),
@@ -34,7 +32,6 @@ def _compute_available_quantities_dict(self):
3432
}
3533
return res, stock_dict
3634

37-
@api.multi
3835
@api.depends("virtual_available")
3936
def _compute_available_quantities(self):
4037
res, _ = self._compute_available_quantities_dict()
@@ -44,7 +41,7 @@ def _compute_available_quantities(self):
4441
product[key] = value
4542

4643
immediately_usable_qty = fields.Float(
47-
digits=dp.get_precision("Product Unit of Measure"),
44+
digits="Product Unit of Measure",
4845
compute="_compute_available_quantities",
4946
search="_search_immediately_usable_qty",
5047
string="Available to promise",
@@ -55,7 +52,7 @@ def _compute_available_quantities(self):
5552
)
5653
potential_qty = fields.Float(
5754
compute="_compute_available_quantities",
58-
digits=dp.get_precision("Product Unit of Measure"),
55+
digits="Product Unit of Measure",
5956
string="Potential",
6057
help="Quantity of this Product that could be produced using "
6158
"the materials already at hand.",

stock_available/models/product_template.py

+2-5
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,12 @@
44

55
from odoo import api, fields, models
66

7-
from odoo.addons import decimal_precision as dp
87
from odoo.addons.stock.models.product import OPERATORS
98

109

1110
class ProductTemplate(models.Model):
1211
_inherit = "product.template"
1312

14-
@api.multi
1513
@api.depends(
1614
"product_variant_ids.immediately_usable_qty",
1715
"product_variant_ids.potential_qty",
@@ -23,7 +21,6 @@ def _compute_available_quantities(self):
2321
if key in product._fields:
2422
product[key] = value
2523

26-
@api.multi
2724
def _compute_available_quantities_dict(self):
2825
variants_dict, _ = self.mapped(
2926
"product_variant_ids"
@@ -51,7 +48,7 @@ def _compute_available_quantities_dict(self):
5148
return res
5249

5350
immediately_usable_qty = fields.Float(
54-
digits=dp.get_precision("Product Unit of Measure"),
51+
digits="Product Unit of Measure",
5552
compute="_compute_available_quantities",
5653
search="_search_immediately_usable_qty",
5754
string="Available to promise",
@@ -62,7 +59,7 @@ def _compute_available_quantities_dict(self):
6259
)
6360
potential_qty = fields.Float(
6461
compute="_compute_available_quantities",
65-
digits=dp.get_precision("Product Unit of Measure"),
62+
digits="Product Unit of Measure",
6663
string="Potential",
6764
help="Quantity of this Product that could be produced using "
6865
"the materials already at hand. "

stock_available/models/res_config_settings.py

-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ def get_values(self):
6666
)
6767
return res
6868

69-
@api.multi
7069
def set_values(self):
7170
super(ResConfigSettings, self).set_values()
7271
self.env["ir.config_parameter"].sudo().set_param(

stock_available/readme/CONTRIBUTORS.rst

+4
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,7 @@
1313
* `Tecnativa <https://www.tecnativa.com>`_:
1414

1515
* Sergio Teruel <sergio.teruel@tecnativa.com>
16+
17+
* `Ecosoft <http://ecosoft.co.th/>`_:
18+
19+
* Pimolnat Suntian <pimolnats@ecosoft.co.th>

stock_available/static/description/index.html

+10-3
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ <h1 class="title">Stock available to promise</h1>
367367
!! This file is generated by oca-gen-addon-readme !!
368368
!! changes will be overwritten. !!
369369
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
370-
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.png" /></a> <a class="reference external" 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" href="https://github.com/OCA/stock-logistics-warehouse/tree/12.0/stock_available"><img alt="OCA/stock-logistics-warehouse" src="https://img.shields.io/badge/github-OCA%2Fstock--logistics--warehouse-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/stock-logistics-warehouse-12-0/stock-logistics-warehouse-12-0-stock_available"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/153/12.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
370+
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.png" /></a> <a class="reference external" 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" href="https://github.com/OCA/stock-logistics-warehouse/tree/13.0/stock_available"><img alt="OCA/stock-logistics-warehouse" src="https://img.shields.io/badge/github-OCA%2Fstock--logistics--warehouse-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/stock-logistics-warehouse-13-0/stock-logistics-warehouse-13-0-stock_available"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/153/13.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
371371
<p>This module proposes several options to compute the quantity available to
372372
promise for each product.
373373
This quantity is based on the projected stock and, depending on the
@@ -411,7 +411,7 @@ <h1><a class="toc-backref" href="#id3">Bug Tracker</a></h1>
411411
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/issues">GitHub Issues</a>.
412412
In case of trouble, please check there if your issue has already been reported.
413413
If you spotted it first, help us smashing it by providing a detailed and welcomed
414-
<a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/issues/new?body=module:%20stock_available%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
414+
<a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/issues/new?body=module:%20stock_available%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
415415
<p>Do not contact contributors directly about support or help with technical issues.</p>
416416
</div>
417417
<div class="section" id="credits">
@@ -454,6 +454,13 @@ <h2><a class="toc-backref" href="#id6">Contributors</a></h2>
454454
</ul>
455455
</blockquote>
456456
</li>
457+
<li><p class="first"><a class="reference external" href="http://ecosoft.co.th/">Ecosoft</a>:</p>
458+
<blockquote>
459+
<ul class="simple">
460+
<li>Pimolnat Suntian &lt;<a class="reference external" href="mailto:pimolnats&#64;ecosoft.co.th">pimolnats&#64;ecosoft.co.th</a>&gt;</li>
461+
</ul>
462+
</blockquote>
463+
</li>
457464
</ul>
458465
</div>
459466
<div class="section" id="maintainers">
@@ -463,7 +470,7 @@ <h2><a class="toc-backref" href="#id7">Maintainers</a></h2>
463470
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
464471
mission is to support the collaborative development of Odoo features and
465472
promote its widespread use.</p>
466-
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/tree/12.0/stock_available">OCA/stock-logistics-warehouse</a> project on GitHub.</p>
473+
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/tree/13.0/stock_available">OCA/stock-logistics-warehouse</a> project on GitHub.</p>
467474
<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>
468475
</div>
469476
</div>

stock_available/views/product_product_view.xml

+49-26
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,75 @@
1-
<?xml version="1.0" encoding="utf-8"?>
1+
<?xml version="1.0" encoding="utf-8" ?>
22
<!-- Copyright 2014 Numérigraphe
33
Copyright 2016 Sodexis
44
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -->
5-
65
<odoo>
76
<record model="ir.ui.view" id="product_normal_form_view">
87
<field name="name">Quantity available to promise (variant tree)</field>
98
<field name="model">product.product</field>
109
<field name="inherit_id" ref="stock.product_form_view_procurement_button" />
1110
<field name="arch" type="xml">
12-
<xpath expr="//button[@name='%(stock.action_stock_level_forecast_report_product)d']"
13-
position="after">
14-
<button type="action" name="%(stock.product_open_quants)d"
11+
<xpath
12+
expr="//button[@name='action_product_forecast_report']"
13+
position="after"
14+
>
15+
<button
16+
type="object"
17+
name="action_open_quants"
1518
attrs="{'invisible':[('type', 'not in', ['product','consu'])]}"
16-
class="oe_stat_button" icon="fa-building-o">
17-
<div class="o_field_widget o_stat_info">
18-
<span class="o_stat_value" widget="statinfo">
19-
<field name="immediately_usable_qty" widget="statinfo" nolabel="1" class="mr4"/>
20-
<field name="uom_name"/>
21-
</span>
22-
<span class="o_stat_text">Available</span>
23-
</div>
19+
class="oe_stat_button"
20+
icon="fa-building-o"
21+
>
22+
<div class="o_field_widget o_stat_info">
23+
<span class="o_stat_value" widget="statinfo">
24+
<field
25+
name="immediately_usable_qty"
26+
widget="statinfo"
27+
nolabel="1"
28+
class="mr4"
29+
/>
30+
<field name="uom_name" />
31+
</span>
32+
<span class="o_stat_text">Available</span>
33+
</div>
2434
</button>
25-
<button type="action" name="%(stock.product_open_quants)d"
35+
<button
36+
type="object"
37+
name="action_open_quants"
2638
attrs="{'invisible':[('type', 'not in', ['product','consu'])]}"
27-
class="oe_stat_button" icon="fa-building-o">
28-
<div class="o_field_widget o_stat_info">
29-
<span class="o_stat_value" widget="statinfo">
30-
<field name="potential_qty" widget="statinfo" nolabel="1" class="mr4"/>
31-
<field name="uom_name"/>
32-
</span>
33-
<span class="o_stat_text">Potential</span>
34-
</div>
39+
class="oe_stat_button"
40+
icon="fa-building-o"
41+
>
42+
<div class="o_field_widget o_stat_info">
43+
<span class="o_stat_value" widget="statinfo">
44+
<field
45+
name="potential_qty"
46+
widget="statinfo"
47+
nolabel="1"
48+
class="mr4"
49+
/>
50+
<field name="uom_name" />
51+
</span>
52+
<span class="o_stat_text">Potential</span>
53+
</div>
3554
</button>
3655
</xpath>
3756
</field>
3857
</record>
3958
<record model="ir.ui.view" id="view_stock_available_product_tree">
4059
<field name="name">Quantity available to promise (variant tree)</field>
4160
<field name="model">product.product</field>
42-
<field name="inherit_id" ref="stock.view_stock_product_tree"/>
61+
<field name="inherit_id" ref="stock.view_stock_product_tree" />
4362
<field name="arch" type="xml">
4463
<tree position="attributes">
45-
<attribute name="decoration-danger">virtual_available&lt;0 or immediately_usable_qty&lt;0</attribute>
46-
<attribute name="decoration-info">virtual_available&gt;=0 or immediately_usable_qty&gt;0</attribute>
64+
<attribute
65+
name="decoration-danger"
66+
>virtual_available&lt;0 or immediately_usable_qty&lt;0</attribute>
67+
<attribute
68+
name="decoration-info"
69+
>virtual_available&gt;=0 or immediately_usable_qty&gt;0</attribute>
4770
</tree>
4871
<field name="virtual_available" position="after">
49-
<field name="immediately_usable_qty" />
72+
<field name="immediately_usable_qty" />
5073
</field>
5174
</field>
5275
</record>

0 commit comments

Comments
 (0)