Search 1.9 billion lines of Odoo code on GitHub

stock_putaway_hook

Author: Camptocamp, Odoo Community Association (OCA)
License: AGPL-3
Branch: 16.0
Repository: aaltinisik/stock-logistics-workflow
Dependencies: base, and stock
Languages: HTML (360, 53.7%), Python (226, 33.7%), and reStructuredText (85, 12.7%)
Other repositories: AITIC/stock-logistics-workflow, Change2improve/stock-logistics-workflow, Comunitea/stock-logistics-workflow, Darknroses/stock-logistics-workflow, ForgeFlow/stock-logistics-workflow, Gabinete-Digital/stock-logistics-workflow, GrupoAlicor/stock-logistics-workflow, Ingeos/stock-logistics-workflow, Jarsa-dev/stock-logistics-workflow, Jarsa/stock-logistics-workflow, LevelPrime/stock-logistics-workflow, NeatNerdPrime/stock-logistics-workflow, OCA/stock-logistics-workflow, Rad0van/stock-logistics-workflow, SequarSrl/stock-logistics-workflow, SeuMarco/stock-logistics-workflow, Studio73/stock-logistics-workflow, TDu/stock-logistics-workflow, TRESCLOUD/stock-logistics-workflow, Tecnativa/stock-logistics-workflow, Vauxoo/stock-logistics-workflow, acsone/stock-logistics-workflow, adhoc-dev/stock-logistics-workflow, akretion/stock-logistics-workflow, anhvu-sg/stock-logistics-workflow, aurestic/stock-logistics-workflow, bmya/stock-logistics-workflow, brain-tec/stock-logistics-workflow, camptocamp/stock-logistics-workflow, coopiteasy/stock-logistics-workflow, ecosoft-odoo/stock-logistics-workflow, factorlibre/stock-logistics-workflow, florian-dacosta/stock-logistics-workflow, focusate/oca-stock-logistics-workflow, grindtildeath/stock-logistics-workflow, guewen/stock-logistics-workflow, houssine78/stock-logistics-workflow, jcoux/stock-logistics-workflow, jesus01x/stock-logistics-workflow, kmee/stock-logistics-workflow, ryanc-me/stock-logistics-workflow, sebalix/stock-logistics-workflow, tafaRU/stock-logistics-workflow, tegin/stock-logistics-workflow, unitek-solusi/OCA-stock-logistics-workflow, ursais/stock-logistics-workflow, versada/stock-logistics-workflow, and xtendoo-corporation/stock-logistics-warehouse

<h1 class="title">Stock Putaway Hooks</h1> <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-workflow/tree/16.0/stock_putaway_hook"><img alt="OCA/stock-logistics-workflow" src="https://img.shields.io/badge/github-OCA%2Fstock--logistics--workflow-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/stock-logistics-workflow-16-0/stock-logistics-workflow-16-0-stock_putaway_hook"><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/154/16.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p> <p>Technical module. It adds hooks to the core putaway method <code>StockLocation._get_putaway_strategy()</code> allowing to plug other strategies and makes the selector fields in the tree views dynamic (required/readonly). See the usage section for details.</p> <p>An example of implementation is the module <code>stock_putaway_by_route</code>.</p> <p><strong>Table of contents</strong></p> <div class="contents local topic" id="contents"> <ul class="simple"> <li><a class="reference internal" href="#usage" id="id1">Usage</a></li> <li><a class="reference internal" href="#bug-tracker" id="id2">Bug Tracker</a></li> <li><a class="reference internal" href="#credits" id="id3">Credits</a><ul> <li><a class="reference internal" href="#authors" id="id4">Authors</a></li> <li><a class="reference internal" href="#contributors" id="id5">Contributors</a></li> <li><a class="reference internal" href="#maintainers" id="id6">Maintainers</a></li> </ul> </li> </ul> </div> <a name="usage"></a> <h2><a class="toc-backref" href="#id1">Usage</a></h2> <p>The modules that implement a new strategy have to follow the following steps. The module <code>stock_putaway_by_route</code> should be used as reference.</p> <p>Add the field to match on <code>stock.putaway.rule</code> in the model and in the view. In the view, the field must have <code>options=&quot;{'exclusive_selection': True}&quot;</code>, which will allow this module to dynamically build dynamic attrs, restricting the selection of more than one field. (defining the readonly and required attrs in the view is therefore useless).</p> <p>Add the strategy key, named after the new field name, in <code>StockLocation._putaway_strategies</code>. Example:</p> <pre> <code>class StockLocation(models.Model): _inherit = &quot;stock.location&quot; &#64;property def _putaway_strategies(self): strategies = super()._putaway_strategies return strategies + [&quot;route_id&quot;]</code> </pre> <p>Pass the value to match with the putaway rule field in the context, in every method calling <code>StockLocation._get_putaway_strategy</code>. The name of the key in the context is:<code>_putaway_&lt;KEY&gt;</code>, where KEY is the name of the new field on the putaway rule. The value can be a unit, a recordset of any length or a list/tuple. In latter cases, the putaway rule is selected if its field match any value in the list/recordset.</p> <a name="bug-tracker"></a> <h2><a class="toc-backref" href="#id2">Bug Tracker</a></h2> <p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/stock-logistics-workflow/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-workflow/issues/new?body=module:%20stock_putaway_hook%0Aversion:%2016.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> <a name="credits"></a> <h2><a class="toc-backref" href="#id3">Credits</a></h2> <a name="authors"></a> <h3><a class="toc-backref" href="#id4">Authors</a></h3> <ul class="simple"> <li>Camptocamp</li> </ul> <a name="contributors"></a> <h3><a class="toc-backref" href="#id5">Contributors</a></h3> <ul class="simple"> <li>Guewen Baconnier &lt;<a class="reference external" href="mailto:guewen.baconnier&#64;camptocamp.com">guewen.baconnier&#64;camptocamp.com</a>&gt;</li> <li>Fernando La Chica &lt;<a class="reference external" href="mailto:fernandolachica&#64;gmail.com">fernandolachica&#64;gmail.com</a>&gt;</li> <li>Denis Roussel &lt;<a class="reference external" href="mailto:denis.roussel&#64;acsone.eu">denis.roussel&#64;acsone.eu</a>&gt;</li> </ul> <a name="maintainers"></a> <h3><a class="toc-backref" href="#id6">Maintainers</a></h3> <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-workflow/tree/16.0/stock_putaway_hook">OCA/stock-logistics-workflow</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>