<a class="reference external image-reference" href="https://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.svg">
</a>
<a name="multicompany-purchase-fix"></a>
<h2>Multicompany purchase fix</h2>
<p>This module fixs errors in multi-company purchase order environments:</p>
<a name="error"></a>
<h3>ERROR:</h3>
<p>When the "Run mrp scheduled" planner is automatically executed and will create
a purchase quotation, it searches for a supplierinfo record for the
corresponding product template and supplier but does not take the company into
account, so if it finds more than one, when accessing the min_qty field it
gives the following error:</p>
<blockquote>
Expected singleton: product.supplierinfo(id_x, ix_y)</blockquote>
<a name="solution"></a>
<h3>SOLUTION:</h3>
<p>Add the "company_id" key with the value of the current company to the context
in the "make_po" function and correct the searches of the
"product.supplierinfo" object in the "_calc_new_qty_price" function so that
the company is taken into account in the search.</p>