Commit Graph
1139 Commits
Author SHA1 Message Date
David Beguin 73505303f8 [IMP] website : send mail to visitor linked to res.partner
This commit allows to send an email to a visitor
directly from the visitor form view if the visitor is linked a
res.partner that a valid email address

Task ID: 2056080
PR #36290
2019-09-17 14:12:20 +00:00
David Beguin 6f5abf933b [IMP] website,livechat : apply various imp and fix on visitor views
Applies various improvements:
  - Remove welcome message if chat request usecase.
  - If a visitor is online: line is green / if offline: line is red (in the list view)
  - Visitors list view: add first / last connection fields and remove time_since_last_action
  - Avoid useless leave notification if the livechat channel is empty

Fix
  - ACLS on website_visitor_page model (for im_livechat_group_user)
  - ACLS on website_visitor and website_visitor_page model (for sales_team.group_sale_salesman)
  - Update visitor lang if visitor change the website lang.
  - Create visitor twice when translated website (due to rerouting)
  - Avatar for visitor banner in discuss. (image_64 instead of old image_small)

Task ID: 2056080
PR #36290
2019-09-17 14:12:19 +00:00
fja-odoo e33172e832 [IMP] website_sale, *: keep track of products viewed
*= website, website_livechat, website_rating

///// Tracking Product /////

Now when a user browse products in eCommerce, we keep track of the
products he looked at. We use the website_visitor
to store the products viewed. A cookie is added with a TTl of 30 min it
will prevent the RPC for that time. We track the page only if the
product view is tracked.

The recently viewed products are displayed as a snippet but also
with the customize option in product pages of website_sale.

Products that are in cart will not be returned as recently viewed.

It is possible to add a recently viewed product to the cart directly
from the carousel, it will not redirect to the cart. If we are on the
cart page, the product is displayed in the cart.

The Visitor page in website now references products viewed

///// Tracking Page /////

Feature to track a view was remove in: https://github.com/odoo/enterprise/pull/4834

That feature is now reintroduced and will use website_track instead of
leads to be stored.

The track field is now on the view instead of the page.

url field is added to website.track, it will store the url for pages and
views

The Visitor page in website now references urls viewed

Add some tests

task-1984575

closes odoo/odoo#35810

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2019-09-16 09:38:53 +00:00
Christophe Simonis 5a273e74f0 [MERGE] forward port branch saas-12.4 up to fe59754c52
closes odoo/odoo#36721

Signed-off-by: Christophe Simonis <chs@odoo.com>
2019-09-13 13:32:51 +00:00
David Beguin 7759db881d [REF-IMP] website, website_crm : handle visitors at merge leads and readd page_views stat button on leads
In order to keep all the visitors from all the leads to merge,
the relation between leads and visitors becomes a many2many.
So that after the lead merge, a lead can have multiple visitors.

This commit re-add the page view stat button that were removed
during website_visitor introduction and page tracking refactoring.
This button counts all the pages views from all the visitors linked
tho the current lead. Clicking on it redirect to the complete
navigation history, from all visitors linked to the lead.

Task ID : 2057428
PR #36180
2019-09-11 14:12:06 +00:00
Christophe Simonis 51354fadb0 [MERGE] forward port branch saas-12.3 up to 50e571acf7
closes odoo/odoo#36491

Signed-off-by: Christophe Simonis <chs@odoo.com>
2019-09-11 09:39:33 +00:00
Christophe Simonis 9bf0b04adb [MERGE] forward port branch 12.0 up to 82a8cdd6f2 2019-09-06 17:52:48 +02:00
Sébastien Theys c6bb103eac [IMP] website: avoid computing multi_website_ qcontext if not useful
Those values are only used on the website navbar when the user is in both groups
so the vast majority of the time they are done for no reason.

This reduces the number of queries by 2 on every page when the user is not admin
and/or multi website is not enabled.

Part of task-2061122

closes odoo/odoo#36483

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2019-09-05 14:53:16 +00:00
Christophe Simonis 545e6d2034 [MERGE] forward port branch 12.0 up to 52f6e38cea 2019-08-30 17:20:28 +02:00
Christophe Simonis 8bd6a93c74 [MERGE] forward port branch saas-11.3 up to ede253f1b2 2019-08-29 16:45:15 +02:00
Christophe Simonis 838b3f2d82 [MERGE] forward port branch 11.0 up to 1385b60004 2019-08-27 16:06:01 +02:00
Romain Derie 0ff1933ba1 [FIX] website: restore sitemap lastmod and priority
Commit 54d30d5194 introduced `lastmod` and `priority` on sitemap locs.

This was broken with 4ecbacaf59 which introduced `website.page` model as it
removed the `PageConverter`.

Before website.page:
1. PageConverter returned records with `__lastmod`
2. `enumerate_pages` loop on converters would remove the prefixed `__`

After website.page:
1. code to remove `__` was still there but the pages would be found and looped
on after that code, making it useless.

With this commit:
1. The code to remove the `__` is moved after searching the pages.

Following #36090
Related to #35464

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2019-08-26 14:43:39 +00:00
Christophe Simonis f26de445e5 [MERGE] forward port branch saas-12.3 up to 6f55fd65da 2019-08-20 12:17:04 +02:00
Christophe Simonis 168e54d488 [MERGE] forward port branch 12.0 up to 32039b2ab4 2019-08-19 18:57:08 +02:00
Romain Derie 2f361bec36 [FIX] website(_*): better ondelete management on website_id
Before this commit, every model having website_id would have the default
`set null` as ondelete value for that field. Exception for `ir.ui.view` and
`website.redirect` which are set to `cascade`.

This meant that deleting a website would basically transform all its specific
records into generic ones.
That would lead to unwanted behavior, such as multiple `ir.attachment` with
same URL, when 2 websites had been theme-customized. Deleting one of the
website would result in later crashes when trying to open theme customization
in the remaining website(s), since those website would find their specific scss
custom attachment as well as the generic one from the deleted website.

Probably more behavior might be problematic when deleting a website before this
commit.

To summarize the choice of this commit implementation, every model not existing
outside website module are set to `cascade` (website.redirect, website.menu,
product.wishlist..).
The rest should be in restrict, as we don't want to delete a whole forum, blog
or job, which should probably be managed case by case to decide what to do.
Thus, restrict is a good choice to notify user of what should be handled.

Some exception remains, ir.ui.view should be delete on cascade while sale.order
should be set to null.

opw-2038414
opw-2035249

closes odoo/odoo#35398

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2019-08-13 10:02:32 +00:00
Christophe Simonis b792ba7d9a [MERGE] forward port branch saas-12.3 up to 752b2553c6 2019-08-08 11:52:13 +02:00
qsm-odooandAndrea Ulliana 1345702258 [IMP] website: add the ability to create mega menus
Allow users to create complex website menus, also known as "mega menus".
Mega menus are enabled individually via the edit menu dialog, then their
content can be customized by dragging snippets in them like any other
snippets area in edit mode.

task-1925319

closes odoo/odoo#36097

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>


Co-authored-by: Andrea Ulliana <aul@odoo.com>
2019-09-03 15:31:42 +00:00
Sébastien TheysandJairo Llopis 1781041f13 [IMP] website, website_event, website_slides: add rel=canonical tag
The canonical tag is important for SEO, indeed it prevents search engines from
indexing duplicate content.

Reasoning
=========

The choice has been made to create the canonical tag automatically depending on
the request path, ignoring the query string, and manually prefixing the
appropriate domain and language code.

Indeed creating it manually for each resource would create a lot of code and
potential mistakes.

It is more dangerous to do it the generic way, but after investigation it
appears that it is an acceptable trade-off since the vast majority of our routes
are well built and already ready for this:

- using query string only for minor features that do not change the main content
- having the models, the ids, the pager and other important features in the path

Override
========

It is still possible to override the default behavior by passing
`canonical_params` manually to the view or to the different methods.

This is done for `/event` because the only way to display Past Events is to add
`date=old`.

Languages
=========

Fix an issue where it was possible for a bot to be on the URL without language
code but to use a language that is not the default language.

Adapt hreflang, because it:
- must only be present on canonical pages
- must always lead to canonical pages
- should not be set if there is no alternate language

Misc
====

task-1958075
closes #12532

Inspired by OCA module `website_canonical_url` courtesy of Jairo Llopis.

closes odoo/odoo#35852

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>


Co-authored-by: Jairo Llopis <jairo.llopis@tecnativa.com>
Co-authored-by: Sébastien Theys <seb@odoo.com>
2019-09-03 12:11:35 +00:00
qsm-odoo 3daed421f4 [FIX] website: restore edit menu dialog
Since saas-12.5, with recent ORM changes, writing on non-existing fields
does not trigger a warning anymore but instead crashes. This revealed
that the 12.0 "Edit Menu" dialog was doing some of that. Indeed,
depending on what was edited, we ended up writing on the 'is_homepage'
field, the 'text' field, the 'isNewWindow' field, ... which do not
exist.

This commit takes advantage of the fix to also lint the dialog code and
convert some of it to ES6.

Discovered while working on task-1925319

closes odoo/odoo#36204

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2019-08-29 07:24:16 +00:00
David Beguin e74c6ef86a [FIX] website : fix visitor cookie expiration
Before this commit, the visitor cookie was expiring by default on
browser session close on firefox. On Chrome, the cookie was always
valid after browser session closing.

On Firefox, the expiration date must be set to make the cookie still valid
after closing the browser.

The same thing happened with livechat_session cookies set
in context of livechat request.

The cookie expiration date (100 years to 'never' expire) have been added.

Linked to original Task ID : 2028059

Task ID : 2060381
PR #36126

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2019-08-27 12:12:37 +00:00
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
David Beguin c5500e685a [FIX] tools : use babel to format timedelta
Babel is already taking the language into account while
formating a time delta into a readable string like '2 minutes ago'.

_format_time_ago was put in translate.py file to be able to use
the _ translate class. But it can be placed in misc like other
format function already using babel.

This fix the PR #34624
and is linked to Task ID : 2028059

Task ID: 2055847
Closes PR #35806

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2019-08-20 08:02:46 +00:00
Christophe Simonis 7d04dc1c7c [MERGE] forward port branch saas-12.2 up to 9e74730a26 2019-08-06 18:48:24 +02:00
Christophe Simonis 0fadd586fa [MERGE] forward port branch 12.0 up to ff9ddfdacc 2019-08-06 15:57:57 +02:00
Christophe Simonis 3faea8fbf8 [MERGE] forward port branch saas-12.4 up to f26de445e5 2019-08-21 10:10:11 +02:00
Martin Trigaux cb9f48d3a9 [FIX] website: proper override of auth_signup
Add the dependency between website and auth_signup
auth_signup is in auto-install but there was no strict dependency

Before this commit, installing website transformed the field
auth_signup_uninvited from a static list to a computed list (due to related).

This fixes the following bug:
1. install auth_signup
-> create selections
2. install webstite
-> remove selections and turn it into a computed field with dynamic
selections
3. update auth_signup
-> recreate the selections when updating the module
4. reload the registry (automatic at the end of update)
-> try to remove the selections -> error as not in install/uninstall
mode

Instead, keep the list static and turn it into a computed field with
inverse

closes odoo/odoo#35861

Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-08-20 13:44:59 +00:00
Sébastien Theys 1e8b9254f5 [IMP] website, website_slides: adapt get_base_url for website
On `website` itself there is no `website_id` so the domain has to be read from
`self` directly.

Also oversight of forward-port 039e6bae99:
On `slide.channel` the override that was done in an earlier version is doing the
same as the generic override that was introduced later, so it can be removed.

closes odoo/odoo#35839

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2019-08-20 10:45:54 +00:00
Raphael Collet 9920f20e4c [IMP] models: ORM speedup
This branch is the combination of several optimizations in the ORM:

* store field values once in the cache: the cache reflects more
faithfully the database, only fields that explicitly depend on the
context have an extra indirection in the cache;

* delay recomputations by default: use method `recompute` to explicitly
flush out pending recomputations;

* delay updates in method `write`: updates are stored in a data
structure that can be flushed efficiently to the database with method
`flush` (which also flush out recomputations);

* make method `modified` take advantage of inverse fields to inverse
dependencies;

* filter records by evaluating a domain on records in Python;

* a computed field with `readonly=False` behaves like a normal field
with an onchange method;

* computed fields are computed in superuser mode by default.

Work done by Toufik Ben Jaa, Raphael Collet, Denis Ledoux and Fabien
Pinckaers.

closes odoo/odoo#35659

Signed-off-by: Denis Ledoux <beledouxdenis@users.noreply.github.com>
2019-08-20 12:43:59 +00:00
David Beguin 6bec0e4d29 [IMP] website : add website visitors activity tracking
This commit adds the website_visitor model that will be used
to track website visitor activity (page viewed, number of visits and
more general info about the visitor (country, lang, etc..)

This model will, in later commit, be used to send chat requests
and push notification from the operators (or backend users)
directly to the visitor.

- A website_visitor is created once the visitor is requesting
a website.page that is tracked.
- A website_visitor is considered as connected if his last tracked
website_page request is within the last 5 minutes.
- The number of visits for a website_visitor is incremented
if his last tracked website_page request was at least 8 hours ago.
- A website_visitor is only handled by the system. Users cannot
create, edit or delete a website_visitor.
- A unique website_visitor is created per website.
That means that the same real person can triggers multiple visitor
creation if visits multiple websites.
This is because, for livechat purpose on later commit, for example,
the chat request can be created on the correct livecaht channel
(linked to the correct website)
- The visitor is recognized via his cookie (visitor_id). So if the visitor
flush his cookies, a new visitor will be created the next time he will
request a tracked website_page.
- Link user's res.partner to website.visitor.
    If a website_visitor log in
    (a visitor that has visitor_id in his cookie),
    the website_visitor is linked to the res.partner.
    The website visitor name is than adapted to match the name of
    the first res.partner linked to the visitor.
    A visitor can have multiple partners as the same session
    can be used by multiple person (one PC for a team for example).

To keep a detailed history of the visitor page views,
we add a website.visitor.page model that makes the link
between visitor and website.page but that keeps the visit date.
So that we can see if a visitor went mulitple times
on the same page and when. It's usefull to see his last page views.

Task ID : 2028059
PR #34624
2019-08-19 06:33:37 +00:00
Christophe Simonis 140ee6b8f0 [MERGE] forward port branch saas-12.4 up to 98a55917a6 2019-08-14 16:48:10 +02:00
jbm-odoo 853a773ee4 [IMP] settings: Improve general UX (back2basics)
TaskID: 2043133

closes odoo/odoo#35382

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-08-13 12:32:30 +00:00
fja-odoo 736353b169 [IMP] website, *: improve published smart button
* = web, website_blog, website_crm_partner_assign, website_event,
website_event_track, website_forum, website_hr_recruitment,
website_livechat, website_partner, website_profile, website_sale,
website_sale_delivery, website_slides

The published button name is a bit ambiguous, now it will clearly state
what it does with a new title : "Go to Website". The "Published",
"Unpublished" state is shown with the globe icon changing color
(green and red) and a title on the button.

Badge and Delivery don't have a website page, the button will then be
a publish/unpublish button in the backend.

task-2002435

closes odoo/odoo#34261

Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2019-08-08 16:05:33 +00:00
Martin Trigaux 85ee046b37 [IMP] *: use res.lang methods
get_installed and _lang_get_id are both ormcached and correctly check
the context

Retrieving a res.lang from a code is a frequent action that can be
achieved with _lang_get (cf previous commit).
Using _lang_get ensure the active_test in the context is correct and
is not poluted with another context propagation issue.
odoo/odoo#35490 discussion is an example of bad context propagation

closes odoo/odoo#35504

Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-08-07 13:06:17 +00:00
mreficent 355a5dfc36 [IMP] *: fix typos in comments
closes odoo/odoo#35404

Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-08-07 10:28:33 +00:00
Christophe Simonis 886eca0131 [IMP] *: remove usage of oldname attribute
This attribute is misleading as it is insufficient to correctly upgrade
the database. It only renames the column in the database, but other
operations are needed, like updating the corresponding `ir.model.fields`
record (and its xmlid). The default values and the translations are also
lost during the upgrade.

Moreover, this feature was misused. It was:
 - left on fields during multiple versions.
 - used on reports (SQL views). This would be ok if the feature was
   complete, but, as is, it was useless.
 - kept unchanged after a second renaming of the field (which can happen
   versions later the first rename).
 - used, even when the meaning of the field changed. i.e. the field
   `archived` has been renamed to the classic `active`, but the value
   in the database should be switched.
2019-08-05 09:36:41 +00:00
fja-odoo 5dac8f8f29 [REF] website, *: remove hardcoded image urls
* = website_forum, website_profile, website_sale,
website_sale_comparison, website_slides, website_slides_survey

Some image links were hard coded in the xml views of website, now they
are replaced with website.image_url(model, field).

Part of https://github.com/odoo/odoo/pull/34149
task-2007400

closes odoo/odoo#34149

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2019-08-05 13:24:22 +00:00
Christophe Simonis e4a4b5a8f0 [MERGE] forward port branch 11.0 up to 0375c0174d 2019-07-24 16:04:59 +02:00
Jairo Llopis 21ede5365a [FIX] website: Delete redirections if website is deleted
Before this patch, if a website is deleted, its redirections will stay, affecting other websites.

Now, website-specific redirections will disappear along with their corresponding website.

closes odoo/odoo#35130

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2019-07-24 10:16:43 +00:00
Christophe Simonis a4b1b532ea [MERGE] forward port branch 12.0 up to b82df99d7a 2019-07-25 20:01:05 +02:00
Christophe Simonis b82df99d7a [MERGE] forward port branch saas-11.3 up to 5f419d4ad3 2019-07-25 18:38:32 +02:00
Romain Derie 4086f344d8 [FIX] website: correctly check security of publish mixin
Commit 916968058d introduced a mechanism to check rights when writing or
creating on `website_published` field.
Problem is, `website_published` is just kind of a related to `is_published`
which really stores the value.

Thus, the checks would not work when writing/creating on `is_published`.
That would leave a loophole to bypass the expected behavior.
2019-08-03 09:51:22 +00:00
Romain Derie 7a90dedd25 [IMP] website*: use published mixin rather than own field
*website_crm_partner_assign, website_customer

Before this commit, some models would create their own `website_published`
field rather than using the `website.published.mixin` mixin which should be
used instead.

That was done to be able to override the default value of the boolean.

This commit simply adds the possibility to override the default value of the
mixin field.

Also, help and string could simply be added on xml views rather than overriding
the field.
2019-08-03 09:51:22 +00:00
Romain Derie cc1d78a80b [IMP] *: correctly read/write website_published
The `website_published` field from the website's mixins is basically a readonly
from `is_published` field.
On read, this field will simply read `is_published` and check if the record's
website_id is accessible (only for the multi mixin).
On write, it will always write on `is_published`.

This commit improves a few things:
- A lot of code was writting on website_published which was just then writting
  on is_published. Writting directly on is_published makes more sense.
- Some backend fields would still reference `website_published` instead of
  `is_published` which would just go through the related for no reason.
  Plus, using `is_published` will make the field tooltip more accurate as we
  are not in a website context ('Visible on current website' to 'Is Published')
- Filter and search on tree view were still using the `website_published`
  related field, which is just a readonly when we are not in a frontend
  context.
- Some create and write function would have security check on
  `website_published` value but that was wrong as the user could bypass that by
  simply writting on `is_published`. For the write method, check `is_published`
  is more accurate as it will cover both case since `website_published` will
  then call the write method on `is_published`
2019-08-03 09:51:22 +00:00
Christophe Simonis bfd34e14b1 [MERGE] forward port branch saas-12.3 up to 40e8b67179 2019-07-26 15:12:29 +02:00
Christophe Simonis e0f9c092cc [MERGE] forward port branch saas-12.2 up to 1d6d790513 2019-07-26 11:32:43 +02:00
Romain Derie bac4b43a23 [FIX] web_editor, website: remove unused param
`_view_get_inherited_children()` `options` parameter is not more useful.
Introduced with ae8232136d and not used since edce2fd6d0.

Also, the opportunity is taken to rename `options` in `_views_get` into
`get_children. Indeed `options` does not mean much.

closes odoo/odoo#35157

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2019-07-24 16:06:27 +00:00
Jairo Llopis a78d743251 [FIX] website: Never find pages from other websites
Steps to reproduce:

1. Go to "My Website".
1. Click *New > New Page*.
1. Page title: "hello", add to menu: yes.
1. Add a snippet, write "hello 1", save.
1. Go to "My Website 2".
1. Click *New > New Page*.
1. Page title: "hello", add to menu: yes.
1. Add a snippet, write "hello 2", save.
1. Go to *Pages > Edit Menu*.
1. Edit the "hello" menu.
1. Change URL to `/hello-world` and save.
1. Click on the "hello" menu.
1. A page with "hello 2" appears.
1. Go to "My Website".
1. Go to *Pages > Edit Menu*.
1. Edit the "hello" menu.
1. Change URL to `/hello-world` and save.
1. Click on the "hello" menu.

Current behavior: Error 404

Expected behavior: A page with "hello 1" appears.

closes odoo/odoo#34913

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2019-07-17 07:54:45 +00:00
Romain Derie bdc76207ca [FIX] website: fix primary inherit view validation when tree is COW'd
Before this commit, it was not possible to install website_forum if the 'Main
Frontent Layout' had been COW'd.

When loading Forum Layout view which is a primary child view, it would crash
during view validation, not finding the element to xpath.

Triggering COW instead of copying fix the issue.

opw-2036119

closes odoo/odoo#35138

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2019-07-26 14:20:27 +00:00
Martin Trigaux beba36416f [MERGE] Forward port of saas-12.3 to saas-12.4 up to 40421be73c 2019-07-16 16:36:40 +02:00
Martin Trigaux 40421be73c [MERGE] Forward port of saas-12.2 to saas-12.3 up to cf8e74a1a7
closes odoo/odoo#34907

Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-07-16 11:44:38 +00:00