Search 1.9 billion lines of Odoo code on GitHub

grap_change_base_product_mass_addition

Author: GRAP
License: AGPL-3
Branch: 12.0
Repository: grap/grap-odoo-custom
Dependencies: base_product_mass_addition, and purchase_quick
Languages: Python (45, 100.0%)
Other branches: 12.0-REF-grap_change_default-compatibility-joint_buying, 12.0-REF-try-use-copier, and 12.0-ocabot-merge-pr-186-by-legalsylvain-bump-patch
Other repositories: legalsylvain/grap-odoo-custom, and quentinDupont/grap-odoo-custom

<h1 class="title">GRAP - Change Base Product Mass Addition</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/grap/grap-odoo-custom/tree/12.0/grap_change_base_product_mass_addition"><img alt="grap/grap-odoo-custom" src="https://img.shields.io/badge/github-grap%2Fgrap--odoo--custom-lightgray.png?logo=github" /></a></p> <p>This module is a patch module, that overwrite the function <code>_inverse_set_process_qty</code> of the model <code>product.product</code> of the module <code>base_product_mass_addition</code>.</p> <p>It avoid to call the function <code>odoo.tests.Form</code> that is very slow, and that is making the module <code>purchase_quick</code> unusable.</p> <p><strong>Benchmark on a Production database, run locally</strong> Without this module, for a purchase, calling <code>_inverse_set_process_qty</code> takes - 12.469824 seconds (for a create) - 13.837742 seconds (for an update)</p> <p>With this module, the same call takes - 0.121779 seconds (for a create) - 0.110520 seconds (for an update)</p> <p><strong>Benchmark on a Demo database, run locally</strong></p> <p>Test Code show that time is divided by 12.</p> <pre> <code lang="python">import timeit def test(): orders = env[&quot;purchase.order&quot;].search([(&quot;partner_id&quot;, &quot;=&quot;, env.ref(&quot;base.res_partner_1&quot;).id)]) for line in orders.mapped(&quot;order_line&quot;): product = line.product_id.with_context(parent_model=&quot;purchase.order&quot;, parent_id=line.order_id.id) product.qty_to_process = line.product_qty * 2</code> </pre> <p>Without this module :</p> <pre> <code lang="python">&gt;&gt;&gt; timeit.timeit(test, number=50) 70.18318000599902</code> </pre> <p>With this module :</p> <pre> <code lang="python">&gt;&gt;&gt; timeit.timeit(test, number=50) 5.822203948999231</code> </pre> <p><strong>Table of contents</strong></p> <div class="contents local topic" id="contents"> <ul class="simple"> <li><a class="reference internal" href="#known-issues-roadmap" id="id1">Known issues / Roadmap</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="known-issues-roadmap"></a> <h2><a class="toc-backref" href="#id1">Known issues / Roadmap</a></h2> <ul class="simple"> <li>make the same work. (the <code>if parent_model == &quot;purchase_order&quot;</code>) for the module <code>stock_picking_quick</code>. (if used)</li> </ul> <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/grap/grap-odoo-custom/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/grap/grap-odoo-custom/issues/new?body=module:%20grap_change_base_product_mass_addition%0Aversion:%2012.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>GRAP</li> </ul> <a name="contributors"></a> <h3><a class="toc-backref" href="#id5">Contributors</a></h3> <ul class="simple"> <li>Sylvain LE GAL (<a class="reference external" href="https://www.twitter.com/legalsylvain">https://www.twitter.com/legalsylvain</a>)</li> </ul> <a name="maintainers"></a> <h3><a class="toc-backref" href="#id6">Maintainers</a></h3> <p>This module is part of the <a class="reference external" href="https://github.com/grap/grap-odoo-custom/tree/12.0/grap_change_base_product_mass_addition">grap/grap-odoo-custom</a> project on GitHub.</p> <p>You are welcome to contribute.</p>