Search 1.9 billion lines of Odoo code on GitHub

product_order_noname

Author: Vauxoo, Odoo Community Association (OCA)
License: LGPL-3
Branch: 14.0
Repository: acsone/product-attribute
Dependencies: product
Languages: HTML (420, 76.8%), Python (26, 4.8%), and reStructuredText (101, 18.5%)
Other branches: 12.0, 12.0-fix-model-viewer-dro, 13.0, 13.0-assortment-cpi, 13.0-fix_product_code_mandatory, 13.0-imp-product_uom-dro, 13.0-packaging_uom_fix, 13.0-product_code_unique_backport_test_resilient-qgr, 13.0-product_pricelist_assortment-ir_rule, 13.0-product_pricelist_assortment_hook-ape, 13.0-product_pricelist_assortment_imp_index, 13.0-wpu_master, 14-add-product_pricelist_item_button-dro, 14-fix-product_state-xbo, 14-product_assortment-xbo, 14-product_brand-xbo, 14-product_life_period-xbo, 14-product_pricelist_assortment-xbo, 14.0-abi_master, 14.0-add-product_category_code_unique-dro, 14.0-add-product_category_sequence-dro, 14.0-add-product_follow_state-dro, 14.0-add-product_lot_category-dro, 14.0-add-product_pricelist_button_box-dro, 14.0-add-product_state_active-dro, 14.0-add-uom_qty_unique-dro, 14.0-add_product_supplierinfo_code-dro, 14.0-fix-copier-dro, 14.0-fix-product-state-ro-dro, 14.0-fix_assortment_domain, 14.0-imp-product-tier-validation2-dro, 14.0-imp-product_code_unique_active-dro, 14.0-imp-product_state-dro, 14.0-imp-product_tier_validation-dro, 14.0-mig-product-category-active-dro, 14.0-mig-product-category-product-link-dro, 14.0-mig-product_state_history-dro, 14.0-mig-state-cpi, 14.0-packaging_uom-sbj, 14.0-upd-copier-dro, and 14.0-upd-template-dro
Other repositories: AITIC/product-attribute, Change2improve/product-attribute, Darknroses/product-attribute, ERPLibre/product-attribute, ForgeFlow/product-attribute, Gabinete-Digital/product-attribute, Ingeos/product-attribute, Jarsa/product-attribute, LevelPrime/product-attribute, NeatNerdPrime/product-attribute, OCA-MUK/product-attribute, OCA/product-attribute, PlanetaTIC/product-attribute, Rad0van/product-attribute, SeuMarco/product-attribute, Studio73/product-attribute, TRESCLOUD/product-attribute, Tecnativa/product-attribute, Vauxoo/product-attribute, aaltinisik/product-attribute, adhoc-dev/product-attribute, agrista/odoo-product-attribute, akretion/product-attribute, andreampiovesana/product-attribute, aurestic/product-attribute, binovo/product-attribute, bmya/product-attribute, brain-tec/product-attribute, camptocamp/product-attribute, coopiteasy/product-attribute, cubells/product-attribute, damdam-s/product-attribute, digitalsatori/product-attribute, druidoo-dev/product-attribute, eLBati/product-attribute, ecosoft-odoo/product-attribute, ehsu0407/product-attribute, grindtildeath/product-attribute, hibou-io/oca-product-attribute, ilyasProgrammer/product-attribute, kmee/product-attribute, kos94ok-3D/product-attribute, legalsylvain/product-attribute, omalbastin/product-attribute, osiell/product-attribute, phuctranerp/product-attribute, sergiocorato/product-attribute, simahawk/product-attribute, solvosci/product-attribute, takinobori/oca-product-attribute, takobi-online/product-attribute, tegin/product-attribute, unitek-solusi/OCA-product-attribute, ursais/product-attribute, versada/product-attribute, vialaurea/OCA-product-attribute, xtendoo-corporation/product-attribute, and ypapouin/product-attribute

<h1 class="title">Product Order No Name</h1> <p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/licence-LGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/product-attribute/tree/14.0/product_order_noname"><img alt="OCA/product-attribute" src="https://img.shields.io/badge/github-OCA%2Fproduct--attribute-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/product-attribute-14-0/product-attribute-14-0-product_order_noname"><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/135/14.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p> <p>This module improves retrieving products when a language is installed and configured. The default behaviour is to order products by name, which in this case would be slow because Odoo will process the product's name to translate it.</p> <p>Warning: This changes the way products are ordered product are ordered &quot;default_code, id&quot; instead of &quot;default_code, translated(name), id&quot;</p> <p>Because Odoo needs the following query to get a translated(name)</p> <pre class="code"> <code class="code">SELECT &quot;product_product&quot;.id FROM &quot;product_product&quot; LEFT JOIN &quot;product_template&quot; AS &quot;product_product__product_tmpl_id&quot; ON ( &quot;product_product&quot;.&quot;product_tmpl_id&quot; = &quot;product_product__product_tmpl_id&quot;.&quot;id&quot; ) LEFT JOIN (SELECT res_id, value FROM &quot;ir_translation&quot; WHERE type = 'model' AND name = 'product.template,name' AND lang = 'es_MX' AND value != '') AS &quot;product_product__product_tmpl_id__name&quot; ON ( &quot;product_product__product_tmpl_id&quot;.&quot;id&quot; = &quot;product_product__product_tmpl_id__name&quot;.&quot;res_id&quot; ) WHERE ( &quot;product_product&quot;.&quot;active&quot; = true ) ORDER BY &quot;product_product&quot;.&quot;default_code&quot;, Coalesce(&quot;product_product__product_tmpl_id__name&quot;.&quot;value&quot;, &quot;product_product__product_tmpl_id&quot;.&quot;name&quot;), &quot;product_product&quot;.&quot;id&quot; LIMIT 10</code> </pre> <dl class="docutils"> <dt>Using a production database executing this query the result is:</dt> <dd><ul class="first last simple"> <li>Planning Time: 1.088 ms</li> <li>Execution Time: 1027.282 ms</li> <li>Total Time: 1028.37 ms</li> </ul> </dd> </dl> <p>It is so slow.</p> <p>Using the new order: &quot;default_code, id&quot; the following query is executed now:</p> <pre class="code"> <code class="code">SELECT &quot;product_product&quot;.id FROM &quot;product_product&quot; WHERE ( &quot;product_product&quot;.&quot;active&quot; = true ) ORDER BY &quot;product_product&quot;.&quot;default_code&quot; LIMIT 10</code> </pre> <dl class="docutils"> <dt>The new result is:</dt> <dd><ul class="first last simple"> <li>Planning Time: 0.095 ms</li> <li>Execution Time: 0.529 ms</li> <li>Total Time: 0.624 ms</li> </ul> </dd> </dl> <p>It is 1.65k times faster</p> <p>It is because the field <code>name</code> has the parameter <code>translate=True</code></p> <p>So, It will process the original value to translate it</p> <p>Then, It will order by a column computed on-the-fly of other tables</p> <p>default_code is a column indexed so the result is faster</p> <p>Opening the <code>/shop</code> page could consume 7.5s instead of 1.2s without this module</p> <dl class="docutils"> <dt>Odoo is using the _order parameter even if you don't need it.</dt> <dd><ul class="first last simple"> <li><code>products.search(...).write(...)</code></li> <li><code>browse().*2many_product_ids.ids</code></li> </ul> </dd> </dl> <p>More info about this on:</p> <blockquote> <a class="reference external" href="https://github.com/odoo/odoo/pull/61618">https://github.com/odoo/odoo/pull/61618</a></blockquote> <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="#other-credits" id="id6">Other credits</a></li> <li><a class="reference internal" href="#maintainers" id="id7">Maintainers</a></li> </ul> </li> </ul> </div> <a name="usage"></a> <h2><a class="toc-backref" href="#id1">Usage</a></h2> <p>Just by installing the module you should see a performance increase when retrieving products, from the website shop or the product's list view for example.</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/product-attribute/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/product-attribute/issues/new?body=module:%20product_order_noname%0Aversion:%2014.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>Vauxoo</li> </ul> <a name="contributors"></a> <h3><a class="toc-backref" href="#id5">Contributors</a></h3> <ul class="simple"> <li>Williams Estrada &lt;<a class="reference external" href="mailto:williams&#64;vauxoo.com">williams&#64;vauxoo.com</a>&gt; <a class="reference external" href="https://www.vauxoo.com/">https://www.vauxoo.com/</a></li> <li>Moises Lopez &lt;<a class="reference external" href="mailto:moylop260&#64;vauxoo.com">moylop260&#64;vauxoo.com</a>&gt; <a class="reference external" href="https://www.vauxoo.com/">https://www.vauxoo.com/</a></li> </ul> <a name="other-credits"></a> <h3><a class="toc-backref" href="#id6">Other credits</a></h3> <p>This module was created and is maintained by:</p> <ul class="simple"> <li>Vauxoo, S.A. de C.V.</li> </ul> <a class="reference external image-reference" href="http://www.vauxoo.com"><img alt="Vauxoo, S.A. de C.V." src="http://www.vauxoo.com/logo.png" /></a> <a name="maintainers"></a> <h3><a class="toc-backref" href="#id7">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>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainers</a>:</p> <p><a class="reference external" href="https://github.com/WR-96"><img alt="WR-96" src="https://github.com/WR-96.png?size=40px" /></a> <a class="reference external" href="https://github.com/moylop260"><img alt="moylop260" src="https://github.com/moylop260.png?size=40px" /></a> <a class="reference external" href="https://github.com/luisg123v"><img alt="luisg123v" src="https://github.com/luisg123v.png?size=40px" /></a></p> <p>This module is part of the <a class="reference external" href="https://github.com/OCA/product-attribute/tree/14.0/product_order_noname">OCA/product-attribute</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>