=====================
Product Order No Name
=====================
..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:e32510bb0f4e8ca7c531922d8ebfa26ea080f968075ee860c382d42d1144747d
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png
:target: https://odoo-community.org/page/development-status
:alt: Production/Stable
.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fproduct--attribute-lightgray.png?logo=github
:target: https://github.com/OCA/product-attribute/tree/15.0/product_order_noname
:alt: OCA/product-attribute
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/product-attribute-15-0/product-attribute-15-0-product_order_noname
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/product-attribute&target_branch=15.0
:alt: Try me on Runboat
|badge1| |badge2| |badge3| |badge4| |badge5|
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.
Warning: This changes the way products are ordered
product are ordered "default_code, id"
instead of "default_code, translated(name), id"
Because Odoo needs the following query to get a translated(name)
.. code-block::
SELECT "product_product".id
FROM "product_product"
LEFT JOIN "product_template" AS "product_product__product_tmpl_id"
ON ( "product_product"."product_tmpl_id" =
"product_product__product_tmpl_id"."id" )
LEFT JOIN (SELECT res_id,
value
FROM "ir_translation"
WHERE type = 'model'
AND name = 'product.template,name'
AND lang = 'es_MX'
AND value != '') AS
"product_product__product_tmpl_id__name"
ON ( "product_product__product_tmpl_id"."id" =
"product_product__product_tmpl_id__name"."res_id" )
WHERE ( "product_product"."active" = true )
ORDER BY "product_product"."default_code",
Coalesce("product_product__product_tmpl_id__name"."value",
"product_product__product_tmpl_id"."name"),
"product_product"."id"
LIMIT 10
Using a production database executing this query the result is:
- Planning Time: 1.088 ms
- Execution Time: 1027.282 ms
- Total Time: 1028.37 ms
It is so slow.
Using the new order: "default_code, id" the following query is executed now:
.. code-block::
SELECT "product_product".id
FROM "product_product"
WHERE ( "product_product"."active" = true )
ORDER BY "product_product"."default_code"
LIMIT 10
The new result is:
- Planning Time: 0.095 ms
- Execution Time: 0.529 ms
- Total Time: 0.624 ms
It is 1.65k times faster
It is because the field ``name`` has the parameter ``translate=True``
So, It will process the original value to translate it
Then, It will order by a column computed on-the-fly of other tables
default_code is a column indexed so the result is faster
Opening the ``/shop`` page could consume 7.5s instead of 1.2s without this module
Odoo is using the _order parameter even if you don't need it.
- ``products.search(...).write(...)``
- ``browse().*2many_product_ids.ids``
More info about this on:
https://github.com/odoo/odoo/pull/61618
**Table of contents**
.. contents::
:local:
Usage
=====
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.
Bug Tracker
===========
Bugs are tracked on `GitHub Issues <https://github.com/OCA/product-attribute/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/product-attribute/issues/new?body=module:%20product_order_noname%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Do not contact contributors directly about support or help with technical issues.
Credits
=======
Authors
~~~~~~~
* Vauxoo
Contributors
~~~~~~~~~~~~
* Williams Estrada <williams@vauxoo.com> https://www.vauxoo.com/
* Moises Lopez <moylop260@vauxoo.com> https://www.vauxoo.com/
Other credits
~~~~~~~~~~~~~
This module was created and is maintained by:
* Vauxoo, S.A. de C.V.
.. image:: http://www.vauxoo.com/logo.png
:alt: Vauxoo, S.A. de C.V.
:target: http://www.vauxoo.com
Maintainers
~~~~~~~~~~~
This module is maintained by the OCA.
.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org
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.
.. |maintainer-WR-96| image:: https://github.com/WR-96.png?size=40px
:target: https://github.com/WR-96
:alt: WR-96
.. |maintainer-moylop260| image:: https://github.com/moylop260.png?size=40px
:target: https://github.com/moylop260
:alt: moylop260
.. |maintainer-luisg123v| image:: https://github.com/luisg123v.png?size=40px
:target: https://github.com/luisg123v
:alt: luisg123v
Current `maintainers <https://odoo-community.org/page/maintainer-role>`__:
|maintainer-WR-96| |maintainer-moylop260| |maintainer-luisg123v|
This module is part of the `OCA/product-attribute <https://github.com/OCA/product-attribute/tree/15.0/product_order_noname>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
Raw data
{
"_id": null,
"home_page": "https://github.com/OCA/product-attribute",
"name": "odoo-addon-product-order-noname",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": null,
"author": "Vauxoo, Odoo Community Association (OCA)",
"author_email": "support@odoo-community.org",
"download_url": null,
"platform": null,
"description": "=====================\nProduct Order No Name\n=====================\n\n.. \n !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n !! This file is generated by oca-gen-addon-readme !!\n !! changes will be overwritten. !!\n !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n !! source digest: sha256:e32510bb0f4e8ca7c531922d8ebfa26ea080f968075ee860c382d42d1144747d\n !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png\n :target: https://odoo-community.org/page/development-status\n :alt: Production/Stable\n.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png\n :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html\n :alt: License: LGPL-3\n.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fproduct--attribute-lightgray.png?logo=github\n :target: https://github.com/OCA/product-attribute/tree/15.0/product_order_noname\n :alt: OCA/product-attribute\n.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png\n :target: https://translation.odoo-community.org/projects/product-attribute-15-0/product-attribute-15-0-product_order_noname\n :alt: Translate me on Weblate\n.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png\n :target: https://runboat.odoo-community.org/builds?repo=OCA/product-attribute&target_branch=15.0\n :alt: Try me on Runboat\n\n|badge1| |badge2| |badge3| |badge4| |badge5|\n\nThis module improves retrieving products when a language is installed and configured.\nThe default behaviour is to order products by name, which in this case would be slow\nbecause Odoo will process the product's name to translate it.\n\nWarning: This changes the way products are ordered\nproduct are ordered \"default_code, id\"\ninstead of \"default_code, translated(name), id\"\n\nBecause Odoo needs the following query to get a translated(name)\n\n.. code-block::\n\n SELECT \"product_product\".id\n FROM \"product_product\"\n LEFT JOIN \"product_template\" AS \"product_product__product_tmpl_id\"\n ON ( \"product_product\".\"product_tmpl_id\" =\n \"product_product__product_tmpl_id\".\"id\" )\n LEFT JOIN (SELECT res_id,\n value\n FROM \"ir_translation\"\n WHERE type = 'model'\n AND name = 'product.template,name'\n AND lang = 'es_MX'\n AND value != '') AS\n \"product_product__product_tmpl_id__name\"\n ON ( \"product_product__product_tmpl_id\".\"id\" =\n \"product_product__product_tmpl_id__name\".\"res_id\" )\n WHERE ( \"product_product\".\"active\" = true )\n ORDER BY \"product_product\".\"default_code\",\n Coalesce(\"product_product__product_tmpl_id__name\".\"value\",\n \"product_product__product_tmpl_id\".\"name\"),\n \"product_product\".\"id\"\n LIMIT 10\n\n\nUsing a production database executing this query the result is:\n - Planning Time: 1.088 ms\n - Execution Time: 1027.282 ms\n - Total Time: 1028.37 ms\n\nIt is so slow.\n\nUsing the new order: \"default_code, id\" the following query is executed now:\n\n.. code-block::\n\n SELECT \"product_product\".id\n FROM \"product_product\"\n WHERE ( \"product_product\".\"active\" = true )\n ORDER BY \"product_product\".\"default_code\"\n LIMIT 10\n\nThe new result is:\n - Planning Time: 0.095 ms\n - Execution Time: 0.529 ms\n - Total Time: 0.624 ms\n\nIt is 1.65k times faster\n\nIt is because the field ``name`` has the parameter ``translate=True``\n\nSo, It will process the original value to translate it\n\nThen, It will order by a column computed on-the-fly of other tables\n\ndefault_code is a column indexed so the result is faster\n\nOpening the ``/shop`` page could consume 7.5s instead of 1.2s without this module\n\nOdoo is using the _order parameter even if you don't need it.\n - ``products.search(...).write(...)``\n - ``browse().*2many_product_ids.ids``\n\n\nMore info about this on:\n\n https://github.com/odoo/odoo/pull/61618\n\n**Table of contents**\n\n.. contents::\n :local:\n\nUsage\n=====\n\nJust by installing the module you should see a performance increase when retrieving products, from the website shop\nor the product's list view for example.\n\nBug Tracker\n===========\n\nBugs are tracked on `GitHub Issues <https://github.com/OCA/product-attribute/issues>`_.\nIn case of trouble, please check there if your issue has already been reported.\nIf you spotted it first, help us to smash it by providing a detailed and welcomed\n`feedback <https://github.com/OCA/product-attribute/issues/new?body=module:%20product_order_noname%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.\n\nDo not contact contributors directly about support or help with technical issues.\n\nCredits\n=======\n\nAuthors\n~~~~~~~\n\n* Vauxoo\n\nContributors\n~~~~~~~~~~~~\n\n* Williams Estrada <williams@vauxoo.com> https://www.vauxoo.com/\n* Moises Lopez <moylop260@vauxoo.com> https://www.vauxoo.com/\n\nOther credits\n~~~~~~~~~~~~~\n\nThis module was created and is maintained by:\n\n* Vauxoo, S.A. de C.V.\n\n.. image:: http://www.vauxoo.com/logo.png\n :alt: Vauxoo, S.A. de C.V.\n :target: http://www.vauxoo.com\n\nMaintainers\n~~~~~~~~~~~\n\nThis module is maintained by the OCA.\n\n.. image:: https://odoo-community.org/logo.png\n :alt: Odoo Community Association\n :target: https://odoo-community.org\n\nOCA, or the Odoo Community Association, is a nonprofit organization whose\nmission is to support the collaborative development of Odoo features and\npromote its widespread use.\n\n.. |maintainer-WR-96| image:: https://github.com/WR-96.png?size=40px\n :target: https://github.com/WR-96\n :alt: WR-96\n.. |maintainer-moylop260| image:: https://github.com/moylop260.png?size=40px\n :target: https://github.com/moylop260\n :alt: moylop260\n.. |maintainer-luisg123v| image:: https://github.com/luisg123v.png?size=40px\n :target: https://github.com/luisg123v\n :alt: luisg123v\n\nCurrent `maintainers <https://odoo-community.org/page/maintainer-role>`__:\n\n|maintainer-WR-96| |maintainer-moylop260| |maintainer-luisg123v| \n\nThis module is part of the `OCA/product-attribute <https://github.com/OCA/product-attribute/tree/15.0/product_order_noname>`_ project on GitHub.\n\nYou are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.\n\n\n",
"bugtrack_url": null,
"license": "LGPL-3",
"summary": "Speedup product retrieve",
"version": "15.0.1.0.0.8",
"project_urls": {
"Homepage": "https://github.com/OCA/product-attribute"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "271674f1306ff5685d8044ad66a7126c3de127c2700b7afbd19918b4eb381a5e",
"md5": "28512ad11b855a9333dea98401da9f2c",
"sha256": "b5ddfbd417870cabc1b115f03bd769a7e6d01f0f5b051f06b8b4f0675b7837a5"
},
"downloads": -1,
"filename": "odoo_addon_product_order_noname-15.0.1.0.0.8-py3-none-any.whl",
"has_sig": false,
"md5_digest": "28512ad11b855a9333dea98401da9f2c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 27886,
"upload_time": "2024-03-24T05:53:40",
"upload_time_iso_8601": "2024-03-24T05:53:40.648518Z",
"url": "https://files.pythonhosted.org/packages/27/16/74f1306ff5685d8044ad66a7126c3de127c2700b7afbd19918b4eb381a5e/odoo_addon_product_order_noname-15.0.1.0.0.8-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-03-24 05:53:40",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "OCA",
"github_project": "product-attribute",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "freezegun",
"specs": []
},
{
"name": "openupgradelib",
"specs": []
}
],
"lcname": "odoo-addon-product-order-noname"
}