Commit Graph
430 Commits
Author SHA1 Message Date
Romain Derie 269aa59411 [IMP] http_routing, website: allow to customize the lang in URL
With this commit it is now possible to change the lang displayed in the URL.
Eg, you could use `/fr` instead of `/fr_BE`, or even a fancier `/french`.

Task-32838

Courtesy of pla@odoo.com

closes odoo/odoo#35135

Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2019-08-26 16:35:19 +00:00
Andrea Ullianaandqsm-odoo 7deceae18c [IMP] website, *: use "auto" widget for font customization
* theme_bootswatch, theme_default, website_theme_install

This commit makes use of the new 'auto' widget for font selection:
instead of enabling a template which will enable a scss file which sets
a font variable to a specific value... we directly allow to do a scss
custo which sets that value.

The code in charge of resetting font customizations on theme switching
is also moved and refactored here in website (instead of being specific
to each theme).

Part of https://github.com/odoo/odoo/pull/33442
task-1974659

Co-authored-by: qsm-odoo <qsm@odoo.com>
2019-07-30 09:59:28 +00:00
Raphael Collet b7fd679a6c [FIX] *: sudo() -> with_user() 2019-07-04 11:32:22 +00:00
Christophe Simonis 9035fb8a2a [MERGE] forward port branch saas-12.4 up to 618ea1ab67 2019-06-18 10:24:25 +02:00
Christophe Simonis 25e3f27062 [MERGE] forward port branch saas-12.3 up to 48a9f5a633 2019-06-17 13:20:35 +02:00
Christophe Simonis 34a8754d4f [MERGE] forward port branch saas-12.2 up to 498b4b4350 2019-06-14 15:20:01 +02:00
Christophe Simonis 8853e6b594 [MERGE] forward port branch 12.0 up to 7ef4ba03c4 2019-06-11 15:20:13 +02:00
Christophe Simonis 9e9e9acef1 [MERGE] forward port branch saas-11.3 up to a2582c4252 2019-06-07 19:04:43 +02:00
Christophe Simonis a2582c4252 [MERGE] forward port branch 11.0 up to bdc62d8031 2019-06-07 13:00:07 +02:00
Romain Derie 9efc11c8da [FIX] website: redirect user
Before this commit, user would be redirect to / instead of /my after signup.
That error was detected with task-1829827 which has a tour ensuring user is
correctly redirected to /my after signup on the checkout summary after payment.

Since 0229ef4c4a, the `web_login()` super call order has been changed when
called from the `/web/signup` route.
See the commit for more details but basically, before the fix, it went only
through:
1. web.web_login
2. portal._login_redirect

Where now, it goes through:
1. website.web_login
2. auth_signup.web_login
3. web.web_login
4.portal._login_redirect

Thus, portal._login_redirect is not returning `/my` as redirect anymore.
Indeed, website.web_login will ignore its super() and force redirect to `/`

With this commit, website's user are redirected to /my as expected.
Side effect: website's user will also be redirected to /my on login instead of
`/`, which is also prefered.

closes odoo/odoo#33865

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2019-06-04 09:38:44 +00:00
Yannick Tivisse f5dfe4727c [IMP] api.py: Rename company_id/company_ids into company/companies
The goal is to be coherent with the user property.

Actually, company_id and company_ids on the environment are no fields.

Calling env.company_id returns a browse record, not an id.
2019-05-29 08:09:15 +00:00
Andreas Perhab 8242ddbc10 [FIX] website: provide favicon for pdf tabs
When opening the pdf at the end of an order Chrome tries to load
/favicon.ico which returns 404 before this patch. We provide the
favicon from the current website.

closes odoo/odoo#33746

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2019-05-29 10:02:18 +00:00
qsm-odoo d7da1d648c [IMP] website, *: improve customize dialog no-reload updates
* base

Before this commit, if an option was customized thanks to the customize
dialog, the page was not reloaded, only the new scss <link/> elements
were retrieved and replaced in the DOM.
There were two problems with this:
- The <script/> and <style/> tags were also retrieved for no reason (as
the whole result of t-call-assets was returned)
- This made use of a deprecated ir.qweb method that we want to remove
(see https://github.com/odoo/odoo/pull/33432)

This commit removes the use of the deprecated method by improving the
system: only the <link/>'s new URLs are returned on customization.

closes odoo/odoo#34040

Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2019-06-11 16:06:07 +00:00
qsm-odoo d0573de2b6 [IMP] website_sale, *: save the layout mode in the user session
* website

Part of https://github.com/odoo/odoo/pull/31147
task-1925327
2019-05-28 15:05:42 +00:00
Yannick Tivisse a5b6f31cf2 [IMP] base: Contextualize the multi company
Purpose
=======

Allow the user to select the allowed companies for which he wants to see records
on top of selecting his current company.

It is confusing for users to see the records from the company he is connected to
and the records of the children companies.

Instead of using the hierarchy of companies to access records across companies,
the user can now select (from his set of allowed companies) the companies for
which he wants to access records.

/!\ This means that the user will interact with records from company A when in
company B.
Example: a SO has been created and confirmed in A. When in B, I create the
invoice from it.

Specifications
==============

1/ Deprecate the parent/children hierarchy on the res.company model. The fields are
kept on the res.company model to ensure the retro-compatibility, but won't be used
accross the standard code anymore. The only functional usage for this mechanism
was to allow to see records from several companies by creating a virtual parent
company, which will be possible with the new mechanism.

2/ By default, a user will only see the records of the company he is connected
to (or records without a company). (It is still editable by the user if needed).
For that, put this information in the user context, to allow having different
configurations on different browser tabs. Instead of having domains like
['|',
('company_id', '=', False),
('company_id', 'child_of', user.company_id.id)]
you'll have something like
['|',
('company_id', '=', False),
('company_id', 'in', company_ids)]
Note that the 'company_ids' is a value that is passed in the evaluation
context on the record rule, as we already have user, or time.
company_ids is a list of the ids of all the enabled companies in the
user's context.

3/ Out of the generic improvements brought by this task, this will illustrate
issues that could exist since several versions. For example, it should not be
possible to create a scrap order for the company A with a package of the company
B, or it should not be possible to create an invoice on the company A with
payment terms from the company B. Before the version 12.0, it was easy to
encounter this kind of issues as the admin was the SUPERUSER_ID. A positive side
effect of the fact that the SUPERUSER_ID has become an inactive user was to
make it more difficult to introduce mismatch on the records, but haven't solved
the issue, as it was still possible to do it with parent companies
configuration. Some of these issues have been fixed in this commit, but all the
business flows should be re-tested to check if an ir.rule should be introduced
(eg: a multi company rule for stock.quand.package), if the company of a record
is correctly transfered to another record created from the first record (eg:
From a SO, create an invoice and a payment, the company of the sales order
should be transfered on the invoice and the payment, even if the company of the
sales order is A and I'm logged into the company B with the company A enabled.

4/ Currently, if I click on a button on a notification email (example 'View
Task'), I face a traceback if I'm not logged into the company of the record.
Now, if you click on a button and if you have access to the record, the correct
company will be automatically set.

5/ If I display a kanban view with several records from several companies (and
an image), all the images should be displayed.

6/ Currently if you copy paste an url, this will crash if you're not in the
correct company. This won't be fixed because it's quite impossible to do it in
a clean way. This task brings a workaround. Copy/Paste -> Traceback -> Log into
the correct company, re-copy/paste -> Ok.

7/ 2 property methods have been added on the environment to retrieve the company
on which the user is logged in and the companies the user enabled, on a specific
tab.
That way, when creating a record, instead of doing
default=lambda self: self.env.user.company_id
do
default=lambda self: self.env.company_id
On the other hand, to retrieve the enabled companies, do
companies = self.env.company_ids

8/ Modify the Company Switcher widget to allow to log into another company
WITHOUT writing on the res.users (and thus bringing cache invalidation issues
and so on). Also allow to enable several companies and see records from several
companies, and independantly of the other browser's tabs.

9/ When focusing on a tab, save the current company configuration on the local
storage. That way, when doing 'CTRL+T' or a middle click, the context is
propagated to the new tab.

10/ Improve the error message in case of multi company access errors. Now, when
the user is in debug mode, display the related names of the records and the name
of the user who brings the issue.

11/ Remove the context erasing when writing on a res.users
This is probably coming from the migration to new API of the base module.
The context was not propagated at this moment, which was a common mistake at
that time. When migrating the module, probably by using the 'black box' method,
as the context was not propagated, it was erased on the new version. This is
now an issue because the context (i.e. the enabled companies) was erased when
writing on a res.users, leading to tracebacks.
See: https://github.com/odoo/odoo/commit/7eab8e26d3d46c53f4be924d6a34e80a66e74960#diff-4c2e738ee8f64f11806c889ea097b5e7R624

12/ Fix the crash manager on redirect warnings. The issue is the following
- Create an invoice on a company without a configured CoA.
- Set a partner
- On the onchange_partner_id, a redirect warning is raised to propose you
to configure a CoA
- Click on 'Go to the configuration panel'
- A generic warning says something like 'Do you want to discard your changes?'
- Click on yes, the page refreshes, but not on the redirect action.
Now, set correctly the action on the hash, and reload instead. The breadcrumb is
lost for example, but you reach the correct action at least.

13/ Introduce a res.group to enable/disable the multi company per tab
feature.

14/ To help the users to know which tab is in which company, add the
possibility to have a favicon per company. When creating a company,
the classical 'O' icon is colored by default in a random color.

15/ Remove the company switcher on the frontend. This was mainly there
to allow a user to swicth to the company linked to the website.
This behavior is now transparent to the user. If the website A is
activated, then the company set on the context is the company of the
website.

16/ Deprecated the _company_default_get method on the res.company
model. Remove the method _get_company on the res.users model.

17/ Add 'allowed_company_ids' and 'current_company_id' on the pyeval
context. You can now use those variables on domains in the views to
access directly to the activated company.ies on the current tab.

TaskID: 1960971

closes odoo/odoo#32341

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-05-13 08:57:49 +00:00
Christophe Simonis 0e7675847f [MERGE] forward port branch saas-12.1 up to 0f4abc5c22 2019-02-22 16:25:02 +01:00
Christophe Simonis 1d2b6f1bef [MERGE] forward port branch 12.0 up to 84143a34b3 2019-02-21 15:37:19 +01:00
Romain Derie 479585140c [IMP] website: adapt reset view code to single view
Reset view feature code still had remains of initial release (Odoo 9.0).
At that point all the view tree was returned, not only the broken view.

Since it has been fixed in 12.0 and refactored in saas-12.3 with this PR, it
now only takes the broken view as argument, handling multiple views has no
sense anymore.

Thus, this commit remove the (unused) multiple view compatibility.

This commit also add a test to test the refactoring or this feature.

Coming from #32009 (task-1943001)
2019-03-29 18:57:06 +00:00
Romain Derie 81df3c5f22 [IMP] website: improve reset view feature
- Store previous arch to be able to reset it (soft reset)
- Add the possibility to reset from file if possible (hard reset)
- Adapt frontend reset page to these new fields
- `arch_fs` hack to check if view was modified got moved to new field
  `arch_updated` as we now need to keep track of the `arch_fs` to reset a
  broken view.

Closes #32009 (task-1943001)
2019-03-29 18:53:56 +00:00
qsm-odoo 10384c689a [IMP] website, *: optimize scss customizations
* web_editor

This commit's goal is to optimize the delay to make a scss customization
thanks to the website customize dialog. Before this commit, the JS code
took advantage of existing web_editor routes but this was far from
efficient as this was done:

1) PY: Load all scss files used in the page
2) JS: Find the one we want to customize and adapt the scss content
3) PY: Create the scss customization with the new content

(So two RPC (including one very slow) and content building in
javascript)

After this commit, this is done:

1) PY: Load the scss file being customized, adapt its content according
   to the new values and save the customization

(So the whole logic is in python, requiring only one small RPC)

This commit also take the opportunity to review the web_editor ace
editor loading code (the logic is shared with website customizations).

PR https://github.com/odoo/odoo/pull/29624
task-1904244
2019-02-08 14:38:51 +00:00
qsm-odoo ff55736c4f [REF] website: simple move of a python file
Next commit will change that file to make it extend a web_editor model
instead of a web_editor controller. This commit only moves the file.

PR https://github.com/odoo/odoo/pull/29624
task-1904244
2019-02-08 14:38:41 +00:00
qsm-odoo 4edb9c4f60 [IMP] website: improve theme customize dialog
- Make the controller part more readable and more efficient (O(1) ORM
  operations instead of O(n)) and remove deprecated code.

- Add the possibility to have a toggle standalone option. This is
  used as soon as an `<opt/>` is alone in its container (note that now,
  the container can be any tag and will be ignored during rendering).

- If an option has no specified 'string' to attach to it, the name of
  the first view it toggles will be used.

PR https://github.com/odoo/odoo/pull/29624
task-1904244
2019-02-08 14:36:43 +00:00
Romain Derie"Romain Derie <rde@odoo.com>""Jérémy Kersten <jke@openerp.com>"
ef03db9edd [FIX] website: restore reset_templates functionality
Since AST was introduced to compile Qweb templates, the reset templates
functionality is not working anymore.
Actually, it does not even appear anymore as the conditions to trigger and show
the reset view behavior can't be True anymore.
Indeed, the code is still importing the old QWebException from odoo.exceptions
which is now just an empty class.
The QWebException that should now be used is the one from odoo.base.models.qweb

More than just a wrong import, the QWebException properties have completely
changed.

Since its last working version (Odoo 9.0), a lot of changes occured, mostly:
  - Odoo 11.0: new model website.page, which completely changed the pages
    behavior and changed the models.
  - Odoo 12.0: multi-website, which introduced the Copy On Write (COW) that
    redefined how we write on view in a website context. We now need to reset
    copied/specific views that have no model_data_id.

This fix is for a stable version. There is some flows that can't be fixed
without a refactoring or new fields (mainly because of the arch_fs being
erased when writing on `arch`, plus we can't introduce a module reload in
stable).
The goal of this commit is to fix the basic and standard case of broken views,
which is when non-technical users are breaking the views through HTML editor.

To reset the views, we will read the original arch in the XML file, as the
dev mode is doing.
To be eligible for the reset, the broken view need an `arch_fs` set. If the
view arch has been modified anywhere else than the frontend, the `arch_fs`
will be erased and the view wont be able to be reset.
As the broken views will be specific views, we will simply read the generic
view in the XML file and write it on the specific. We can't simply remove the
specific view as we might be on a specific tree.

Specific case, in case of custom views create dropping a snippet in an oe_struc
we just delete this inehrited view to allow end user to have their page back.

In some case of bad compilation in sub template, we try to guess which inherited
view, t-called view is broken by string matching based on 'last_path_node' xpath.

Add new module test_website to add tests, it will be usefull for futur test of
install/uninstall and ...

Todo in master:
  - try to track on QWebException the real template that is broken and not only
    the last node from the main template.

Co-authored-by: "Romain Derie <rde@odoo.com>"
Co-authored-by: "Jérémy Kersten <jke@openerp.com>"

closes odoo/odoo#29957
2019-02-13 20:33:18 +00:00
Christophe Simonis f927c68ddb [MERGE] forward port branch 12.0 up to cb8fefa899 2019-01-31 16:59:58 +01:00
Andrea Ulliana 515e7bc50f [IMP] website, *: improve CSS edition usability + add JS edition
* web_editor

Currently, when an user wants to edit the css of its website, he has
access to lots of files and, in debug mode, to even more files. While
the feature is nice for people who know what they are doing, a lambda
person can easily break its website by changing the wrong files. Also,
nothing warns the user that the files that are edited will never receive
updates anymore (unless if they are reset). The goal is to prevent
those behavior while still allowing the add custom css. Another goal
is to be able to *add* custom javascript.

Custom files created for the user:
SCSS: user_custom_rules.scss, user_custom_bootstrap_overridden.scss
JS: user_custom_javascript.js

See https://github.com/odoo/odoo/pull/29999
task-1919350
2019-02-05 14:28:29 +00:00
Christophe Simonis 4400cce820 [MERGE] forward port branch saas-12.1 up to 4524ad06a8 2019-02-04 13:27:22 +01: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
Christophe Simonis 8aa8548d8a [MERGE] forward port branch 12.0 up to 3e4138deaa
closes odoo/odoo#30045
2019-01-09 15:56:53 +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
Adrian Torres 52f5528cfb [REF] *: replace deprecated pycompat helpers for builtins
This commit replaces calls to pycompat helpers that were intended for
python 2 <-> python 3 interoperability for python 3 builtins, as python
2 is no longer officially supported by Odoo.

This includes:
    * calls to imap/izip/ifilter replaced by map/zip/filter
    * uses of text_type replaced by str
    * uses of unichr replaced by chr
    * calls to implements_to_string, implements_iterator removed
    * string_types and integer_types replaced by str, int respectively
    * calls to to_native replaced by calls to to_text

This is done in preparation to the removal of these deprecated helpers
in the following commit.
2018-11-29 09:28:17 +00:00
Christophe Simonis 6faad524cf [MERGE] forward port branch 12.0 up to bc744a1da4 2018-11-16 19:30:20 +01:00
Christophe MatthieuandAntoine Guenet f296992317 [IMP] web_editor,*: Refactoring the wysiwyg editor and 'html' field
* Creating a new structure by transforming all the plugins in the
  library using the odoo inheritance system. Plugins are easier to
  implement with the AbstractPlugin to add Odoo behaviors.

* From now on, the methods of the library (in this case Summernote) can
  no longer be called by other modules or files. Only the wysiwyg
  widgets can access it, to simplify the updating process. The wysiwyg
  object serves as an interface.

* Depending on the options the snippets will be loaded or not, the
  editor will be in an iframe or not... all of this is transparent from
  the outside.

* Regarding iframes, all controllers related to editing have been
  removed: the new API no longer needs them. This speeds up loading,
  eases testing and removes complexity for the same
  features.

PUBLIC FEATURES

There are several public methods on the Wysiwyg class:
* Wysiwyg.prepare (WidgetParent): returns a deferred resolved when the
  library (xml, lazy, assets...) is loaded.
* Wysiwyg.getRange (DOM): returns the range (selection in the dom)
* Wysiwyg.setRange (startNode, startOffset, endNode, endOffset): creates
  a range (selection in the dom)
* Wysiwyg.setRangeFromNode (DOM, options) that creates a range from an
  element (option available to select all, start or end)

A jQuery selector was added: :o_editable, which indicates whether the
current element is editable. That is, if it is contained in a tag with
the attribute 'contentEditable = "true"' or in a tag with the class
o_editable.
Several methods are also present:
* focusIn: makes a focus and places the cursor at the beginning of the
  element
* focusInEnd: makes a focus and places the cursor at the end of the
  element
* selectContent: makes a focus and selects the content

HTML FIELD

The HTML field can receive different options:
* style-inline: {boolean} transforms a class into an inline style when
  saving and vice versa when reading.
* no-attachment: {boolean} prevents the use of attachments (in media
  dialog)
* cssEdit: {xml_id} to use a template containing the css to loaded in
  an iframe when editing
* cssReadonly: {xml_id} to use a template containing the css to load
  into an iframe when viewing in readonly
* snippets: {xml_id} snippets template (can be used with or without
  cssEdit)
* wrapper: {template} qweb static template (containing a tag:
  id = "wrapper") that will include the content during editing (removed
  on save)

MASS MAILING

A widget was created for mass mailing. There are now two fields:
body_html and body_arch.
body_arch contains the code with the class without conversion into
inline style, useful when editing and one with the inline style that is
visible in readonly mode and sent by email.
Advantage: no spreading errors, able to update css/theme, able to do
more changes when converting to inline style so that a maximum of mail
clients have an impeccable rendering.

Co-authored-by: Antoine Guenet <age@odoo.com>
2019-01-17 08:40:21 +00:00
Goffin Simon 51982f9199 [FIX] website: Impossible to link an analytic account
Steps to reproduce the bug:

- Go to Website > Dashboard > Analytics and click on "Link my analytics account"
- Enter some data and save

Bug:

A traceback was raised: TypeError: website_set_ga_data() missing 1 required
positional argument: 'website_id'

opw:1905874

closes odoo/odoo#28636
2018-11-13 16:12:47 +00:00
qsm-odoo 8c756a32a0 [REF] website: review theme dialog engine
Refactor the code to remove useless parts, simplify behaviors and allow
more customizations in future tasks.

closes odoo/odoo#28167
2018-10-26 09:29:53 +00:00
Romain Derie 3c11cf926c [FIX] website: only one website on dashboard if no multi-website
If multi-website is disabled, we still show all the websites on the website
analytics dashboard.

This commit will only show one website if multi-website is disabled

closes odoo/odoo#27737
2018-10-17 09:12:20 +00:00
qsm-odoo 509a7f73b0 [FIX] website, *: restore color edition in theme dialog
* base, web_editor

Commit https://github.com/odoo/odoo/commit/44d659d0df6b50ae230af39a0d41a46b9549e2ae
made the system work with multi-website but fetching the assets content
was unfortunately not working in multi-website...

Also restore correct search operators.
2018-09-27 13:56:09 +02:00
Jeremy Kersten 44d659d0df [FIX] web_editor,website: add hook method in web editor to allow to add the website_id
Before this commit, the view create by editor (to change the scss file in asset for example) was not website specific.
Now we override (use the new hook method) to add the website_id.
2018-09-25 19:40:42 +02:00
Romain Derie 4daceeddb2 [IMP] website(_*): add kwargs in routes where necessary
task-32836
2018-09-25 19:16:10 +02:00
qsm-odoo c8a37b4678 [FIX] website: adapt customize modal to multi-website
The code used the xml_id field instead of the key field at some point,
so the modal was not fetching the proper views.

This commit also removes the useless code in there.
2018-09-13 10:35:42 +02:00
Jeremy Kersten 7566a8c205 [FIX] website: page manager visual fix
sort by url by default
don't show multi level if not in multi website mode
2018-08-31 18:04:23 +02:00
Romain Derie 47b00c5d53 [FIX] base,website,web_editor: handle key field on ir.ui.view for multi website
With multi-websites, we expect qweb views to have a key set as it is the key
that is used to find duplicates (two views with same keys are duplicate, the
one with a website_id set is more specific than the one without a website_id)

Thus, 5ff87e8039 sort on key in order to find the most suitable one.

It would crash if a qweb view is created without a key (False) as it can't sort
`bool` and `str`.

This commit:
  - Adds a generated key to scss views
  - Adds an SQL constraint to avoid QWeb views without a `key`
  - Generates a random key when creating a QWeb view without a `key`
  - Handle False key in `filter_duplicate()` by extracting views with False key
    before sorting, and then adding these views to the recordset

Note: We also want the key to be editable as it is now an important field with
      multiwebsite. Thus, we removed the readonly on this field.

+ fix python tests as we now force key on qweb views with sql constraint
+ pep8
2018-08-31 16:37:45 +02:00
Romain Derierde-odoojke-odoo
65d8177b55 [REF] website*: revamp res_config_settings for website
Reorder res.config.settings for website
Make website_id in no create in most view
Revamp res.configsetting and view Form simplified

Transform old 'useless' stored field for presentation by computed field.
We can consider that if there are not key, feature is disable.

Co-authored-by: rde-odoo
Co-authored-by: jke-odoo
2018-08-24 20:01:02 +02:00
Jeremy KerstenandDerie Romain 066cfc9598 [IMP] website_[blog|event|forum|sale|slide]: make website specific
Set up env & tools for module website multiwebsite (blog, event, sale..)
website_id in modelConverter and ir_rule

add _compute_domain_keys to have a different cache per website
  or rules would not be correctly website_dependant
  eg: blog 1 on website 1, blog 2 on website 2
      access blog 1 from website 1 => can access -> normal
      access blog 1 from website 2 => can access -> should crash because (ir rule)

split mixing website.published.mixin and website.published.multi.mixin to have
website_id only on last one.
 multi mixing will:
     - override website_published compute to take current_website into account (not in backend)
     - force website when clicking on published in backend

- website blog, website_sale, website_event, website_forum, website_slides are now multi website

Co-authored-by: Derie Romain <rde@odoo.com>
Co-authored-by: Kersten Jérémy <jke@odoo.com>
2018-08-13 20:16:34 +02:00
Jeremy KerstenandDerie Romain a45bb90fac [IMP] website: improve pagemanager to be multi website compliant
Now we can see which specific page override wich page when page are sorted by url.

Co-authored-by: Derie Romain <rde@odoo.com>
Co-authored-by: Kersten Jérémy <jke@odoo.com>
2018-08-13 19:51:32 +02:00
Jeremy KerstenandDerie Romain ff26b20a48 [REF] website: small diff pep, renaming, make generic function
This commit should not change the behaviour in most cases.

Co-authored-by: Derie Romain <rde@odoo.com>
Co-authored-by: Kersten Jérémy <jke@odoo.com>
2018-08-13 19:51:17 +02:00
Joren Van Onder 4f6ec1cd2a [IMP] website,*: support multiple websites
This implements support to administer multiple websites. Although the
core functionality already existed, managing multiple websites was
fairly technical.

In the interest of database updates and migration this attempts to
keep duplicated data to a minimum. To do this the usual generic
records are rendered unless some website-specific record exists that
replaces it. Copy-on-write (COW) is used to create these
website-specific records. Through this mechanism creating a
website-specific record is delayed until necessary. A COW mechanism
has been implemented on 4 models: ir.ui.view, website.page,
website.menu and ir.attachment. These COW mechanisms are activated
when editing data through the website (aka frontend). These frontend
edits (e.g. with web_editor) will be website-specific, possibly
creating a website-specific record when necessary. When editing data
in the backend nothing special will happen, even when editing a
generic record. Note that because of this mechanism also facilitates
the ability to create new, uncustomized websites because the generic
data is kept.

Support is provided for a website to have any theme. Themes are fairly
complex to handle. Standalone themes can depend on other standalone
themes (e.g. theme_beauty depends on theme_loftspace) and themes
usually modify some data of the themes they depend on. Because a theme
can be installed on multiple websites, using website_id m2o fields
does not work well. It would require duplicate data, making updates
and migration harder. Because of this, data for themes (ir.ui.view and
ir.attachment specifically) have a theme_id m2o. website has a
theme_ids m2m that identifies all theme modules currently installed on
it. Through these fields we figure out what to render. A theme is only
fully uninstalled when it's no longer active on any website. The
advantage of this approach is that upgrading or migrating theme data
is no different from the single-website case.

The website.published.mixin class was modified to handle multiple
websites. A wizard was added in the backend to easily manage this for
multiple website.

Although not used anywhere in this commit, a 'website_id' variable has
been added in the evaluation context of ir.rule. It allows to easily
make any model multi-website aware, all that's needed is a custom
website_id m2o field on a model and a custom record rule.
2018-08-13 19:51:10 +02:00
qsm-odoo 22c4311e28 [IMP] *: make customize dialog generic and improve options
* web, web_editor, website, website_theme_install, portal,
  theme_default, theme_bootswatch

The purpose of this task is to make the customize dialog as generic as
possible, that is theme-independant:

1) The design is now totally generic (Odoo visuals)
2) The XML definition is form-view like. This allows themes to extend
   the dialog without any risk of breaking the style and also allows to
   not care about lots of technical details.
3) New options have been included. Those were themes options that are
   now generic and which themes can simply adapt without touching the
   customize modal (navbar colors, footer color, navbar layout, fonts,
   body background, ...).

The color palette can now also be customized with user colors.

Using sass functionnalities, color palettes and fonts integration is now
a lot better.

Thanks to @qha-odoo for the original design.

task-31677
2018-08-10 16:49:29 +02:00
Christophe Simonis aba8c2b8fb [MERGE] forward port branch 11.0 up to 1b272a2050 2018-06-05 16:27:49 +02:00
Denis Ledoux 579f67166a [FIX] websiste: determinist homepage for portal users
In the portal module,
the `index` method from the `web` module controllers
is overriden to redirect `/`
to the portal `/my` for the portal users,
instead of the regular backend `/web`.

However, when `website` is installed,
this behavior should not happen,
as you would like the signed in portal users to
be able to see the website homepage,
and not to be redirected to `my` when
they try to access `/` root path of the website.

Because the override in the website module was done on the
`index` method coming from the `web` module instead of the `portal`,
according in which way the Python module were loaded,
it sometimes redirected to `/my`, sometimes it correctly
displayed the homepage. This is because the modules are not
loaded in a determinist order.

To summarize, on runbot, if you logged as portal/portal,
one time on two you were redirected to `/my`, and the other
time you saw the homepage correctly.

As `website` depends on `portal`,
we have the possibility to override the `index` method
of `portal` instead of the one of `web`,
to force the determinist order,
and therefore the determinist behavior of the homepage for
portal users.
2018-06-04 15:57:56 +02:00
Christophe Simonis 5f2d080cf8 [MERGE] forward port branch 11.0 up to ad825b673b 2018-04-16 18:34:56 +02:00