Commit Graph
4997 Commits
Author SHA1 Message Date
Romain Derie 789aa140b9 [FIX] website, website_sale: correctly set company_id on address
During checkout, the user can create a new billing (only for public user as it
will create a 'normal' `res.partner`), a new shipping, edit its billing (that
will edit himself) or edit its shipping address.

All those cases will go through the exact same methods, public user and logged
in user included.

This previously led to multiple issues and multiple fixes to correctly set
`company_id` and `website_id` on the address (res.partner).

See 44372471ef that fixed the `website_id` part.

See 3a0f05f33 that fixed the multi-company behavior, but needed 2ba71140 to not
modify the company of an already created partner, but was still incomplete as
after that fix a logged in user would still have the admin (sudo) company
instead of the website one as supposed.

This commit will fix that bug and add some tests for all mentionned issues.

Related to #28853 as we want to backport the mentionned commit but needed to be
fix first.

closes odoo/odoo#34596

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2019-07-04 13:58:23 +00:00
Pragya Ladda bd49d9c0cf [IMP] website: cannot deactivate language used by website
closes odoo/odoo#31520

---

backport of 8e2f9a4fe2
Initially a improvement, it is now backported in 12.0 to fix #34430

closes odoo/odoo#34474

Signed-off-by: Christophe Simonis <chs@odoo.com>
2019-07-01 08:59:28 +00:00
Romain Derie 6ebcb1db80 [IMP] tool, website, website_sale: move test utils functions
We have multiple ways of simulating a frontend context while running python
tests (mainly during TransactionCase):
  - `MockObject` class from 8557bcfa30
  - `simulate_frontend_context` method from a5a5a57e48
  - `DotDict` from f8efc9a957

This commit moves `MockObject` to misc to be reusable and adapt it to be
accessible by dot notation with `DotDict`.

Part of #34396
2019-06-26 17:08:09 +00:00
Odoo Translation Bot 2cc3ec0b8a [I18N] Update translation terms from Transifex 2019-06-30 01:17:50 +02:00
Odoo Translation Bot 53b6ab9f05 [I18N] Update translation terms from Transifex 2019-06-23 01:17:13 +02:00
Odoo Translation Bot 25eac59ffa [I18N] Update translation terms from Transifex 2019-06-16 01:18:49 +02:00
qsm-odoo 19896a5757 [FIX] website: stop support of BS3 'show' class
The BS3 'show' class cannot be supported as BS4 still defines a 'show'
class for other purposes which conflict with its former use (tab-pane,
fade effects, ...). Adding more complex rules won't solve the problem as
they would change css rules priorities.

closes odoo/odoo#34139

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2019-06-14 10:49:02 +00:00
qsm-odoo 62b89ea467 [FIX] website: allow different compatibility grays
Commit https://github.com/odoo/odoo/commit/4f9a0cb4fcdfa9fee66c042593f4d411dd0e192f
introduced a way for users to enable a compatibility template to provide
support for some old BS3 classes.

Some of these classes are the bg-gray-* classes. The problem is that
enabling the compatibility file forces them to the new BS4 gray values
while the user may have done a custo to generate them automatically
from other gray values. This commit allows to keep the compatibility
file enabled, without overriding compatibility grays the user may have
provided on its own.

closes odoo/odoo#34134

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2019-06-14 09:51:05 +00:00
Nans Lefebvre ea064c81c9 [FIX] website: fix access error at settings save
Let a database with company C1, C2,
and a website W belonging to C1, used for both companies.
Settings in C2 cannot be saved without setting a website.
At settings load W is removed from C2 because it belongs to C1.
So reset C2's website to W.
This triggers a (useless) write of company_id (C1.id) on W.
Then we have w.user_id.company_id.id != self.env.user.company_id.id, (C1 != C2).
So if contacts are not shared, then accessing w.user_id.company_id would cause
an access error because of record rules, preventing the save.
As a result, settings are unusable for company C2.

opw 2008887

closes odoo/odoo#34102

Signed-off-by: Denis Ledoux <beledouxdenis@users.noreply.github.com>
2019-06-13 12:41:15 +00:00
Odoo Translation Bot 0ebee56da5 [I18N] Update translation terms from Transifex 2019-06-09 01:17:53 +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
Odoo Translation Bot 72a0963d2d [I18N] Update translation terms from Transifex 2019-06-02 03:08:27 +02:00
Romain Derie 87d2661aba [FIX] website: remove noupdate for aboutus, contactus, homepage arch
Before this commit, aboutus contactus and homepage would be flag as noupdate.
If not modified, those view would not get modification on module update, which
is not logic.

Now, those view will benefit from any update. It makes even more sense since
multi-website, as those views will never get modified directly (it will COW).

closes odoo/odoo#33919

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2019-06-05 13:36:38 +00:00
Nicolas Martinelli 16f9375dab [FIX] website: website-specific child views
On a eCommerce page were there was no SEO optimization change:
- Customize > Activate "eCommerce categories"
- Customize > Activate "Colapsible category list"
- Promote > Optimize SEO > Change description > Save

Nothing happens.

Actually, an SQL error is raised because of the `ondelete='restrict'`
set at:

https://github.com/odoo/odoo/blob/897feb553e6ef75af9434cb77436b26abde3a761/odoo/addons/base/models/ir_ui_view.py#L212

In this case, we have the following structure:

```
View 1
|
---> View 2 (Website-specific)
|
---> View 3 (Website-specific)
```

For example:

```
Products
|
---> eCommerce Categories (Website-specific)
|
---> Collapsible Category List (Website-specific)
```

Since the inherited view (View 2) is website-specific, we duplicate it
and try to unlink it. However, this view has children, which raises the
error.

To solve the issue, we re-attach the children of the inherited view to
its copy. In a realistic situation, the children of a website-specific
view should also be website-specific, so there is no need to apply the
'copy or re-attach' logic recursively.

We end up with:

```
View 1 (Website-specific, duplicated)
|
---> View 2 (Website-specific, duplicated)
|
---> View 3 (Website-specific)
```

opw-1997946

closes odoo/odoo#33787

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-06-04 08:30:08 +00:00
Odoo Translation Bot 28382b76d8 [I18N] Update translation terms from Transifex 2019-06-02 01:18:32 +02: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
Christophe Simonis 5f17daae40 [MERGE] forward report branch 11.0 up to daf9763e6e 2019-05-17 10:00:11 +02:00
Sébastien Theys 3b3f85670f [FIX] website: prevent crash with image gallery snippet
If destroy is called before start, there will be a crash before this commit.

At the time of this commit, this can be reproduced in master by dropping the
image gallery snippet, clicking on add images (double click, which opens the
media dialog twice for some reason), selecting 2 images to add on the
media dialog, and clicking on add. The error will be in the JS console.

closes odoo/odoo#33440

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2019-05-16 14:33:40 +00:00
Odoo Translation Bot ec792da72b [I18N] Update translation terms from Transifex 2019-05-26 03:07:48 +02:00
Odoo Translation Bot 7237b8f2a2 [I18N] Update translation terms from Transifex 2019-05-19 03:08:16 +02:00
Odoo Translation Bot 5941f00143 [I18N] Update translation terms from Transifex 2019-05-12 03:10:00 +02:00
Odoo Translation Bot 27aabeaad5 [I18N] Update translation terms from Transifex 2019-05-05 03:10:58 +02:00
Denis Ledoux 6fd637e131 [MERGE] forward port branch 11.0 up to b71b78035b 2019-04-24 14:31:10 +02:00
Odoo Translation Bot b24e0441b9 [I18N] Update translation terms from Transifex 2019-05-26 01:15:48 +02:00
Odoo Translation Bot e07ecf298f [I18N] Update translation terms from Transifex 2019-04-21 03:09:35 +02:00
Odoo Translation Bot 631abaf689 [I18N] Update translation terms from Transifex 2019-04-28 03:09:59 +02:00
Christophe Simonis 4c61621efb [MERGE] forward port branch 11.0 up to 9a7e3c8b49 2019-04-08 17:45:00 +02:00
Romain Derie 90dec44a28 [FIX] website: restore the add of website_id on user at signup
Since b5a12b4aac the website_id was not set anymore.

Indeed, before this commit website_id was the field from the inherits, thus
when writing on website_id from res.user, we would write on the partner field.

But with b5a12b4aac the website_id was explicitely overrided on res.users as a
related to res.partner (its inherits) with readonly=True.

Thus, writting website_id on res.users was not working anymore.

closes odoo/odoo#33521

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2019-05-21 10:01:58 +00:00
Romain Derie c209c250d7 [FIX] website: prevent new website homepage to be '/-1'
Before this commit, the URL of the bootstraped homepage for a new website
could be '/-1' instead of '/'.

Indeed, creating a new website ends up calling `page.copy` which try to get an
unique URL for the website (to avoid duplicated URL after copy). Typically, the
copied page will have a suffix (-X).

But `get_unique_path` in charge of doing that is based on `get_current_website`
method which will/could return a wrong website (not the one we created).
For instance the one forced in session after using the website switcher or
creating a website or installing a theme.

As those website already have (most likely) a homepage '/', get_unique_path
will create the bootstraped homepage with '/-1' as URL.

Step to reproduce (among others):
- Create a new website in backend through res.settings screen
- Create another new website, it's homepage will be '/-1'.
- Repeat indefinitely, every two website created, the bug will appear.
(One out of two, the bug won't appear since it will try to get an unique URL
on the previously created website which only has '/-1' so '/' is assumed
unique)

closes odoo/odoo#33372

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2019-05-14 15:12:50 +00:00
Odoo Translation Bot b25fdb25b5 [I18N] Update translation terms from Transifex 2019-05-19 01:16:49 +02:00
Christophe Simonis d8c0826b07 [MERGE] forward port branch saas-11.3 up to 37bca6ae50 2019-05-17 12:19:55 +02:00
Nicolas Lempereur 838d557eaf [FIX] website: rte_translator ok in manual & debug
The rte_translator tour that test translation on the frontend could not
be started from the "[debug menu]" > "Start Tour" for two reasons:

- the start URL is not specified, so the test was started on current
backend page wich is wrong (in python the start url is "/")

- the backend original state (params after #) does not work with ?k=v
inside argument value, so `#return_url=/?debug=true`.

To solve this issue, we encode the return_url value and add a start url
when rte_translator is started manually.

opw-1998623
closes #33443

Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2019-05-16 14:37:20 +00:00
Odoo Translation Bot 330e1ea4ab [I18N] Update translation terms from Transifex 2019-04-14 03:14:27 +02:00
Odoo Translation Bot 610ab82b51 [I18N] Update translation terms from Transifex 2019-04-07 03:14:49 +02:00
Nicolas Lempereur 8557bcfa30 [FIX] website: language prefixed URL on website bis
Reintroduces 5324284f5 that was reverted because in the case of an URL
like /payment_stripe/static/src/js/stripe.js directly inside a QWeb
template, we would possibly get:

  /fr_FR/payment_stripe/static/src/js/stripe.js

Which is not accepted by werkzeug SharedDataMiddleware we use to serve
static data in /{module_name}/static/ directories.

Added test without changeset failed with:

- test_process_att_no_request_lang: <AssertionError>
  line: self._test_att('/en_US/', {'href': '/'})
  wrong result: {'href': '/en_US/'}
- test_process_att_with_request_lang: <AssertionError>
  line: self._test_att('/', {'href': '/fr_FR/'})
  wrong result: {'href': '/'}
- test_process_att_matching_cdn_and_lang: <AssertionError>
  line: self._test_att('/en_US/a', {'href': 'http://test.cdn/a'})
  wrong result: {'href': 'http://test.cdn/en_US/a'}
- test_process_att_no_route: <AssertionError>
  line: self._test_att('/my-page', {'href': '/fr_FR/my-page'})
  wrong result: {'href': '/my-page'}
- test_process_att_url_crap: <IndexError: list index out of range>
  line: request.httprequest.app._log_call[-1],

opw-1922051
closes #32095

Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2019-04-02 14:45:24 +00:00
Christophe Simonis 3e54704e66 [MERGE] forward port branch 11.0 up to 27081bf6f5 2019-03-05 17:26:04 +01:00
Christophe Simonis 27081bf6f5 [MERGE] forward port branch saas-15 up to c03f6db6ea 2019-03-05 16:45:22 +01:00
Christophe Simonis c03f6db6ea [MERGE] forward port branch saas-14 up to fdb9f8273b 2019-03-05 16:23:55 +01:00
qsm-odoo fdb9f8273b [FIX] web_editor: stop using translated versions in HTML editor
Since https://github.com/odoo/odoo/commit/5a030db3eb77b6d80187f8ae1a64303b2f50391d
the HTML editor displayed the translated versions of the templates it
allows to customize. So if the user edited and saved such a template,
the non-translated version was saved with translated-version content.

The behavior before the mentioned commit was:
1) Load all views the HTML editor allows to edit
2) Each time a view is displayed, re-make a RPC to load the view again

The mentioned commit made this simpler by making:
1) Load all views the HTML editor allows to edit
2) Each time a view is displayed, simply show the previously loaded view

... the problem was that the step (2) of the old behavior was
explicitly saying (client-side) to load the view's untranslated content.
This commit makes step (1) always load the untranslated versions of the
views (server-side).
2019-03-04 17:05:01 +01:00
Odoo Translation Bot f014204447 [I18N] Update translation terms from Transifex 2019-03-03 03:15:43 +01:00
gustavovalverde c812cc4ebc [I18N] *: remove es_DO translations
Include commit 572d628 again, as it was lost with a forward port.

closes odoo/odoo#31479
2019-02-28 12:39:03 +00:00
Adrian Torres 21a95bae50 [FIX] website: properly unlink website_id ir.model.field
It is not properly unlinked because it is a m2o required with
ondelete='set null'

Fixes #25078

closes odoo/odoo#30617
2019-02-01 09:56:30 +00:00
Nicolas Lempereur 6c6ef6588f [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 #30567
2019-01-25 16:58:19 +00: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
Odoo Translation Bot 48d88b6e6d [I18N] Update translation terms from Transifex 2019-03-31 03:16:57 +02:00
Nicolas Lempereur 2a89f0c7f8 [REV] "[FIX] website: language prefixed URL on website"
This reverts commit 5324284f56
This reverts commit ad826f56ba.

If for example we had in a template:

 <script type="text/javascript" src="/payment_stripe/static/src/js/stripe.js"></script>

it has been reproduced to be gotten as:

 <script type="text/javascript" src="/de_DE/payment_stripe/static/src/js/stripe.js"></script>

which is unexpected and could cause an error.
closes #32090

Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2019-03-25 10:53:25 +00:00
Odoo Translation Bot fa12433867 [I18N] Update translation terms from Transifex 2019-03-24 03:11:51 +01:00