How to Change Default Sorting of Odoo Shop Catalog
Setting the default sorting order for the catalog of products in the shop

Search for a command to run...
Setting the default sorting order for the catalog of products in the shop

No comments yet. Be the first to comment.
When to Use What GCP Database Service.

Designing and Developing a Contract from Scratch

Announcing my blockchain specialization certificate

Showing how to feed a Flask application with an existing database

Showing how to reuse a blueprint for several subdomains

Sooner or later, users of Odoo ERP system for website shopping may need to have a preffered default sorting order for the website product catalog.
By default products seem to be randomly arranged; but in its real sense, the default is that products are sorted in an order that reads published>>sequence>>name. In other words:
From the foregoing, the easiest way may be to make sure the sequence is in the desired order. If the sequence can't be ascertained to be in the desired order then read on.
Disclaimer: This post is just to show how the aforestated feature can be achieved and I will be editing the actual Odoo file; generally, it is always considered a good practice not to modify an Odoo file but through a custom module.
That said, choose your ooperating system:
Linux
Windows
sudo suaddons/website_sale/controllers/main.py
Thus, I will do vi addons/website_sale/controllers/main.pysearch for url = shop: in vi /url = shop
Hit Enter, then i to change the mode to INSERT
After the Matching line Sort as needed, for alphabetically ascending order do:
if "order" not in post:
post["order"]="name asc"
Save and exit. Press Esc to change the mode
Type :wq to save and exit in vim
Restart the server: /etc/init.d/odoo restart
Done
server\odoo\addons\website_sale\controllers\main.py.C:\Program Files (x86)\Odoo 12.0\server\odoo\addons\website_sale\controllers\main.pyurl = shopif "order" not in post:
post["order"]="name asc"
Save and exit.
Restart the server:
Done