Search 1.9 billion lines of Odoo code on GitHub

multicompany_purchase_fix

Author: Trey (www.trey.es)
License: AGPL-3
Branch: 8.0
Repository: acysos/trey-addons
Dependencies: procurement, and purchase
Languages: Python (95, 33.9%), SVG (166, 59.3%), and reStructuredText (19, 6.8%)
Other repositories: RL-OtherApps/trey-addons, TheCloneMaster/trey-addons, kit9/trey-addons, and treytux/trey-addons

<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 &quot;Run mrp scheduled&quot; 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 &quot;company_id&quot; key with the value of the current company to the context in the &quot;make_po&quot; function and correct the searches of the &quot;product.supplierinfo&quot; object in the &quot;_calc_new_qty_price&quot; function so that the company is taken into account in the search.</p>