From 5f885c5548f2f12e2bc46f9bbbf7b347f1e39377 Mon Sep 17 00:00:00 2001 From: Sergio Teruel Date: Wed, 26 Jun 2019 17:43:11 +0200 Subject: [PATCH] [MIG] stock_available: Migration to v12.0 --- stock_available/README.rst | 85 +++- stock_available/__init__.py | 2 - stock_available/__manifest__.py | 6 +- stock_available/models/product_product.py | 11 +- stock_available/models/product_template.py | 11 +- stock_available/readme/CONFIGURE.rst | 7 + stock_available/readme/CONTRIBUTORS.rst | 15 + stock_available/readme/DESCRIPTION.rst | 8 + stock_available/readme/USAGE.rst | 3 + stock_available/static/description/index.html | 472 ++++++++++++++++++ stock_available/tests/test_stock_available.py | 2 +- .../views/product_product_view.xml | 24 +- .../views/product_template_view.xml | 20 +- 13 files changed, 599 insertions(+), 67 deletions(-) create mode 100644 stock_available/readme/CONFIGURE.rst create mode 100644 stock_available/readme/CONTRIBUTORS.rst create mode 100644 stock_available/readme/DESCRIPTION.rst create mode 100644 stock_available/readme/USAGE.rst create mode 100644 stock_available/static/description/index.html diff --git a/stock_available/README.rst b/stock_available/README.rst index a687864cc..11c91e313 100644 --- a/stock_available/README.rst +++ b/stock_available/README.rst @@ -1,11 +1,30 @@ -.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg - :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html - :alt: License: AGPL-3 - ========================== Stock available to promise ========================== +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :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 + :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 + :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 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + 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 @@ -15,6 +34,11 @@ In case of immediate production capacity, it is possible to configure on which field the potential is computed, by default Quantity On Hand is used. This can be configured in `Inventory` > `Configuration` > `Settings`. +**Table of contents** + +.. contents:: + :local: + Configuration ============= @@ -33,44 +57,57 @@ This module adds a field named `Available for sale` on the Product form. Various additional fields may be added, depending on which information you chose to base the computation on. -.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas - :alt: Try me on Runbot - :target: https://runbot.odoo-community.org/runbot/153/11.0 - 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. +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 `_. + +Do not contact contributors directly about support or help with technical issues. Credits ======= -Images ------- +Authors +~~~~~~~ -* Odoo Community Association: `Icon `_. +* Numérigraphe +* Sodexis Contributors ------------- +~~~~~~~~~~~~ -* Lionel Sausin (Numérigraphe) -* Sodexis -* Factor Libre - Kiko Peiro +* `Numérigraphe `_: -Maintainer ----------- + * Lionel Sausin + +* `Sodexis `_: + + * Sodexis + +* `Factor Libre `_: + + * Kiko Peiro + +* `Tecnativa `_: + + * Sergio Teruel + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. .. image:: https://odoo-community.org/logo.png :alt: Odoo Community Association :target: https://odoo-community.org -This module is maintained by the OCA. - 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. -To contribute to this module, please visit https://odoo-community.org. +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/__init__.py b/stock_available/__init__.py index 2c1e277e2..83e553ac4 100644 --- a/stock_available/__init__.py +++ b/stock_available/__init__.py @@ -1,5 +1,3 @@ -# Copyright 2014 Numérigraphe -# Copyright 2016 Sodexis # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from . import models diff --git a/stock_available/__manifest__.py b/stock_available/__manifest__.py index 40193f198..236da110b 100644 --- a/stock_available/__manifest__.py +++ b/stock_available/__manifest__.py @@ -4,8 +4,10 @@ { 'name': 'Stock available to promise', - 'version': '11.0.1.1.0', - "author": "Numérigraphe, Sodexis, Odoo Community Association (OCA)", + 'version': '12.0.1.0.0', + 'author': 'Numérigraphe, Sodexis, Odoo Community Association (OCA)', + 'website': 'https://github.com/OCA/stock-logistics-warehouse', + 'development_status': 'Production/Stable', 'category': 'Warehouse', 'depends': ['stock'], 'license': 'AGPL-3', diff --git a/stock_available/models/product_product.py b/stock_available/models/product_product.py index af76f6139..f65cd0516 100644 --- a/stock_available/models/product_product.py +++ b/stock_available/models/product_product.py @@ -4,16 +4,7 @@ from odoo import api, fields, models from odoo.addons import decimal_precision as dp -import operator as py_operator - -OPERATORS = { - '<': py_operator.lt, - '>': py_operator.gt, - '<=': py_operator.le, - '>=': py_operator.ge, - '=': py_operator.eq, - '!=': py_operator.ne -} +from odoo.addons.stock.models.product import OPERATORS class ProductProduct(models.Model): diff --git a/stock_available/models/product_template.py b/stock_available/models/product_template.py index e02336950..945f0c541 100644 --- a/stock_available/models/product_template.py +++ b/stock_available/models/product_template.py @@ -4,16 +4,7 @@ from odoo import models, fields, api from odoo.addons import decimal_precision as dp -import operator as py_operator - -OPERATORS = { - '<': py_operator.lt, - '>': py_operator.gt, - '<=': py_operator.le, - '>=': py_operator.ge, - '=': py_operator.eq, - '!=': py_operator.ne -} +from odoo.addons.stock.models.product import OPERATORS class ProductTemplate(models.Model): diff --git a/stock_available/readme/CONFIGURE.rst b/stock_available/readme/CONFIGURE.rst new file mode 100644 index 000000000..e6b596bfd --- /dev/null +++ b/stock_available/readme/CONFIGURE.rst @@ -0,0 +1,7 @@ +By default, this module computes the stock available to promise as the virtual +stock. +To take advantage of the additional features, you must define on which information you +want to base the computation, by checking one or more boxes in the settings: +`Inventory` > `Configuration` > `Settings` > `Stock available to promise`. +In case of "Include the production potential", it is also possible to configure +which field of product to use to compute the production potential. diff --git a/stock_available/readme/CONTRIBUTORS.rst b/stock_available/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..9f854b266 --- /dev/null +++ b/stock_available/readme/CONTRIBUTORS.rst @@ -0,0 +1,15 @@ +* `Numérigraphe `_: + + * Lionel Sausin + +* `Sodexis `_: + + * Sodexis + +* `Factor Libre `_: + + * Kiko Peiro + +* `Tecnativa `_: + + * Sergio Teruel diff --git a/stock_available/readme/DESCRIPTION.rst b/stock_available/readme/DESCRIPTION.rst new file mode 100644 index 000000000..d345320b2 --- /dev/null +++ b/stock_available/readme/DESCRIPTION.rst @@ -0,0 +1,8 @@ +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 +configuration, it can account for various data such as sales quotations or +immediate production capacity. +In case of immediate production capacity, it is possible to configure on which +field the potential is computed, by default Quantity On Hand is used. +This can be configured in `Inventory` > `Configuration` > `Settings`. diff --git a/stock_available/readme/USAGE.rst b/stock_available/readme/USAGE.rst new file mode 100644 index 000000000..85749174d --- /dev/null +++ b/stock_available/readme/USAGE.rst @@ -0,0 +1,3 @@ +This module adds a field named `Available for sale` on the Product form. +Various additional fields may be added, depending on which information you +chose to base the computation on. diff --git a/stock_available/static/description/index.html b/stock_available/static/description/index.html new file mode 100644 index 000000000..25ec92086 --- /dev/null +++ b/stock_available/static/description/index.html @@ -0,0 +1,472 @@ + + + + + + +Stock available to promise + + + +
+

Stock available to promise

+ + +

Beta License: AGPL-3 OCA/stock-logistics-warehouse Translate me on Weblate Try me on Runbot

+

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 +configuration, it can account for various data such as sales quotations or +immediate production capacity. +In case of immediate production capacity, it is possible to configure on which +field the potential is computed, by default Quantity On Hand is used. +This can be configured in Inventory > Configuration > Settings.

+

Table of contents

+ +
+

Configuration

+

By default, this module computes the stock available to promise as the virtual +stock. +To take advantage of the additional features, you must define on which information you +want to base the computation, by checking one or more boxes in the settings: +Inventory > Configuration > Settings > Stock available to promise. +In case of “Include the production potential”, it is also possible to configure +which field of product to use to compute the production potential.

+
+
+

Usage

+

This module adds a field named Available for sale on the Product form. +Various additional fields may be added, depending on which information you +chose to base the computation on.

+
+
+

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.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • Numérigraphe
  • +
  • Sodexis
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

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.

+

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

+
+
+
+ + diff --git a/stock_available/tests/test_stock_available.py b/stock_available/tests/test_stock_available.py index 40fae522d..976dd7c5f 100644 --- a/stock_available/tests/test_stock_available.py +++ b/stock_available/tests/test_stock_available.py @@ -28,7 +28,7 @@ class TestStockLogisticsWarehouse(TransactionCase): supplier_location = self.env.ref('stock.stock_location_suppliers') stock_location = self.env.ref('stock.stock_location_stock') customer_location = self.env.ref('stock.stock_location_customers') - uom_unit = self.env.ref('product.product_uom_unit') + uom_unit = self.env.ref('uom.product_uom_unit') # Create product template templateAB = templateObj.create( diff --git a/stock_available/views/product_product_view.xml b/stock_available/views/product_product_view.xml index b47593220..742d98239 100644 --- a/stock_available/views/product_product_view.xml +++ b/stock_available/views/product_product_view.xml @@ -14,20 +14,24 @@ diff --git a/stock_available/views/product_template_view.xml b/stock_available/views/product_template_view.xml index cb51cb2a1..b4543ca95 100644 --- a/stock_available/views/product_template_view.xml +++ b/stock_available/views/product_template_view.xml @@ -14,20 +14,24 @@