Merge PR #1152 into 13.0

Signed-off-by pedrobaeza
This commit is contained in:
OCA-git-bot
2021-05-21 06:47:19 +00:00
25 changed files with 2005 additions and 0 deletions

View File

@@ -0,0 +1 @@
../../../../stock_available_mrp

View File

@@ -0,0 +1,6 @@
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)

View File

@@ -0,0 +1,128 @@
=========================================================
Consider the production potential is 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_mrp
: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_mrp
: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 takes the potential quantities available for Products into account in
the quantity available to promise, where the "Potential quantity" is the
quantity that can be manufactured with the components immediately at hand.
By configuration, the "Potential quantity" can be computed based on other product field.
For example, "Potential quantity" can be the quantity that can be manufactured
with the components available to promise.
**Table of contents**
.. contents::
:local:
Known issues / Roadmap
======================
Known issues
~~~~~~~~~~~~
The manufacturing delays are not taken into account : this module assumes that
if you have components in stock goods, you can manufacture finished goods
quickly enough.
As a consequence, and to avoid overestimating, **only the first level** of Bill
of Materials is considered.
However Sets (a.k.a "phantom" BoMs) are taken into account: if a component must
be replaced with a set, it's the stock of the set's product which will decide
the potential.
If a product has several variants, only the variant with the biggest potential
will be taken into account when reporting the production potential. For
example, even if you actually have enough components to make 10 iPads 16Go AND
42 iPads 32Go, we'll consider that you can promise only 42 iPads.
Removed features
~~~~~~~~~~~~~~~~
Previous versions of this module used to let programmers demand to get the
potential quantity in an arbitrary Unit of Measure using the `context`. This
feature was present in the standard computations too until v8.0, but it has
been dropped from the standard from v8.0 on.
For the sake of consistency the potential quantity is now always reported in
the product's main Unit of Measure too.
Roadmap
~~~~~~~
Possible improvements for future versions:
* Take manufacturing delays into account: we should not promise goods to
customers if they want them delivered earlier that we can make them
* Compute the quantity of finished product that can be made directly on each
Bill of Material: this would be useful for production managers, and may make
the computations faster by avoiding to compute the same BoM several times
when several variants share the same BoM.
* Add an option (probably as a sub-module) to consider all raw materials as
available if they can be bought from the suppliers in time for the
manufacturing.
Bug Tracker
===========
Bugs are tracked on `GitHub Issues <https://github.com/OCA/stock-logistics-warehouse/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 <https://github.com/OCA/stock-logistics-warehouse/issues/new?body=module:%20stock_available_mrp%0Aversion:%2012.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.
Credits
=======
Authors
~~~~~~~
* Numérigraphe
Contributors
~~~~~~~~~~~~
* Loïc Bellier (Numérigraphe) <lb@numerigraphe.com>
* Lionel Sausin (Numérigraphe) <ls@numerigraphe.com>
* many thanks to Graeme Gellatly for his advice and code review
* Laurent Mignon <laurent.mignon@acsone.eu>
* Cédric Pigeon <cedric.pigeon@acsone.eu>
* Florian da Costa <florian.dacosta@akretion.com>
Maintainers
~~~~~~~~~~~
This module is maintained by the OCA.
.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org
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 <https://github.com/OCA/stock-logistics-warehouse/tree/12.0/stock_available_mrp>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@@ -0,0 +1,4 @@
# Copyright 2014 Numérigraphe SARL
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import models

View File

@@ -0,0 +1,13 @@
# Copyright 2014 Numérigraphe SARL, Camptocamp
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "Consider the production potential is available to promise",
"version": "13.0.1.0.0",
"author": "Numérigraphe," "Odoo Community Association (OCA)",
"website": "https://github.com/OCA/stock-logistics-warehouse",
"category": "Hidden",
"depends": ["stock_available", "mrp"],
"demo": ["demo/mrp_data.xml"],
"license": "AGPL-3",
"installable": True,
}

View File

@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo noupdate="1">
<record id="product_kit_1a" model="product.product">
<field name="default_code">PCSC234-WHITE</field>
<field
name="product_tmpl_id"
ref="mrp.product_product_table_kit_product_template"
/>
<field
name="product_template_attribute_value_ids"
eval="[(6,0,[ref('product.product_attribute_value_3')])]"
/>
</record>
<record id="mrp.product_product_table_kit" model="product.product">
<field
name="product_template_attribute_value_ids"
eval="[(6,0,[ref('product.product_attribute_value_4')])]"
/>
</record>
<record id="mrp.mrp_bom_kit_line_2" model="mrp.bom.line">
<field
name="bom_product_template_attribute_value_ids"
eval="[(6,0,[ref('product.product_attribute_value_4')])]"
/>
</record>
<record id="product_computer_desk_bolt_white" model="product.product">
<field name="name">Bolt</field>
<field name="categ_id" ref="product.product_category_5" />
<field name="standard_price">1.0</field>
<field name="list_price">5.0</field>
<field name="type">product</field>
<field name="uom_id" ref="uom.product_uom_unit" />
<field name="uom_po_id" ref="uom.product_uom_unit" />
<field name="default_code">BOLT-WHITE</field>
</record>
<record id="mrp_bom_kit_line_3" model="mrp.bom.line">
<field name="product_id" ref="product_computer_desk_bolt_white" />
<field name="product_qty">4</field>
<field name="product_uom_id" ref="uom.product_uom_unit" />
<field name="sequence">5</field>
<field name="bom_id" ref="mrp.mrp_bom_kit" />
<field
name="bom_product_template_attribute_value_ids"
eval="[(6,0,[ref('product.product_attribute_value_3')])]"
/>
</record>
</odoo>

View File

@@ -0,0 +1,70 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_available_mrp
#
# Translators:
# Rudolf Schnapka <rs@techno-flex.de>, 2016
msgid ""
msgstr ""
"Project-Id-Version: stock-logistics-warehouse (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-01-14 01:38+0000\n"
"PO-Revision-Date: 2016-01-14 09:35+0000\n"
"Last-Translator: Rudolf Schnapka <rs@techno-flex.de>\n"
"Language-Team: German (http://www.transifex.com/oca/OCA-stock-logistics-"
"warehouse-8-0/language/de/)\n"
"Language: de\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: stock_available_mrp
#: model:ir.model.fields,field_description:stock_available_mrp.field_product_product__bom_id
msgid "BOM"
msgstr ""
#. module: stock_available_mrp
#: model:product.product,name:stock_available_mrp.product_computer_desk_bolt_white
#: model:product.template,name:stock_available_mrp.product_computer_desk_bolt_white_product_template
msgid "Bolt"
msgstr ""
#. module: stock_available_mrp
#: model:ir.model,name:stock_available_mrp.model_product_product
msgid "Product"
msgstr "Produkt"
#. module: stock_available_mrp
#: model:product.product,name:stock_available_mrp.product_kit_1a
#: model:product.template,name:stock_available_mrp.product_kit_1a_product_template
msgid "Table Kit"
msgstr ""
#. module: stock_available_mrp
#: model:product.product,description:stock_available_mrp.product_kit_1a
#: model:product.template,description:stock_available_mrp.product_kit_1a_product_template
msgid "Table kit"
msgstr ""
#. module: stock_available_mrp
#: model:product.product,uom_name:stock_available_mrp.product_computer_desk_bolt_white
#: model:product.product,uom_name:stock_available_mrp.product_kit_1a
#: model:product.template,uom_name:stock_available_mrp.product_computer_desk_bolt_white_product_template
#: model:product.template,uom_name:stock_available_mrp.product_kit_1a_product_template
msgid "Unit(s)"
msgstr ""
#. module: stock_available_mrp
#: model:product.product,weight_uom_name:stock_available_mrp.product_computer_desk_bolt_white
#: model:product.product,weight_uom_name:stock_available_mrp.product_kit_1a
#: model:product.template,weight_uom_name:stock_available_mrp.product_computer_desk_bolt_white_product_template
#: model:product.template,weight_uom_name:stock_available_mrp.product_kit_1a_product_template
msgid "kg"
msgstr ""
#~ msgid "Product Template"
#~ msgstr "Produktvorlage"
#~ msgid "Thousand"
#~ msgstr "Tausend"

View File

@@ -0,0 +1,66 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_available_mrp
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: stock-logistics-warehouse (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-01-14 01:38+0000\n"
"PO-Revision-Date: 2016-01-13 16:35+0000\n"
"Last-Translator: <>\n"
"Language-Team: Spanish (http://www.transifex.com/oca/OCA-stock-logistics-"
"warehouse-8-0/language/es/)\n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: stock_available_mrp
#: model:ir.model.fields,field_description:stock_available_mrp.field_product_product__bom_id
msgid "BOM"
msgstr ""
#. module: stock_available_mrp
#: model:product.product,name:stock_available_mrp.product_computer_desk_bolt_white
#: model:product.template,name:stock_available_mrp.product_computer_desk_bolt_white_product_template
msgid "Bolt"
msgstr ""
#. module: stock_available_mrp
#: model:ir.model,name:stock_available_mrp.model_product_product
msgid "Product"
msgstr "Producto"
#. module: stock_available_mrp
#: model:product.product,name:stock_available_mrp.product_kit_1a
#: model:product.template,name:stock_available_mrp.product_kit_1a_product_template
msgid "Table Kit"
msgstr ""
#. module: stock_available_mrp
#: model:product.product,description:stock_available_mrp.product_kit_1a
#: model:product.template,description:stock_available_mrp.product_kit_1a_product_template
msgid "Table kit"
msgstr ""
#. module: stock_available_mrp
#: model:product.product,uom_name:stock_available_mrp.product_computer_desk_bolt_white
#: model:product.product,uom_name:stock_available_mrp.product_kit_1a
#: model:product.template,uom_name:stock_available_mrp.product_computer_desk_bolt_white_product_template
#: model:product.template,uom_name:stock_available_mrp.product_kit_1a_product_template
msgid "Unit(s)"
msgstr ""
#. module: stock_available_mrp
#: model:product.product,weight_uom_name:stock_available_mrp.product_computer_desk_bolt_white
#: model:product.product,weight_uom_name:stock_available_mrp.product_kit_1a
#: model:product.template,weight_uom_name:stock_available_mrp.product_computer_desk_bolt_white_product_template
#: model:product.template,weight_uom_name:stock_available_mrp.product_kit_1a_product_template
msgid "kg"
msgstr ""
#~ msgid "Product Template"
#~ msgstr "Plantilla de producto"

View File

@@ -0,0 +1,66 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_available_mrp
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: stock-logistics-warehouse (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-01-14 01:38+0000\n"
"PO-Revision-Date: 2016-01-13 16:35+0000\n"
"Last-Translator: <>\n"
"Language-Team: Finnish (http://www.transifex.com/oca/OCA-stock-logistics-"
"warehouse-8-0/language/fi/)\n"
"Language: fi\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: stock_available_mrp
#: model:ir.model.fields,field_description:stock_available_mrp.field_product_product__bom_id
msgid "BOM"
msgstr ""
#. module: stock_available_mrp
#: model:product.product,name:stock_available_mrp.product_computer_desk_bolt_white
#: model:product.template,name:stock_available_mrp.product_computer_desk_bolt_white_product_template
msgid "Bolt"
msgstr ""
#. module: stock_available_mrp
#: model:ir.model,name:stock_available_mrp.model_product_product
msgid "Product"
msgstr "Tuote"
#. module: stock_available_mrp
#: model:product.product,name:stock_available_mrp.product_kit_1a
#: model:product.template,name:stock_available_mrp.product_kit_1a_product_template
msgid "Table Kit"
msgstr ""
#. module: stock_available_mrp
#: model:product.product,description:stock_available_mrp.product_kit_1a
#: model:product.template,description:stock_available_mrp.product_kit_1a_product_template
msgid "Table kit"
msgstr ""
#. module: stock_available_mrp
#: model:product.product,uom_name:stock_available_mrp.product_computer_desk_bolt_white
#: model:product.product,uom_name:stock_available_mrp.product_kit_1a
#: model:product.template,uom_name:stock_available_mrp.product_computer_desk_bolt_white_product_template
#: model:product.template,uom_name:stock_available_mrp.product_kit_1a_product_template
msgid "Unit(s)"
msgstr ""
#. module: stock_available_mrp
#: model:product.product,weight_uom_name:stock_available_mrp.product_computer_desk_bolt_white
#: model:product.product,weight_uom_name:stock_available_mrp.product_kit_1a
#: model:product.template,weight_uom_name:stock_available_mrp.product_computer_desk_bolt_white_product_template
#: model:product.template,weight_uom_name:stock_available_mrp.product_kit_1a_product_template
msgid "kg"
msgstr ""
#~ msgid "Product Template"
#~ msgstr "Tuotteen malli"

View File

@@ -0,0 +1,67 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_available_mrp
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: stock-logistics-warehouse (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-01-14 01:38+0000\n"
"PO-Revision-Date: 2020-11-12 12:44+0000\n"
"Last-Translator: Yann Papouin <y.papouin@dec-industrie.com>\n"
"Language-Team: French (http://www.transifex.com/oca/"
"OCA-stock-logistics-warehouse-8-0/language/fr/)\n"
"Language: fr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n > 1;\n"
"X-Generator: Weblate 3.10\n"
#. module: stock_available_mrp
#: model:ir.model.fields,field_description:stock_available_mrp.field_product_product__bom_id
msgid "BOM"
msgstr "Nomenclature"
#. module: stock_available_mrp
#: model:product.product,name:stock_available_mrp.product_computer_desk_bolt_white
#: model:product.template,name:stock_available_mrp.product_computer_desk_bolt_white_product_template
msgid "Bolt"
msgstr "Boulon"
#. module: stock_available_mrp
#: model:ir.model,name:stock_available_mrp.model_product_product
msgid "Product"
msgstr "Article"
#. module: stock_available_mrp
#: model:product.product,name:stock_available_mrp.product_kit_1a
#: model:product.template,name:stock_available_mrp.product_kit_1a_product_template
msgid "Table Kit"
msgstr "Table en kit"
#. module: stock_available_mrp
#: model:product.product,description:stock_available_mrp.product_kit_1a
#: model:product.template,description:stock_available_mrp.product_kit_1a_product_template
msgid "Table kit"
msgstr "Table en kit"
#. module: stock_available_mrp
#: model:product.product,uom_name:stock_available_mrp.product_computer_desk_bolt_white
#: model:product.product,uom_name:stock_available_mrp.product_kit_1a
#: model:product.template,uom_name:stock_available_mrp.product_computer_desk_bolt_white_product_template
#: model:product.template,uom_name:stock_available_mrp.product_kit_1a_product_template
msgid "Unit(s)"
msgstr "Unité(s)"
#. module: stock_available_mrp
#: model:product.product,weight_uom_name:stock_available_mrp.product_computer_desk_bolt_white
#: model:product.product,weight_uom_name:stock_available_mrp.product_kit_1a
#: model:product.template,weight_uom_name:stock_available_mrp.product_computer_desk_bolt_white_product_template
#: model:product.template,weight_uom_name:stock_available_mrp.product_kit_1a_product_template
msgid "kg"
msgstr "kg"
#~ msgid "Product Template"
#~ msgstr "Modèle de produit"

View File

@@ -0,0 +1,97 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_available_mrp
#
# Translators:
# Bole <bole@dajmi5.com>, 2016
msgid ""
msgstr ""
"Project-Id-Version: stock-logistics-warehouse (9.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-06-12 19:59+0000\n"
"PO-Revision-Date: 2016-06-14 10:45+0000\n"
"Last-Translator: Bole <bole@dajmi5.com>\n"
"Language-Team: Croatian (Croatia) (http://www.transifex.com/oca/OCA-stock-"
"logistics-warehouse-9-0/language/hr_HR/)\n"
"Language: hr_HR\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
#. module: stock_available_mrp
#: model:ir.model.fields,field_description:stock_available_mrp.field_product_product__bom_id
msgid "BOM"
msgstr ""
#. module: stock_available_mrp
#: model:product.product,name:stock_available_mrp.product_computer_desk_bolt_white
#: model:product.template,name:stock_available_mrp.product_computer_desk_bolt_white_product_template
msgid "Bolt"
msgstr ""
#. module: stock_available_mrp
#: model:ir.model,name:stock_available_mrp.model_product_product
msgid "Product"
msgstr "Proizvod"
#. module: stock_available_mrp
#: model:product.product,name:stock_available_mrp.product_kit_1a
#: model:product.template,name:stock_available_mrp.product_kit_1a_product_template
msgid "Table Kit"
msgstr ""
#. module: stock_available_mrp
#: model:product.product,description:stock_available_mrp.product_kit_1a
#: model:product.template,description:stock_available_mrp.product_kit_1a_product_template
msgid "Table kit"
msgstr ""
#. module: stock_available_mrp
#: model:product.product,uom_name:stock_available_mrp.product_computer_desk_bolt_white
#: model:product.product,uom_name:stock_available_mrp.product_kit_1a
#: model:product.template,uom_name:stock_available_mrp.product_computer_desk_bolt_white_product_template
#: model:product.template,uom_name:stock_available_mrp.product_kit_1a_product_template
msgid "Unit(s)"
msgstr ""
#. module: stock_available_mrp
#: model:product.product,weight_uom_name:stock_available_mrp.product_computer_desk_bolt_white
#: model:product.product,weight_uom_name:stock_available_mrp.product_kit_1a
#: model:product.template,weight_uom_name:stock_available_mrp.product_computer_desk_bolt_white_product_template
#: model:product.template,weight_uom_name:stock_available_mrp.product_kit_1a_product_template
msgid "kg"
msgstr ""
#~ msgid "Product Template"
#~ msgstr "Predložak proizvoda"
#~ msgid "<span class=\"o_stat_text\">Potential</span>"
#~ msgstr "<span class=\"o_stat_text\">Potencijal</span>"
#~ msgid "Component ids"
#~ msgstr "ID-ovi komponenata"
#~ msgid "Potential"
#~ msgstr "Potencijal"
#~ msgid ""
#~ "Quantity of this Product that could be produced using the materials "
#~ "already at hand."
#~ msgstr ""
#~ "Količina ovog proizvoda nije mogla biti proizvedena korištenjem trenutno "
#~ "raspoloživih materijala."
#~ msgid ""
#~ "Quantity of this Product that could be produced using the materials "
#~ "already at hand. If the product has several variants, this will be the "
#~ "biggest quantity that can be made for a any single variant."
#~ msgstr ""
#~ "Količina ovog proizvoda koja može biti proizvodedna raspoloživim "
#~ "količinama sirovina. Ako proizvod ima nekoliko varijanti, ovo će biti "
#~ "najveća moguća količina koja se može proizvesti za svaku pojedinu "
#~ "varijantu."
#~ msgid "Thousand"
#~ msgstr "Tisuću"

View File

@@ -0,0 +1,63 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_available_mrp
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: stock-logistics-warehouse (9.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-09-04 10:11+0000\n"
"PO-Revision-Date: 2016-04-27 11:10+0000\n"
"Last-Translator: <>\n"
"Language-Team: Italian (http://www.transifex.com/oca/OCA-stock-logistics-"
"warehouse-9-0/language/it/)\n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: stock_available_mrp
#: model:ir.model.fields,field_description:stock_available_mrp.field_product_product__bom_id
msgid "BOM"
msgstr ""
#. module: stock_available_mrp
#: model:product.product,name:stock_available_mrp.product_computer_desk_bolt_white
#: model:product.template,name:stock_available_mrp.product_computer_desk_bolt_white_product_template
msgid "Bolt"
msgstr ""
#. module: stock_available_mrp
#: model:ir.model,name:stock_available_mrp.model_product_product
msgid "Product"
msgstr "Prodotto"
#. module: stock_available_mrp
#: model:product.product,name:stock_available_mrp.product_kit_1a
#: model:product.template,name:stock_available_mrp.product_kit_1a_product_template
msgid "Table Kit"
msgstr ""
#. module: stock_available_mrp
#: model:product.product,description:stock_available_mrp.product_kit_1a
#: model:product.template,description:stock_available_mrp.product_kit_1a_product_template
msgid "Table kit"
msgstr ""
#. module: stock_available_mrp
#: model:product.product,uom_name:stock_available_mrp.product_computer_desk_bolt_white
#: model:product.product,uom_name:stock_available_mrp.product_kit_1a
#: model:product.template,uom_name:stock_available_mrp.product_computer_desk_bolt_white_product_template
#: model:product.template,uom_name:stock_available_mrp.product_kit_1a_product_template
msgid "Unit(s)"
msgstr ""
#. module: stock_available_mrp
#: model:product.product,weight_uom_name:stock_available_mrp.product_computer_desk_bolt_white
#: model:product.product,weight_uom_name:stock_available_mrp.product_kit_1a
#: model:product.template,weight_uom_name:stock_available_mrp.product_computer_desk_bolt_white_product_template
#: model:product.template,weight_uom_name:stock_available_mrp.product_kit_1a_product_template
msgid "kg"
msgstr ""

View File

@@ -0,0 +1,95 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_available_mrp
#
# Translators:
# Claudio Araujo Santos <claudioaraujosantos@gmail.com>, 2016
msgid ""
msgstr ""
"Project-Id-Version: stock-logistics-warehouse (9.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-07-03 20:56+0000\n"
"PO-Revision-Date: 2016-07-07 19:41+0000\n"
"Last-Translator: Claudio Araujo Santos <claudioaraujosantos@gmail.com>\n"
"Language-Team: Portuguese (Brazil) (http://www.transifex.com/oca/OCA-stock-"
"logistics-warehouse-9-0/language/pt_BR/)\n"
"Language: pt_BR\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#. module: stock_available_mrp
#: model:ir.model.fields,field_description:stock_available_mrp.field_product_product__bom_id
msgid "BOM"
msgstr ""
#. module: stock_available_mrp
#: model:product.product,name:stock_available_mrp.product_computer_desk_bolt_white
#: model:product.template,name:stock_available_mrp.product_computer_desk_bolt_white_product_template
msgid "Bolt"
msgstr ""
#. module: stock_available_mrp
#: model:ir.model,name:stock_available_mrp.model_product_product
msgid "Product"
msgstr "Produto"
#. module: stock_available_mrp
#: model:product.product,name:stock_available_mrp.product_kit_1a
#: model:product.template,name:stock_available_mrp.product_kit_1a_product_template
msgid "Table Kit"
msgstr ""
#. module: stock_available_mrp
#: model:product.product,description:stock_available_mrp.product_kit_1a
#: model:product.template,description:stock_available_mrp.product_kit_1a_product_template
msgid "Table kit"
msgstr ""
#. module: stock_available_mrp
#: model:product.product,uom_name:stock_available_mrp.product_computer_desk_bolt_white
#: model:product.product,uom_name:stock_available_mrp.product_kit_1a
#: model:product.template,uom_name:stock_available_mrp.product_computer_desk_bolt_white_product_template
#: model:product.template,uom_name:stock_available_mrp.product_kit_1a_product_template
msgid "Unit(s)"
msgstr ""
#. module: stock_available_mrp
#: model:product.product,weight_uom_name:stock_available_mrp.product_computer_desk_bolt_white
#: model:product.product,weight_uom_name:stock_available_mrp.product_kit_1a
#: model:product.template,weight_uom_name:stock_available_mrp.product_computer_desk_bolt_white_product_template
#: model:product.template,weight_uom_name:stock_available_mrp.product_kit_1a_product_template
msgid "kg"
msgstr ""
#~ msgid "Product Template"
#~ msgstr "Modelo Produto"
#~ msgid "<span class=\"o_stat_text\">Potential</span>"
#~ msgstr "<span class=\"o_stat_text\">Potencial</span>"
#~ msgid "Component ids"
#~ msgstr "IDs de componentes"
#~ msgid "Potential"
#~ msgstr "Potencial"
#~ msgid ""
#~ "Quantity of this Product that could be produced using the materials "
#~ "already at hand."
#~ msgstr ""
#~ "Quantidade deste produto que poderia ser produzido usando os materiais já "
#~ "na mão."
#~ msgid ""
#~ "Quantity of this Product that could be produced using the materials "
#~ "already at hand. If the product has several variants, this will be the "
#~ "biggest quantity that can be made for a any single variant."
#~ msgstr ""
#~ "Quantidade deste produto que poderia ser produzido usando os materiais já "
#~ "na mão. Se o produto tiver várias variantes, esta será a maior quantidade "
#~ "que pode ser feito por qualquer uma única variante."
#~ msgid "Thousand"
#~ msgstr "Mil"

View File

@@ -0,0 +1,71 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_available_mrp
#
# Translators:
# Matjaž Mozetič <m.mozetic@matmoz.si>, 2016
msgid ""
msgstr ""
"Project-Id-Version: stock-logistics-warehouse (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-01-14 01:38+0000\n"
"PO-Revision-Date: 2016-01-14 05:18+0000\n"
"Last-Translator: Matjaž Mozetič <m.mozetic@matmoz.si>\n"
"Language-Team: Slovenian (http://www.transifex.com/oca/OCA-stock-logistics-"
"warehouse-8-0/language/sl/)\n"
"Language: sl\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n"
"%100==4 ? 2 : 3);\n"
#. module: stock_available_mrp
#: model:ir.model.fields,field_description:stock_available_mrp.field_product_product__bom_id
msgid "BOM"
msgstr ""
#. module: stock_available_mrp
#: model:product.product,name:stock_available_mrp.product_computer_desk_bolt_white
#: model:product.template,name:stock_available_mrp.product_computer_desk_bolt_white_product_template
msgid "Bolt"
msgstr ""
#. module: stock_available_mrp
#: model:ir.model,name:stock_available_mrp.model_product_product
msgid "Product"
msgstr "Proizvod"
#. module: stock_available_mrp
#: model:product.product,name:stock_available_mrp.product_kit_1a
#: model:product.template,name:stock_available_mrp.product_kit_1a_product_template
msgid "Table Kit"
msgstr ""
#. module: stock_available_mrp
#: model:product.product,description:stock_available_mrp.product_kit_1a
#: model:product.template,description:stock_available_mrp.product_kit_1a_product_template
msgid "Table kit"
msgstr ""
#. module: stock_available_mrp
#: model:product.product,uom_name:stock_available_mrp.product_computer_desk_bolt_white
#: model:product.product,uom_name:stock_available_mrp.product_kit_1a
#: model:product.template,uom_name:stock_available_mrp.product_computer_desk_bolt_white_product_template
#: model:product.template,uom_name:stock_available_mrp.product_kit_1a_product_template
msgid "Unit(s)"
msgstr ""
#. module: stock_available_mrp
#: model:product.product,weight_uom_name:stock_available_mrp.product_computer_desk_bolt_white
#: model:product.product,weight_uom_name:stock_available_mrp.product_kit_1a
#: model:product.template,weight_uom_name:stock_available_mrp.product_computer_desk_bolt_white_product_template
#: model:product.template,weight_uom_name:stock_available_mrp.product_kit_1a_product_template
msgid "kg"
msgstr ""
#~ msgid "Product Template"
#~ msgstr "Predloga proizvoda"
#~ msgid "Thousand"
#~ msgstr "Tisoč"

View File

@@ -0,0 +1,59 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_available_mrp
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: stock_available_mrp
#: model:ir.model.fields,field_description:stock_available_mrp.field_product_product__bom_id
msgid "BOM"
msgstr ""
#. module: stock_available_mrp
#: model:product.product,name:stock_available_mrp.product_computer_desk_bolt_white
#: model:product.template,name:stock_available_mrp.product_computer_desk_bolt_white_product_template
msgid "Bolt"
msgstr ""
#. module: stock_available_mrp
#: model:ir.model,name:stock_available_mrp.model_product_product
msgid "Product"
msgstr ""
#. module: stock_available_mrp
#: model:product.product,name:stock_available_mrp.product_kit_1a
#: model:product.template,name:stock_available_mrp.product_kit_1a_product_template
msgid "Table Kit"
msgstr ""
#. module: stock_available_mrp
#: model:product.product,description:stock_available_mrp.product_kit_1a
#: model:product.template,description:stock_available_mrp.product_kit_1a_product_template
msgid "Table kit"
msgstr ""
#. module: stock_available_mrp
#: model:product.product,uom_name:stock_available_mrp.product_computer_desk_bolt_white
#: model:product.product,uom_name:stock_available_mrp.product_kit_1a
#: model:product.template,uom_name:stock_available_mrp.product_computer_desk_bolt_white_product_template
#: model:product.template,uom_name:stock_available_mrp.product_kit_1a_product_template
msgid "Unit(s)"
msgstr ""
#. module: stock_available_mrp
#: model:product.product,weight_uom_name:stock_available_mrp.product_computer_desk_bolt_white
#: model:product.product,weight_uom_name:stock_available_mrp.product_kit_1a
#: model:product.template,weight_uom_name:stock_available_mrp.product_computer_desk_bolt_white_product_template
#: model:product.template,weight_uom_name:stock_available_mrp.product_kit_1a_product_template
msgid "kg"
msgstr ""

View File

@@ -0,0 +1,77 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_available_mrp
#
# Translators:
# Jeffery Chenn <jeffery9@gmail.com>, 2016
msgid ""
msgstr ""
"Project-Id-Version: stock-logistics-warehouse (9.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-08-28 10:00+0000\n"
"PO-Revision-Date: 2019-09-26 15:05+0000\n"
"Last-Translator: 黎伟杰 <674416404@qq.com>\n"
"Language-Team: Chinese (China) (http://www.transifex.com/oca/"
"OCA-stock-logistics-warehouse-9-0/language/zh_CN/)\n"
"Language: zh_CN\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=1; plural=0;\n"
"X-Generator: Weblate 3.8\n"
#. module: stock_available_mrp
#: model:ir.model.fields,field_description:stock_available_mrp.field_product_product__bom_id
msgid "BOM"
msgstr "BOM"
#. module: stock_available_mrp
#: model:product.product,name:stock_available_mrp.product_computer_desk_bolt_white
#: model:product.template,name:stock_available_mrp.product_computer_desk_bolt_white_product_template
msgid "Bolt"
msgstr "螺栓"
#. module: stock_available_mrp
#: model:ir.model,name:stock_available_mrp.model_product_product
msgid "Product"
msgstr "产品"
#. module: stock_available_mrp
#: model:product.product,name:stock_available_mrp.product_kit_1a
#: model:product.template,name:stock_available_mrp.product_kit_1a_product_template
msgid "Table Kit"
msgstr "桌台套件"
#. module: stock_available_mrp
#: model:product.product,description:stock_available_mrp.product_kit_1a
#: model:product.template,description:stock_available_mrp.product_kit_1a_product_template
msgid "Table kit"
msgstr "桌台套件"
#. module: stock_available_mrp
#: model:product.product,uom_name:stock_available_mrp.product_computer_desk_bolt_white
#: model:product.product,uom_name:stock_available_mrp.product_kit_1a
#: model:product.template,uom_name:stock_available_mrp.product_computer_desk_bolt_white_product_template
#: model:product.template,uom_name:stock_available_mrp.product_kit_1a_product_template
msgid "Unit(s)"
msgstr "件"
#. module: stock_available_mrp
#: model:product.product,weight_uom_name:stock_available_mrp.product_computer_desk_bolt_white
#: model:product.product,weight_uom_name:stock_available_mrp.product_kit_1a
#: model:product.template,weight_uom_name:stock_available_mrp.product_computer_desk_bolt_white_product_template
#: model:product.template,weight_uom_name:stock_available_mrp.product_kit_1a_product_template
msgid "kg"
msgstr "公斤"
#~ msgid "Product Template"
#~ msgstr "产品模板"
#~ msgid "<span class=\"o_stat_text\">Potential</span>"
#~ msgstr "<span class=\"o_stat_text\">潜在</span>"
#~ msgid "Potential"
#~ msgstr "潜在"
#~ msgid "Thousand"
#~ msgstr "千"

View File

@@ -0,0 +1,4 @@
# Copyright 2014 Numérigraphe SARL
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import product_product

View File

@@ -0,0 +1,139 @@
# Copyright 2014 Numérigraphe SARL
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from collections import Counter
from odoo import api, fields, models
from odoo.fields import first
class ProductProduct(models.Model):
_inherit = "product.product"
bom_id = fields.Many2one(
comodel_name="mrp.bom", compute="_compute_bom_id", string="BOM"
)
@api.depends("virtual_available", "bom_id", "bom_id.product_qty")
def _compute_available_quantities(self):
super()._compute_available_quantities()
def _get_bom_id_domain(self):
"""
Real multi domain
:return:
"""
return [
"|",
("product_id", "in", self.ids),
"&",
("product_id", "=", False),
("product_tmpl_id", "in", self.mapped("product_tmpl_id.id")),
]
@api.depends("product_tmpl_id")
def _compute_bom_id(self):
bom_obj = self.env["mrp.bom"]
boms = bom_obj.search(self._get_bom_id_domain(), order="sequence, product_id")
for product in self:
product.bom_id = product.bom_id
product_boms = boms.filtered(
lambda b: b.product_id == product
or (not b.product_id and b.product_tmpl_id == product.product_tmpl_id)
)
if product_boms:
product.bom_id = first(product_boms)
def _compute_available_quantities_dict(self):
res, stock_dict = super()._compute_available_quantities_dict()
# compute qty for product with bom
product_with_bom = self.filtered("bom_id")
if not product_with_bom:
return res, stock_dict
icp = self.env["ir.config_parameter"]
stock_available_mrp_based_on = icp.sudo().get_param(
"stock_available_mrp_based_on", "qty_available"
)
# explode all boms at once
exploded_boms = product_with_bom._explode_boms()
# extract the list of product used as bom component
component_products = self.env["product.product"].browse()
for exploded_components in exploded_boms.values():
for bom_component in exploded_components:
component_products |= first(bom_component).product_id
# Compute stock for product components.
# {'productid': {field_name: qty}}
if res and stock_available_mrp_based_on in list(res.values())[0]:
# If the qty is computed by the same method use it to avoid
# stressing the cache
component_qties, _ = component_products._compute_available_quantities_dict()
else:
# The qty is a field computed by an other method than the
# current one. Take the value on the record.
component_qties = {
p.id: {stock_available_mrp_based_on: p[stock_available_mrp_based_on]}
for p in component_products
}
for product in product_with_bom:
# Need by product (same product can be in many BOM lines/levels)
exploded_components = exploded_boms[product.id]
component_needs = product._get_components_needs(exploded_components)
if not component_needs:
# The BoM has no line we can use
potential_qty = immediately_usable_qty = 0.0
else:
# Find the lowest quantity we can make with the stock at hand
components_potential_qty = min(
[
component_qties[component.id][stock_available_mrp_based_on]
/ need
for component, need in component_needs.items()
]
)
bom_id = product.bom_id
potential_qty = bom_id.product_qty * components_potential_qty
potential_qty = potential_qty > 0.0 and potential_qty or 0.0
# We want to respect the rounding factor of the potential_qty
# Rounding down as we want to be pesimistic.
potential_qty = bom_id.product_uom_id._compute_quantity(
potential_qty,
product.bom_id.product_tmpl_id.uom_id,
rounding_method="DOWN",
)
res[product.id]["potential_qty"] = potential_qty
immediately_usable_qty = potential_qty if bom_id.type != "phantom" else 0
res[product.id]["immediately_usable_qty"] += immediately_usable_qty
return res, stock_dict
def _explode_boms(self):
"""
return a dict by product_id of exploded bom lines
:return:
"""
exploded_boms = {}
for rec in self:
exploded_boms[rec.id] = rec.bom_id.explode(rec, 1.0)[1]
return exploded_boms
@api.model
def _get_components_needs(self, exploded_components):
""" Return the needed qty of each compoments in the exploded_components
:type exploded_components
:rtype: collections.Counter
"""
needs = Counter()
for bom_component in exploded_components:
component = bom_component[0].product_id
needs += Counter({component: bom_component[1]["qty"]})
return needs

View File

@@ -0,0 +1,10 @@
* Loïc Bellier (Numérigraphe) <lb@numerigraphe.com>
* Lionel Sausin (Numérigraphe) <ls@numerigraphe.com>
* many thanks to Graeme Gellatly for his advice and code review
* Laurent Mignon <laurent.mignon@acsone.eu>
* Cédric Pigeon <cedric.pigeon@acsone.eu>
* Florian da Costa <florian.dacosta@akretion.com>
* `Tecnativa <https://www.tecnativa.com>`_:
* Víctor Martínez

View File

@@ -0,0 +1,6 @@
This module takes the potential quantities available for Products into account in
the quantity available to promise, where the "Potential quantity" is the
quantity that can be manufactured with the components immediately at hand.
By configuration, the "Potential quantity" can be computed based on other product field.
For example, "Potential quantity" can be the quantity that can be manufactured
with the components available to promise.

View File

@@ -0,0 +1,41 @@
Known issues
~~~~~~~~~~~~
The manufacturing delays are not taken into account : this module assumes that
if you have components in stock goods, you can manufacture finished goods
quickly enough.
As a consequence, and to avoid overestimating, **only the first level** of Bill
of Materials is considered.
However Sets (a.k.a "phantom" BoMs) are taken into account: if a component must
be replaced with a set, it's the stock of the set's product which will decide
the potential.
If a product has several variants, only the variant with the biggest potential
will be taken into account when reporting the production potential. For
example, even if you actually have enough components to make 10 iPads 16Go AND
42 iPads 32Go, we'll consider that you can promise only 42 iPads.
Removed features
~~~~~~~~~~~~~~~~
Previous versions of this module used to let programmers demand to get the
potential quantity in an arbitrary Unit of Measure using the `context`. This
feature was present in the standard computations too until v8.0, but it has
been dropped from the standard from v8.0 on.
For the sake of consistency the potential quantity is now always reported in
the product's main Unit of Measure too.
Roadmap
~~~~~~~
Possible improvements for future versions:
* Take manufacturing delays into account: we should not promise goods to
customers if they want them delivered earlier that we can make them
* Compute the quantity of finished product that can be made directly on each
Bill of Material: this would be useful for production managers, and may make
the computations faster by avoiding to compute the same BoM several times
when several variants share the same BoM.
* Add an option (probably as a sub-module) to consider all raw materials as
available if they can be bought from the suppliers in time for the
manufacturing.

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

View File

@@ -0,0 +1,477 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.15.1: http://docutils.sourceforge.net/" />
<title>Consider the production potential is available to promise</title>
<style type="text/css">
/*
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 7952 2016-07-26 18:15:59Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
customize this style sheet.
*/
/* used to remove borders from tables and images */
.borderless, table.borderless td, table.borderless th {
border: 0 }
table.borderless td, table.borderless th {
/* Override padding for "table.docutils td" with "! important".
The right padding separates the table cells. */
padding: 0 0.5em 0 0 ! important }
.first {
/* Override more specific margin styles with "! important". */
margin-top: 0 ! important }
.last, .with-subtitle {
margin-bottom: 0 ! important }
.hidden {
display: none }
.subscript {
vertical-align: sub;
font-size: smaller }
.superscript {
vertical-align: super;
font-size: smaller }
a.toc-backref {
text-decoration: none ;
color: black }
blockquote.epigraph {
margin: 2em 5em ; }
dl.docutils dd {
margin-bottom: 0.5em }
object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
overflow: hidden;
}
/* Uncomment (and remove this text!) to get bold-faced definition list terms
dl.docutils dt {
font-weight: bold }
*/
div.abstract {
margin: 2em 5em }
div.abstract p.topic-title {
font-weight: bold ;
text-align: center }
div.admonition, div.attention, div.caution, div.danger, div.error,
div.hint, div.important, div.note, div.tip, div.warning {
margin: 2em ;
border: medium outset ;
padding: 1em }
div.admonition p.admonition-title, div.hint p.admonition-title,
div.important p.admonition-title, div.note p.admonition-title,
div.tip p.admonition-title {
font-weight: bold ;
font-family: sans-serif }
div.attention p.admonition-title, div.caution p.admonition-title,
div.danger p.admonition-title, div.error p.admonition-title,
div.warning p.admonition-title, .code .error {
color: red ;
font-weight: bold ;
font-family: sans-serif }
/* Uncomment (and remove this text!) to get reduced vertical space in
compound paragraphs.
div.compound .compound-first, div.compound .compound-middle {
margin-bottom: 0.5em }
div.compound .compound-last, div.compound .compound-middle {
margin-top: 0.5em }
*/
div.dedication {
margin: 2em 5em ;
text-align: center ;
font-style: italic }
div.dedication p.topic-title {
font-weight: bold ;
font-style: normal }
div.figure {
margin-left: 2em ;
margin-right: 2em }
div.footer, div.header {
clear: both;
font-size: smaller }
div.line-block {
display: block ;
margin-top: 1em ;
margin-bottom: 1em }
div.line-block div.line-block {
margin-top: 0 ;
margin-bottom: 0 ;
margin-left: 1.5em }
div.sidebar {
margin: 0 0 0.5em 1em ;
border: medium outset ;
padding: 1em ;
background-color: #ffffee ;
width: 40% ;
float: right ;
clear: right }
div.sidebar p.rubric {
font-family: sans-serif ;
font-size: medium }
div.system-messages {
margin: 5em }
div.system-messages h1 {
color: red }
div.system-message {
border: medium outset ;
padding: 1em }
div.system-message p.system-message-title {
color: red ;
font-weight: bold }
div.topic {
margin: 2em }
h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
margin-top: 0.4em }
h1.title {
text-align: center }
h2.subtitle {
text-align: center }
hr.docutils {
width: 75% }
img.align-left, .figure.align-left, object.align-left, table.align-left {
clear: left ;
float: left ;
margin-right: 1em }
img.align-right, .figure.align-right, object.align-right, table.align-right {
clear: right ;
float: right ;
margin-left: 1em }
img.align-center, .figure.align-center, object.align-center {
display: block;
margin-left: auto;
margin-right: auto;
}
table.align-center {
margin-left: auto;
margin-right: auto;
}
.align-left {
text-align: left }
.align-center {
clear: both ;
text-align: center }
.align-right {
text-align: right }
/* reset inner alignment in figures */
div.align-right {
text-align: inherit }
/* div.align-center * { */
/* text-align: left } */
.align-top {
vertical-align: top }
.align-middle {
vertical-align: middle }
.align-bottom {
vertical-align: bottom }
ol.simple, ul.simple {
margin-bottom: 1em }
ol.arabic {
list-style: decimal }
ol.loweralpha {
list-style: lower-alpha }
ol.upperalpha {
list-style: upper-alpha }
ol.lowerroman {
list-style: lower-roman }
ol.upperroman {
list-style: upper-roman }
p.attribution {
text-align: right ;
margin-left: 50% }
p.caption {
font-style: italic }
p.credits {
font-style: italic ;
font-size: smaller }
p.label {
white-space: nowrap }
p.rubric {
font-weight: bold ;
font-size: larger ;
color: maroon ;
text-align: center }
p.sidebar-title {
font-family: sans-serif ;
font-weight: bold ;
font-size: larger }
p.sidebar-subtitle {
font-family: sans-serif ;
font-weight: bold }
p.topic-title {
font-weight: bold }
pre.address {
margin-bottom: 0 ;
margin-top: 0 ;
font: inherit }
pre.literal-block, pre.doctest-block, pre.math, pre.code {
margin-left: 2em ;
margin-right: 2em }
pre.code .ln { color: grey; } /* 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 }
pre.code .literal.string, code .literal.string { color: #0C5404 }
pre.code .name.builtin, code .name.builtin { color: #352B84 }
pre.code .deleted, code .deleted { background-color: #DEB0A1}
pre.code .inserted, code .inserted { background-color: #A3D289}
span.classifier {
font-family: sans-serif ;
font-style: oblique }
span.classifier-delimiter {
font-family: sans-serif ;
font-weight: bold }
span.interpreted {
font-family: sans-serif }
span.option {
white-space: nowrap }
span.pre {
white-space: pre }
span.problematic {
color: red }
span.section-subtitle {
/* font-size relative to parent (h1..h6 element) */
font-size: 80% }
table.citation {
border-left: solid 1px gray;
margin-left: 1px }
table.docinfo {
margin: 2em 4em }
table.docutils {
margin-top: 0.5em ;
margin-bottom: 0.5em }
table.footnote {
border-left: solid 1px black;
margin-left: 1px }
table.docutils td, table.docutils th,
table.docinfo td, table.docinfo th {
padding-left: 0.5em ;
padding-right: 0.5em ;
vertical-align: top }
table.docutils th.field-name, table.docinfo th.docinfo-name {
font-weight: bold ;
text-align: left ;
white-space: nowrap ;
padding-left: 0 }
/* "booktabs" style (no vertical lines) */
table.docutils.booktabs {
border: 0px;
border-top: 2px solid;
border-bottom: 2px solid;
border-collapse: collapse;
}
table.docutils.booktabs * {
border: 0px;
}
table.docutils.booktabs th {
border-bottom: thin solid;
text-align: left;
}
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
font-size: 100% }
ul.auto-toc {
list-style-type: none }
</style>
</head>
<body>
<div class="document" id="consider-the-production-potential-is-available-to-promise">
<h1 class="title">Consider the production potential is available to promise</h1>
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" 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" 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_mrp"><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_mrp"><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>
<p>This module takes the potential quantities available for Products into account in
the quantity available to promise, where the “Potential quantity” is the
quantity that can be manufactured with the components immediately at hand.
By configuration, the “Potential quantity” can be computed based on other product field.
For example, “Potential quantity” can be the quantity that can be manufactured
with the components available to promise.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#known-issues-roadmap" id="id1">Known issues / Roadmap</a><ul>
<li><a class="reference internal" href="#known-issues" id="id2">Known issues</a></li>
<li><a class="reference internal" href="#removed-features" id="id3">Removed features</a></li>
<li><a class="reference internal" href="#roadmap" id="id4">Roadmap</a></li>
</ul>
</li>
<li><a class="reference internal" href="#bug-tracker" id="id5">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="id6">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="id7">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="id8">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="id9">Maintainers</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="known-issues-roadmap">
<h1><a class="toc-backref" href="#id1">Known issues / Roadmap</a></h1>
<div class="section" id="known-issues">
<h2><a class="toc-backref" href="#id2">Known issues</a></h2>
<p>The manufacturing delays are not taken into account : this module assumes that
if you have components in stock goods, you can manufacture finished goods
quickly enough.</p>
<p>As a consequence, and to avoid overestimating, <strong>only the first level</strong> of Bill
of Materials is considered.</p>
<p>However Sets (a.k.a “phantom” BoMs) are taken into account: if a component must
be replaced with a set, its the stock of the sets product which will decide
the potential.</p>
<p>If a product has several variants, only the variant with the biggest potential
will be taken into account when reporting the production potential. For
example, even if you actually have enough components to make 10 iPads 16Go AND
42 iPads 32Go, well consider that you can promise only 42 iPads.</p>
</div>
<div class="section" id="removed-features">
<h2><a class="toc-backref" href="#id3">Removed features</a></h2>
<p>Previous versions of this module used to let programmers demand to get the
potential quantity in an arbitrary Unit of Measure using the <cite>context</cite>. This
feature was present in the standard computations too until v8.0, but it has
been dropped from the standard from v8.0 on.</p>
<p>For the sake of consistency the potential quantity is now always reported in
the products main Unit of Measure too.</p>
</div>
<div class="section" id="roadmap">
<h2><a class="toc-backref" href="#id4">Roadmap</a></h2>
<p>Possible improvements for future versions:</p>
<ul class="simple">
<li>Take manufacturing delays into account: we should not promise goods to
customers if they want them delivered earlier that we can make them</li>
<li>Compute the quantity of finished product that can be made directly on each
Bill of Material: this would be useful for production managers, and may make
the computations faster by avoiding to compute the same BoM several times
when several variants share the same BoM.</li>
<li>Add an option (probably as a sub-module) to consider all raw materials as
available if they can be bought from the suppliers in time for the
manufacturing.</li>
</ul>
</div>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#id5">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/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 smashing it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/stock-logistics-warehouse/issues/new?body=module:%20stock_available_mrp%0Aversion:%2012.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">
<h1><a class="toc-backref" href="#id6">Credits</a></h1>
<div class="section" id="authors">
<h2><a class="toc-backref" href="#id7">Authors</a></h2>
<ul class="simple">
<li>Numérigraphe</li>
</ul>
</div>
<div class="section" id="contributors">
<h2><a class="toc-backref" href="#id8">Contributors</a></h2>
<ul class="simple">
<li>Loïc Bellier (Numérigraphe) &lt;<a class="reference external" href="mailto:lb&#64;numerigraphe.com">lb&#64;numerigraphe.com</a>&gt;</li>
<li>Lionel Sausin (Numérigraphe) &lt;<a class="reference external" href="mailto:ls&#64;numerigraphe.com">ls&#64;numerigraphe.com</a>&gt;</li>
<li>many thanks to Graeme Gellatly for his advice and code review</li>
<li>Laurent Mignon &lt;<a class="reference external" href="mailto:laurent.mignon&#64;acsone.eu">laurent.mignon&#64;acsone.eu</a>&gt;</li>
<li>Cédric Pigeon &lt;<a class="reference external" href="mailto:cedric.pigeon&#64;acsone.eu">cedric.pigeon&#64;acsone.eu</a>&gt;</li>
<li>Florian da Costa &lt;<a class="reference external" href="mailto:florian.dacosta&#64;akretion.com">florian.dacosta&#64;akretion.com</a>&gt;</li>
</ul>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#id9">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>
<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/stock-logistics-warehouse/tree/12.0/stock_available_mrp">OCA/stock-logistics-warehouse</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>
</div>
</body>
</html>

View File

@@ -0,0 +1,4 @@
# Copyright 2014 Numérigraphe SARL
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import test_potential_qty

View File

@@ -0,0 +1,394 @@
# Copyright 2014 Numérigraphe SARL
# Copyright 2021 Tecnativa - Víctor Martínez
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo.osv.expression import TRUE_LEAF
from odoo.tests.common import TransactionCase
class TestPotentialQty(TransactionCase):
"""Test the potential quantity on a product with a multi-line BoM"""
def setUp(self):
super().setUp()
self.product_model = self.env["product.product"]
self.bom_model = self.env["mrp.bom"]
self.bom_line_model = self.env["mrp.bom.line"]
self.stock_quant_model = self.env["stock.quant"]
self.config = self.env["ir.config_parameter"]
self.location = self.env["stock.location"]
self.main_company = self.browse_ref("base.main_company")
# Get the warehouses
self.wh_main = self.browse_ref("stock.warehouse0")
self.wh_ch = self.browse_ref("stock.stock_warehouse_shop0")
#  An interesting product (multi-line BoM, variants)
self.tmpl = self.browse_ref("mrp.product_product_table_kit_product_template")
#  First variant
self.var1 = self.browse_ref("mrp.product_product_table_kit")
#  Second variant
self.var2 = self.browse_ref("stock_available_mrp.product_kit_1a")
# Make bolt a stockable product to be able to change its stock
# we need to unreserve the existing move before being able to do it.
bolt = self.env.ref("mrp.product_product_computer_desk_bolt")
bolt.stock_move_ids._do_unreserve()
bolt.type = "product"
# Components that can be used to make the product
components = [
# Bolt
bolt,
# Wood Panel
self.browse_ref("mrp.product_product_wood_panel"),
]
# Zero-out the inventory of all variants and components
for component in components + [v for v in self.tmpl.product_variant_ids]:
component.stock_quant_ids.unlink()
#  A product without a BoM
self.product_wo_bom = self.browse_ref("product.product_product_11")
# Record the initial quantity available for sale
self.initial_usable_qties = {
i.id: i.immediately_usable_qty
for i in [self.tmpl, self.var1, self.var2, self.product_wo_bom]
}
def _create_inventory(self, location_id, company_id):
inventory = self.env["stock.inventory"].create(
{
"name": "Test inventory",
"company_id": company_id,
"location_ids": [(4, location_id)],
"start_empty": True,
}
)
inventory.action_start()
return inventory
def _create_inventory_line(self, inventory_id, product_id, location_id, qty):
self.env["stock.inventory.line"].create(
{
"inventory_id": inventory_id,
"product_id": product_id,
"location_id": location_id,
"product_qty": qty,
}
)
def create_inventory(self, product_id, qty, location_id=None, company_id=None):
if location_id is None:
location_id = self.wh_main.lot_stock_id.id
if company_id is None:
company_id = self.main_company.id
inventory = self._create_inventory(location_id, company_id)
self._create_inventory_line(inventory.id, product_id, location_id, qty)
inventory._action_done()
def create_simple_bom(
self, product, sub_product, product_qty=1, sub_product_qty=1, routing_id=False
):
bom = self.bom_model.create(
{
"product_tmpl_id": product.product_tmpl_id.id,
"product_id": product.id,
"product_qty": product_qty,
"routing_id": routing_id,
}
)
self.bom_line_model.create(
{
"bom_id": bom.id,
"product_id": sub_product.id,
"product_qty": sub_product_qty,
}
)
return bom
def assertPotentialQty(self, record, qty, msg):
record.refresh()
# Check the potential
self.assertEqual(record.potential_qty, qty, msg)
# Check the variation of quantity available for sale
self.assertEqual(
(record.immediately_usable_qty - self.initial_usable_qties[record.id]),
qty,
msg,
)
def test_potential_qty_no_bom(self):
#  Check the potential when there's no BoM
self.assertPotentialQty(
self.product_wo_bom, 0.0, "The potential without a BoM should be 0"
)
def test_potential_qty_no_bom_for_company(self):
chicago_id = self.ref("stock.res_company_1")
# Receive 1000x Wood Panel owned by Chicago
self.create_inventory(
product_id=self.env.ref("mrp.product_product_wood_panel").id,
qty=1000.0,
location_id=self.wh_ch.lot_stock_id.id,
company_id=chicago_id,
)
# Put Bolt owned by Chicago for 1000x the 1st variant in main WH
self.create_inventory(
product_id=self.env.ref("mrp.product_product_computer_desk_bolt").id,
qty=1000.0,
location_id=self.wh_ch.lot_stock_id.id,
company_id=chicago_id,
)
self.assertPotentialQty(
self.tmpl, 250.0, "Wrong template potential after receiving components"
)
test_user = self.env["res.users"].create(
{
"name": "test_demo",
"login": "test_demo",
"company_id": self.main_company.id,
"company_ids": [(4, self.main_company.id), (4, chicago_id)],
"groups_id": [
(4, self.ref("stock.group_stock_user")),
(4, self.ref("mrp.group_mrp_user")),
],
}
)
bom = self.env["mrp.bom"].search([("product_tmpl_id", "=", self.tmpl.id)])
test_user_tmpl = self.tmpl.with_user(test_user)
self.assertPotentialQty(
test_user_tmpl, 250.0, "Simple user can access to the potential_qty"
)
# Set the bom on the main company (visible to members of main company)
# and all products without company (visible to all)
# and the demo user on Chicago (child of main company)
self.env["product.product"].search([TRUE_LEAF]).write({"company_id": False})
test_user.write({"company_ids": [(6, 0, self.main_company.ids)]})
bom.company_id = self.main_company
self.assertPotentialQty(
test_user_tmpl,
0,
"The bom should not be visible to non members of the bom's "
"company or company child of the bom's company",
)
bom.company_id = chicago_id
test_user.write({"company_ids": [(4, chicago_id)]})
self.assertPotentialQty(test_user_tmpl, 250.0, "")
def test_potential_qty(self):
for i in [self.tmpl, self.var1, self.var2]:
self.assertPotentialQty(i, 0.0, "The potential quantity should start at 0")
# Receive 1000x Wood Panel
self.create_inventory(
product_id=self.env.ref("mrp.product_product_wood_panel").id,
qty=1000.0,
location_id=self.wh_main.lot_stock_id.id,
)
for i in [self.tmpl, self.var1, self.var2]:
self.assertPotentialQty(
i,
0.0,
"Receiving a single component should not change the "
"potential of %s" % i,
)
# Receive enough bolt to make 1000x the 1st variant in main WH
self.create_inventory(
product_id=self.env.ref("mrp.product_product_computer_desk_bolt").id,
qty=1000.0,
location_id=self.wh_main.lot_stock_id.id,
)
self.assertPotentialQty(
self.tmpl, 250.0, "Wrong template potential after receiving components"
)
self.assertPotentialQty(
self.var1, 250.0, "Wrong variant 1 potential after receiving components"
)
self.assertPotentialQty(
self.var2,
0.0,
"Receiving variant 1's component should not change "
"variant 2's potential",
)
# Receive enough components to make 213 the 2nd variant at Chicago
inventory = self._create_inventory(
self.wh_ch.lot_stock_id.id, self.ref("stock.res_company_1")
)
self._create_inventory_line(
inventory.id,
self.ref("mrp.product_product_wood_panel"),
self.wh_ch.lot_stock_id.id,
1000.0,
)
self._create_inventory_line(
inventory.id,
self.ref("stock_available_mrp.product_computer_desk_bolt_white"),
self.wh_ch.lot_stock_id.id,
852.0,
)
inventory._action_done()
self.assertPotentialQty(
self.tmpl.with_context(test=True),
250.0,
"Wrong template potential after receiving components",
)
self.assertPotentialQty(
self.var1,
250.0,
"Receiving variant 2's component should not change "
"variant 1's potential",
)
self.assertPotentialQty(
self.var2, 213.0, "Wrong variant 2 potential after receiving components"
)
# Check by warehouse
self.assertPotentialQty(
self.tmpl.with_context(warehouse=self.wh_main.id),
250.0,
"Wrong potential quantity in main WH",
)
self.assertPotentialQty(
self.tmpl.with_context(warehouse=self.wh_ch.id),
213.0,
"Wrong potential quantity in Chicago WH",
)
# Check by location
self.assertPotentialQty(
self.tmpl.with_context(location=self.wh_main.lot_stock_id.id),
250.0,
"Wrong potential quantity in main WH location",
)
self.assertPotentialQty(
self.tmpl.with_context(location=self.wh_ch.lot_stock_id.id),
213.0,
"Wrong potential quantity in Chicago WH location",
)
def test_multi_unit_recursive_bom(self):
# Test multi-level and multi-units BOM
uom_unit = self.env.ref("uom.product_uom_unit")
uom_unit.rounding = 1.0
p1 = self.product_model.create(
{
"name": "Test product with BOM",
"type": "product",
"uom_id": self.env.ref("uom.product_uom_unit").id,
}
)
p2 = self.product_model.create(
{
"name": "Test sub product with BOM",
"type": "consu",
"uom_id": self.env.ref("uom.product_uom_unit").id,
}
)
p3 = self.product_model.create(
{
"name": "Test component",
"type": "product",
"uom_id": self.env.ref("uom.product_uom_unit").id,
}
)
bom_p1 = self.bom_model.create(
{"product_tmpl_id": p1.product_tmpl_id.id, "product_id": p1.id}
)
self.bom_line_model.create(
{
"bom_id": bom_p1.id,
"product_id": p3.id,
"product_qty": 1,
"product_uom_id": self.env.ref("uom.product_uom_unit").id,
}
)
# Two p2 which have a bom
self.bom_line_model.create(
{
"bom_id": bom_p1.id,
"product_id": p2.id,
"product_qty": 2,
"product_uom_id": self.env.ref("uom.product_uom_unit").id,
}
)
bom_p2 = self.bom_model.create(
{
"product_tmpl_id": p2.product_tmpl_id.id,
"product_id": p2.id,
"type": "phantom",
}
)
# p2 need 2 unit of component
self.bom_line_model.create(
{
"bom_id": bom_p2.id,
"product_id": p3.id,
"product_qty": 2,
"product_uom_id": self.env.ref("uom.product_uom_unit").id,
}
)
p1.refresh()
# Need a least 5 units for one P1
self.assertEqual(0, p1.potential_qty)
self.create_inventory(p3.id, 1)
p1.refresh()
self.assertEqual(0, p1.potential_qty)
self.create_inventory(p3.id, 3)
p1.refresh()
self.assertEqual(0, p1.potential_qty)
self.create_inventory(p3.id, 5)
p1.refresh()
self.assertEqual(1.0, p1.potential_qty)
self.create_inventory(p3.id, 6)
p1.refresh()
self.assertEqual(1.0, p1.potential_qty)
self.create_inventory(p3.id, 10)
p1.refresh()
self.assertEqual(2.0, p1.potential_qty)
def test_potential_qty_list(self):
# Try to highlight a bug when _get_potential_qty is called on
# a recordset with multiple products
# Recursive compute is not working
p1 = self.product_model.create({"name": "Test P1"})
p2 = self.product_model.create({"name": "Test P2"})
p3 = self.product_model.create({"name": "Test P3", "type": "product"})
self.config.set_param("stock_available_mrp_based_on", "immediately_usable_qty")
# P1 need one P2
self.create_simple_bom(p1, p2)
# P2 need one P3
self.create_simple_bom(p2, p3)
self.create_inventory(p3.id, 3)
self.product_model.invalidate_cache()
products = self.product_model.search([("id", "in", [p1.id, p2.id, p3.id])])
self.assertEqual(
{p1.id: 3.0, p2.id: 3.0, p3.id: 0.0},
{p.id: p.potential_qty for p in products},
)