Commit Graph
4889 Commits
Author SHA1 Message Date
Odoo Translation Bot 1bec017c15 [I18N] Update translation terms from Transifex 2019-02-10 01:32:20 +01:00
qsm-odoo 930839c76b [FIX] website: remove data-editor-message attributes on save
When the edit mode is entered, some elements receive
data-editor-message attributes. These were not removed on save which
could in some cases make the attributes be saved in the database. For
this to happen it would require an `.oe_structure.oe_empty` element to
be put *inside* an editable element (instead of being the one which is
editable). In that case the `.oe_structure` content would be saved in an
inheriting view but the parent view would also be COW'd for no reason
because of that attribute.

Difficult to say if such a case exist in the current views but as it
technically possible and that some of our tests use that configuration,
it is worth fixing.
Note: this fix was in fact done in the new editor in master and allowed
to detect that one of our test was not testing a feature correctly
because of that. This will be adapted in a different commit of this PR.

closes odoo/odoo#30834
2019-02-06 09:49:11 +00:00
Romain Derie aef6a5aaed [FIX] website: specific view ID might also change on save
Commit https://github.com/odoo/odoo/commit/29075a8e2c734624cec4f6009185616634f70dea
was written while there was an incorrect behavior related to
multi-website, oe_structure_ID and edit mode in a rare specific case
(see the second commit from this PR for detailed explanation
https://github.com/odoo/odoo/pull/30834).

That rare case was detected in 12.0 since the tour did not work on
master with the new editor (that fixed the incorrect behavior).
Basically, it was COWing the edited view even if only an oe_structure_ID
was touched.

Indeed, when saving a specific view in the HTML editor, we should also
search for its possible new ID as it could change if we also edited its
generic parent. In that case, the view will be copied and then unlinked
to preserve inherit order on the new specific tree.
2019-02-06 09:49:11 +00:00
Odoo Translation Bot 69dbbea09a [I18N] Update translation terms from Transifex 2019-02-03 01:38:30 +01:00
Jeremy Kersten bb473003d7 [FIX] website: res_config_setting in multi company
Before this commit, if the first website in the select was not in your current
company, it raises a traceback.

Now with filter on your own company, and support empty website selected
removing required on related field and using attrs dynamic to make it required

closes odoo/odoo#30769
2019-02-01 09:34:06 +00:00
Jeremy Kersten d609dbdd11 [FIX] website: make "Edit in backend" always go to website backend
Before this commit, clicking "Edit in backend" from the website could randomly
lead to the backend under another menu or without module, depending on the
other modules that are installed or version com/ent used.

After this commit, it will always open the backend under the specifiec menu
or website menu if not defined.

+ uses existing website dedicated action for product.template in 'Edit backend'

task-1919436
closes #30555

Co-authored by seb@odoo.com

closes odoo/odoo#30657
2019-01-29 10:54:56 +00:00
Jeremy Kersten 09be5b235c [FIX] website: force web.layout inheriting later
Before this commit, if you installed website in community you was not able to
install web_enterprise, because the web.login_layout was replaced (by hinerit)
by website and break the xpath from enterprise login.

Now we apply the Enterprise login xpath before that website replace it.
2019-01-29 10:46:09 +00:00
Romain Derie 326a44c3f7 [FIX] web_editor, website: consider COW view when loading view
Before this commit:
1. If we were editing a template with no xml_id, typically the case when
   editing a specific view (COW'd), the 'Template ID' label would be left empty
   as the view does not have an xml_id but only a key.
2. If we were editing a generic view, the template would be COW'd and replaced
   by the specific one created during the save.
   After the save, the page would be reload and will try to reopen the edited
   template (stored in url `res=123`). But as this template would be replaced
   by the COW'd view, the JS would crash trying to access an inexisting view.
   The HTML editor would then open in a very thin modal, barely editable.

Now:
1. Display the template's key instead of its xml_id. The key is basically a
   duplicate of the xml_id, mainly used in website.
2. If we are saving a generic view, we search for its newly created specific
   view to upload the URL hash before reloading.

task-1934279
Fix #30447
2019-01-29 16:06:23 +00:00
Romain Derie 751ea9634a [IMP] website: add tests for scss edition on html editor
As this behavior was recently broken (fixed in #30403), this commit
adds a test tour for that flow.

task-1934279
Fix #30447
2019-01-29 16:06:23 +00:00
Romain Derie 6bd579bd6b [FIX] web_editor: send the html editor writes one after another
With the following view hierarchy:
   A
   |
   B' (oe_structure_ID view)

Before this fix, when saving multiple templates at once from the same hierarchy
the COW views (website) would not be saved correctly as the first call to
`write` would COW the parent view, then the second concurent call to `write`
would create the child specific view under the generic parent view.
Instead, the generic parent should have been cloned to a specific parent view
and then the child view should be COW under the specific parent.

  A    A'
  |    |
  B'   B*' (This one is the old B', without B' changes in the html editor)

Instead of

  A   A'
      |
      B'

Calling the `write` one after another will do the trick. Indeed, when the
second call is fired, the first call has already triggered the COW behavior.
Thus, the second call correctly retrieves the COW view.

Another issue might still appear, if the parent view write is sent first.
Indeed, the parent view will be COW, thus the specific child view (second write
waiting to be fired) will be deleted to be added on the new specific hierarchy.
Thus, that write will then raise an error since the view does not exist anymore.

task-1934279
Fix #30447
2019-01-29 16:06:23 +00:00
Odoo Translation Bot fe36bff420 [I18N] Update translation terms from Transifex 2019-01-27 01:37:55 +01:00
Nicolas Lempereur c7a281d880 [FIX] website: affix menu no close frontend mobile menu
On mobile the frontend menu navbar is an hamburger menu that open on
click.

If the option "Customize > Main layout | Affix Top Menu" is
enabled, there is two menu:

- one at the full top of the page
- one affixed to the top of the viewport (only shown if we are at least
  scrolling 300px away from the top of the page)

But there is a side effect: when scrolling if the menu at the top of the
page is opened, it will be automatically closed => this makes sense to
avoid having two menu shown on the same page but is an odd behavior.

With this commit, the behavior is changed and when the menu is opened in
the top, the affixed menu is not shown (it only works if the top page
menu has no opened dropdown).

opw-1920310
closes #30564
2019-01-25 15:56:15 +00:00
Jeremy Kersten 9cfd1eefd8 [FIX] website: don't copy is_published
Before this commit, if you duplicate a published record on the website,
the copy was already published, while in most of case you need to update
it to adapt to the new content. There doesn't make senses to duplicate the
same content on a website and let the duplicate content.

Task-1930058
2019-01-22 16:38:48 +00:00
Odoo Translation Bot 127fdea764 [I18N] Update translation terms from Transifex 2019-01-21 17:38:09 +01:00
Christophe Simonis d657d6457f [FIX] website: update *all* views, not only website ones
closes odoo/odoo#30369
2019-01-18 16:34:08 +00:00
Romain Derie b5fe23055d [FIX] website: handle COW'd views during module install/update
Since multi-website, we COW (copy on write) views when editing a view on a
website.
This is causing 2 issues related to module install/update:
1. During a module install, when creating an inherited view, it will create
   that view as expected on the generic tree.
   But that generic tree may not be used on website(s). Indeed, if the view
   was edited, we are now using a copy of the view instead of the original
   XML view (with an xml_id).
   That copied view won't get the new inherited view in its view tree.
   Now, we correctly copy the new view under every specific view tree (if
   exists).
2. During a module update, when updating a view, it will only update the view
   having the xml_id, so the generic one.
   But most of the time, the generic view is not used as it was usually COW'd
   and the specific view now replace the generic one.
   Now, we also apply the update on the COW'd view. Note that only unmodified
   field will be updated, this behavior basically mimic the noupdate behavior
   on view's ir.model.data.

Step to reproduce for bug 1:
  - Install website_sale module
  - Go to a product page and then enter edit mode
  - Make a modification to trigger COW, eg edit the information area under the
    price "30-day money-back guarantee".
  - Now install website_sale_comparison module
  - The product page won't have the comparison button as the comparison view
    inheriting the product view was created on the generic tree and not copied
    on the specific tree (COW'd before the comparison module install).

Step to reproduce for bug 2:
  - Repeat first 3 steps of bug 1
  - Now make a modification in a view from the XML file in
    website_sale_comparison module and update the module
  - Only the view with the xml_id is updated, not it's COW'd views. This mean
    that only the generic view is updated and not the specific one(s) really
    used on the website.

task-1920487

closes odoo/odoo#29956
2019-01-10 16:19:35 +00:00
Romain Derie 20e9d77be8 [FIX] website: correct order when copying view children on COW
Before this commit, a generic view tree could be valid but impossible to copy
on a COW specific tree.

This was because when looping through inherit_children_ids to copy them, they
would be sorted by the ir.ui.view sort order (name, priority, id).
Indeed, when applying view inheritance and reading a view arch, children are
sorted by (priority, id).

Thus, if sorting the children by (name, priority, id) was different than
sorting by (priority, id) and the children view would conflict in that new
order, the COW would raise an error "can't find DOM element"

Step to reproduce:
  - Create a parent view with just a DIV in arch
  - Add a child view that add something inside that DIV
  - Add another child view with a name alphabetically lower than the other
    child and that replace the DIV by something else, like a SECTION
  - Everything works as expected, when reading the parent view arch, the first
    child is inserting something into the DIV and then the second is replacing
    the DIV
  - Now try to trigger the COW on the parent view by writing something on it in
    a website context
  - It will crash as the child views will be copied in another order, sorted
    firstly by name.
  - Indeed, when reading parent view, the second child will be copied first as
    it's name is lower than the first, it will then replace the DIV by a SPAN.
    When trying to copy the other child view that is supposed to insert
    something into the DIV, the DIV will not be found and it will crash.
2019-01-09 13:09:26 +00:00
Christophe Simonis 378b283c02 [MERGE] forward port branch saas-11.3 up to 83cc046e9a 2019-01-16 17:02:34 +01:00
Christophe Simonis 83cc046e9a [MERGE] forward port branch 11.0 up to 4c93e4be0d 2019-01-16 14:26:14 +01:00
Nicolas Martinelli b876cb397d [FIX] website: null type redirection
Commit 68e9d5504c makes the redirection type mandatory, which is
logical. Since we can't add such a constraint in stable, we make the
field required in the view and assign a default value (in case the
module is not upgraded, which is very likely to be the case).

opw-1924983

closes odoo/odoo#30252
2019-01-16 07:51:53 +00:00
Anshuman Sharma cd1d9824ab [FIX] website: solve alignment bugs in onboarding
- Fix the position of 'Add to menu' toggle button in new page dialog
- Properly align tip icon in the welcome message

task-1895287

closes odoo/odoo#29403
2019-01-16 10:16:44 +00:00
Martin Trigaux 1e224d244c [I18N] export 12.0 source terms
Mostly following changes at 7f8631a913

closes odoo/odoo#30072
2019-01-15 15:15:34 +00:00
Romain Derie be6f1aa179 [FIX] website: fix the card collapse opening on debug error 500
Since panel collapse became card collapse while migrating from BS3 to BS4 with
commit 59237ea819, it is impossible to open the card content.

Indeed, there was already data-parent attribut pointing to inexisting DOM
element. This was not an issue in BS3 but BS4 is not working with it.

closes odoo/odoo#30142
2019-01-11 12:26:04 +00:00
qsm-odoo 07e1a24368 [FIX] website: allow to remove jumbotron bg color
In the 'banner' snippet, there is a column using a white jumbotron
component. Those comes with a default background color so when using the
website builder to remove the white background, it did not go away;
it was replaced with the default background color (some gray).

This commit sets the default background color of jumbotron components to
'transparent'.

task-1889341

closes odoo/odoo#30099
2019-01-10 12:37:49 +00:00
Sébastien Theys 6b85cbc844 [FIX] website: fix viewref to not raise when raise_if_not_found=False
`ref` could raise even if raise_if_not_found was False on `viewref`, now we
prevent that, and rely only on the exception on `viewref`.

Also, when not set to raise, the method could return None instead of a recorset.

PR: #29753
2019-01-09 12:54:46 +00:00
Sébastien Theys 9ba8dedbf5 [FIX] base,website: make better comments for view helpers
PR: #29753
2019-01-09 12:51:56 +00:00
Nans Lefebvre 8c5ec851fc [FIX] website: fix menus unlinking
Fine-tuning of commit b48d2b6b5e.
The call to unlink inside the unlink can recurse infinitely
in case there is a copy of a menu.
We replace that direct call by an accumulator so no recursion occurs.

opw 1922448

closes odoo/odoo#30032
2019-01-09 10:29:52 +00:00
Nicolas Martinelli 6be112ac2c [I18N] website: export missing translations
Following https://github.com/odoo/odoo/commit/7f8631a913de7aebb9b954

opw-1908220

closes odoo/odoo#30060
2019-01-09 09:51:52 +00:00
Romain Derie d3a7edaec4 [FIX] web, website: set correct order on modal footer button
Since 12.0, some modal footer button order were changed. The primary button
would not be the one in the modal footer corner.

This is against bootstrap but more annoyingly, users are intuitively clicking
on the secondary button, ending up closing the modal and losing form
information they entered.

This commit simply fix the regression from 12.0 as before 12.0 these buttons
were positionned correctly.

Note that a commit in master (saas-12.2) will fix all the other ones that were
wrongly positionned before 12.0.

Step to reproduce:
  - Go to an event having the possibility to register.
  - Click on 'Register Now', a modal is shown to write details (name, email..)
  - You intuitively click on 'Cancel' as it is the bottom right button
    |________________________________ CONFIRM _ CANCEL _|
  - The modal is closed, if you try to open it again your infos are lost

Closes #29884
task-1922120
2019-01-08 12:50:24 +00:00
Odoo Translation Bot 652cecffde [I18N] Update translation terms from Transifex 2019-01-06 01:32:05 +01:00
Sébastien Theys b969c0afcd [FIX] *: correctly hide "groups settings" from user form
* = account, sale_management, website

Settings that are using groups internally should not appear on the user form
without using debug mode.

The admin should not get the idea that he should configure those per user,
because they are going to be reset if/when changing the general setting.

closes #29842
PR: #29860
2019-01-03 09:37:41 +00:00
Odoo Translation Bot 91382f691d [I18N] Update translation terms from Transifex 2018-12-30 01:30:16 +01:00
Atul Patel c5cb1a6b38 [FIX] website: remove faulty decorator
copy_menu_hierarchy is not a model function since it expects
to iterate on a recordset of websites

closes odoo/odoo#29723
2018-12-24 18:05:51 +00:00
Odoo Translation Bot b234af04c1 [I18N] Update translation terms from Transifex 2018-12-24 12:51:19 +01:00
Odoo Translation Bot 47aae6faba [I18N] Update translation terms from Transifex 2018-12-23 01:29:13 +01:00
Romain Derie 88242d6a15 [FIX] website: simplify filter_duplicate
The `filter_duplicate()` method was introduced with b0b6b9afb5 for
website_version.
The module was removed on Odoo 12.0 with https://github.com/odoo/enterprise/commit/51c1bb3cca9ae02fc55cb49ba98cec2901a8e273

`filter_duplicate()` can now fit the multi-website behavior more simply.

Closes #29347
2018-12-19 18:24:50 +00:00
Romain Derie e0c67651db [FIX] website: prevent customize options to be reordered
With multi-website, activating a customize option (customize_show view) will
actually duplicate the customize view to make it specific.
By doing so, the duplicated view will have a higher ID than the original, and
the original's siblings customize options.

Before this fix, two issues could be seen:
1. When toggling a customize option, it would appear last in the dropdown
   afterward. This is because of the views being sorted by (priority, id)
   (if the views have the same priority).
2. When toggling, sometimes the views header would be duplicated. This comes
   from the JS code that loop through the returned views and create the DOM
   by adding a header when the view inherit_id is different than the previous.
   Obviously, as 2 views with the same inherit_id could not be grouped together
   now that the specific one has a bigger ID, it will create twice the DOM.

=> Check tests in this commit, they have schemas that will explain it clearly

Note: We don't take priority into account for customize menu view order as it
      would create the same problem as (2.)
      We could have sorted by (inherit_id, priority, name) to avoid the issue
      and give the user possibility to order options in header but it was
      decided we dont.

Closes #29347
2018-12-19 18:24:50 +00:00
Romain Derie ae8232136d [FIX] website: get only specific view children on _views_get()
Before this comit:
The `_views_get()` method would be called recursively for every
`inherit_children_ids`.
At the end of the method, we would get the complete view hierarchy, including
duplicate hierarchies for website specific copies (COW).

Then, the `get_related_views` that is calling `_views_get()` would be overriden
in website module to keep only most specific views.

But this would not be enough as it would leave orphans from other trees:
  - Have a base view 'B'
  - That has an inherited view 'I'
  - That has itself an inherited view 'II'
  - Now make the hierarchy specific on a website from 'I'
  - And add another inherited view to 'I' on the generic tree
This become:
              B
             / \
            /   \
           I     I'
          / \     |
        II  II2   II'

As explained, filtering duplicates would not be enough as it would correctly
remove 'I' and 'II' from the generic tree but would not remove 'II2'.

At the end, it would return "B", "II2", "I'" and "II'".

Now, we correctly return only "B", "I'" and "II'" by ignoring generic trees
when there is a specific one.

Closes #29347
2018-12-19 18:24:53 +00:00
Romain Derie f7df35540b [FIX] web_editor, website(_theme_install): avoid theme.ir.ui.view crash
In a particular case, `_views_get` was mixing apples and oranges, ir.ui.view
and theme.ir.ui.view.

This was the case if a theme has a theme.ir.ui.view t-calling another
theme.ir.ui.view.
(Only theme's sale bridge cause this issue, eg theme_kea_sale.products)
Then, having that theme installed on a website would make all other website
without that theme to crash when opening the /shop customize menu.

Indeed, the theme.ir.ui.view would have the xml_id theme_kea_sale.search.
The generic view `website_sale.products` would have `theme_kea_sale.products`
as inherit child which is website specific and t-call `theme_kea_sale.search`.

Then, on a website witout theme_kea installed, opening the customize menu would
call `get_related_views` that would call `_views_get` that would loop through
inherit children calling `_view_obj` that would not find a view with that key
and would fallback on self.env.ref, finding the theme.ir.ui.view.

Note: `_views_get` might return specific view for another website but that will
      be filtered on `get_related_views` override in website.

Step to reproduce:
  - Have at least 2 websites and website_sale installed
  - Install theme_kea on a website, it will also install theme_kea_sale
  - Go on the website that has not theme_kea installed
  - Go to /shop
  - Open Customize menu, it won't load because of python crash

opw-1914576
Closes #29347
2018-12-19 18:23:36 +00:00
Jorge Pinna Puissant 149e04b10d [IMP] website: Explain scope of language in keywords in seo
When there is a website with traduction (for exemple, Spanish and
French). In the Spanish website, at the SEO menu, you can add keywords
using any of the languages (Spanish or French), but these keywords are
only added to the Spanish website.

To avoid misunderstanding between the website language and the keyword
language a tooltip is added.

closes odoo/odoo#29683
2018-12-20 14:05:01 +00:00
Christophe Simonis d4c65a7ede [MERGE] forward port branch 11.0 up to 2156af480f 2018-12-04 17:11:57 +01:00
Odoo Translation Bot e0b1718e4a [I18N] Update translation terms from Transifex 2018-12-02 03:16:02 +01:00
Martin Trigaux fa98749154 [I18N] export 12.0 source terms
Update to reflect the recent code changes

closes odoo/odoo#29636
2018-12-19 08:50:10 +00:00
Jeremy Kersten 7afaf2c277 [FIX] website: seo - fix translation for seo modal
Lang / Context is implicitely added in the query using this._rpc

Before this commit if you set the title 'Title 1' for your website in the main
langage and after edit the title as "Title 2" in another language, it was the
main title that was replaced instead of the translation.

Now we use this._rpc that bind automatically the context and so the current lang
that we are editing.

closes odoo/odoo#29596
2018-12-18 09:22:49 +00:00
Odoo Translation Bot 3ce5c8bebd [I18N] Update translation terms from Transifex 2018-12-16 01:18:51 +01:00
Christophe Simonis c0eef42711 [MERGE] forward port branch 11.0 up to 962298c920 2018-11-29 16:13:28 +01:00
Nicolas Lempereur 962298c920 [FIX] website: es_* translation typo
The translation had wrongly `</ i>` which from a report broke some
initialization of some snippet of the website editor.

es_CO, es_DO, es_EC languages are not available in transifex so this
change is done manually for them.

opw-1907752
closes #29135
2018-11-29 10:43:45 +00:00
qsm-odoo a153ed42a0 [FIX] website, *: properly clean website widgets
* web_editor

When an user saves its website, all the animations are destroyed so that
a clean DOM is saved. This is particularly important for snippets like
the latest post one that would crash the page if not cleaned before
saving.

Two cases were found where animations were not cleaned before saving and
this is what this commit fixes:
- When an user used the undo/redo system, all animations were lost as
  the DOM is recreated.
- When an user duplicated a snippet, animations were not restarted on
  the cloned element.

closes odoo/odoo#29159
2018-11-29 16:41:33 +00:00
Romain Derie 9c4eab3ef4 [FIX] website: ensure only editor can force website with URL 'fw'
Before this commit, everyone could use the `fw` query string to force a
website during the dispatching. Plus, it would not require multi-website to be
enabled (multi-website only display UI elements, it does not affect behaviors
as they are already triggered even if multi-website is disabled).

This was intended but caused an issue for public users.
Indeed, the code that would force a website during the http dispatching would
be executed in `_add_dispatch_parameters`, after the auth methods.

Then, the request.uid would be the one from the website we were leaving and not
the one of the website we are forcing.
Public user would then not be recognized as such (if both websites have their
own public user) and would have interface glitchs (considered as connected).
Note: Next reload or page navigation would set the request.uid correctly.

Now:
To avoid such a behavior, we decided to allow only designer user to be able to
switch website with the `fw` query string, and only if multi-website is
enabled.
Note: The designer group check is done on the leaving website and not the
      forcing one as `_add_dispatch_parameters` is executed after auth methods.
      There is no way to check with which user the user will be logged on the
      forcing website (Public, Same user, different user?).
      Also, it would have to handle the same domain/different domain.

Step to reproduce:
  - Activate multi-website
  - Activate multi-company
  - Create SiteA and SiteB
  - Create CompanyA and CompanyB
  - Set CompanyA on SiteA and CompanyB on SiteB
  - A new public user will be bootstraped for CompanyB
  - Optionnaly, setting manually a different public user for CompanyB will do
    the same.
  - Go to website 1, request.uid is PubUserA and request.website is SiteA
  - Navigate to website 2 with `?fw=2` in URL, request.uid will be PubUserA and
    request.website will be SiteB.
    This is wrong, request.uid should be PubUserB as we are on SiteB

This will result in multiple bug, mainly the non logged user will see the
dropdown in the navbar as if they were logged in showing 'PubUserA'.

Fixes #27998

closes odoo/odoo#29136
2018-12-12 14:21:53 +00:00
Jeremy Kersten dc30b955e0 [FIX] website: don't show switcher website if only 1 website
In some case, you can have multi website enabel with only 1 website:
    - If you create a second and deleted it.
    - Or after a migration to check common view and specific view e.g.

In this case, before this commit, you have switcher of country that is just
an empty dropdown.

closes odoo/odoo#29481
2018-12-12 15:47:55 +00:00