When a DB is duplicated, it's going through the neutralize process
which is helpful to clean stuff that will be messing around with the
duplicated DB.
The CDN should actually be part of that. Since a CDN url is bound to a
domain, when you copy the database (and most likely run it on its own
different domain), it just won't properly work.
Indeed, if you setup a CDN X for domain A and then copy a DB to domain
B, this will happen:
- You access website B
- You try to load an img, which is using CDN X URL
- CDN X URL is fetching the ressource on DB A instead of DB B, which
might or might not exist (an image will likely share the same path so
it might work, but for assets url it might not if the bundle url has
changed)
In the event of the assets having changed, they will never be loaded and
the duplicated DB won't be loading properly.
The only workaround in this case is to switch to debug mode to bypass
the post processing and so the CDN url transform.
Useful commits:
- Introduction of neutralize
https://github.com/odoo/odoo/pull/67825
- Conversion of neutralize from ORM calls to raw SQL
https://github.com/odoo/odoo/commit/e5dbded9bb363351feff7ca8a56c7f8a6860f492
opw-3880102
closesodoo/odoo#163210
X-original-commit: ab6493ae9fff218a43df12829011a4f642902114
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
It should not be common, but through custo or in debug mode, one can
create a menu without an URL since it's not required on the model.
Through regular flows, it won't be possible since our UI won't let you
go through when creating a menu if you don't set a URL.
Followup of https://github.com/odoo/odoo/commit/948235079f002794f9837d3cf91e2d20e3254e20
X-original-commit: f2ac2ab72a190375c8116a11109191c0b7b970dc
Part-of: odoo/odoo#160588
Commit [1] was introduced to fix an issue where the website menu cache
is incompatible with having a slug url in one of its menu.
But in the enterprise build, since the website_helpdesk module is adding
one menu containing a slug url, it would disable the menu cache.
Unfortunately, the website_blog perf tests (at_install) are executed
after website_helpdesk is installed, meaning that in enterprise, the
perf test of website_blog would fail since it would require some more
SQL Queries (1 or 2 depending of the test) to render a blog post as it
would have to query the website.menu table.
It's still unclear how commit [1] was merged in the codebase since the
enterprise staging should have failed.
runbot-60466
runbot-60467
[1]: https://github.com/odoo/odoo/commit/948235079f002794f9837d3cf91e2d20e3254e20closesodoo/odoo#158666
X-original-commit: 11acdfc7d8dd0dfe146b6f7547123af94e2a0baf
Signed-off-by: Guillaume Dieleman (gdi) <gdi@odoo.com>
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Those are optional, commit [1] mimicked the python code in JS but with a
mistake: "required" instead of "optional".
Steps to reproduce:
- Enable cookies setting on website
- Drag & drop a snippet
- Modify that snippet conditional visibility to "Utm Campaign: Sale"
- Visit in incognito /?utm_campaign=Sale, you don't see the snippet,
which is good
- Now click on "Only Essentials" in the cookies banner
- The snippet will be shown, because when accepting the essentials
cookies, the utm ones were set, since they were marked as required.
[1]: https://github.com/odoo/odoo/commit/90ada07ecfc308ad181748d3e809810bb90f3eecclosesodoo/odoo#158720
X-original-commit: 63b0606d728be949cc6cfcb0dbdf17114ec1c711
Signed-off-by: Jérémy Kersten <jke@odoo.com>
Current behavior:
When the cookie bar is activated, the optional cookies are deactivated
by default, unless you click on I agree.
This causes issues regarding UTMs:
- You can have blocks to show only if an UTM cookies has been set
- UTM should be added on sale order for instance when reaching the
website through a link with an UTM and then buying something
Steps to reproduce (utm on quotation):
1. Install ecommerce
2. Go to Settings/Website
3. Activate Cookies Bar
4. Open a private tab
5. Go to /shop?utm_campaign=Sale
6. Click on I agree on the cookie bar
7. Buy a product
8. Go back to Sales App in backend
9. Find the last public user quotation
10. Go to other info tab
11. The medium field is empty
Steps to reproduce (utm based visibility):
1. Drag & drop a snippet on a page (let's say the /page)
2. Set that snippet visibility to "Visible only if utm campaign is
"Sale"
3. Repeat step 2 3 4 from above
4. Open /page?utm_campaign=Sale
5. You will see that the block is not shown despite accepting the
cookies and having the correct utm set.
Note: we don't want that clicking on I agree reload the page, it would
solve everything but would have poor usability.
Note that with the default cookies bar, you could still naviguate to
another page, and accept the cookies later, in which case the UTM would
never be set since they would not be in the URL anymore.
It's an acceptable limitation, if that's a real issue to someone, they
have to set the popup layout to a blocking one, not the small non
intrusive one.
Fix:
When closing the cookie bar, forcing the info in the URL to be stored in
the cookies if the key is a UTM.
opw-3681927
closesodoo/odoo#157711
X-original-commit: 8c31c2b08ed84ccdb97af628d9db7f6c67c6d830
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Co-authored-by: Antoine (ande) <ande@odoo.com>
Steps to reproduce:
- Click on the footer and enable footer "Slide Hover" option
- In the theme tab, add a theme bg image
- Drag & drop a "Text - Image" snippet (or any snippet without a bg
color set, or any snippet with a bg color set and just remove it)
- The snippets and page layout in genral will receive a forced color
instead of using the bg image set.
This is because with the slide hover option, the bg has to be moved from
the `#wrapwrap` to the `main`. Indeed, it's the main which is scrolling
hover the footer, not the `#wrapwrap`. Without doing that, the elements
hover the footer would have a transparent background and would not hide
the footer.
But the bg image was not considered when doing it, only the bg color.
opw-3704746
closesodoo/odoo#157638
X-original-commit: 68c8a7f48ac955a8e9e4f1fc8cb1c76af54116b3
Signed-off-by: Guillaume Dieleman (gdi) <gdi@odoo.com>
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Some templates are rendering the blog post cover in a very blurry way.
It was not detected sooner because of a mix of:
- The default blog posts img do not go through the `/web/image` route
and are not resized down / impacted
- Some of the layouts are working fine
- For the problematic layouts, the problem gets worse when you select
only one or two "Fetched Elements".
Steps to reproduce:
- Add an image on a blog post (you can just download the one on the PR)
- Add a "Blog Posts" dynamic snippet on a page
- Select "Card Layout"
- By default, you'll see that the image is very blurry. If you select
2 (or 1) instead of 3 fetched elements, it will get even worse.
Note that it's like that since forever, when it was introduced with
https://github.com/odoo/odoo/commit/3c0d98bcd8adf9325ee3497eb8d25ec7f904d6a5
opw-3771992
opw-3758676
closesodoo/odoo#156962
X-original-commit: 7d817e950f9e7c18a504d8bff04e02efb9d9dbde
Signed-off-by: Soukéina Bojabza (sobo) <sobo@odoo.com>
Before this commit and most likely since commit [1], the "Open in new
window" option of link would not persist through editions.
Steps to reproduce:
- Create a link in the website builder
- Set its "Open in new window" property to true
- Save, and see that it works as expected
- Now enter edit mode again, the toggle will be off and not on as it
should be since the `target="_blank"` was correctly added.
For easy of debugging and understanding, you can just grep this line
```js
this.initialNewWindow = this.initialNewWindow || this.linkEl.target === '_blank';
```
[1]: https://github.com/odoo/odoo/commit/d7245d2abf528d093226c80e40975e63d61e8997#
opw-3781477
closesodoo/odoo#156739
X-original-commit: 5ea2e015a8faed502c378d4e5042f8a0cf50cbf9
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
When a crawler (eg Googlebot) come to visit your website, it grants you
a limited amount of time and ressources, it's called "Crawler budget".
If you have millions of URLs, it won't go through each one of them in a
single go.
The best you can help those crawler, the better. The sitemap `lastmod`
attribute, despite not being fully respected and trusted by crawlers, is
one of the way you can still try to help them.
For website.pages, it's already done. But for controllers, it's not an
easy thing to do as we have no way to automatically figure what are the
relevant records/fields to look at to know the last update date.
For instance, on the event pages, some pages content are mostly stored
inside an `ir.ui.view`, but the title, hours etc are part of the event
itself.
We can't just say "we take the last write_date of the record", it's
wrong in 2 ways:
- The first one I just explained where we wouldn't be able to easily get
all the elements part of the page rendering and would miss a possible
element write_date, leaving an outdated date in `lastmod`.
- Then, there is another issue (which is more problematic in stable):
the `write_date` is often updated for non website related purposes.
For instance, on /partners/<partner>, we wouldn't be able to use the
write date on odoo.com as the partners shown there (having a grade)
are update every weeks in average, because of many fields, for
instance: commission_plan_id, partner_weight, grade_id, ...
Still, there is a quick win possible in stable about forum posts which
are not impacted by the 2 issues explained above:
- The `write_date` doesn't seem to be updated too frequently for
(sitemap) irrelevant reasons. We can ensure to show a date which is
only modified when the forum.post page really gets a modification.
- All the forum.post information displayed on the page are stored inside
the forum.post itself.
This commit is thus adding the `lastmod` on forum.post URLs in the
sitemap in hope of not making Google waste time on (very) old posts.
Note: we don't use the `last_activity_date` as it wouldn't be updated in
case of the post `content` or `name` being modified for instance,
which would be wrong.
Some metrics: On odoo.com, out of the 83499 forum posts having a
`last_activity_date < 2023-10-01`, only 2335 have a `write_date`
after `2023-10-01`. It means that those two fields are actually
giving almost the same results.
Using `write_date` is thus the best choice: not impacted by the
issues mentioned above and cover all relevant record change, as
opposed to `last_activity_date`.
Note: the `lastmod` has to be trustworthy and correct, if you set wrong
or outdated info inside it, Google won't trust you/it anymore.
closesodoo/odoo#155197
Signed-off-by: Jérémy Kersten <jke@odoo.com>
This shouldn't change anything regarding SEO, but is worth a try.
It will also impact the link suggestion when creating a link in the
editor, but having pages listed first also have sense there, or at least
it won't be worst.
The idea for the SEO part is that if the sitemap order (if too long)
would have some impact as crawlers might have a limited crawling budget
for your website and it will only crawl the first pages it finds.
Are those "first pages" impacted by the sitemap order? It's almost sure
it's not, as Google definitely knows how to crawl on its own, and is
even probably ignoring the sitemap most of the time.
Also, pages:
- Are probably always important content since you created manually a page to
write something, while (some) controllers might just be content you
care less about. Pages are probably always important while we can't
say that for controllers.
- Should be fewer in number than controllers most of the time
- Have a lastmod set, as opposed to controllers
- May be created at any time, meaning a new crawler visit is needed,
while controllers are almost never added in production, installing a
new module is something very rare. Exception is about record's
controllers which are "created" at any time like pages (eg a new
product controller page)
For all those reasons, this commit reverse the pages vs controllers
order in the sitemap.
This is coming from our prod where some pages are yet not indexed while
they have been published months ago.
closesodoo/odoo#152350
Signed-off-by: Jérémy Kersten <jke@odoo.com>
Commit [1] introduced a way to "hide" an ir.ui.view through a new
visibility field.
That field has multiple possible values to restrict the access. One of
those is "Restricted Groups", but when selected it's really hard to
figure what to do next because nothing happens on screen: there is no
"groups" field where to add the groups.
Those groups should actually be added a bit below, in the groups_id
field which is "hidden" inside the "Access Rights" second tab.
This is because the groups_id field already existed (in base module)
before introducing the website visibility feature which just relied on
that field when set to "Restricted Groups".
Note that another possible value for visibility is "Password", and in
this case a password field appear below the visibility field as one
would expect.
[1]: https://github.com/odoo/odoo/commit/e239934abe456257c9dc285d1ad9829c0353900cclosesodoo/odoo#151602
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
*: test_website
Commit [1] modified the custom page search model so it is adding the
current website in the search domain.
But it was not considering the case of models not having a website_id
field.
The only case was the appoitment.type model.
Steps to reproduce:
- Install website_appointment (enterprise)
- Click on Website > Site > Appointments
- Crash
[1]: https://github.com/odoo/odoo/commit/db670f64f4c2190f1655f9077ea62885049a3c84closesodoo/odoo#151686
X-original-commit: 247a5e157f14ce2cd8fbbe8d191abcb3c2e4ec0d
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
This commit was written for Odoo 16.4 and then backported.
In Odoo 16, only point 2. described just below is not working.
The 16.4 commit was thus retarget to Odoo 16 as it was also fixing the
second point.
------------------
Before this commit:
The website selected in the website selector of the search view in the
website.page list/kanban view was always set to the first one found in
the DB and was never:
1. the one you visited in the website preview
2. or the one matching the URL of your backend.
But 1. was working fine before commit [1] from the frameworkjs which
introduced a way to "reset" the screen between apps/menu switch.
Despite 1. working before commit [1], it was not ideally coded and
worked "by chance", see below for a few facts and explication.
------------------
Fact 1:
When you have multiple websites and you are on a website, the website
served is the result of 2 possibilities:
1. All websites have a specific domain, then you can only see a given
website on its own domain. Attempting to select another website in
the website switcher will redirect you to that other website domain.
2. You have one or more websites without any domain, then you can see
those ones from any domain by using the website switcher. It will
force the website in session, and despite being on a domain which
should serve a given website (the one which has its domain set that
domain if there is one), it will serve you the one you selected in
the website switcher.
Fact 2:
- It is the `website_preview` which is setting the currentWebsite
property of the `website_service`.
- But the `website_service` can be used on its own, without any
`website_preview` being involved in the process.
- When the website preview is unmounted, the currentWebsite from the
website service is reset to null.
- The website page list component is reading the currentWebsite from the
website service.
- When switching from the website preview to another menu like the
website pages list, the page list component (PageControllerMixin) is
actually initialized/created before the website preview is unmounted.
In the end, the following happen:
1. Go to website preview -> it sets the website service current
website
2. Go to website page list
3. The website page list component reads the current website from the
website service which is set
4. The website preview is unmounted, emptying the current website from
the website service
5. The website page list is shown to the user
6. Any call from the page list component to the current website will
now be "wrong" / not return the same as during its `onWillStart`,
as website preview was unmounted just after that, emptying the
website set in the website service. Luckily, there is none.
Fact 3:
Commit [1] changed the order of the steps listed above, now 4 occurs
before 3, so when the page list component reads the website from the
website service, the unmount of the website preview already kicked in,
emptying that website service website.
This is the source of the bug fixed here: the current website could
never be found anymore.
-----------------
This commit is simply finding the current website_id by asking it to the
server.
It will fix point 1. listed at the very beginning of the commit message,
but will also make point 2. work.
Another solution would have been to find a workaround to the frameworkjs
change (like investigating the `noEmptyTransition` option) to restore
what we had before, but it would have been as "fragile" as before and
wouldn't have fixed other flows as the current fix does.
----------------
Steps to reproduce 1:
- Without any domain set, go to your DB in the website preview of your
website in the backend
- Switch to the website 2 in the navbar website switcher
- You are now viewing website 2 in the website preview
- Click on "Pages" in the "Site" menu to go to the page list view
- The website selected in the search view is the first one, not the
website 2. Also, the page shown are from the website 1, not the
website 2.
- This was working before commit [1] and this commit is fixing that.
But this commit is also fixing/improving flows which never worked:
- Before commit [1] (or in Odoo 16 to be simpler), do the same 4 first
steps as above.
- You will see that the listed pages are the ones from website 2 and
that the selected website is the second one, correct.
- Now just reload the page, it will show website 1, despite the website
2 being forced (if you did reload the page on the preview, it would
still show website 2).
- This is because the website_preview was never involved after the
reload since you reached the list view / website service without going
through the website preview.
- The same can be seen if you go to the Pages list view directly through
CTRL+K, in which case you won't go through the preview.
--------------------
Note that the chance is taken to reorder the wutils export, it was
becoming a real mess and it was not possible to easily read through the
method names to find/guess something.
------------------
[1]: https://github.com/odoo/odoo/commit/9f6ed9f6d1ef7ec1870980498480cae0ffc729d8
Related to task-3676124
opw-3658648
closesodoo/odoo#151269
X-original-commit: 0128beed551395b30f957a5edc1a23a6f3d0ba31
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Previous commit is fixing the code so that a view without `en_US` in
arch_db jsonb value won't make the code crash (`get_related_views`).
The commit before that actually improved the custom snippets so the
translations are forwarded to it when it's saved.
But that new code was introducing a way to have an arch without `en_US`
value, which led to the bug described above.
While the previous commit fixed the consequence of the issue, this
commit solves the root cause of the issue, introduced 2 commits before.
Arguably, this commit could be squashed in the one 2 commits ago, but
it makes things more clear to figure.
task-3375518
closesodoo/odoo#150945
X-original-commit: bf598d9098b4be36542a9a91c0dd1055cf36aed5
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Since commit [1], the lang was removed from the context by setting it to
None.
In Odoo 16 and since jsonb, it's not correct, the lang should simply be
popped from the context.
Indeed, having `lang=None` in the context will not return any value when
reading the arch if the arch has no `en_US` default value.
The previous commit will make it so the translations will be forwarded
to custom snippets when saving a snippet. With that commit, the issue
described above will be problematic and lead to a crash.
There is probably other legit ways to reproduce the issue which are not
yet found as we don't really use non english DB often.
Step to reproduce (following previous commit):
- Create a db with french only and install website.
- Then enable dutch and add it on the website as second lang
- Drop a title snippet & translate it in the dutch version
- Save and go back to the main lang (fr)
- Drag & drop again this newly saved snippet (custom snippet)
- Save and to to dutch version
- Enter translate mode
-> A traceback will be shown, because `get_related_views` will fail on
"empty etree document", because when in the stack doing
`etree.fromstring(view.arch)`, it will fail since arch = ''.
Step to reproduce (without the previous commit):
- Remove the `en_US` jsonb key from a view, eg
`update ir_ui_view set arch_db = (select arch_db - 'en_US' from ir_ui_view where id = 4) where id = 4;`
- Start odoo-bin in `shell` mode
- Do `self.env['ir.ui.view'].browse(4).arch` -> Will output the arch
- Do `self.env['ir.ui.view'].browse(4).with_context(lang=None).arch`
-> This will crash on record not found error.
[1]: https://github.com/odoo/odoo/commit/fdb9f8273be62d0a6d8051f7ca0a66cdf22ae5e7
task-3375518
X-original-commit: 9cb17bc9cb1490219d1488c99e419a84681ca121
Part-of: odoo/odoo#150945
This commit adds translation capability to custom snippets.
Before this commit, the custom snippet was not translate friendly:
1. Neither when saving a block as custom snippet
2. Neither when dropping a custom snippet into a page.
This was a known limitation for years. But now it's time to make it
work.
Step to reproduce (part 1):
- Enable french
- Drag & drop Title snippet in a page
- Translate the Title
- Save the block as custom snippet
-> Go in the backend view of this custom snippet, in debug, there is no
translation that followed the title.
Step to reproduce (part 2):
- Following previous steps, now add the translation manually on the
custom snippet view
- Back in a page in edit mode, drag & drop this custom snippet in the
page
- Switch to french
-> The title is not translated, the drag & drop copy code but no
translations
Those are the "page/view" to "page/view" translation transfer, but it
could also be any html field (like a product description) to view
(custom snippet) or view (custom snippet) to any html field.
task-3375518
opw-3242100
X-original-commit: 2bd6c1a8d653453692211eef0f5d46a0047eb6f2
Part-of: odoo/odoo#150945
This commit does 2 things:
- It prevents saving the parallax bg css properties which does not makes
sense as those properties are related to the current screen scroll
position. Each scroll position has its own css properties.
Saving those did no harm tho, as on start those were recomputed.
- It prevents flagging that parallax bg css properties change as a dirty
change by stopping the observer while changing those properties.
This is not really helping much apart from being right, since when
discarding, to know if something is dirty, it's not considering the
`o_dirty` class but doing some DOM comparison before/after, so:
- In this case, the css options are most likely still not the same,
see below "O_DIRTY EXPLANATIONS" for explanation about that part.
- There is still some stuff that will get in the way and make the
before/after DOM not the same:
- Scrolling a few px will hide the navbar and reveal the other one,
flagging it as a dom diff
- When having a few menu end entering edit mode, some will end up
in the "extra menu area" (grouped inside the "+" menu entry),
which will also be considered as dom diff
Step to reproduce:
- Enter edit mode and drag & drop a parallax snippet
- Update its "Parallax" sub-option from "Fixed" to "Bottom to Top"
- This option change adds some css properties to the `s_parallax_bg`:
top, bottom and transform. Each time you scroll, those are updated.
- Save and then inspect the source code of the page (CTRL-U)
- BUG 1: The `s_parallax_bg` was saved with those css properties set to
the values related to where the scroll was when saved.
- BUG 2: Now enter edit mode again and check that the `#wrap` is
automatically and directly set as `o_dirty`.
--------------------
O_DIRTY EXPLANATIONS:
- The "cancel" is comparing dom before and after edition to know if it
is dirty or not (and thus to know if it has to show that pending
changes modal)
- The "save", to know is something has changed and need to be saved, is
not doing that dom comparison
- Before this commit, the "o_dirty" class would be added when entering
edit mode, as the parallax would recompute its css top/bottom values,
which would differ from the ones saved in DB (because of the right
panel reducing the content size)
- Before this commit, on top of the "o_dirty" class, there would be the
top/bottom style diff too, as explained above
- After this commit, the o_dirty class is not added anymore
- After this commit, the top/bottom style is not saved in DB, but it's
added when the widget is started, meaning that there will also be a
DOM diff (before: no style, after: top/bottom style)
- On cancel, the snippets are not destroyed, meaning the style added on
the start of the parallax is not removed before considering the dom
diff
--------------------
Related PR about mitigating dirty issues: https://github.com/odoo/odoo/pull/144121
Related PR which should solve this kind of issues one day: https://github.com/odoo/odoo/pull/74923
opw-3672851
closesodoo/odoo#150994
X-original-commit: 4f8d8072a87ad0a67fbe5e61c5845d18c0e05d71
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Note: This fw-port commit cherry-picked and squashed commit [2] directly
as it was fixing this original commit before it had the chance to
be forward ported.
Since commit [1], which adapted the website pages list view to OWL, the
records listed on screen are filtered according to the active website
filter. However, the full list of records is still used behind the
scenes for all potential actions.
Steps to reproduce:
1. Go to the pages list view.
2. Select a specific website (if it's not already the case).
=> The total of records in the upper right corner does not match the
number of pages on that specific website.
3. Click on the "Select all" checkbox.
=> All the pages are selected, including those that do not appear on
screen.
This is because the records were just visually hidden with a `t-if`.
[1]: https://github.com/odoo/odoo/commit/940f4ee875332dafa1f379970a7683be6b3ee606
[2]: https://github.com/odoo/odoo/commit/db670f64f4c2190f1655f9077ea62885049a3c84
Courtesy of @robinlej and @detrouxdev
Related to task-3676124
opw-3554064
opw-3658648
closesodoo/odoo#149547
X-original-commit: 8d78a916dc8c0eca82e8a6a2c6f5541938709930
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Commit [1] allowed restricted editor to use the optimize seo dialog:
- When they have write access on the record, they can fill the form and
save changes
- when they don't have the write access, the form is in readonly and a
warning is shown to explain it.
But a mistake was made: the restricted editor, when opening the SEO
dialog on a website.page, would receive an access error directly when
reading the SEO fields, instead of the expected readonly SEO dialog
without a save button.
Step to reproduce:
- Login with a restricted editor with no extra rights
- Go to / homepage
- Open the optimize seo dialog
- An access right error is shown
[1]: https://github.com/odoo/odoo/commit/891162574eead15cf64a4f934e5f12346cbcfbbfclosesodoo/odoo#148280
Signed-off-by: Jérémy Kersten <jke@odoo.com>
Originally, restricted editors don't have the rights to edit the SEO of
a record.
It was probably a bad idea as they can already edit the record itself
and can change the name / description of the record in the page.
Changing the SEO seems to be very similar.
Also, for our internal needs, we need our HR people (which are
restricted editor with rights on jobs position) to be able to edit the
SEO of their jobs. And we don't want to grant them the full editor
right.
Note:
- We already have a `data-can-optimize-seo` attribute set on the HTML
tag if one is logged in, but this is just about knowing if the record
has SEO-mixin capability, it does not check the rights for a given
record.
- In master, one day, we would like to have the "Edit" button shown only
when something can be edited for restricted editor (to not be able to
enter edit mode to then not be able to edit anything). The same would
be nice here: optimize seo menu could only be shown if you have the
right, but we don't want to do an extra RPC each time for now.
- We keep the info shown in readonly mode so the restricted user can see
it and ask for a change to someone else if needed
Related commits:
- https://github.com/odoo/odoo/commit/94e2eefca28196efc0ac38f155a3b85acbbdeaae
- https://github.com/odoo/odoo/commit/21464edf7ce858c065e113e32d857dfa4ace1788closesodoo/odoo#147981
Signed-off-by: Jérémy Kersten <jke@odoo.com>
`onDuplicate` was marked as optional while it never was. If you don't
specify it, the call to `this.props.onDuplicate();` will still be
executed and will crash:
`Uncaught Promise > this.props.onDuplicate is not a function`
Randomly spotted while reviewing PR about duplicate button in list view
related to opw-3640878. But it's not related to it.
closesodoo/odoo#147647
X-original-commit: 296feaa9aa16cdb1766ce8d2f5ae8126d74f881b
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
This commit is fixing a last minute error in commit [1] after a push
force which move its code above the existing line `vals['url'] = url`.
After the code move, `vals['url']` was not the updated url value (which
went through slugify and unique path functions).
- Create a /test page, publish it.
- Set /test as homepage url directly on the website (in the settings)
- Go to that page
- Open the page properties and change its URL from /test to /test_un
-> The page url is /test-un but the website homepage_url is still
/test_un (not slugified) in the website settings
[1]: https://github.com/odoo/odoo/commit/374a1b31f70a3209b1ae11db8e5886350579c7f9closesodoo/odoo#147641
X-original-commit: 3c8a58b654418fc2fc0dc9bc28420c7dcb1bafee
Signed-off-by: Colin Louis (loco) <loco@odoo.com>
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
A anchor menu in the mobile offcanvas related to an element in the
current page doesn't work in offcanvas:
- The offcanvas doesn't close
- The page doesn't scroll to the clicked location
This is because the menu anchor navigation is hooked to use our own
scrolling behavior instead of the browser one.
Doing so, we preventDefault, which prevent the offcanvas menu to close
itself when clicking on a anchor menu.
This commit simply manually closes the offcanvas and once the closing
animation is complete, starts our own smooth scrolling.
It also targets the desktop offcanvas menu (when hamburger layout is
selected) so it got a smoother UX: it closes then scrolls, instead of
scrolling but not closing.
Another possibility would have been to just close manually the offcanvas
without a preventDefault and without a call to our custom scrolling
method.
Doing so, the browser would naturally scroll to the element while we
close the offcanvas but it would be less elegant as you wouldn't see the
scrolling animation.
Note that the offcanvas was introduced with commit [1].
[1]: https://github.com/odoo/odoo/commit/bc13176de8d66bbdc1c536017b1f046c5fd31a86
opw-3604963
closesodoo/odoo#146907
X-original-commit: db881e66785a866319bd4980a9ae7b6393e55457
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Keeping things in the same order between both files will help when
modifying this file later.
After this commit, the `globals` in both files are 100% sync'd.
Part-of: odoo/odoo#146907
A later commit will add `Offcanvas` as new bootstrap global in the
eslintrc files.
Since the globals are randomly sorted, the chance is taken to regroup
those.
Part-of: odoo/odoo#146907
Before this commit, the "on hover" animation option would be shown for
images of type url-attachment-redirect.
Selecting that "On Hover" option value would result in a crash if the
image was CORS protected (which is often the case).
Steps to reproduce:
- Drag & drop "Text - Image" snippet
- Double click on an image to replace it
- Select in the media dialog "Add URL" and insert a CORS protected
image URL
- The image is correctly added, and its url is something like
`/web/image/123-redirect/xxx.jpg`
- Click on the image and then click on its "Animation" option and select
"on hover" as value
-> It crashes
The same error will happen with absolute URL of a CORS protected image
(instead of the relative local redirect attachment-url
`/web/image/123-redirect/xxx.jpg`).
Technical stack:
> the XML option `data-animation-mode="onHover"`
> call the js method `animationMode()`
> calls `trigger_up('enable_hover_effect')`
> calls `setImgShape()`
> calls `_applyShapeAndColors()`
> calls `_writeShape()`
> calls `applyModifications()`
> calls `loadImage()` which fails to load the image
-----------
Technical note: JS `fetch()` takes advantage of the browser cache, no
need to create a `Map` cache for it, despite the `_computeVisibility()`
method being called multiple times.
----------
Related to commit [1].
The code is failing since commit [2] which added the "On hover" image
animation.
Other animation values won't fail. And not-cors-protected images will
work fine with the on hover option.
[1]: https://github.com/odoo/odoo/commit/f0fe283c761cd6b1d7293dd41795ac6fc721e341
[2]: https://github.com/odoo/odoo/commit/7f730f81ec541cc7791fc6b3fded17c838433f85closesodoo/odoo#146732
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
There is a code in charge of removing image animation attributes, but
this code was not removing the `o_animate_on_hover` class.
Probably not that big of a deal but during the investigation of a bug,
this class was not removed while the attributes where, which seems to
lead to a crash later.
Related to commit https://github.com/odoo/odoo/commit/7f730f81ec541cc7791fc6b3fded17c838433f85
Part-of: odoo/odoo#146732
There is cases leading to have a `data-shape` but no
`data-shape-colors`. It then makes the code crash.
Step to reproduce:
- Drag & drop "Text - Image" snippet
- Double click on an image to replace it
- Select in the media dialog "Add URL" and insert a CORS protected
image URL
- The image is correctly added, and its url is something like
`/web/image/123-redirect/xxx.jpg`
- Click on the image and then click on its "Animation" option
-> It crashes
In such a case, the code was crashing on the line below this fix:
`img.dataset.shapeColors.split(';')`
The modified code here is related to commit [1].
But the code only break in Odoo 17, probably following commit [2].
[1]: https://github.com/odoo/odoo/commit/cd403480f90cf7103651f3be818a14b06d3c73ca
[2]: https://github.com/odoo/odoo/commit/7f730f81ec541cc7791fc6b3fded17c838433f85
Part-of: odoo/odoo#146732
Since its introduction with commit [1], the blog post teaser is not
translatable as the field was not set as `translate=True` by mistake.
It's not possible sadly in stable to add it since the jsonb introduction
for translated fields, as `translate=True` behaves as a DB change.
Without a module update, it will crash, trying to set jsonb value in a
non jsonb field.
A best effort is make here to add a tooltip to hint what's going when in
translate mode and clicking on this field text.
Note that the field is not marked as translatable, but if people click
on it, they will see the tooltip.
If we face multiple needs, it might be clever to introduce a new
property on field declaration allowing the mark a field as "translate
forgotten" so that our builder shows this warning out of the box.
Step to reproduce:
- Install 2 langs on website
- Go to /blog in the main language and enter edit mode
- Type something on a blog card below the cover (it should show by
default the first few sentences of the blog content)
- Go to the alternate language and enter translate mode
- The field is not maked as translatable and can't be translated
[1]: https://github.com/odoo/odoo/commit/8cc850f3a54f62072d4df99de612f17494ffb123#diff-ae5c21b812e929930064fb93dc919ef1701fd63bae3d9fb306160d01be5629b3R114-R115
opw-3474638
closesodoo/odoo#147287
X-original-commit: abc5e3c119b74691949c7f48d3b7ba1f9fc88626
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
- Create a "/test" page, publish it
- Set "/test" as homepage url directly on the website (in the settings)
- Go to that page
- Open the page properties and change its URL from /test to /else
From there, the website setting (`homepage_url` field) was still set to
/test and not /else.
It means that the first "published" menu would then be used to avoid
serving a 404 as homepage to your visitors.
It is a bit confusing and people probably just expect to change that
website setting too when changing the page URL.
We had some feedback about similar flows (that couldn't be reproduced or
where people weren't sure) where people ended up writting on the wrong
page or losing their content.
Maybe this will mitigate the issue.
Kind of related: task-3476840
closesodoo/odoo#147086
X-original-commit: 374a1b31f70a3209b1ae11db8e5886350579c7f9
Signed-off-by: Jérémy Kersten <jke@odoo.com>
Using the animation option on an image can turn the image src from
relative to absolute.
It then makes our code crash in some cases (multi domain & cors
protected img). The previous commit makes sure to protect this case by
making the code more robust.
This commit is fixing one of the detected root cause (explained in
previous commit).
The fixed code was introduced with commit [1].
Since we can't guarantee our code has no other way to turn relative into
absolute url, neither that we won't introduce new code doing that, the
very small safety net from previous commit has to be keep as defensive
programming.
[1]: https://github.com/odoo/odoo/commit/7f730f81ec541cc7791fc6b3fded17c838433f85closesodoo/odoo#146731
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
The image mouseover animation, introduced with [1], can crash through
legit UI flows:
- Visit your website on domain 1 (you will need to access the same
website from another domain later):
1. On local: use http://localhost:8069/ and http://127.0.0.1:8069/
2. On runbot: use master-all and master in URL
3. On odoo.com: use xyz.odoo.com and xyz.com
- Drag & drop "Text - Image" snippet
- Double click on the image to replace it
- Upload any image
- Click on the image and set its "Animation" option to "On Hover"
- Save
- Outside edit mode, mouseover the image to see the animation
- Behind the scene, the img src is changed from /web/image/xyz to a
hardcoded base64 value to show the animation
- Now enter edit mode, the system will actually reset the src to the
original src (to replace the b64) but it will replace it by an
absolute link and not the initial relative link
- Edit the text below the image, BUT DON'T MOUSEOVER THE IMAGE
(otherwise the absolute url would be turned into b64)
- Save, again DON'T MOUSEOVER THE IMAGE
- Now go on your second domain to access the same page
Bug: Mouseover the image, a `Uncaught Promise > Failed to fetch` error
will be raised because of a CORS error.
Indeed, on http://localhost:8069/, simply doing this in your debug tool:
```js
fetch('http://127.0.0.1:8069/website/static/src/img/snippets_demo/s_image_text.jpg')
```
will throw the same error.
Note: we can't just modify the CSP rule(s) to allow that domain because
we have no way to know which domains are safe and really domains from
the same database:
- When you are on xx.odoo.com, there is no way to know that xx.com is
also your domain for the same website. At best it will be set in the
website domain but it's not always the case (often not the case in
mono website)
- When you are on xx.com, we have no way to know that xx.odoo.com is
also your domain for the same website. At best it will be set in the
ICP `web.base_url` but until that ICP is actually frozen, it will
change every time the admin logs in the database.
[1]: https://github.com/odoo/odoo/commit/7f730f81ec541cc7791fc6b3fded17c838433f85
Part-of: odoo/odoo#146731
Step to reproduce:
- Create a mega menu
- Enter edit mode and select it
- You can duplicate the top level block (but not remove it)
- If you duplicate it, you end up with a second top level block that you
can't delete ever, even by deleting inner elements one by one.
Technical details:
1. The remove button of the mega menu is already hidden thanks to commit
[1] which used the `forceNoDeleteButton` editor option introduced
with commit [2].
2. The table of content snippet also need to hide both the delete and
clone button. It was done in an "non-ideal" way with commit [3].
3. The delete button removal for table of content snippet was actually
improved to use the `forceNoDeleteButton` option of commit [2].
4. It's also commit [1] which prevent the deletion of the top level
block when deleting inner elements one by one: when the last one is
deleted, it regenerates the whole block.
This commit thus simply makes it so `forceNoDeleteButton` also hides the
clone button.
A first solution was made by introducing a new `forceNoCloneButton`
option, but there is good chances that you always want to either hide
both or show both, so merging those options for now is the simplest
solution.
It also takes the opportunity to remove the (now) useless code in the
table of content snippet.
[1]: https://github.com/odoo/odoo/commit/97810a9c40396bb27cb5779937734849d185cf1f
[2]: https://github.com/odoo/odoo/commit/7ef484377a493ebe558242480d0da6b542d6c247
[3]: https://github.com/odoo/odoo/commit/9fb2dad97cfbd412bee3cb5d1358a9835e721f60#diff-ea32a091d6b1a47aeea680fa39bbc9111260cbdaf07e9f388a9d04741806ea8fR128-R129
opw-3604033
opw-3627319
closesodoo/odoo#146745
X-original-commit: 44b006778df913b847c58b3e405d2a177fcb1a7c
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Before this commit and since PR [1], the default "checked" value set on
checkboxes field on the form snippet were lost once the page is saved.
This is because [1] changed the rendering engine of qweb templates from
our own qweb js rendering code to owl templates rendering.
By doing so, `t-att-checked="'checked'"` would toggle the "internal"
checkbox checked value but would not add the checked attribute on the
element.
It's a deliberate choice made in owl. As the checked attributed does not
mean the same as the internal checked value, it makes sense.
Indeed, the checked attribute is about the default value of the checkbox
while the checked internal value is about the current checked state of
the checkbox.
In React, for instance, the same behavior can be seen. And if one wants
to really set the checked attribute, they got to go with
`defaultChecked`.
Same apply with `value`.
Maybe owl will implement the same `defaultXXX` behavior in the future as
it's something that was already discussed on their side.
Step to reproduce:
- Drag & drop a form in the website builder
- Add a new custom field and select "Multiple Checkboxes" type
- Set one of the checkbox checked by default
- It is visually checked, but the attribute is not set
- Save the page
-> The checkbox is back to unset state since the attribute was not set
[1]: https://github.com/odoo/odoo/pull/130467
opw-3607795
closesodoo/odoo#146328
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Before this commit and since [1] when the website builder was moved from
the "frontend" to the "backend" of Odoo in Odoo 16, the option to enable
URL redirect when updating a page URL was "compressed":
- The toggle/switch element has not enough room to be displayed entirely
if there were too many dependencies
- The toggle/switch label was split in multiple lines, words could even
be split in 2.
Step to reproduce:
- Go to / in the website builder (so the / finds a lot of dependencies)
- Open page property
- Change the URL field, you see the redirect url field appear with the
mentioned issues.
Note:
- In other languages, the switch label could be even longer, splitting
the line makes even more sense
- Removing a class is generally something to be avoided in stable, but
this type of class should not be xpath'd anyway. And given the
template structure, it's unlikely someone would have xpath it as it's
easy to xpath any element without relying on classes.
One solution would have been to add a new class to cancel the first
one but it seems overkill in this case.
[1]: https://github.com/odoo/odoo/commit/2ef7e788263b4742a8e0788f47673b7b31da3726closesodoo/odoo#146244
X-original-commit: 8c17c487e6632192874133a2ce4265a0f1eaf6fb
Signed-off-by: Outagant Mehdi (mou) <mou@odoo.com>
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Before this commit and since commit [1], it was possible to clone a page
in the page list view.
It shouldn't be the case, cloning a page lead to bad result: a page
with the same URL which is not shown in the page list view because pages
are filtered by URL to remove duplicates.
Cloning a page has always had to be done through the page properties >
"clone page" button. Doing it this way will ask the user for a new page
name (and so a new url). The page will then correctly be listed.
[1]: https://github.com/odoo/odoo/commit/3192051806e0da1276604a31ad818f8768105362
opw-3591738
closesodoo/odoo#146173
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Commit [1] removed the `email_from` field from the `project.task` model
but forgot to adapt/delete some field occurences.
One of those is related to the form in the website builder which allows
to create task when the form is sent.
Two errors were detected:
- Non critical:
The field is still passed to the form field whitelisting process.
Since the whitelisting is done in raw SQL, it didn't crash or log
anything even if the column did not exist anymore.
- Critical:
The field was still marked as model required in the form JS registry,
altering the form builder behaviors.
One of those is that when the form input related to this field was
re-created (eg when changing / hovering an option in the right panel),
it would lose it's "name" attribute.
Two possible issues from that point:
1. When a visitor submit the form, the "email_from" field value is not
set anymore in the task description and that information is just
lost. You then have no way to reach back to him.
2. (Minor) The auto-fill behavior of the form was not working anymore
Probably more issues were introduced but only those ones got detected as
of today.
Step to reproduce:
- Drop a website form, choose "Create a Task"
- Focus the default "Email" field
- Hover the mouse on the "eye" icon ("Invisible") next to the Position
attribute. If you inspect the DOM, the input has now lost the `name`
attribute.
- If you save, you will face the issues reported above.
- If you then reopen the editor and focus the email field again, the
tooltip will now say that the "null" field is required.
[1]: https://github.com/odoo/odoo/commit/a424cf481c676a230beeb6102fc67bedf472a882
opw-3626573
closesodoo/odoo#146170
X-original-commit: 6679fddbcaf7d9146ab242e0eed61ee0628f047f
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
See commit [1] for in-depth explanation and framework-js change but
basically, `renderToElement` do not allow multiple root nodes since
[2].
The fix is just about using the correct method to render multiple root
nodes. Without the fix, it just crashed when you click on the page
dependencies links.
Step to reproduce:
- Go to /
- Open Page Properties
- Edit / to /test
- A list of possible dependencies will be shown, it's a link that can be
clicked to open a tooltip to have more details
- Clicking on it crash without this commit
[1]: https://github.com/odoo/odoo/commit/2cff7e4094ebb4b56ab17a1462ff358b4b3e7ffd
[2]: https://github.com/odoo/odoo/commit/6303a3eacdca012649a2ffda627b65c17a7217f1closesodoo/odoo#145715
Signed-off-by: Benjamin Vray (bvr) <bvr@odoo.com>
The delay translation feature [1], when the website main language is not
English, is not working alongside the HTML Editor.
There seems to be multiple bugs, both in Odoo 16 and Odoo 17 following
jsonb and then delay translation.
A full investigation will need to be done (and tests written for it) for
all possible flows:
1. English DB + Website FR (only)
2. English DB + Website FR (main lang) + Website EN (translated version)
3. French DB + French Website (English is not even enabled on DB)
4. French DB + English website
5. Case 3. + Website EN (translated version)
6. Case 4. + Website FR (translated version)
Also, for each of those flows:
- both the website builder and the HTML Editor need to behaves correctly
(at least not wipe user content).
- both the Odoo records (xml views eg) and user records (new website
page eg) need to behaves correctly.
This commit, for now, disables the delay translation to restore what we
have in Odoo 16.
The whole investigation, fixes and tests will be done after this commit
in both Odoo 16 and Odoo 17.
Step to reproduce (one of the flow, which is problematic for one of our
big client to go in production):
- Have DB and admin in English
- Have FR only on the website
- Enter edit mode on a page (website builder)
- Drag & drop a snippet and save
- Open HTML Editor, add a blank line
- The page content is gone, user lost its page
------- Technical Details about above case ------------
In Odoo 16, before delay translation, in such a setup (FR only on
website), when modifying the html editor, it would have the same effect
as modifying the page content in the builder, because the English
version (not used because website only use the fr translation) would
also receive the website builder changes, both EN and FR would actually
be sync'd in DB.
For this particular case, it kind of worked, but probably not for other
cases like adding english as translation lang on the website where this
lang sync would not make sense.
This "urgent" fix/feature disabling is done because people are unable to
create or maintain website when they use the HTML Editor. Worst, they
lose all their work again and again.
Indeed, it's not yet sure how but module update also wipe user changes
in such configuration in Odoo 17.
All this is based on feedback of our "PS tech" which is unable to go in
production because of those bugs.
-------------------------------------------------------
Related to PR [2] which is the Odoo 17 forward port of commit [3]
introduced in Odoo 16.0.
[1]: https://github.com/odoo/odoo/commit/2d08f97c0778469b409fca23f2be5f5a98ce3df8
[2]: https://github.com/odoo/odoo/pull/144693
[3]: https://github.com/odoo/odoo/commit/f54aa6f58d494bca940a3e575d4092ee386d488c
task-3621753 (where the deep investigation and fixes will happen)
closesodoo/odoo#144760
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Commit [1] moved page scrollbar to #wrapwrap, which introduced some
issues. This was needed to not have a double scrollbar when the builder
edition panel was moved from left to right.
One of the issue if that the browser print was not working anymore.
A workaround has been found with this commit to make it work again. It
is just reverting the mentioned commit when inside the browser print
preview, which can be achieved through css directly.
Note that in the future, this PR [2] should revert the fact that the
scrollable element is the #wrapwrap.
Also note that while this fix allow printing pages again, there is still
the same behavior as in Odoo 13 and before (where you can print pages
too): the printing preview will not be in desktop size but display the
pages as on tablet size.
[1]: https://github.com/odoo/odoo/commit/4e7be69825163c0a0ff41c882a196fc7f3158fb3
[2]: https://github.com/odoo/odoo/pull/98429
opw-3557672
closesodoo/odoo#144107
X-original-commit: eb0a05319789ebc3732ef623a3811b5bc8b43daf
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
When creating a new website through the configurator, the images that
will be used on the website will be the one specified by the selected
industry.
We recently introduced 2 new images with commit [1] for which the
industries have no images set as we did not have time to do it.
It would require going through the ~4000 industries and finding a
relevant image on Unsplash for it.
This commit is simply using another existing set image instead.
Indeed, if an industry hasn't set an image, the theme one will be used
instead, which is less ideal.
Step to reproduce:
- Create a new website
- Select "Garden furniture store"
- Select the Orchid theme (the one in the middle to this day)
- Drag & drop the Banner snippet, 2 out of the 3 images used in this
snippet will use the theme images (images about flowers) instead of
images of furniture (related to the selected industry)
[1]: https://github.com/odoo/odoo/commit/3cbdf754ff8fac8a77887c4307b658cb86b0be1dclosesodoo/odoo#141117
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
There is an exact case where having a grid mode block inside a mega menu
item will fully bug: all elements will be on top of each other.
In order to reach this case, you need to:
- Create a mega menu
- Make the block inside this mega menu use grid mode
- Find a screen size where this mega menu will be part of the extra menu
items (hidden in the `+` entry)
- BUT the screen size should not toggle the mobile view
Point of attention when trying to replicate the issue:
When you enable grid mode, the result will depend on the available size.
So be sure to not enable the grid mode on a megamenu which is already
hidden in the extra items when you are in edit mode, in such a case,
there is no bug.
This commit simply disables the grid mode in such a case, it will thus
behave like the grid mode in mobile view and therefore be responsive
(disabled in mobile).
opw-3547405
closesodoo/odoo#139956
X-original-commit: fb209432049d9874308a2bdc3c9d2baa210ccced
Signed-off-by: Soukéina Bojabza (sobo) <sobo@odoo.com>
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Previous commit(s) did improve the preview of snippets when dragged and
dropped but also the `t-snippet-call` capability of some snippets.
Part of that improvement was to add snippet `onBuilt` JS output in the
snippet XML definition directly.
For google and facebook snippets, it means firing a request to those
websites when entering edit mode.
It's not that bad (considering the trade-off of the preview and
t-snippet-call), but will need to be re-discussed later post freeze to
find a better way to not fire those requests ideally when the snippet
is called in the right panel (but would need the preview to still work).
For the meantime, this request seems to be making a test fail
(`test_01_menu_hierarchies`) due to the gmap API call being returned
after the test has been marked as successful.
Before investigating further, this commit just prevent the iframe to
show up when in test mode so we can merge this work which is needed for
tomorrow freeze.
closesodoo/odoo#138748
Related: odoo/design-themes#726
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Commit [1] introduced a method to restore the mega menu state (closed)
so it's not saved open when saving the website builder edition.
That method is `_restoreMegaMenus()`.
It was then moved with commit [2], where it was called in `destroy`
where it was actually making the code crash because once you reach
`destroy`, the website content (the iframe) has already been reloaded
(and thus removed / recreated).
It's done through `reloadIframe()`.
So, depending of your network speed and the server response time, if the
page is served before reaching the mega menu restoration, it will crash.
Restoring the mega menu in the (wysiwig) destroy doesn't seems to do
anything as the page is already saved when reaching `destroy`.
Step to reproduce:
- Have a high latency, like 500ms (you can create a profile in chrome
debug tool in network tab)
- Create a mega menu on the website
- Enter edit mode
- Directly save or discard
-> Traceback, the jQuery toggle elements (`.o_mega_menu_toggle`) are not
in the DOM anymore, since the iframe got reloaded. Those elements
thus don't have a reference to `$` anymore, ultimately making this
line crash:
```js
const $toggle = toggle.ownerDocument.defaultView.$(toggle);
```
[1]: https://github.com/odoo/odoo/commit/1345702258adbfbee0d780dc22e552395e6d1df7
[2]: https://github.com/odoo/odoo/commit/d7245d2abf528d093226c80e40975e63d61e8997
opw-3483837
opw-3478642
closesodoo/odoo#138538
X-original-commit: caeb92bfb624c9c30ec9f9e3c2b1dd385e9b089b
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
This reverts commit 3b9401c354.
It shouldn't have been merged in the first place. The PR was `r-` but it
seems like the mergebot bugged and still merged it because there was an
occurence of `r+` in the sentence which asked robodoo to `r-`.
> robodoo r- just to be sure, since there was a random r+ not [...]
Rationale of the revert:
- Bad field name:
- "ecommerce" in product module
- "ecommerce" but used in POS
- Arguably very low value to share the field -> This field is used in
ecommerce to add info exactly between the price and the name of a
product. There is low chance that you want to share that exact
information with the POS.
- Technically, it couldn't work. What you design in website builder on
the product page is related to website assets JS and CSS, which are
not loaded neither in the backend and neither in the POS.
It was leading to multiple critical issues, mainly:
- Losing the whole style of the content (CSS)
- Breaking completly the snippets (visually and design wise) (CSS/JS)
- Not even show (JS is in charge of showing the content eg)
Note that the same issues were already existing in that field in the
backend (it's shown in the product form view). The ecommerce team was
looking for a solution to make it work, but it's impossible as to work,
it would need the website / frontend assets, which can't be loaded in
the backend / POS.
The cancel of this PR was validated with PO of POS and ecommerce
following those explanation, which they weren't aware of.
Apart from this revert, further PR will be done to:
1. Remove the field from the product form view (ecommerce app)
2. Create a new field for POS
Revert of https://github.com/odoo/odoo/pull/136906
task-3524272
closesodoo/odoo#137514
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
*: website_event
Without this, the seo saving would not forward the current website in
the context. It's especially bad in this case as it's writing on views
which are not triggering the COW due to the lack of a website_id in the
context.
Step to reproduce:
- Go to /shop (if you didn't do anything, this will be bound to the
`website_sale.products` view which has no website_id set and is called
a generic view)
- Open "Optimize SEO" dialog and type something in the title
- Save
- It saved the change on the mentioned view, without duplicating it
(COW) before writing on it. The title you added is now applied to
every websites and not only the one you edited, which is against the
website holy grail rule: only the website you edit should be changed.
Technically, this is because we refactored that part of the code in Odoo
16: the website is now editable in the backend.
Note that this fix also revealed that a test for events (which has been
introduced with [1]) was relying on the bug: it tested the meta title of
a view that should (and will after this fix) have been COW'ed. This test
will now indirectly protects this bug from re-happening, although we
might want to write a dedicated test in the future as the behavior for
events might need some refactoring.
[1]: https://github.com/odoo/odoo/commit/2072a7739eb9a9ee87c8b3c7b0d43a82a7e2375f
opw-3499285
closesodoo/odoo#136550
X-original-commit: c45c0bf8fff7285a9fff33ff9bf1c24bbfb130e7
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Co-authored-by: qsm-odoo <qsm@odoo.com>
This commit fixes this error:
- The IMP done at [3] added a lot of fields but all of those forgot the
`_t()`/`_lt()` translation.
Note that:
1. A fix to replace `_t` by `_lt` was done at [4] but it was badly done
as it was not targetting the correct version... and only fixed one of
many occurences.
2. In this forward port, using `_t()` seems to be working again, using
`_lt()` is not required anymore. This part of the PR has been removed
here. For tracking purpose, here was the other bug:
- The form registry fields added in [1] and [2] in Odoo 13 had a
`string` attribute translated with `_t()` while now it should be
translated with `_lt()`. It was surely working in Odoo 13 but not
anymore. It's not worth investigating to be sure.
- Not needed since a recent commit which removed `_lt()` (it's a
deprecated alias to `_t()` which now handles the lazy translation
directly too.
[1]: https://github.com/odoo/odoo/pull/32565
[2]: https://github.com/odoo/enterprise/pull/4063
[3]: https://github.com/odoo/odoo/commit/617eba941785aa680edb826e14b0009637d60dee
[4]: https://github.com/odoo/odoo/commit/2be83cae7bcda369ed5bc7806aef845c6c76e687
opw-3471873
closesodoo/odoo#134238
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
---- Horizontal spacing issue ----
The horizontal spacing between systray items in the patched website
systray is too small. It was using the regular margin of the default
Odoo systray which is composed of almost only icons for which a small
spacing is what we need.
But the website patched systray contains a lot of text, where we want a
bigger spacing, exactly how we do for the app menus.
---- New class on systray ----
To target the website systray in scss, a new class was added on it.
There is no clean way in JS to add that class, as the website systray
patch is only altering the method in charge of returning the systray
items. The rest is left up to the base NavBar class component, including
rendering.
That NavBar component does not come with a built in way to add a class.
We could have targeted the DOM directly in the patch through
`this.root.el` and added the class in JS directly but that seems like an
owl anti pattern.
---- Vertical align issue ----
Before this commit, the btn in the systray didn't have the same line
height as other elements: both the "Edit" (in main lang) and "Translate"
(in alternate lang) buttons had a (1-2px) vertical alignment issue.
This was because, despite having the same font style and font size, they
had a different line-height making it glitch 1-2px vertically.
It's a bit less visible for the Edit button as there is a pencil icon
between this text and the text next to it.
For the translate button, it's quite visible directly.
For testing purpose, you can simply remove the icons and the left-right
margins of those systray items so the text are glued to each other and
you clearly see the misindentation.
---- Misc ----
For tracking purpose, there is multiple cases to be tested regarding
those buttons:
- Community vs Enterprise (where those are colored)
- Regular mode vs translate mode
closesodoo/odoo#135956
X-original-commit: 066e4a1ddd9faf7ba866c5428c943b5af8115191
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Co-authored-by: "stefanorigano (SRI)" <sri@odoo.com>
This commit introduces a test in Odoo 15 about a broken behavior in Odoo
16 which was not covered by a test.
A fix will be shipped alongside this commit forward-port in Odoo 16.
The behavior involved here is about:
- Having a multi-url defined route
- One of those URL not having a model converter
- One of those URL having a model converter
- Creating a 308 redirect for the URL without model converter
Something like this route (real example from the code):
```py
@http.route([
'''/shop''',
'''/shop/page/<int:page>''',
'''/shop/category/<model("product.public.category"):category>''',
'''/shop/category/<model("product.public.category"):category>/page/<int:page>'''
], type='http', auth="public", website=True, sitemap=sitemap_shop)
```
And this redirect (real usual example from clients):
```py
self.env['website.rewrite'].create({
'name': 'Test Multi URL 308',
'redirect_type': '308',
'url_from': '/shop',
'url_to': '/magasin',
})
```
In Odoo 15, everything will work as expected:
1. Accessing /shop will redirect to /magasin
2. Accessing /shop/category/categ-1 will not redirect and user will be
on /shop/category/categ-1 still
But in Odoo 16:
In the case described above, acessing the URL with model converter from
the route will fail and redirect to a non slugified URL in the form of
`/some-url?param=test.model%287%2C%29` which is basically the
stringified encoded version of the record `test.model(7,)`.
Note:
- It doesn't matter if the route is contained in the other, the error
will still occur even if `'''/shop'''` was `'''/abc'''`.
- Even if all URL from the route have their own 308 redirect, the error
will still occur.
- It won't have any issue if there is a 308 on the route with model
converter: both the one without model converter and other url with
model converter will work and won't be impacted.
This might be because of a concept of "merging URL" from httpocalypse,
see https://github.com/odoo/odoo/commit/347a3ccf763cc6958d5dc1df3168c9c65245736c
opw-3450054
opw-3466498
opw-3477380
opw-3475694
X-original-commit: 22ca1c48f78cdf575f9a2b0823f9487f942bc7cd
Part-of: odoo/odoo#134206
Entering edit mode in the website builder is bound to ALT+A.
But often, you are on the frontend version on the page you want to edit
where you first have to navigate to the backend version of the page to
enter edit mode.
This commit adds the same shortcut in the frontend pages.
It's a low effort/small code added to have a really useful shortcut.
Even if there is no hint about this shortcut existence, it will be
found quite easily as people used to keyboard will, out of habit, press
this keyboard even in frontend (after a page reload eg, which navigates
to the frontend).
closesodoo/odoo#132236
X-original-commit: 09287915371032753593295df6c616f3bcb55ac9
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Step to reproduce:
- Be sure to have `sale_quotation_builder` installed
- Drag & drop the "Steps" snippet on a product in edit mode
- Add this product on a SO in the backend
- Click on Customer Preview
-> The step snippet will not have the connector lines anymore
This is because in Odoo 16, the step snippet connectors are now `svg`
element (see [1]) which are removed by the sanitizer.
```py
from lxml.html import clean
svg='<svg><path/></svg>'
clean.Cleaner().clean_html(svg)
```
It's not the case in the `website_description` field of the product
template as this field is defined with `sanitize_overridable=True` [2]
which make it so the users with the right to do so can bypass the
sanitation and use the Step snippet in this field.
Since the quotation description can be a copy of that field, but without
the same sanitize behavior, the connectors are lost.
Note that most of the `sale_quotation_builder` description HTML fields
were already set as `sanitize_overridable=True` with [2] and [3] but
those ones were not.
[1]: https://github.com/odoo/odoo/commit/aba31e9f2d8a44ce1586403f2a621a6caeed57b4
[2]: https://github.com/odoo/odoo/commit/44ae3f38da07c2215b1547d992f053a11829a8ac
[3]: https://github.com/odoo/odoo/commit/811cf78ee1e63a7c41efe578fb64ee2deeca1dde
opw-3380346
closesodoo/odoo#129690
X-original-commit: 7a928c92136400454e7ed53326f2cdc9173fa1b3
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Before this commit, only the cross icon "x" top right of the popup would
be able to properly close the popup and set a cookie to prevent that
popup to open again later.
There is no way through the UI to make a button in the popup do the same
behavior.
This commit now add this behavior to any `.btn-primary` element inside
the popup, except a few ones like the newsletter input group button and
the website form submit one.
Note that we have a way in stable to do that, but it's through code.
People have to add the `js_close_popup` class to the button. This class
is there for this reason, but it's obviously limited to tech people
only or our support.
task-3377306
opw-3328135
closesodoo/odoo#124432
Signed-off-by: Arthur Detroux (ard) <ard@odoo.com>
When user creates a new 'livechat channel' in website, and click on
'Optimize SEO' a traceback will appear.
Step to reproduce:
- Install 'website' and 'im_livechat' module
- Go to 'website' module
- Click on 'NEW' and then create a new 'Livechat Widget'
- Go to 'Site' and click on 'Optimize SEO'
Error: A traceback appears: Invalid field 'website_meta_title' on model
'im_livechat.channel'
The menu should not be shown for such model which do not inherit the
SEO mixin. This commit ensures that.
sentry-4241511888
closesodoo/odoo#128187
X-original-commit: b2bcf950bd62872fe5dc9455636256d9213b58dc
Signed-off-by: Colin Louis (loco) <loco@odoo.com>
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Before this commit, when opening the media dialog, the optimized images
would be fetched too.
An optimized image is an image related to an original one which received
some modification (crop etc).
Those optimized images are hidden by default, and can only be shown when
toggling the "Show optimized" option, which can be shown only in debug
mode.
So, fetching those images outside debug mode is:
1. Useless, as we don't do anything with those and never show them
2. Buggy sometimes, as a full patch of "Load more" images could be
composed of only optimized images, meaning the "load more" will
actually look like it did nothing, as all received images are (and
will remain) hidden.
There is a tiny exception: if the edited image is an optimized one, we
still need to fetch it's attachment so we can show this image in the
media dialog as selected.
This fix thus filter out all the optimized images (except the one from
the explained exception) from the `search_read()`.
opw-3372811
closesodoo/odoo#127853
X-original-commit: 24177b5e2b56a94a51ac4b922d555beda9347611
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
The website frontend apps menu list is not working when the user has a
`Home Action` defined on his user.
The `Home Action` is meant to redirect to the defined action whenever
that user is login in.
But since the backend menu links on the website have most of the time
no `action` defined but just a `menu_id` defined, the `Home Action` will
kick in and take over the redirection, the same way as if the user just
type `/web` without any params.
To solve that, we simply force the `action` of those links (if they
don't already have one).
This will make sure that the redirect is working as it should for users
having a `Home Action` set.
Step to reproduce:
- Set a Home Action for any user, like "Contacts"
- Go to the website frontend, eg on `/`.
- Click on the top left button to show the backend app menus list
- Click on any menu (CRM, Invoicing, Calendar..)
-> Most of those menu will not redirect you were you are supposed to be
but on your Home Action instead.
You can figure which one will be buggy or not by just mouseovering
the link and see if the URL param `action` is set to something or
not.
--- Technical hints ---
There is multiple methods to get the list of menus in Odoo:
- `load_web_menus`: called by the web client rpc, calling `load_menus`.
If a top/app menu has no action defined on it, it sets the first found
action of their children menus to it.
It returns the full (flat) list of menus, not only the top/app ones.
This method is not ormcached but is calling an ormcached method and
just doing some tiny work on the data.
- `load_menus_root`: called only by website backend template to add the
app list on the website (in the frontend) to jump to the backend.
It does not force the action if a menu has no action set on it.
It returns only the top/app menus.
This method is ormcached.
Note that this method seems only used by the website module.
- `load_menus`: returns the full (flat) list of menus without a force
action
This method is ormcached.
Fixes https://github.com/odoo/odoo/issues/119971
task-3378963
closesodoo/odoo#127840
X-original-commit: f28a349aa40b2ea48ef8f2b71e806b965777014f
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Since commit [1] (introduced in Odoo 15), when a published website page
has no URL set, the search snippet would crash when typing something
inside it.
I am not sure why was the page url not required at the model level, this
will be considered in master.
Note that to create a page without a URL, the only flow is to create a
new page in the backend.
Indeed, the `write` is overridden to add a trailing `/`, and the
frontend flows to create/write a page are also shielded against empty
URL.
Note that it's easy to create a page without a URL through legit flows.
Depending on the Odoo version, there is always a way to reach a website
page form view: either simply Website > Configuration > Pages or
Site > Pages > Debug mode > Click on Bug icon in tree view > Click on
page m2o.
Step to reproduce:
- Create a page with no URL (see above explanation how to do it)
- Make sure it's publish (you can do it in the form view)
- Drag & drop the Search snippet on a page
- Type something in the search snippet
-> TB
[1]: https://github.com/odoo/odoo/commit/9f9c4bb7e40233e633f97c60fb00ae191e9077af#diff-77bd6b19c39e211959885024bcad914655ff84cfc10c16633687d014e50aa69aR69
Fixes https://github.com/odoo/odoo/issues/129728closesodoo/odoo#129915
X-original-commit: f75ec6131eff9165b06d42d27a49dd756387f4a0
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Before this commit, the "click on save" in french step was checking for
the element containing the "Save" french translation term, which is
coming from Transifex.
It sometimes changes, making the tour fail.
It was "Sauver", then "Sauvegarder" and now "Enregistrer".
This was a well known issue as we already made a quick and dirty fix for
that with [1].
It was judged enough as we did not want to spend more time on this fix
as it was expected to not break anytime soon, and we needed a quick fix.
The chance is now taken to adapt the test to not rely anymore on the
.pot file.
We also take the chance to not use an existant translation but a fake
one as it will speed up the test (no need to actually read/parse .po
files are there is none for this lang).
[1]: https://github.com/odoo/odoo/commit/594ac2c9651f27cc1623fcd5b916cb191241651b
runbot-22946
runbot-22945
closesodoo/odoo#127493
X-original-commit: 6d9d4d1b43544ae98cc8037ba01c81b66ab9f0ee
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
When a field had an error (required, wrong format etc), upon submission
of the form there would be a JS traceback preventing the page to work
anymore (the Donate button would spin forever).
This is because the code was not adapted to the Bootstrap 5 migration.
It seems like this code to update the config's content is not required
anymore, as without it the content is correctly updated through the
existing `.popover()` call a line above.
You can ensure that by simply omitting your email and send the form, it
will tell you that the email is required. Then just type "a" in the
email field and send again, it will tell you that the format is not
correct.
Somehow, it seems to also be the case in Odoo 15 in Bootstrap 4,
removing those line do not break that.
Some fixes were made at [1] and [2] about the same issue but somehow
people just fixed their own case, while grepping `.config.content` would
have easily found this one too.
[1]: https://github.com/odoo/odoo/commit/37546006940f99c8860e89997ed7a623abd5fa72
[2]: https://github.com/odoo/odoo/commit/0cff1dc2967cafeb8964ed0802c309d3bb7f7525
opw-3381196
closesodoo/odoo#126444
X-original-commit: 9e46ceea801d5044f5db4fee65d5980c64cfa23b
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
This commit ensure the expected tables are accessed when a page (not
only) is requested.
This is needed because without that, we can only check the query count
number which might be broken without being noticed:
- Commit 1 reduce queries by 2 (no need to access table X anymore)
- Commit 2 later reduce queries by 2 (less access on a table) but
without noticing it, it also now introduce back the access of table X.
At the end the query count is still fine, but the code is not: it broke
a previous improvement while it was not necessary.
Worst, it could even lower the query count despite still breaking a
previous improvement (-3 queries +2 queries back).
Also, since the query count of a page is not exactly the same inside a
test and in real use cases, an `EXTRA_REQUEST` param is used in those
tests to abstract that change and still use the "real use case" query
count in the test to fit the reality, be human readable and easier to
write/debug.
Indeed, in test mode there is more queries due to the test cursor
rollback and savepoint, but there is one less query (the cache one).
Some commit wrongly reduced that `EXTRA_REQUEST` param making it looks
like there was an improvement while there wasn't.
This commit will help preventing all of that, ensuring the correct
tables are accessed and only those, on top of checking the query count
number (we still need to check the query count in case there is a query
not catched in the SQL table logs).
Some of the PRs/commits where it happened:
- https://github.com/odoo/odoo/commit/aa1c1b0bcb5327894c7b00d0454eebae06eaa005
- https://github.com/odoo/odoo/pull/112000/files#r1160851862closesodoo/odoo#124939
X-original-commit: 26e1fc3abd54a1baa16cf1c99d75d501a8dc6906
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
This commit introduced a way to log queried table on cursor without
having to be in `--log-sql` mode.
It will be used in next commit to add complete performances tests which
will ensure the correct tables are accessed when a page is requested.
This is useful as right now those performances tests are only doing a
check against the SQL query number without ensuring the queries are the
correct ones.
As a result, one could introduce an improvement which would reduce the
queries (-2) but break another previous improvement (-2) which would
add back those queries (+2). Since the query count would be the same
(-2+2), it would be undetected, instead of being fixed directly and
keep both improvements (-2-2).
See next commit for concrete example(s) and use of this improvement.
X-original-commit: 8ef6137a34aa35182399a2bd4b20dd57479ab2e7
Part-of: odoo/odoo#124939
Before this commit, a multiline SQL Query (crafted, as the ORM is one
lining the queries) would not be catched in the `sql_from_log` and
`sql_into_log` variables, despite being shown and counted in the request
queries (unless the `into` or `from` part of the query is on the first
line).
At the end, not only the query was not listed in this table report but
if you sum the table report queries, it would not match the shown query
count.
This is the case for the `website_visitor` UPSERT query:
```sql
WITH visitor AS (
INSERT INTO website_visitor (...)
VALUES (
..., (
SELECT id FROM res_country WHERE code = NULL
)
)
ON CONFLICT (access_token)
DO UPDATE SET
...
RETURNING ...
)
SELECT id, upsert from visitor;
```
This commit is allowing the `into` and `from` part of the select to be
detected even if it's not part of the very first line of the query.
As a result, since a SELECT and an INSERT could be part of a same query,
we exclude the SELECT to be considered as a SELECT query if an INSERT
was already found in this query.
This will allow to have table query count log be in par with the query
count number (except for the `base_registry_signaling`, see note below).
It will also be helpful in next commits which will introduce a way to
access those logged queried table in the testing suite without being in
`--log-sql` mode.
Note: the SQL query on `base_registry_signaling` (which occurs every
time to check if the cache should be invalidated) is not tracked
either due to how it is build, it doesn't seems really needed to
have this one shown in the table logs. See [1].
This commit also remove the `lower()` usage and use the `IGNORECASE`
flag from `RE` instead.
[1]: https://github.com/odoo/odoo/commit/4aeba0c12e0512e537178e6cba0993a11f001ec3
X-original-commit: 255aa168bef5d63480e88b4d34511e3aac910f49
Part-of: odoo/odoo#124939
Without this commit, the words in this template (below the images) won't
be colored as translated (green) / not translated (yellow).
This is because there is a block element inside an inline element and
the color is applied on the inline element which has no impact on
children blocks since inline elements don't take up available space.
See https://stackoverflow.com/a/7439861
Note that:
- `display: inline-block` is not an option either as it would be messing
with the `t-field` which receive this `data-oe-translation-state`
property too. Applying the `inline-block` style on those will break
the layout, typically on a product page.
- same for `display: contents`, it's not working as such elements don't
generate any box, properties like border / bg color etc are thus
ignored.
opw-3305117
closesodoo/odoo#124560
X-original-commit: ed89b0ffd7f4d6a04f71f474720ff4d82c9ecf9a
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Commit [1] introduced an cleaning of the iframefallback on page unload,
which was removing the `autoplay` attribute of the iframe `src` URL.
It was done to prevent video/music to keep playing in the invisible
iframe.
The fix was not generic and purposely targetted the elements which we
identified as problematic.
Commit [2] then made that cleaning generic, catching all iframe.
Doing so, it was actually catching too many iframes and led to traceback
on iframe not having a set `src`.
This is the case for every database having a configured reCaptcha, among
other things.
For reCaptcha, it's because it's adding the following iframe dynamically
through their third party script:
`<iframe style="display: none;"></iframe>`
This commit ensures we only target iframe having an URL attribute being
set to something.
Step to reproduce (with reCaptcha):
- Enable and configure reCaptcha
- Go to /contactus
- Leave the iframe page, eg click on "Contactus" menu to refresh it
-> Traceback
[1]: https://github.com/odoo/odoo/commit/ad78585cd514f5ff16647572d34937c18a112529
[2]: https://github.com/odoo/odoo/commit/6be8af36726d750065972e122e8f4a0aa0f56a17
opw-3343450
closesodoo/odoo#123621
X-original-commit: 463d4ee0c8000f948463772b7c96c8d111bcbc8e
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Before this commit this tour was often failing. It seems to be because
there were some requests still being executed / received after the test
was marked as successful and browser getting killed.
According to the logs, even when the tour is actually not failing, there
is still some unexpected requests going on.
With this commit, saving and waiting the edit mode to be exited will
prevent all those requests issues, as it seems like the requests done
after exiting edit mode are all awaited before marking the test as
successfull.
== Before the fix success case ==
- Tour snippet_editor_panel_options on step: 'The text toolbar should still be visible, and the text still selected. (trigger: #oe_snippets .o_we_customize_panel > #o_we_editor_toolbar_container)'
- GET /website/static/src/img/snippets_options/header_template_default.svg HTTP/1.1" 200 - 0 0.000 0.003
- [Same GET for 10 other header templates]
- test successful
- Session expired
- POST /website/theme_customize_data_get HTTP/1.1" 200 - 3 0.001 0.003
- [2 lines above x10]
- Deleting cookies and clearing local storage
- Navigating to: "about:blank"
- Navigation result: {'frameId': 'A538603CC37A4E9EBA99B8624C1CD34E', 'loaderId': '9187051DD3D9477FA4EDEB1A544D584E'}
- Waiting for frame 'A538603CC37A4E9EBA99B8624C1CD34E' to stop loading
- waiting for threads: [<Thread(odoo.service.http.request.139669352166976, started 139669352166976)>]
== Before the fix error case ==
- Tour snippet_editor_panel_options on step: 'The text toolbar should still be visible, and the text still selected. (trigger: #oe_snippets .o_we_customize_panel > #o_we_editor_toolbar_container)'
- GET /website/static/src/img/snippets_options/header_template_sidebar.svg HTTP/1.1" 200 - 0 0.000 0.004
- [Same GET for 10 other header templates]
- test successful
- GET /web/static/img/smile.svg HTTP/1.1" 200 - 0 0.000 0.001
- GET /web/static/img/spin.svg HTTP/1.1" 200 - 0 0.000 0.001
- Failed to fetch
- Asking for screenshot
- Trying to set result to failed (TypeError: Failed to fetch) but found the future settled (<Future at 0x7f8fa1a25120 state=finished returned bool>)
- Deleting cookies and clearing local storage
- Screenshot in: /data/build/tests/36222061-master-all_no_autotag/screenshots/sc_20230513_220042_739175_TestUi.png
- Navigating to: "about:blank"
- Navigation result: {'frameId': 'E1A779132E972A440E5FE892BBBC9FEC', 'loaderId': '822ACED443DB0C84F57DD4A1FF451D5B'}
- Waiting for frame 'E1A779132E972A440E5FE892BBBC9FEC' to stop loading
- waiting for threads: [<Thread(odoo.service.http.request.140254747010624, started 140254747010624)>]
== After the fix case ==
- Tour snippet_editor_panel_options on step: 'iframe body:not(.editor_enable)'
- GET /web/static/img/spin.svg HTTP/1.1" 200 - 0 0.000 0.003
- POST /website/theme_customize_data_get HTTP/1.1" 200 - 8 0.002 0.035
- [Many other POST/GET requests]
- test successful
- Deleting cookies and clearing local storage
- Navigating to: "about:blank"
- Navigation result: {'frameId': '4B87BC8A50A3FEBD7D508394DD5BDB19', 'loaderId': '7CCB3B6434B52B456A1AA470C3CFA1BF'}
- Waiting for frame '4B87BC8A50A3FEBD7D508394DD5BDB19' to stop loading
- waiting for threads: [<Thread(odoo.service.http.request.139744500471360, started 139744500471360)>]
runbot-15312
closesodoo/odoo#121795
X-original-commit: 936cc061ab20dc1fe4587b24f59dc322d0e7ad9b
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
== Issue ==
A business code error was detected by the internal team on our
production. The cache and assets where invalidated !WAY! too often for
the past months.
It was hard to figure but finally the error was tracked down to be
located in the assets retrieval stack of our code when a database is
accessed through multiple different domains.
In our production use case, whenever one was accessing `odoo.com/web`
after someone accessed `accounts.odoo.com/web`, the assets would be
invalidated and recomputed, again and again, whenever someone accessed
the backend on a domain after someone else did with another domain.
Obviously, on our production, this could be occuring multiple time per
minute.
Technically, this is because the "assets retrieval stack" had a mismatch
in multiple endpoint when trying to find if a current website was
involved (serving for the frontend).
Some business method were using `env.context.get('website_id')` while
others were using `env['website'].get_current_website(fallback=False)`.
From there, when the code was called without a `website_id` in the
context, `get_current_website()` would still return a `website_id` when
called from `http://odoo.com` as there is a website having its domain
set to it. `get_current_website()` is then finding it and returning it.
But it would not when the user is on `http://accounts.odoo.com`.
Since we have a custom scss override (done through our website builder,
basically an ir.asset linked to a "url type" attachment:
`/website/static/src/scss/options/colors/user_color_palette.scss`) for
our website to define the website colors which is shadowing the scss
file from disk.
So, depending of the host/domain, either the real file disk for this URL
or the ir.asset linked to our website for this URL would be fetched to
generate the bundle hash (which is basically the last modification date
of the files/attachments).
Obviously, the file on disk and the ir.assets have a different last
modification date.
The system would then consider the assets as outdated and would
regenerate it.
You can see it in the logs where the attachment id of the assets URL
would get higher and higher everytime you access the DB through another
domain.
Using `get_current_website(fallback=False)`:
- `_get_related_assets()` https://github.com/odoo/odoo/blame/30d3b97b5ece379d9ddcbceda9d12c03dc7f4a48/addons/website/models/ir_asset.py#L14
- `filter_duplicate()` https://github.com/odoo/odoo/blame/30d3b97b5ece379d9ddcbceda9d12c03dc7f4a48/addons/website/models/ir_asset.py#L41
- ..
Using `get_current_website()`:
- `_get_custom_attachment()` https://github.com/odoo/odoo/blame/30d3b97b5ece379d9ddcbceda9d12c03dc7f4a48/addons/website/models/assets.py#L162
- ..
Using `context.get('website_id')`:
- `_get_asset_url_values()` https://github.com/odoo/odoo/blame/30d3b97b5ece379d9ddcbceda9d12c03dc7f4a48/addons/website/models/ir_qweb.py#L23
- ..
== Fix ==
A fix could have been to aligned those to use the same way of retrieving
the website but it would be too fragile (definitely some other places
where the same bug is involved but not yet found).
What is done in this commit is something we wanted to do for a long time
(see [1]) but was based purely on guess and feeling rather than concrete
bug / use case, but now that we found a real use case, we will do it:
- It doesn't seems to make sense to consider the request host/domain
when we are in the backend
- Same for the forced session, those should only impact the frontend
calls.
But this seems to have too much impact in stable to be changed, as it
would require to check every caller to also check for the session if
it makes sense. This will be done in master as not really needed to
prevent the critical bug fixed here.
- When something wants to alter the backend with a website, it should
explicitely be passed in the context, which is still considered
regardless if it's a backend/frontend call.
- If something needs to consider the forced website in session in the
backend, it should explicitely check it, not relying on
`get_current_website()`.
== Step to reproduce ==
- Start a db with website installed
- Enter the website builder in edit mode and change the "Theme Colors"'s
first "Color Presets"'s background color (it is white by default).
- Set the website domain to `http://127.0.0.1:8069/`
- Go to `http://127.0.0.1:8069/web` and login
- Go to `http://127.0.0.2:8069/web` and login
- Now start refreshing those 2 pages one after each other.
Everytime you will refresh the page, it will take a very long time
(~5-10 seconds) before loading the page, and monitoring the logs will
show something about invalidating the cache and huge query count.
== Benchmark ==
For the explained "multiple domain access" case, the backend /web will
now be loaded in less than 10ms and with ~10 SQL Queries when website is
installed, while it was taking ~4 seconds and ~200 Sql Queries before
the fix.
Before the fix:
```
odoo.modules.registry: At least one model cache has been invalidated, signaling through the database
GET host1.com/web HTTP/1.1 200 - 222 0.135 3.840 <-- 222 Queries, ~4s
odoo.modules.registry: At least one model cache has been invalidated, signaling through the database
GET host2.com/web HTTP/1.1 200 - 181 0.101 3.692 <-- 181 Queries, ~4s
odoo.modules.registry: At least one model cache has been invalidated, signaling through the database
GET host1.com/web HTTP/1.1 200 - 215 0.121 3.704 <-- 215 Queries, ~4s
odoo.modules.registry: At least one model cache has been invalidated, signaling through the database
GET host2.com/web HTTP/1.1 200 - 181 0.100 3.616 <-- 181 Queries, ~4s
```
After the fix:
```
odoo.modules.registry: At least one model cache has been invalidated, signaling through the database
GET host1.com/web HTTP/1.1 200 - 101 0.043 0.353 <-- 101 Queries, ~0.3s
GET host2.com/web HTTP/1.1 200 - 11 0.004 0.007 <-- 11 Queries, ~10ms
GET host1.com/web HTTP/1.1 200 - 11 0.003 0.005 <-- 11 Queries, ~10ms
GET host2.com/web HTTP/1.1 200 - 11 0.003 0.008 <-- 11 Queries, ~10ms
```
[1]: https://github.com/odoo/odoo/pull/94161#discussion_r904780031 (Also other PR/task but couldn't find those.)
closesodoo/odoo#120364
X-original-commit: 28dd35eb3c681b630f0b3c109a7d8209f9fa42d8
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
There is a very nice and clear system that helps the user to figure
what are the available area to drop content inside, and what will they
do: are they shared between products, or product specific etc.
The issue is that once you have dropped a snippet inside, that helper
message is not shown anymore, but it's still not obvious which area is
used for what, actually you have no clue which one is which, especially
if you come back on the page later: at best remember there were 2
separate zones but you don't especially remember which one is which.
Keeping the message helps in that regard without any negative impact.
Note that making the message appear when there are already a snippet
will work out of the box in the sense that the message will be
duplicated and shown twice: one at the very bottom of the area and one
at the very top.
Note that there is 5 cases to consider here:
- Empty website.page in edit mode (no drag & drop)
- Empty website.page with drag & drop
- Non empty website.page with drag & drop
- Empty product description with drag & drop
- Non empty product description with drag & drop
This commit also takes care of fixing the text color issue where the
"editor message" could not be read because of text color too close to
bg color.
task-3160416
closesodoo/odoo#117705
X-original-commit: 9236628b0d037a0a9444d13a30d813f4a8413377
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
==== Purpose ====
There is an issue with the `/@/` symbol website is using to display a
page in the backend: if someone copy paste a link with `/@/` in it and
send it in an email, some mail client will block those mails.
It was reported by our internal team, after feedback from some sales
persons.
Office 365 was incriminated (not the outlook.com web platform). While we
couldn't reproduce the issue, it was decided by the hierarchy to get rid
of it as it was judged impossible to educate our sales to not send such
links.
It's probably a good decision as:
- `@` in URL are usually used for HTTP Authorization:
`http://username:password@example.com`
Link [1] seems to mention that some mail client will not implement
correctly the URL check to see if the `@` is problematic and will
simply block mails having links containing `@`.
- The tradeoff of removing it is impacting dev/tech people, not the end
user (except for F5, see below).
==== Technical ====
Before this commit and since commit [2] the following behaviors were
introduced:
1. a `/@/` prefix was added visually in the URL bar of the browser when
accessing the website app (previewing your website in the backend) to
differentiate it from the regular website/frontend URL
2. the possibility to type yourself `/@/` in the URL to access a website
page in the backend app
It was improving the following pain point:
A. On page refresh (F5 or browser button), the user would land on the
frontend version of the website instead of remaining in the backend.
B. When the user edited the URL (Like removing `/shop` and typing
`/jobs` instead, he would land on the frontend version too.
C. Impossible to directly go to the backend version of the website.
This commit is now reverting point 1. while keeping the possibility of
point 2.
It means that while you can still reach directly your page in the
backend, the backend URL part `/@/` won't be kept.
About the mentioned point above:
A. This pain point will be back
B. This one too but workaround possible: need to edit the URL but also
need to now add the `/@/`
C. This one will still be "fixed" as `/@/` still reachable.
While it seems to be decreasing the UX, it actually is an acceptable
tradeoff as:
- It mostly impacts dev/tech people, lambda end user don't play with
URLs (low risk)
- It will prevent their mail to be blocked (high value)
--------------
Finally, note that in the meantime commit [3] was introduced which
relied on this `/@/` presence. This had to be adapted.
[1]: https://www.malwarebytes.com/blog/news/2022/05/long-lost-symbol-gets-new-life-obscuring-malicious-urls
[2]: https://github.com/odoo/odoo/commit/030d3cb10ee79aa1f010134578f4bcf65a1cfcde
[3]: https://github.com/odoo/odoo/commit/a0b3499d348d252c3abd48154e1fd8dd545c7504closesodoo/odoo#116100
X-original-commit: b01337710b5fde995a184e442f48b687cd17967a
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
This commit will rename the font "Muli" to "Mulish" as it has been
renamed in Google Fonts.
closesodoo/odoo#114932
X-original-commit: c24602e882f87c361866a739459a9d6e3f4fc6ef
Related: odoo/design-themes#638
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
This commit addresses a bug where the "description" field on the user
screen was not displaying properly. This fixes the formatting issue,
ensuring that the field is now properly displayed with appropriate line
breaks and spacing. Users can now view their description information as
intended.
closesodoo/odoo#114881
X-original-commit: 52858350a78856e7da444617dc2779a2f19688a0
Signed-off-by: Vranckx Florian (flvr) <flvr@odoo.com>
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
There is a weird deeper low level misbehavior which makes concurent
click to not acts as they should.
Depending on the runbot/tour speed, the misbehavior might kick in and
makes the tour fail.
When you click on multiple options very quick back to back, their click
will be registered and processed one by one, waiting for the previous
one before considering the next one.
You can see that by simply printing a console log in both
`renderListItems` and `_computeWidgetState` method from `s_social_media`
`options.js` file. Then click quickly on the options related to this
snippet like the active toggle and/or remove custom media.
Despite respecting the click order and not overlapping, some click
results (like hidding or removing) will be rollbacked visually and only
the latest click result (starting from the DOM state before the first
click) will be applied.
Long story short: spam click on every toggle option of all the social
media, you will see that all your click will be processed one by one:
- The first media you toggled off will be toggled off
- Then the second media you toggled off will be toggled off but the
first one will be back to toggle on.
It seems to be correctly applying the click result one after the other,
but always starting from the initial DOM state/option widget state
(before the clicks), and not as it should: process the second click
based on the state of things altered by the previous click.
This will need a deeper and longer investigation to fix the root cause.
In the meantime, as this tour is failing multiple times a day, this
commit introduce a workaround to avoid this error in the tour.
task-3212519 (later fix)
runbot-16628
closesodoo/odoo#114600
X-original-commit: e9bd67672ea0517771998ec56f155709cd7c310e
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
With DB having only one blog (most common case, but we are used to test
it with demo data where we have two), the query params are lost when
accessing the blog controller without passing a blog.
Eg, `/blog?search=hubble` will redirect to `/blog/travel-1`
This is because the business code is doing an early redirect if we
access the `/blog` URL without a blog post passed to it to redirect to
that blog post URL directly (since there is only one), but that redirect
is not passing the query parameters.
The main impacted params are `state`, `order` and `search` but it's the
same for all others.
Step to reproduce (in later version):
- Be sure to only have one blog
- Drag & drop the search snippet in the homepage or anywhere
- Make it search on blog only (through the snippet option)
Type anything, it will not work and won't do the search. It will just
redirect to the blog page.
closesodoo/odoo#114107
X-original-commit: 41c27fd4912fb9f50ce5f31fff7c17c77b8530f7
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Before this commit, if the user mousedown a snippet, it would start a
timer of 1500 ms and a the end of the timer, it would show a tooltip to
help the user indicating him that he should drag & drop and not click.
The drag & drop code would (sort of) stop that timer if a drag was
detected, to not show the tooltip if the user is correctly drag &
dropping.
But it feels weird, as when you fail to realize you should drag & drop
but click instead, you only have the hint 1.5s later.
Some internal people would actually use triple click on snippet when
trying to show this tooltip, because it's probably not easy to figure
exactly what the trigger is.
The change is then made to show the tooltip directly on mouseup.
If the drag & drop code did not indicate that a drag happened, we can
safely assume it was a simple click and not a drag.
closesodoo/odoo#112666
X-original-commit: 00becd38ac5f43e2586b258d01c7af2825f75ddc
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Since website was moved from frontend to backend in 16.0 with [1], there
was an issue with the page list view which would not show the homepage
record when multi website group was not enabled.
Indeed, we have our own `recordFilter` method which is based on the
`website_id` field.
But the framework ignore this field (it doesn't read the property at all
and so don't have access to its value) if it's hidden by a `groups`
property. In such cases, the field should be duplicated and hidden with
`invisible`, as those fields will have their value retrieved depsite
being hidden.
Step to reproduce:
- Install website with no demo data (to have only one website)
Or go to runbot / install website with demo data and disable the multi
website group
- Go to Website > Site > Pages
- You don't see the homepage in the list, because there is 2 homepage
(one specific and one generic) but since the website_id is not fetch,
both are considered generic (which is not supposed to be possible)
and the filter is then considering those to be shadowed by the other,
ultimately filtering out both.
[1]: https://github.com/odoo/odoo/commit/31cc10b91dc7762e23b4bde9b945be0c4ce3fe3bclosesodoo/odoo#112461
X-original-commit: 5ff5daee518d23c3b6958133eb1f99bc5fc1063f
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
See previous commit, it fixes a bug introduced by a recent change in the
javascript framework that broke the website kanban override.
This commit is ensuring that the kanban can be accessed and used.
Ideally, it should have been a QUnit test but since this has to be
merged ASAP (critical bug) and a test is more than welcome as it's not
the first time our custom kanban is broken, a hook in an existing tourµ
is used to easily and quickly test it in the meantime.
closesodoo/odoo#112369
X-original-commit: aca72bcdae98e1304c934f67efa65273d636863a
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
For some reason the `website_id` field was added in the form view of the
`ir.asset` model in a website module overide but it was not done for the
list view where it matters equally (if not most regarding the flow).
Indeed, those views / this model is mainly accessed for debugging
purpose in which case you are most likely looking for a specific asset.
In the website case, it's most of the time to find the custom asset
that was created following a scss customization in the right panel of
the website builder.
In such a case, it will have a website_id and will be easy to find in
the list view.
It's also the case for all the records having a `website_id`, we show
that field in both form and list view, it's always important when
managing / debugging DBs in multi-website environment.
See [1] for introduction of `ir.asset`.
[1]: https://github.com/odoo/odoo/commit/8cc066173dfb61bd95b8e1f0716f71f4e251810aclosesodoo/odoo#112156
X-original-commit: 1e6ea1a1e38f9769b91b80c3fd1e2ecabae35bb6
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Commit [1] improved the url dependencies search behavior to include more
models to search in but also the multi record capability (needed for
multi delete in list view now that website is in the backend).
But a line of code was badly designed, making the perfs horrible.
That line code shouldn't have been part of the loop as it doesn't
depend of the loop.
This was drastically more impactful on the `/` page.
Benchmark: for the `/` page, searching in 1000 product template website
description will go from 29.74 seconds to 0.29 seconds.
See the speedscope result on the PR description.
For ~10.000 products, it will go from ~7 minutes to 1.35s.
[1]: https://github.com/odoo/odoo/commit/6ac17b93437868cbefbe13448a6fcbb29953f221
task-3169378
closesodoo/odoo#111933
X-original-commit: 9816b2ba6ee85dcba7b2f85e70c617994b7748c4
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
Before this commit conditions based on `_handle_visibility` and
`_get_cached_visibility` did work only by relying on the cache of the
`menu.page_id` being populated when accessing `is_visible` in sudo.
This does not work if the cache is cleared between the calls.
This commit makes sure all 3 conditions have access the record.
The actual issue has not been reproduced locally yet.
The various workers, crons, websocket work on distinct envs - even
through code they cannot impact the cache of another local env outside
the `check_signaling` system which is only used between requests.
For the problem to occur, some intra-request multithreading is needed
but it could not be located so far.
task-3149270
closesodoo/odoo#111882
X-original-commit: a864192ecd270848fede23d3eb053318d07ae8e8
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
On the `/forum/<forum>/tag` page, since the update from BS4 to B5, the
box to subscribe supposed to be shown when hovering a tag is not shown
anymore.
This is because in BS4, `col-md-3` was bringing the `position:relative`
css property but it's not the case anymore in BS5.
The `.o_forum_tag_follow_box` which is in `position:absolute` is
therefore not working as expected.
It is actually shown, but the user can't notice it as it's shown at the
very bottom of the page below the footer (you can see the scrollbar size
being changed).
closesodoo/odoo#111751
X-original-commit: 9a45860e9df1e24760ae5ba45faee4a67dbfc80d
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Before this commit, if a link to a page was not correct because of a
case mismatch, it would simply land on a 404 page.
While it's correct, as URL are case sensitive, it leads to a few bad UX
flow at the admin/editor level:
- Create a link in your page (on a text or a button eg), type an URL
which does not exists (to create it after) like /Page
- Click on the link/button you just made, you are redirected to /Page
which display a 404 with the "Create page" option (correct)
- When you click on that button, it will actually create a page with
/page URL, leading to a mismatch between the URL you created and the
page URL.
Your link/button will still lead to a 404 URL as it points to /Page.
Since it's just a fallback when an exact URL match is not found, it
should not break anything and should not have bad impact at any level
(seo/speed etc).
Indeed:
- It's done through a 302 redirect
- `_serve_page()` is already a fallback case, so it will only make
the `website.redirect` and 404 cases a bit slower due to the extra
search query.
The only possible scenario seems to be if the user (mind the uppercase):
- Created a /Page page
- Created a redirect from /page to /another-page
In this case, /page won't land on /another-page but on /Page.
This flow seems unlikely and is not actually wrong either way.
At least, it certainly is less important than ensuring a case
insensitive fallback.
Finally, note that another solution would have been to either:
- Force page URL to lower case.
-> This is not stable friendly, people might be relying on this to
create pages with different casing:
`/Batman-VII-The-Dark-Knight-Whatevers`, while not recommended,
doesn't sounds idiot.
On top of not being stable friendly, we probably want to keep
offering this possibility
- Redirect all URLs to lowercase endpoints.
-> This is obviously not stable and not Odoo's jobs. It should be
something decided by the sysadmin and done at nginx (etc) level.
task-3110294
opw-3104030
closesodoo/odoo#111736
X-original-commit: f05491105f93939490cbeb078cb7653c38685644
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Since [1], a race condition would be faced as the dict order is not
guaranteed, sometimes failing because:
```
AssertionError: Lists differ: ['/demo', '/admin'] != ['/admin', '/demo']
```
[1]: https://github.com/odoo/odoo/commit/a87b4142dd4a2c05e3e1885b2c54f5e0d3c7ac47
runbot-15727
closesodoo/odoo#111417
X-original-commit: 3e9a1dd76ce5172c4797bc92f0351e107589c3a5
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
- Ignore anchors, those are not sent to the server anyway, no way to
compare even if we wanted to
- Ensure query string (qs) are the same to be considered equals
On top of that, it also fixes the case when the user inserted an
absolute URL instead of a relative one, it will now match.
task-3096367
opw-3091427
closesodoo/odoo#107782
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
- `clean_url` method was wrongly flag as `api.model`
- the `unslug_url` was not called for the URL comparison in the dropdown
case, meaning that `/shop/prod-1` would not match `/shop/product-1` as
it should (and as it does for regular non dropdown menu)
- the `active` class was actually never working for the dropdown case,
as the class was added on the wrong element (`li` instead of `a`)
The code was hard to read (mainly because huge python conditions in XML)
and kinda redundant, going through an util method should be clearer and
help reading the template XML.
task-3096367
opw-3091427
Part-of: odoo/odoo#107782
Due to the end part of the regex `(?=$|/)`, it will not find and thus
not unslug string if they end up with a query string or and anchor
except if there is a trailing slash before.
First, it's unlikely that there will be a trailing slash as it's not
common and on top of that, Odoo try to enforce non trailing slash in
URL.
Second, it's not that hard to makes those cases work.
Before this commit, the following string would "match" and be unslug:
- /blog-1
- /blog-1/
- /blog-1/register
- /blog-1/?qs=2
- /blog-1/#anchor
But those would not:
- /blog-1?qs=2
- /blog-1#anchor
Part-of: odoo/odoo#107782
Since the refactoring of website.visitor with [1] (upsert), the
`access_token` is supposed to be holding the same value as the
`partner_id` when the visitor is linked to a partner:
- Anonymous visitor: no `partner_id`, `access_token` is a hash value
- Partner visitor: `partner_id` set, `access_token` should be sync with
`partner_id`.
`partner_id` is just a stored computed field holding the `access_token`
value if it is an integer value.
There should never be a case where there is a `partner_id` set and the
`access_token` is not equal to the `partner_id`.
For instance, having a visitor with `partner_id` = 4 and `access_token`
= `e4r3ejkj4` is supposed to be impossible.
It would lead to crash, because the visitor is only searched based on
his `access_token`, meaning that when searching for the visitor of
partner 4, none would be found and a new one would try to be created,
raising the `uniq_access_token_id` SQL constraint.
While the `partner_id`/`access_token` sync might seems weird, it is done
to allow the `upsert` use in SQL to improve perfs of this low level
behavior.
It's actually not as weak as it seems as there is only a single entry
point to update the `partner_id` and `access_token`: the authenticate
override of website.
Those fields are not supposed to be changed elsewhere.
Note that modifying the `access_token` would not be an issue as the
`partner_id` is just a stored compute based on the `access_token`.
But it's only true when modifying through the ORM as if you do that in
raw SQL, it won't go through the `api.depends` which is supposed to
recompute the stored computed `partner_id` field.
But something was forgotten during the initial dev: the partner merge
behavior: it does (on top of other thing) auto discover the m2o field
relations that points to a `res.partner` and modify those values in raw
SQL to the new value.
This is obviously wrong regarding the `website.visitor`'s `partner_id`
field, the `access_token` should also be updated, or when possible
visitors should be merged too.
Note that for DB upgrated from previous version to Odoo 16, this is
ensured through the following upgrade script [2]:
```sql
UPDATE website_visitor
SET access_token = partner_id::text
WHERE partner_id IS NOT NULL
```
[1]: https://github.com/odoo/odoo/commit/d348bed1ad9d3d16b295f013f015706be6c07820
[2]: https://github.com/odoo/upgrade/commit/0cedcbf70494dfeddeb5a97c13bf875cb6a86886
task-3148111
closesodoo/odoo#111002
X-original-commit: a87b4142dd4a2c05e3e1885b2c54f5e0d3c7ac47
Signed-off-by: Romain Derie (rde) <rde@odoo.com>