Odoo is opensource and has module structure. So, for the question
– Is it possible to change /this/ in Odoo?
the only answer is:
– Yes, everything is possible to do in Odoo.
OK, but how to do that? Where to find an instruction of how to implement some particular feature?
Let's take an example. Imagine we need a custom link for product at
website shop. By default link is generated from Name field, but you
need to make it be generated from new Name SEO field.
i.e. instead of this link:
/shop/product/ipad-mini-8
there should be this one:
/shop/product/super-seo-link-for-ipad-mini-8
where product has fields:
Name: iPad Mini
Name SEO: Super SEO link for iPad Mini
How to do that? Can we find the answer in documentation? I believe, it
doesn't have an answer.
So, let's try to do it ourself. We have Odoo source, so let's try to
find a solution there.
In our example we can start from seaching by /shop/product/:
These lines from addons/website_sale/controllers/main.py looks interesting:
What about <model("product.template"):product>? What is it? How it
works? There should be a way for you to find the answer in
source. Maybe you know about werkzeug library, maybe you know about
slug function, maybe you know about ir.http model. So there should
be a keyword to search. At the worst you can search by "model"
keyword OR look through whole website module.
OK, I found the answer in addons/website/models/ir_http.py. Function to_url is what we need.
where slug function is from addons/website/models/website.py
So, that is. To make a custom link, we have to inherit ModelConverter
and modify to_url function. Something like that:
And you are visiting my old website. I built a company since those times and don't update this website anymore. For the latest news follow me on Twitter