forked from OCA/product-attribute
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge commit 'refs/pull/1044/head' of https://github.com/oca/product-…
…attribute into 15.0-699
- Loading branch information
Showing
16 changed files
with
921 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,186 @@ | ||
===================== | ||
Product Order No Name | ||
===================== | ||
|
||
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |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/14.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-14-0/product-attribute-14-0-product_order_noname | ||
:alt: Translate me on Weblate | ||
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png | ||
:target: https://runbot.odoo-community.org/runbot/135/14.0 | ||
:alt: Try me on Runbot | ||
|
||
|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: | ||
|
||
Check on version 16 | ||
=================== | ||
|
||
Check if this module is still necessary in that version due to the changes on "ir.translation". | ||
|
||
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 smashing it by providing a detailed and welcomed | ||
`feedback <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**>`_. | ||
|
||
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/14.0/product_order_noname>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Copyright 2020 Vauxoo, S.A. de C.V. | ||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). | ||
{ | ||
"name": "Product Order No Name", | ||
"summary": "Speedup product retrieve", | ||
"version": "15.0.1.0.0", | ||
"development_status": "Production/Stable", | ||
"category": "Technical Settings", | ||
"website": "https://github.com/OCA/product-attribute", | ||
"author": "Vauxoo, Odoo Community Association (OCA)", | ||
"maintainers": ["WR-96", "moylop260", "luisg123v"], | ||
"license": "LGPL-3", | ||
"depends": ["product"], | ||
"application": False, | ||
"installable": True, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * product_order_noname | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 14.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"PO-Revision-Date: 2021-04-10 11:46+0000\n" | ||
"Last-Translator: Yves Le Doeuff <yld@alliasys.fr>\n" | ||
"Language-Team: none\n" | ||
"Language: fr\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: \n" | ||
"Plural-Forms: nplurals=2; plural=n > 1;\n" | ||
"X-Generator: Weblate 4.3.2\n" | ||
|
||
#. module: product_order_noname | ||
#: model:ir.model.fields,field_description:product_order_noname.field_product_product__display_name | ||
#: model:ir.model.fields,field_description:product_order_noname.field_product_template__display_name | ||
msgid "Display Name" | ||
msgstr "Nom affiché" | ||
|
||
#. module: product_order_noname | ||
#: model:ir.model.fields,field_description:product_order_noname.field_product_product__id | ||
#: model:ir.model.fields,field_description:product_order_noname.field_product_template__id | ||
msgid "ID" | ||
msgstr "" | ||
|
||
#. module: product_order_noname | ||
#: model:ir.model.fields,field_description:product_order_noname.field_product_template__default_code | ||
msgid "Internal Reference" | ||
msgstr "Référence interne" | ||
|
||
#. module: product_order_noname | ||
#: model:ir.model.fields,field_description:product_order_noname.field_product_product____last_update | ||
#: model:ir.model.fields,field_description:product_order_noname.field_product_template____last_update | ||
msgid "Last Modified on" | ||
msgstr "Dernière modification" | ||
|
||
#. module: product_order_noname | ||
#: model:ir.model,name:product_order_noname.model_product_product | ||
msgid "Product" | ||
msgstr "Article" | ||
|
||
#. module: product_order_noname | ||
#: model:ir.model,name:product_order_noname.model_product_template | ||
msgid "Product Template" | ||
msgstr "Modèle d'article" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * product_order_noname | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 14.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"Last-Translator: \n" | ||
"Language-Team: \n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: \n" | ||
"Plural-Forms: \n" | ||
|
||
#. module: product_order_noname | ||
#: model:ir.model.fields,field_description:product_order_noname.field_product_product__display_name | ||
#: model:ir.model.fields,field_description:product_order_noname.field_product_template__display_name | ||
msgid "Display Name" | ||
msgstr "" | ||
|
||
#. module: product_order_noname | ||
#: model:ir.model.fields,field_description:product_order_noname.field_product_product__id | ||
#: model:ir.model.fields,field_description:product_order_noname.field_product_template__id | ||
msgid "ID" | ||
msgstr "" | ||
|
||
#. module: product_order_noname | ||
#: model:ir.model.fields,field_description:product_order_noname.field_product_template__default_code | ||
msgid "Internal Reference" | ||
msgstr "" | ||
|
||
#. module: product_order_noname | ||
#: model:ir.model.fields,field_description:product_order_noname.field_product_product____last_update | ||
#: model:ir.model.fields,field_description:product_order_noname.field_product_template____last_update | ||
msgid "Last Modified on" | ||
msgstr "" | ||
|
||
#. module: product_order_noname | ||
#: model:ir.model,name:product_order_noname.model_product_product | ||
msgid "Product" | ||
msgstr "" | ||
|
||
#. module: product_order_noname | ||
#: model:ir.model,name:product_order_noname.model_product_template | ||
msgid "Product Template" | ||
msgstr "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
from . import product | ||
from . import product_template |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from odoo import models | ||
|
||
|
||
class ProductProduct(models.Model): | ||
_inherit = "product.product" | ||
_order = "priority desc, default_code, id" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from odoo import fields, models | ||
|
||
|
||
class ProductTemplate(models.Model): | ||
_inherit = "product.template" | ||
_order = "priority desc, default_code" | ||
|
||
default_code = fields.Char(index=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
* Williams Estrada <williams@vauxoo.com> https://www.vauxoo.com/ | ||
* Moises Lopez <moylop260@vauxoo.com> https://www.vauxoo.com/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
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 |
Oops, something went wrong.