Commit Graph
1350 Commits
Author SHA1 Message Date
Benoit Socias 3c0d98bcd8 [IMP] website_blog: add a blog snippet that relies on snippet filters
Before this commit the latest posts snippet implemented the lookup for
its templates and its rendering procedure.

After this commit a new blog posts snippet is introduced which relies on
the dynamic snippet mechanisms.

task-2477207
https://github.com/odoo/odoo/pull/67334
2021-03-29 14:27:58 +00:00
David Beguin 14167ea884 [FIX] website_livechat: hide visited website.page for non website_designer
When opening the visitor view, if user is not website designer, there was an
access error as only website editor can read website.page model.

This commit applies the website_designer group to page_ids field to avoid crash.
There are no viable solution to show the visited page in stable without changing
the model definition. Hide the info is then the better solution.

Task ID-2301261
PR odoo/odoo#60549

X-original-commit: 69cc2911b52fd17b37fb71544574f63cf09dd17e
2021-03-29 11:17:47 +00:00
Benoit Socias 3355dc1623 [REF] website, website_sale: support recently viewed in product snippet
Before this commit the recently viewed products were handled differently
from the dynamic product snippet.

After this commit the dynamic product snippet supports the functionality
of the recently viewed products snippet:
- its template used to show each product
- its filter of displayed products
- its "Add to cart" feature (with the animation)
- its "Forget" feature (only applicable when viewing recently viewed)
Also added "Accessories" and "Recently Sold With" filterings.

Several kinds of filtering can be combined.
- Products can be restricted to a given category
  - Pseudo categories for all products or current category can be used
- Products can be restricted to matching names
- Products can be obtained from one of the following:
  - Newest
  - Latest sold: ordered by descending frequency in last 8 orders
  - Latest viewed
  - Accessories (of the current product)
  - Recently sold with (the current product)
Accessories and recently sold with are only available in product pages.

Also, generic templates have been considered useless and the whole
mechanism allowing them has been removed (this includes the
pre-rendering mechanism for the fields specified in the filter).

task-2453416
https://github.com/odoo/odoo/pull/65554
2021-03-26 15:41:44 +00:00
Romain Derie 7cdf04df67 [IMP] website: add qweb view to see view hierarchy
The core website behavior is the COW (copy on write) which makes it possible to
handle multiple websites on a single database.

When you do a CRUD operation on an `ir.ui.view` in a website context, the ORM
normal behavior is bypass to perform special stuff, such as:
  - Write: if the view is generic (no `website_id`), we bifurcate the write on
           the specific view (same `key` but with `website_id` set). If that
           view doesn't exist, we create it and fork its whole descending
           hierarchy. This write behavior is known as COW.
  - Create: we ensure that view is created only for the website and no other.
            Basically we just add a `website_id` to that view, but it might
            also be about setting the correct `inherit_id` by finding the
            specific view among multiple views with the same `key`.
  - Unlink: if the view is generic, we will unlink that view but also create a
            copy of that view for every other websites so they remain
            unmodified: this is known as COU (copy on unlink).

All those behavior aims to satisfy to the multi website holy grail:
 -- Any modification in a website context should never impact another website --

Because of those uncommon behaviors, it is sometimes hard to understand or
investigate a database, as views might be copied, up to the point where there
is multiple whole view hierarchies.

This commit attempts to create an user interface to easily figure what's going
on in a database at an `ir.ui.view` level.
The mains advantages of that new `ir.ui.view` Qweb view is to:
  - easily figure which views are COW'd on which website
  - easily detect which views have a real `arch` modification
  - easily see that `arch` change

Closes #63040

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2021-03-26 15:29:42 +00:00
Sébastien Mottet (oms) 2323af4451 [REF] website, *: centralize color palettes in website
*: web_editor

All theme specific color palettes have been moved into website.
It allows to access them without having to install theme modules and
this is a preparation for our website configuration screen task.

Lists of palettes have been replaced by maps with palette names as keys.
Those names are composed of the palette's original theme name ('generic'
or 'base' for palettes not specific to a theme) and of an index
(ex: 'anelusia-2'), for compatibility.
To keep compatibility with previous version we also convert old color
palettes number to color palette name, specifically for each theme.

A side effect of this change is that we got rid of all gray palettes
which existed in some themes. Those were not fitting the new possibility
of gray customization in the third panel and were not always really a
good customization of the default grays (they still were there mainly
for historical purposes). Unfortunately, this may have some side effect
for old websites which used those grays but the new gray palettes (left
to the default one) should most of the time come as an improvement of
the old ones, and they are now customizable by the user. In the future,
we may associate a perfectly-chosen default gray palette, fitting the
customization system, for each color palette.

PR: https://github.com/odoo/odoo/pull/67488
task-2451965

closes odoo/odoo#67488

Related: odoo/design-themes#455
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-03-26 11:31:17 +00:00
Oussama MESSAOUDIandqsm-odoo 35d27a6c1d [IMP] website, *: control hue and saturation of grays
*: web_editor

The purpose of this commit is to control the hue and the saturation of
the gray palette.

task-2362091

closes odoo/odoo#66428

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Co-authored-by: qsm-odoo <qsm@odoo.com>
2021-03-24 17:36:14 +00:00
Carlos Valverde da6c19acd0 [IMP] website: replace the default website logo
Previous default website logo of the 'website' module ('YourLogo' 
image) looked like a text and not like a proper logo, so it has been 
replaced by a more stylised, gray-coloured, version, as a svg.

--

task-2448746

closes odoo/odoo#68075

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2021-03-18 12:34:54 +00:00
Benoit Socias d400205fc6 [FIX] website: avoid duplication of cookie policy page
Before this commit a cookie policy page was created every time the
website settings were saved with the "Cookies Bar" option enabled.

After this commit the policy page is created only if it does not already
exist for the website.

task-2454424
https://github.com/odoo/odoo/pull/67217

closes odoo/odoo#67370

X-original-commit: 2f920e0023d29545d2957e5d6ca1619068af893b
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2021-03-05 14:02:07 +00:00
Jeremy Kersten f09c84c022 [FIX] base, web_editor, website: add missing encoding on etree.tostring
Since lxml 4.5.0 that use now use libxml2 2.9.10, without it, it can crash.

Here sample of content that is broken:
https://drive.google.com/file/d/1gB2-jl4fabHscLjH9OZc4WZgtSEbCVj7/view?usp=sharing

note: this commit is to merge 3 changes of #64526

opw-2428617
opw-2428664

closes odoo/odoo#66883

X-original-commit: 38983d123d171ac3cc1efacd99d9776f0ed08734
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2021-02-26 07:55:25 +00:00
Nicolas Seinlet b9c776129a [FIX] website: decorate create method
When method isn't decorated, create a view trigger a traceback
"create() missing 1 required positional argument: 'vals_list'".

Handle create_multi use case.

closes odoo/odoo#66527

X-original-commit: 16a5a0ed278679b25b8b30677c2c0d4da59526aa
Signed-off-by: Romain Derie <rdeodoo@users.noreply.github.com>
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-02-19 11:13:23 +00:00
Jeremy Kersten be49f9fb1f [IMP] website: remove meta_data from params of filter, and design card
Call _get_filter_meta_data when needed instead to compute it only once and
give it from function to function, it is really trivial to compute and the
api of functions are simple from this way.

Avoid to use h4/h5 taf for styling bug use bootstrap feature for it.
The semantic of <div class='h4'/> vs <h4/> is not the same for SEO

Don't make call_to_action_url required

+ small typo

task-2446024
https://github.com/odoo/odoo/pull/65176
2021-02-16 14:20:24 +00:00
Benoit Socias 1d2dd3f76f [IMP] website, website_sale: remove most escaping from Dynamic Products
Before this commit the filtering code for the Dynamic Products snippet
was rendering all its values.

After this commit the filtering code for the Dynamic Products snippet
mostly returns the values to be rendered.
Because the list_price still needs to be rendered with the correct
currency, the general rendering mechanism is being informed through the
field meta-data that the escaping was already done.

task-2446024
https://github.com/odoo/odoo/pull/65176
2021-02-16 10:18:15 +00:00
Benoit Socias df7c77fd7a [REF] website: make the rendering code common to real data and sample
Before this commit the rendering data structure had to be handled both
when rendering a data sample and when rendering actual records.

After this commit the rendering data structure is generated in the same
way in both situations.

task-2446024
https://github.com/odoo/odoo/pull/65176
2021-02-16 10:18:07 +00:00
Benoit Socias 0cede3fa14 [IMP] website: display sample data for dynamic snippets
Before this commit when a dynamic snippet was fully configured but
returned no data, the rendered section remained empty in edit mode.

After this commit when a dynamic snippet is fully configured but has no
data to display, some sample data is generated in edit mode to give a
feel of how the page will look like when data will be available.

task-2446024
https://github.com/odoo/odoo/pull/65176
2021-02-16 10:17:58 +00:00
Romain Derie 6a9b5bba9b [FIX] base, website: replicate inherit_id update on cow view
Before this commit, only whitelisted fields would be updated on cow views
during a module update.
A field would be whitelisted if he had the same value than the original view,
see it as a heuristic to not write on modified fields.

But `inherit_id` is not that simple, even if the cow view has a different value
than its original view, it doesn't mean it was modified by the user, it is just
because of the cow mechanism that assigned a copied view as inherit_id, which
is just a copy ofthe original one.

We can thus consider `inherit_id` as unchanged and whitelist it if the `key` is
the same.

In practice, it means that cow'd views did not receive the `inherit_id` updates
as in commit https://github.com/odoo/odoo/commit/c8577568a1e39f6692889b3e21652fa3b8df06b2#diff-823e5db841dca1798ff1300e243059a4e1c93343598d2be5a1d1dcd1d2d0c273R537
where `portal.my_account_link` had its `inherit_id` changed from
`portal.frontend_layout` to `portal.user_dropdow`, see https://github.com/odoo/upgrade/pull/2059:

Considering a module update changing `inherit_id` of D from A to B, the
following use cases are expected. Without this fix, D' never move:

CASE 1
  A    A'   B                      A    A'   B
  |    |                 =>                 / \
  D    D'                                  D   D'

CASE 2
  A    A'   B    B'               A    A'   B   B'
  |    |                 =>                 |   |
  D    D'                                   D   D'

CASE 3
    A    B                        A    B
   / \                   =>           / \
  D   D'                             D   D'

CASE 4
    A    B    B'                  A    B   B'
   / \                   =>            |   |
  D   D'                               D   D'

Opw: 2422773
Opw: 2422727
Opw: 2422770
Opw: 2423406
Opw: 2423859
X-original-commit: ff69f11e9c97d63d9319a8094a87af93984aba38
2021-02-12 15:52:37 +00:00
Francois (fge) 402740f73e [ADD] web: add /web/assets for assets bundle
Part of PR 63177
2021-02-15 10:55:00 +01:00
Simon Genin (ges)andFrancois 929fec3a54 [IMP] base: add support for native JS modules
Because of the way Odoo works at its core, we do not know before hand
which files will be loaded as an asset in the browser, because it
depends on the installed Odoo addons.  This is why it is historically
difficult to integrate Odoo with standard JS tooling, and this is why
Odoo needs to use a custom javascript module system.

However, there is a way to use native JS modules (and gain all the
benefits from it: IDE autocompletion, ease of refactoring, intellisense,
...): we can write JS as native JS modules, but convert them at runtime
into Odoo custom modules. This is exactly the strategy applied by this
PR.

This has a lot of benefits, but there is a downside: we can no longer
serve statically JS files in debug=assets.  This would be a dealbreaker,
if we did not have sourcemaps (implemented in the next commit).

This commit introduces the python code that will transpile native JS
modules into odoo JS modules.

Task ID: 2414902
PR: 63177

Co-authored-by: Francois (fge) <fge@odoo.com>
2021-02-15 10:18:11 +01:00
Jeremy Kersten 70eb143b2f [IMP] website: use correct groups on field access_token
Previously, since the group name was wrong, nobody can access this.
Now we let group_website_publisher read it...
Change is not critical, since previous typo make it unreadable for
all.

closes odoo/odoo#66061

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2021-02-12 12:10:22 +00:00
Jeremy Kersten 2ecc538d51 [FIX] website: handle RequestUID case in slug
Before this commit, a 308 on a route with a modelconverter for a model
that have a seo_name field will crash with an exception:
Cannot iterate on RequestUID

Another simplest solution was to use a with_user(SUPERUSER_ID) but in this case
it bypass the security set and display the name of the record even if not yet
published.

How to reproduce:

Create a 308 from /shop/<product> to /mag/<product>
Unpublish product 10
Try to access /shop/product-10

You have an unmanaged '500 internal error"
because slug_matching -> build -> to_url -> slug with a record with Requestuid
as env._uid.

X-original-commit: 4ac2cab96655a3c5e673b0a04be5599dba507850
2021-02-01 14:51:19 +00:00
Romain Derie f2583f3de4 [IMP] website(_*): prevent wrong multi website access during dispatch
Before this commit, routes were prevented to be accessed if the route model was
not accessible from the current website, eg you couldn't access blog1 which is
set to website2 from website 1.
That would raise a 404 even from admin/editor.

This commit introduce that behavior at a lowel level in a generic way, instead
of having to write it on every route.

Note that routes without a model converter won't benefit from this.

Closes #63499

closes odoo/odoo#64313

Related: odoo/enterprise#15688
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2021-01-25 11:01:13 +00:00
Nasreddin (bon) f6e2d74a78 [FIX] website: Warning message on website if dynamic snippet category deleted
Issue

	- Install "Ecommerce" app
	- Go to 'Shop' page and edit it
	- Add a "Dynamic Products" block
	- Click on it to edit it :
	-  Select any template
	-  Select `Desks` as product category
	-  Save
	- Go to "Website -> Configuration -> eCommerce Categories"
	- Delete the "Desks" category
	- Go back to Shop page

	Error : "Record does not exist or has been deleted".

Cause

	The search domain is looking for child categories of dataset.productCategoryId
	(who does not exist anymore in the above case).
	`child_of` do a browse() to fetch the records, and therefore generate
	an error if category not found.

Solution

	Log warning message if unexptected domain and return empty records set instead.

This commit also reverts commit 0de069b8ca9fb005ba5b076984f5677de25889ee that generated the issue.

opw-2440917

closes odoo/odoo#64947

X-original-commit: e452d30f739db39a088248a3109c8c49cff9d49f
Signed-off-by: LTU-Odoo <IT-Ideas@users.noreply.github.com>
Signed-off-by: bon-odoo <nboulif@users.noreply.github.com>
2021-01-22 15:03:24 +00:00
nie f33550e3c1 [FIX] website: page visibility 'connected' leads to a 403 when connected
Steps:
- As admin, go to "Contact us" or any other page on the website (1)
- Go to Pages > Page Properties > Publish
- Change the visibility to Signed In
- Save
- As demo, go to (1)

Bug:
The user "demo" is signed in but is returned a 403 Forbidden

Explanation:
When landing on a page with visibility: 'connected', the only way to see
the page is to have a group matching the groups of the page as seen
here: https://github.com/odoo/odoo/blob/28b748a559e1ffb5fb7c3631bf77adba121b2ebf/odoo/addons/base/models/ir_ui_view.py#L625-L626
This fix lets any connected users see the page.

opw:2431700

closes odoo/odoo#64720

X-original-commit: b02a99bec709b5a6dc4dabb6cb81435dadc24e7e
Signed-off-by: backspac <backspac@users.noreply.github.com>
2021-01-18 17:55:30 +00:00
qsm-odoo d7be062403 [FIX] website: make automatic specific view on create
SOC for ir.ui.view creation. If a view is created without a website_id,
it should get one if one is present in the context. Also check that
an explicit website_id in create values matches the one in the context.

Note: it was already the case but kinda by chance and not entirely
correct. Most of the time, the 'arch' field was specified as a creation
value... and as it is a computed field with an inverse method, a COW
was triggered. But this had also the inconvenient of creating an extra
generic view without any arch.

closes odoo/odoo#43245

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-01-14 11:26:59 +00:00
Olivier Dony 2ded82920e [FIX] website: repair "overwrite" mode for translation wizard
In the context of bug #43365, the fix merged in #48031 introduced an
override of `ir.translation._load_module_terms()`, which calls `super()`
then does some extra stuff.

This was forward-ported to later versions, unfortunately the
forward-ports missed the fact that the method signature changed at some
point (circa saas-13.2) and the `overwrite` flag which used to be passed
in the `context` had become an explicit method argument.

As a result, that argument is lost in the `super()` call and the
`website` module entirely disables the "overwrite" mode for the
translation loading wizard.

The fwd-port that seems to introduce the issue is odoo/odoo#50477 (998987f8ee148235f4025eb97a424e838ac6fc9f)

closes odoo/odoo#64251

X-original-commit: 26355a6bf83a194c2e398e859e49920da1f415b8
Signed-off-by: Olivier Dony (odo) <odo@openerp.com>
2021-01-08 10:40:26 +00:00
qsm-odoo 834e3f8f9b [IMP] base, *: remove read_template and review colorpicker template
*: web_editor, website

In stable versions, [1] was made as a fix to allow access to read
the colorpicker template for mass mailing users when they do not have
the read access right on ir.ui.view records.

This commit, for master, remove the need of using the confusing
read_template method by using render_public_asset instead (thus turning
the read into a render, which is the same for our colorpicker but might
be a change for potential custo). At the same time, this allows to
remove the read_template public method entirely.

Related to task-2412544

[1]: 8af75e00bdcda3d5ff4facd2f5f146e1d6bf79e4

closes odoo/odoo#64100

Related: odoo/enterprise#15580
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-01-06 09:30:13 +00:00
qsm-odooandSamuel Degueldre 4612343e99 [FIX] website_theme_install: not copy fields for theme record templates
Themes define records which are used as templates for the creation of
base model records on theme installation on a website.
E.g. a "theme.ir.attachment" record's purpose is to be a template for an
"ir.attachment" record creation on theme installation on a website.

Those final records have extra fields to indicate from which theme
template they come from. If those records are ever to be duplicated,
they should not duplicate those links to the theme templates otherwise
it may cause issues when uninstalling/updating a theme (you want the
records linked to the theme to be deleted/updated but not the duplicated
ones, which do not act differently from user created ones).

Duplicate ones will be linked to the website anyway (just like "normal"
user created ones) and should only be automatically removed if that
website is deleted.

The issue is more visible from 14.0 where applying some modifications to
images via the editor (crop / filter / optimization / ...) will
duplicate the original image before modifying it.

closes odoo/odoo#63951

X-original-commit: 890935bbdf924b06b7dabd89802f6dd824159a4b
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Co-authored-by: Samuel Degueldre <sad@odoo.com>
2020-12-31 16:12:59 +00:00
jpr-odoo f3009d30e5 [FIX] website: fixed traceback while trying to open password protected page
task-2281216
Closes  https://github.com/odoo/odoo/pull/55692

closes odoo/odoo#63555

X-original-commit: 7e0541c90542d2d040415ef0dbc4e0cb8e7f2ffc
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2020-12-17 18:11:29 +00:00
Romain Derie d2e08a602a [FIX] website: fix typo on domain
Because there is a trailing comma, the code crashes and the domain becomes a
tuple.

Cherry-pick of 82df14554e0e8

closes odoo/odoo#62409

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2020-12-08 12:07:16 +00:00
Adrian Torres 679185f3e8 [IMP] *: replace all raises inside unlink by api.ondelete
With this commit, all instances of errors being raised inside
`BaseModel.unlink` overrides are moved into methods decorated with
`api.ondelete` which is safer.
2020-12-04 09:16:16 +00:00
Aurélien Warnon 1adf67423e [IMP] website_*: improve various website.visitor views
PURPOSE

Make various changes to the website.visitor views to improve readability and
ease marketing analysis.

SPECS

The changes include notably:
- Add/rename/move fields/filters elements
- Remove some unnecessary information or put it in optional="hide" in tree view
- Add website_id information (with the multi-website group)
- Slightly rework layouts (new widgets / spacing / images / buttons / ...)
- Move some technical information into the "debug mode"

LINKS

Task 2092302
ENT PR odoo/enterprise#14611
UPG PR odoo/upgrade#1902

closes odoo/odoo#61417

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-11-26 15:29:13 +00:00
Benoit Socias ccfca271b9 [IMP] website: keep loader alive until editor is opened
Before this commit the navigation toolbar was accessible after selecting
a theme before the editor was opened, which on slow connections made it
possible for users to leave the screen and miss the tour

After this commit the loader animation of the theme installation is
blocking the access to the screen until the editor is opened thus
preventing user to navigate elsewhere before seeing the tour

task-2387608

closes odoo/odoo#62029

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2020-11-26 09:28:14 +00:00
Goffin Simon 315c293b6c [FIX] website: Delete the current website
Steps to reproduce the bug:

- Delete the current website
- Go to homepage

Bug:

An error 500 was displayrd

opw:2381929

closes odoo/odoo#61959

X-original-commit: ae6515a5fb849a4b561b87eaa5c78035771a17b8
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
2020-11-18 15:36:38 +00:00
fw-bot c1e0b03d8b [IMP] website: make homepage tour, available on homepage only
Homepage tour starts with a very generic step 'drop snippet'
So, you can be in the middle of another tour and see the step of homepage tour.
This doesn't fix all cases, but make conflict less frequent.

E.g.

go to step 4 of tour event
click on save (before doing the step 5)
click on edit
Element is no more dirty (because save before step 5) so the step 5 not visible,
Tour with higher sequence (== lower priority) become visible. (e.g.: homepage)

Forward-Port of bca6cf2693d38c76b1af08398a3125bb16b59c15

closes odoo/odoo#61157

Related: odoo/design-themes#416
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2020-11-04 09:54:08 +00:00
Jeremy Kersten 0a948f67ec [FIX] website: fix recursive list in _enumerate_page
Each time the function is called, we append to the same persistent object.

closes odoo/odoo#60808

X-original-commit: d8790cce3e4a23d2b6b1c32d48d5df14fbdcfd33
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2020-10-27 10:23:25 +00:00
Adrian Torres b7017e58cc [FIX] *: adapt business code to function-redefined error
This commit adapts the business code in which
class/module/function/method redefinition took place so that it no
longer happens and the pylint test passes.
2020-10-16 12:56:52 +00:00
SEINLET Nicolas 5a03cc64d3 [IMP] website_visitor: avoid double indexing
unique constraint create an btree unbique index:
``` # \d website_visitor [...] Indexes:     "website_visitor_pkey"
PRIMARY KEY, btree (id)     "website_visitor_access_token_unique" UNIQUE
CONSTRAINT, btree (access_token)     "website_visitor_partner_uniq"
UNIQUE CONSTRAINT, btree (partner_id) ``` removing index=True avoid this
double indexing.

closes odoo/odoo#60120

X-original-commit: efb33e783bd04d542009ef0f57eba6a4aacbca65
Signed-off-by: Olivier Dony (odo) <odo@openerp.com>
Signed-off-by: Nicolas Seinlet (nse) <nse@odoo.com>
2020-10-15 15:50:31 +00:00
Jeremy Kersten 550d2935bd [IMP] website: support generic website for dynamic snippet filters
Made the website_id non mandatory on website snippet filters and adapted
the fetching route so that it interprets an unspecified website_id as
the filter being available on any website.

Before this commit website snippet filters had to be limited to one
single website.

After this commit website snippet filters can be made available on all
websites by setting their website_id to no value (this is the new
default of the pre-defined filters).

https://github.com/odoo/odoo/pull/59831
task-2355369

closes odoo/odoo#59831

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2020-10-13 13:09:45 +00:00
Laurent Stukkens (LTU) 0ef25d19bc [FIX] website,website_sale: HTML escape dynamic snippet
Issue
    To do on Community:
    - Install website_sale (eCommerce)
    - Go into Website app
    - Navigate through Product/Products
    - Edit 'Customizable Desk (CONFIG)' and add '&' and/or '<' and/or '>'
      characters into the name
    - Save
    - Go to the Website app Dashboard and click on 'Go to Website'
    - Click on 'Edit' button
    - Drag and drop the 'Dynamic Product' snippet into the website
    - Click on the block 'Your Dynamic Snippet wil be ...'
    - In the right panel, in the 'Dynamic Product' snippet options,
      chose a 'Template' and a 'Product Category'

    A traceback is shown

Cause
    the '&' character crashes lxml.etree.fromstring

Solution
    ensure no '&' is sent to lxmx.etree.fromstring by using
    odoo.tools.html_escape (in order to ensure no other problematic
    characters are sent to the front) on the field values except when
    not applicable (widget rendering with record_to_html should not be
    escaped).
    It is important to note here that this is applicable
    to action servers that are used by the dynamic filter.

opw-2357027

closes odoo/odoo#59805

X-original-commit: f91422115c09be484f2868347566b6392ed0effd
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2020-10-12 17:45:45 +00:00
David Beguin 4c9e39cfbd [FIX] website: get visitor tz directly from cookie
Since tz is now (from 6eb4762fee) added to the client cookie,
visitor timezone can directly be set when creating the visitor, using the
request.

Jstz can be removed as even for module in ENT that used this lib,
we can get the timezone using Intl lib instead.

This will also reduce the number of request made only to get visitor's
timezone.

This commit reverts part of 17e8402523
Linked ENT PR: 12963

Task ID: 2333825

closes odoo/odoo#59501

X-original-commit: 3d9a2de3575777c87327691319d89f9de6b8eada
Related: odoo/enterprise#13918
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-10-08 11:45:39 +00:00
Romain Derie e38e64b36f [FIX] website: prevent redirect loop on / if no homepage
Since 3d65424708d, if the homepage does not exists (no page with '/' as URL,
no page set as homepage), it would loop between / controller and _serve_page.

task-2250381

closes odoo/odoo#59548

X-original-commit: 07b701c581bd960bed42fcf97fae0dfed0332656
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
Signed-off-by: Romain Derie <rdeodoo@users.noreply.github.com>
2020-10-08 16:32:15 +00:00
Martin Trigaux 2683184aa6 [FIX] *: fix all the typos
And other reported English mistakes in source string
Courtesy of Transifex translators

And remove leftover from gengo

closes odoo/odoo#59022

X-original-commit: 26efc84c5cac47a2cc83d7b084f8b71528fec6c7
Related: odoo/enterprise#13781
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-10-05 09:36:34 +00:00
Jeremy Kersten 75c2640ce5 [FIX] website: server_page match trailing slash
After this commit, if an url with trailing slash is not found we fallback
to the url without the slash with a redirect to respect seo.
With this change we have the same behavior that controllers.

We continue to support trailing slash if page explicitely created with /
via backend e.g. and for retrocompatibility.

task-2346185

closes odoo/odoo#58603

X-original-commit: 3d65424708d1623654756d58d78cec5f8d71276f
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2020-09-28 10:28:44 +00:00
Laurent Stukkens (LTU) b5e611ba3d [IMP] website: add image widget support for urls char fields
* Prior to this commit, images were only managed when being an image
  field. No widget were used either.

* After this commit, image stored in model as url (as res.country.image_url)
  can be used when specifying ':image' after the field name. The fields are
  now rendered using their corresponding default widget. If there is a need
  to force another widget and if the developer is sure that it is compatible,
  he/she can specify it using the notation: 'field_name:widget_name'.

closes odoo/odoo#57645

X-original-commit: 18d4e3327c7152b4c3a86ba377e3357f213b703c
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2020-09-14 12:17:27 +00:00
Jeremy Kersten 5c0d64cb17 [IMP] website: redirect in edit mode after theme selection
This commit redirect the user to the website in the edit mode once a theme has
been selected.

task-2172208

X-original-commit: f474eac4543712ae5b1c7d614f9eff9367445107
2020-09-11 16:31:50 +00:00
Victor Feyens 2f3dcb8947 [IMP] base,website*: do not store country flags.
1) Avoid the storage of all country flags as ir_attachment (230+
ir_attachment in a new db) to reduce the filestore of databases.

The country flags are nearly static and not expected to be modified on
Odoo instances.

This change is based on the new "image_url" widget logic (see previous commits).

2) Extend the flag coverage for countries

Add the missing country flags & specify a mapping to provide flags
for overseas administrated countries/territories.
2020-09-02 16:43:45 +00:00
Victor Feyens c482fdbf05 [IMP] various: improve code style and performance by improve `all()` usage
PURPOSE

Clean code. Be more performance oriented.

SPECIFICATIONS

Improvements applied in this commit

  * not all() --> any(not) for earlier returns;
  * all([generator]) --> all(generator) to avoid unnecessary list casting.
    This code construct is better managed by all;

This commit will probably not have a big performance effect on standard
production databases. However each performance and cleaning improvement
is welcomed.

LINKS

Task ID-2328619

closes odoo/odoo#56810

X-original-commit: 1cc6bb1231401ea7f501d2f5b5e9641ec8734850
Related: odoo/enterprise#12802
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2020-08-31 13:59:27 +00:00
Jeremy Kersten e6f8c86572 [IMP] website: Use contact us as default cta in header
X-original-commit: 963215f488d12aa6fbb0c108dfd1c3dc557756d8
2020-08-31 09:17:10 +00:00
Jeremy Kersten 96bc3d4fff [FIX] website: invalide cache page with classic ormcache invalidation
To avoid to manually invalid the lru cache and probably miss some place
(assets, website menu, qweb view, website, company, ...) we use the classic
cache.

Courtesy of @rco-odoo for the help and review

closes odoo/odoo#56744

X-original-commit: 98e12901c97a67dc87f21647473754cd6f384d4a
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2020-08-28 14:54:11 +00:00
qsm-odoo c873e3e1aa [IMP] website: make it easier to enable off-canvas menu in themes
Part of https://github.com/odoo/odoo/pull/56427
task-2264627

X-original-commit: 5de3608680dbd232fbc3a1042aca4abdbfd590b0
2020-08-28 08:19:45 +00:00
Cocographique 3c05896c8f [IMP] website, *: add 'magazine' header template
*: website_sale, website_sale_wishlist

Part of https://github.com/odoo/odoo/pull/56427
task-2264627

X-original-commit: 77d82cfbddb64cc7302672c7741eb65c9fc4a125
2020-08-28 08:19:43 +00:00