From b546d23d27626d4b779a7c4113ba2c831793dcf1 Mon Sep 17 00:00:00 2001
From: ps-tubtim
Date: Tue, 16 Jun 2020 13:37:06 +0700
Subject: [PATCH] [MIG] stock_available: Migration to 13.0
---
stock_available/README.rst | 14 ++--
stock_available/models/product_product.py | 7 +-
stock_available/models/product_template.py | 7 +-
stock_available/models/res_config_settings.py | 1 -
stock_available/readme/CONTRIBUTORS.rst | 4 +
stock_available/static/description/index.html | 13 +++-
.../views/product_product_view.xml | 75 +++++++++++-------
.../views/product_template_view.xml | 78 +++++++++++++------
.../views/res_config_settings_views.xml | 22 ++++--
9 files changed, 144 insertions(+), 77 deletions(-)
diff --git a/stock_available/README.rst b/stock_available/README.rst
index 686c93195..281541b9c 100644
--- a/stock_available/README.rst
+++ b/stock_available/README.rst
@@ -14,13 +14,13 @@ Stock available to promise
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fstock--logistics--warehouse-lightgray.png?logo=github
- :target: https://github.com/OCA/stock-logistics-warehouse/tree/12.0/stock_available
+ :target: https://github.com/OCA/stock-logistics-warehouse/tree/13.0/stock_available
:alt: OCA/stock-logistics-warehouse
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
- :target: https://translation.odoo-community.org/projects/stock-logistics-warehouse-12-0/stock-logistics-warehouse-12-0-stock_available
+ :target: https://translation.odoo-community.org/projects/stock-logistics-warehouse-13-0/stock-logistics-warehouse-13-0-stock_available
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
- :target: https://runbot.odoo-community.org/runbot/153/12.0
+ :target: https://runbot.odoo-community.org/runbot/153/13.0
:alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -63,7 +63,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.
@@ -95,6 +95,10 @@ Contributors
* Sergio Teruel
+* `Ecosoft `_:
+
+ * Pimolnat Suntian
+
Maintainers
~~~~~~~~~~~
@@ -108,6 +112,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/stock-logistics-warehouse `_ project on GitHub.
+This module is part of the `OCA/stock-logistics-warehouse `_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
diff --git a/stock_available/models/product_product.py b/stock_available/models/product_product.py
index 4832fbc37..7a4d4ce3f 100644
--- a/stock_available/models/product_product.py
+++ b/stock_available/models/product_product.py
@@ -4,7 +4,6 @@
from odoo import api, fields, models
-from odoo.addons import decimal_precision as dp
from odoo.addons.stock.models.product import OPERATORS
@@ -17,7 +16,6 @@ class ProductProduct(models.Model):
_inherit = "product.product"
- @api.multi
def _compute_available_quantities_dict(self):
stock_dict = self._compute_quantities_dict(
self._context.get("lot_id"),
@@ -34,7 +32,6 @@ class ProductProduct(models.Model):
}
return res, stock_dict
- @api.multi
@api.depends("virtual_available")
def _compute_available_quantities(self):
res, _ = self._compute_available_quantities_dict()
@@ -44,7 +41,7 @@ class ProductProduct(models.Model):
product[key] = value
immediately_usable_qty = fields.Float(
- digits=dp.get_precision("Product Unit of Measure"),
+ digits="Product Unit of Measure",
compute="_compute_available_quantities",
search="_search_immediately_usable_qty",
string="Available to promise",
@@ -55,7 +52,7 @@ class ProductProduct(models.Model):
)
potential_qty = fields.Float(
compute="_compute_available_quantities",
- digits=dp.get_precision("Product Unit of Measure"),
+ digits="Product Unit of Measure",
string="Potential",
help="Quantity of this Product that could be produced using "
"the materials already at hand.",
diff --git a/stock_available/models/product_template.py b/stock_available/models/product_template.py
index 13c4a0068..893b7aa74 100644
--- a/stock_available/models/product_template.py
+++ b/stock_available/models/product_template.py
@@ -4,14 +4,12 @@
from odoo import api, fields, models
-from odoo.addons import decimal_precision as dp
from odoo.addons.stock.models.product import OPERATORS
class ProductTemplate(models.Model):
_inherit = "product.template"
- @api.multi
@api.depends(
"product_variant_ids.immediately_usable_qty",
"product_variant_ids.potential_qty",
@@ -23,7 +21,6 @@ class ProductTemplate(models.Model):
if key in product._fields:
product[key] = value
- @api.multi
def _compute_available_quantities_dict(self):
variants_dict, _ = self.mapped(
"product_variant_ids"
@@ -51,7 +48,7 @@ class ProductTemplate(models.Model):
return res
immediately_usable_qty = fields.Float(
- digits=dp.get_precision("Product Unit of Measure"),
+ digits="Product Unit of Measure",
compute="_compute_available_quantities",
search="_search_immediately_usable_qty",
string="Available to promise",
@@ -62,7 +59,7 @@ class ProductTemplate(models.Model):
)
potential_qty = fields.Float(
compute="_compute_available_quantities",
- digits=dp.get_precision("Product Unit of Measure"),
+ digits="Product Unit of Measure",
string="Potential",
help="Quantity of this Product that could be produced using "
"the materials already at hand. "
diff --git a/stock_available/models/res_config_settings.py b/stock_available/models/res_config_settings.py
index 824a04e72..6ce4230fd 100644
--- a/stock_available/models/res_config_settings.py
+++ b/stock_available/models/res_config_settings.py
@@ -66,7 +66,6 @@ class ResConfigSettings(models.TransientModel):
)
return res
- @api.multi
def set_values(self):
super(ResConfigSettings, self).set_values()
self.env["ir.config_parameter"].sudo().set_param(
diff --git a/stock_available/readme/CONTRIBUTORS.rst b/stock_available/readme/CONTRIBUTORS.rst
index 9f854b266..12ff0e6b0 100644
--- a/stock_available/readme/CONTRIBUTORS.rst
+++ b/stock_available/readme/CONTRIBUTORS.rst
@@ -13,3 +13,7 @@
* `Tecnativa `_:
* Sergio Teruel
+
+* `Ecosoft `_:
+
+ * Pimolnat Suntian
diff --git a/stock_available/static/description/index.html b/stock_available/static/description/index.html
index d50828330..d8e5baa4b 100644
--- a/stock_available/static/description/index.html
+++ b/stock_available/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 proposes several options to compute the quantity available to
promise for each product.
This quantity is based on the projected stock and, depending on the
@@ -411,7 +411,7 @@ chose to base the computation on.
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.
@@ -463,7 +470,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.
@@ -39,24 +61,32 @@
Quantity available to promise (tree)product.template
-
+
- virtual_available<0 or immediately_usable_qty<0
- virtual_available>=0 or immediately_usable_qty>0
+ virtual_available<0 or immediately_usable_qty<0
+ virtual_available>=0 or immediately_usable_qty>0
-
+ Quantity available to promise (kanban)product.template
-
+
-
Available to Promise:
+
Available to Promise:
diff --git a/stock_available/views/res_config_settings_views.xml b/stock_available/views/res_config_settings_views.xml
index ded35456b..3740a4235 100644
--- a/stock_available/views/res_config_settings_views.xml
+++ b/stock_available/views/res_config_settings_views.xml
@@ -1,8 +1,7 @@
-
+
-
Stock settings: quantity available to promise
@@ -14,21 +13,28 @@