Search 1.9 billion lines of Odoo code on GitHub

stock_reservation_condition

Author: Komit, Odoo Community Association (OCA)
License: AGPL-3
Branch: 10.0
Repository: congdpt/stock-logistics-workflow
Dependencies: purchase, sale, and stock
Languages: Python (231, 78.3%), XML (40, 13.6%), and YAML (24, 8.1%)

<img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.svg"> <a name="the-idea-objective"></a> <h2>The idea/ objective</h2> <p>Change the mechanism of reservation of products when the user confirms the quotation/ SO and when the scheduler runs so products can be kept available in case they are not needed immediately or to wait for a Purchase order to be received (avoiding other delivery due to a partially booking that blocks the partially available order anyway).</p> <a name="technical-description-for-definition-of-the-reservation"></a> <h3>Technical description for Definition of the reservation</h3> <p>Quotation/ SO adjustments:</p> <blockquote> <ul class="simple"> <li><dl class="first docutils"> <dt>In header:</dt> <dd><ul class="first last"> <li>Add field &quot;Reservation Date&quot; under Expected date of delivery (manual input)</li> </ul> </dd> </dl> </li> <li><dl class="first docutils"> <dt>Add tab &quot;Related POs&quot; with a new m2m field reservation_po_ids and display only 2 columns:</dt> <dd><ul class="first last"> <li>PO number</li> <li>Reservation Date: a new field on PO, computed as latest date of related incoming shipments</li> </ul> </dd> </dl> </li> </ul> </blockquote> <p>Rename the status in stock move (&quot;Waiting Another Move&quot;) and stock picking (&quot;Waiting Another Operation&quot;) with a suffix &quot;or PO Reception or SO Reservation Date&quot;.</p> <a name="expected-behavior"></a> <h3>Expected Behavior</h3> <p>If sale_order.reservation_date is set or sale_order.reservation_po_ids has some values:</p> <blockquote> <ul> <li><p class="first">The reservation of these products is not done when user confirms the SO</p> </li> <li><dl class="first docutils"> <dt>The reservation will be done by the scheduler</dt> <dd><ul class="first last"> <li><p class="first">If the SO is linked to a PO, for each product listed in the SO: - The system will look for the product in on of the reservation_po_ids which is already received:</p> <blockquote> <ul class="simple"> <li>If it is found, the products (stock.quant) will be reserved</li> </ul> </blockquote> </li> <li><p class="first">Otherwise, if the SO is not linked to a PO and has a reservation_date: - If the so.reservation_date is reached, then reserve the product</p> <blockquote> <p>Otherwise, we proceed as normal:</p> </blockquote> </li> </ul> </dd> </dl> </li> <li><p class="first">Reservation will take place when the user confirms the quotation/SO</p> </li> </ul> </blockquote> <a name="technical-solution-to-adjust-the-booking-mechanism"></a> <h3>Technical Solution to adjust the booking mechanism</h3> <p>Override stock_move.action_assign:</p> <p>pseudo-code: <a href="#id1"><span class="problematic" id="id2">``</span></a><a href="#id3"><span class="problematic" id="id4">`</span></a>python</p> <blockquote> <dl class="docutils"> <dt>if not move.so.reservation_date and len(move.so.reservation_po_ids) ==0:</dt> <dd>pass # continue the function action_assign</dd> <dt>elif move.product_id in </dt> <dd><blockquote class="first"> move.so.reservation_po_ids.last_picking_id.filtered(state=Done).lines.product_id:</blockquote> <p class="last">pass # continue the function action_assign</p> </dd> <dt>elif move.so.reservation_date &lt; today():</dt> <dd>pass # continue the function action_assign</dd> <dt>else:</dt> <dd>return False</dd> </dl> </blockquote> <p><a href="#id5"><span class="problematic" id="id6">``</span></a>` Notes =====</p> <blockquote> <ul class="simple"> <li>Reservation Date on the SO has no impact if a product is part of one of the reservation_po_ids</li> </ul> </blockquote> <a name="installation"></a> <h3>Installation</h3> <p>No external library is used.</p> <a name="configuration"></a> <h3>Configuration</h3> <p>This module does not require any special configuration</p> <a name="usage"></a> <h3>Usage</h3> <ul class="simple"> <li>Set date when you wanna reserve on Sale Order</li> <li>If Sale Order has Purchase order, link it into Related POs on Sale Order</li> </ul> <a name="known-issues-roadmap"></a> <h3>Known issues / Roadmap</h3> <ul class="simple"> <li>If Reservation Date is not set or Reservation Date is less than today, system will reserve as Odoo native</li> <li>If Reservation Date is greater to or equal to today, system will skip reservation</li> </ul> <a name="credits"></a> <h3>Credits</h3> <a name="contributors"></a> <h4>Contributors</h4> <ul class="simple"> <li>Jean-Charles Drubay &lt;<a class="reference external" href="mailto:jc&#64;komit-consulting.com">jc&#64;komit-consulting.com</a>&gt;</li> <li>Cong, Duong Pham Thanh &lt;<a class="reference external" href="mailto:cong.dpt&#64;komit-consulting.com">cong.dpt&#64;komit-consulting.com</a>&gt;</li> </ul> <a name="maintainer"></a> <h4>Maintainer</h4> <a class="reference external image-reference" href="http://odoo-community.org"><img alt="Odoo Community Association" src="http://odoo-community.org/logo.png" /></a> <p>This module is maintained by the OCA.</p> <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>To contribute to this module, please visit <a class="reference external" href="http://odoo-community.org">http://odoo-community.org</a>.</p>