mirror of
https://github.com/OCA/stock-logistics-warehouse.git
synced 2025-01-21 14:27:28 +02:00
[ADD] stock_available
Generic module to compute the stock quantity available to promise using several implementations. stock_available_immediatly is changed to become the first optional implementation. Cherry pick of commit0b060f619ffrom the v7 branch [IMP] stock_available* uses new API [ADD] stock_available_mrp Module to take immediate manufaturing capability into account in the stock quantity available to promise. Conflicts: stock_available/res_config.py [DEL] move stock_available_mrp to __unported__ [ADD] stock_available_sale Take sale quotations into account in the stock quantity available to promise Cherry-picked from497068f5f5Conflicts: stock_available/res_config.py [DEL] move stock_available_sale to __unported__ [IMP] READMEs and TODOs Cherry-picked from v7 at8add4bea7eConflicts: __unported__/stock_available_mrp/__openerp__.py stock_available/__openerp__.py stock_available_immediately/__openerp__.py [IMP] respect product decimal precision https://github.com/odoo/odoo/issues/5512 andb3e5a940e3makes it clear the standard intends to support decimal precision on the product form.
This commit is contained in:
committed by
ps-tubtim
parent
a6d061d236
commit
8da242ce15
47
stock_available/README.rst
Normal file
47
stock_available/README.rst
Normal file
@@ -0,0 +1,47 @@
|
||||
Stock available to promise
|
||||
==========================
|
||||
|
||||
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.
|
||||
This can be configured in the menu Settings > Configuration > Warehouse.
|
||||
|
||||
Configuration
|
||||
=============
|
||||
|
||||
By default, this module computes the stock available to promise as the virtual
|
||||
stock.
|
||||
To take davantage of the additional features, you must which information you
|
||||
want to base the computation, by checking one or more boxes in the settings:
|
||||
`Configuration` > `Warehouse` > `Stock available to promise`.
|
||||
|
||||
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.
|
||||
|
||||
Credits
|
||||
=======
|
||||
|
||||
Contributors
|
||||
------------
|
||||
|
||||
* Lionel Sausin (Numérigraphe) <ls@numerigraphe.com>
|
||||
* many others contributed to sub-modules, please refer to each sub-module's credits
|
||||
|
||||
Maintainer
|
||||
----------
|
||||
|
||||
.. image:: http://odoo-community.org/logo.png
|
||||
:alt: Odoo Community Association
|
||||
:target: http://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 http://odoo-community.org.
|
||||
22
stock_available/__init__.py
Normal file
22
stock_available/__init__.py
Normal file
@@ -0,0 +1,22 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# This module is copyright (C) 2014 Numérigraphe SARL. All Rights Reserved.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from . import product
|
||||
from . import res_config
|
||||
32
stock_available/__openerp__.py
Normal file
32
stock_available/__openerp__.py
Normal file
@@ -0,0 +1,32 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# This module is copyright (C) 2014 Numérigraphe SARL. All Rights Reserved.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
{
|
||||
'name': 'Stock available to promise',
|
||||
'version': '8.0.2.0.0',
|
||||
"author": u"Numérigraphe,Odoo Community Association (OCA)",
|
||||
'category': 'Warehouse',
|
||||
'depends': ['stock'],
|
||||
'license': 'AGPL-3',
|
||||
'data': [
|
||||
'product_view.xml',
|
||||
'res_config_view.xml',
|
||||
]
|
||||
}
|
||||
98
stock_available/i18n/fr.po
Normal file
98
stock_available/i18n/fr.po
Normal file
@@ -0,0 +1,98 @@
|
||||
# Translation of OpenERP Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * stock_available
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: OpenERP Server 7.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2014-07-30 16:42+0000\n"
|
||||
"PO-Revision-Date: 2014-07-30 16:42+0000\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
|
||||
#: field:product.product,immediately_usable_qty:0
|
||||
msgid "Available to promise"
|
||||
msgstr "Disponible à la vente"
|
||||
|
||||
#. module: stock_available
|
||||
#: view:product.product:0
|
||||
msgid "Available to promise:"
|
||||
msgstr "Disponible à la vente:"
|
||||
|
||||
#. module: stock_available
|
||||
#: field:stock.config.settings,module_stock_available_sale:0
|
||||
msgid "Exclude goods already in sale quotations"
|
||||
msgstr "Exclure les marchandises qui sont déjà dans les devis"
|
||||
|
||||
#. module: stock_available
|
||||
#: field:stock.config.settings,module_stock_available_immediately:0
|
||||
msgid "Exclude incoming goods"
|
||||
msgstr "Exclure les receptions attendues"
|
||||
|
||||
#. module: stock_available
|
||||
#: field:stock.config.settings,module_stock_available_mrp:0
|
||||
msgid "Include the production potential"
|
||||
msgstr "Inclure la production potentielle"
|
||||
|
||||
#. module: stock_available
|
||||
#: code:_description:0
|
||||
#: model:ir.model,name:stock_available.model_product_product
|
||||
#, python-format
|
||||
msgid "Product"
|
||||
msgstr "Article"
|
||||
|
||||
#. module: stock_available
|
||||
#: view:stock.config.settings:0
|
||||
msgid "Stock available to promise"
|
||||
msgstr "Stock disponible à la vente"
|
||||
|
||||
#. module: stock_available
|
||||
#: help:product.product,immediately_usable_qty:0
|
||||
msgid "Stock for this Product that can be safely proposed for sale to Customers.\n"
|
||||
"The definition of this value can be configured to suit your needs"
|
||||
msgstr "Stock de cet article qui peut sans risque être proposé à la vente aux clients.\n"
|
||||
"La définition de cette valeur est paramétrable selon vos besoins"
|
||||
|
||||
#. module: stock_available
|
||||
#: help:stock.config.settings,module_stock_available_mrp:0
|
||||
msgid "This will add the quantities of goods that can be immediately manufactured, to the quantities available to promise.\n"
|
||||
"This installs the module stock_available_mrp.\n"
|
||||
"If the module mrp is not installed, this will install it too"
|
||||
msgstr "Ceci ajoute les quantités de marchandises qui peuvent être immédiatement fabriquées, aux quantitiés disponibles à la vente.\n"
|
||||
"Ceci installe le module stock_available_mrp.\n"
|
||||
"Si le module mrp n'est pas encore installé, il le sera aussi"
|
||||
|
||||
#. module: stock_available
|
||||
#: help:stock.config.settings,module_stock_available_immediately:0
|
||||
msgid "This will subtract incoming quantities from the quantities available to promise.\n"
|
||||
"This installs the module stock_available_immediately."
|
||||
msgstr "Ceci soustrait les réceptions attendues des quantitiés disponibles à la vente.\n"
|
||||
"Ceci installe le module stock_available_immediately."
|
||||
|
||||
#. module: stock_available
|
||||
#: help:stock.config.settings,module_stock_available_sale:0
|
||||
msgid "This will subtract quantities from the sale quotations from the quantities available to promise.\n"
|
||||
"This installs the modules stock_available_sale.\n"
|
||||
"If the modules sale and sale_delivery_date are not installed, this will install them too"
|
||||
msgstr "Ceci soustrait les quantités des devis de vente des quantitiés disponibles à la vente.\n"
|
||||
"Ceci installe le modules stock_available_sale.\n"
|
||||
"Si les modules sale et sale_delivery_date ne sont pas encore installés, ils le seront également"
|
||||
|
||||
#. module: stock_available
|
||||
#: view:product.product:0
|
||||
msgid "red:immediately_usable_qty<0;blue:immediately_usable_qty>=0 and state in ('draft', 'end', 'obsolete');black:immediately_usable_qty>=0 and state not in ('draft', 'end', 'obsolete')"
|
||||
msgstr "red:immediately_usable_qty<0;blue:immediately_usable_qty>=0 and state in ('draft', 'end', 'obsolete');black:immediately_usable_qty>=0 and state not in ('draft', 'end', 'obsolete')"
|
||||
|
||||
#. module: stock_available
|
||||
#: code:_description:0
|
||||
#: model:ir.model,name:stock_available.model_stock_config_settings
|
||||
#, python-format
|
||||
msgid "stock.config.settings"
|
||||
msgstr "stock.config.settings"
|
||||
|
||||
92
stock_available/i18n/stock_available.pot
Normal file
92
stock_available/i18n/stock_available.pot
Normal file
@@ -0,0 +1,92 @@
|
||||
# Translation of OpenERP Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * stock_available
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: OpenERP Server 7.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2014-07-30 16:48+0000\n"
|
||||
"PO-Revision-Date: 2014-07-30 16:48+0000\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
|
||||
#: field:product.product,immediately_usable_qty:0
|
||||
msgid "Available to promise"
|
||||
msgstr ""
|
||||
|
||||
#. module: stock_available
|
||||
#: view:product.product:0
|
||||
msgid "Available to promise:"
|
||||
msgstr ""
|
||||
|
||||
#. module: stock_available
|
||||
#: field:stock.config.settings,module_stock_available_sale:0
|
||||
msgid "Exclude goods already in sale quotations"
|
||||
msgstr ""
|
||||
|
||||
#. module: stock_available
|
||||
#: field:stock.config.settings,module_stock_available_immediately:0
|
||||
msgid "Exclude incoming goods"
|
||||
msgstr ""
|
||||
|
||||
#. module: stock_available
|
||||
#: field:stock.config.settings,module_stock_available_mrp:0
|
||||
msgid "Include the production potential"
|
||||
msgstr ""
|
||||
|
||||
#. module: stock_available
|
||||
#: code:_description:0
|
||||
#: model:ir.model,name:stock_available.model_product_product
|
||||
#, python-format
|
||||
msgid "Product"
|
||||
msgstr ""
|
||||
|
||||
#. module: stock_available
|
||||
#: view:stock.config.settings:0
|
||||
msgid "Stock available to promise"
|
||||
msgstr ""
|
||||
|
||||
#. module: stock_available
|
||||
#: help:product.product,immediately_usable_qty:0
|
||||
msgid "Stock for this Product that can be safely proposed for sale to Customers.\n"
|
||||
"The definition of this value can be configured to suit your needs"
|
||||
msgstr ""
|
||||
|
||||
#. module: stock_available
|
||||
#: help:stock.config.settings,module_stock_available_mrp:0
|
||||
msgid "This will add the quantities of goods that can be immediately manufactured, to the quantities available to promise.\n"
|
||||
"This installs the module stock_available_mrp.\n"
|
||||
"If the module mrp is not installed, this will install it too"
|
||||
msgstr ""
|
||||
|
||||
#. module: stock_available
|
||||
#: help:stock.config.settings,module_stock_available_immediately:0
|
||||
msgid "This will subtract incoming quantities from the quantities available to promise.\n"
|
||||
"This installs the module stock_available_immediately."
|
||||
msgstr ""
|
||||
|
||||
#. module: stock_available
|
||||
#: help:stock.config.settings,module_stock_available_sale:0
|
||||
msgid "This will subtract quantities from the sale quotations from the quantities available to promise.\n"
|
||||
"This installs the modules stock_available_sale.\n"
|
||||
"If the modules sale and sale_delivery_date are not installed, this will install them too"
|
||||
msgstr ""
|
||||
|
||||
#. module: stock_available
|
||||
#: view:product.product:0
|
||||
msgid "red:immediately_usable_qty<0;blue:immediately_usable_qty>=0 and state in ('draft', 'end', 'obsolete');black:immediately_usable_qty>=0 and state not in ('draft', 'end', 'obsolete')"
|
||||
msgstr ""
|
||||
|
||||
#. module: stock_available
|
||||
#: code:_description:0
|
||||
#: model:ir.model,name:stock_available.model_stock_config_settings
|
||||
#, python-format
|
||||
msgid "stock.config.settings"
|
||||
msgstr ""
|
||||
|
||||
51
stock_available/product.py
Normal file
51
stock_available/product.py
Normal file
@@ -0,0 +1,51 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# This module is copyright (C) 2014 Numérigraphe SARL. All Rights Reserved.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from openerp import models, fields, api
|
||||
from openerp.addons import decimal_precision as dp
|
||||
|
||||
|
||||
class ProductTemplate(models.Model):
|
||||
"""Add a field for the stock available to promise.
|
||||
|
||||
Useful implementations need to be installed through the Settings menu or by
|
||||
installing one of the modules stock_available_*
|
||||
"""
|
||||
_inherit = 'product.template'
|
||||
|
||||
@api.depends('virtual_available')
|
||||
def _product_available(self):
|
||||
"""No-op implementation of the stock available to promise.
|
||||
|
||||
By default, available to promise = forecasted quantity.
|
||||
|
||||
Must be overridden by another module that actually implement
|
||||
computations."""
|
||||
for product in self:
|
||||
product.immediately_usable_qty = product.virtual_available
|
||||
|
||||
immediately_usable_qty = fields.Float(
|
||||
digits=dp.get_precision('Product Unit of Measure'),
|
||||
compute='_product_available',
|
||||
string='Available to promise',
|
||||
help="Stock for this Product that can be safely proposed "
|
||||
"for sale to Customers.\n"
|
||||
"The definition of this value can be configured to suit "
|
||||
"your needs")
|
||||
43
stock_available/product_view.xml
Normal file
43
stock_available/product_view.xml
Normal file
@@ -0,0 +1,43 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<record model="ir.ui.view" id="view_stock_available_form">
|
||||
<field name="name">Quantity available to promise (form)</field>
|
||||
<field name="model">product.template</field>
|
||||
<field name="inherit_id" ref="stock.view_template_property_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="virtual_available" position="after">
|
||||
<newline/>
|
||||
<field name="immediately_usable_qty" />
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="view_stock_available_tree">
|
||||
<field name="name">Quantity available to promise (tree)</field>
|
||||
<field name="model">product.template</field>
|
||||
<field name="inherit_id" ref="stock.view_stock_product_template_tree"/>
|
||||
<field name="arch" type="xml">
|
||||
<data>
|
||||
<tree position="attributes">
|
||||
<attribute name="colors">red:immediately_usable_qty<0;blue:immediately_usable_qty>=0 and state in ('draft', 'end', 'obsolete');black:immediately_usable_qty>=0 and state not in ('draft', 'end', 'obsolete')</attribute>
|
||||
</tree>
|
||||
<field name="virtual_available" position="after">
|
||||
<field name="immediately_usable_qty" />
|
||||
</field>
|
||||
</data>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="view_stock_available_kanban">
|
||||
<field name="name">Quantity available to promise (kanban)</field>
|
||||
<field name="model">product.template</field>
|
||||
<field name="inherit_id" ref="stock.product_template_kanban_stock_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='virtual_available']/.." position="replace">
|
||||
<li t-if="record.type.raw_value != 'service'">Available to promise: <field name="immediately_usable_qty"/> <field name="uom_id"/></li>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
||||
49
stock_available/res_config.py
Normal file
49
stock_available/res_config.py
Normal file
@@ -0,0 +1,49 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# This module is copyright (C) 2014 Numérigraphe SARL. All Rights Reserved.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from openerp import models, fields
|
||||
|
||||
|
||||
class StockConfig(models.TransientModel):
|
||||
"""Add options to easily install the submodules"""
|
||||
_inherit = 'stock.config.settings'
|
||||
|
||||
module_stock_available_immediately = fields.Boolean(
|
||||
string='Exclude incoming goods',
|
||||
help="This will subtract incoming quantities from the quantities "
|
||||
"available to promise.\n"
|
||||
"This installs the module stock_available_immediately.")
|
||||
|
||||
# module_stock_available_sale = fields.Boolean(
|
||||
# string='Exclude goods already in sale quotations',
|
||||
# help="This will subtract quantities from the sale quotations from "
|
||||
# "the quantities available to promise.\n"
|
||||
# "This installs the modules stock_available_sale.\n"
|
||||
# "If the modules sale and sale_delivery_date are not "
|
||||
# "installed, this will install them too")
|
||||
|
||||
# module_stock_available_mrp = fields.Boolean(
|
||||
# string='Include the production potential',
|
||||
# help="This will add the quantities of goods that can be "
|
||||
# "immediately manufactured, to the quantities available to "
|
||||
# "promise.\n"
|
||||
# "This installs the module stock_available_mrp.\n"
|
||||
# "If the module mrp is not installed, this will install it "
|
||||
# "too")
|
||||
33
stock_available/res_config_view.xml
Normal file
33
stock_available/res_config_view.xml
Normal file
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<record id="view_stock_configuration" model="ir.ui.view">
|
||||
<field name="name">Stock settings: quantity available to promise</field>
|
||||
<field name="model">stock.config.settings</field>
|
||||
<field name="inherit_id" ref="stock.view_stock_config_settings" />
|
||||
<field name="arch" type="xml">
|
||||
<data>
|
||||
<xpath expr="//group[last()]" position="after">
|
||||
<group>
|
||||
<label for="id" string="Stock available to promise" />
|
||||
<div>
|
||||
<div>
|
||||
<field name="module_stock_available_immediately" class="oe_inline" />
|
||||
<label for="module_stock_available_immediately" />
|
||||
</div>
|
||||
<!-- <div>
|
||||
<field name="module_stock_available_sale" class="oe_inline" />
|
||||
<label for="module_stock_available_sale" />
|
||||
</div> -->
|
||||
<!-- <div>
|
||||
<field name="module_stock_available_mrp" class="oe_inline" />
|
||||
<label for="module_stock_available_mrp" />
|
||||
</div> -->
|
||||
</div>
|
||||
</group>
|
||||
</xpath>
|
||||
</data>
|
||||
</field>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
||||
Reference in New Issue
Block a user