Commit Graph
272 Commits
Author SHA1 Message Date
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
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 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
Raphael Collet b7fd679a6c [FIX] *: sudo() -> with_user() 2019-07-04 11:32:22 +00:00
fja-odoo dc561aae03 [IMP] website: enhance http error pages
- The traceback is only visible if in debug mode or if edit mode.

- All except_orm exceptions are now displayed as a 400
but the AccessError wich is a 403. There is now a dedicted page
for the 400 error.

- Errors messages are no longer the exception args but its name if the
exception is an except_orm. Else there is no message since the current
logic override exceptions of type Exception in ir_http thus we have
no message to display.

Part of https://github.com/odoo/odoo/pull/32132
task-1894820
2019-06-28 08:53:52 +00:00
Thanh Dodeur c212cfe899 [REF] *: removes datas_fname from ir.attachment
This commit removes the field `datas_fname` from `ir.attachment` as
it was unnecessary and most of the time the duplicate of `name` or
`url`.

Task #1909865

closes odoo/odoo#32976

Signed-off-by: Martin Geubelle (mge) <mge@openerp.com>
2019-06-05 09:12:13 +00:00
qsm-odoo e9be0bb178 [REF] web, *: share common parts of main frontend layouts
* http_routing, portal, rating, survey, website, website_survey,
website_slides_survey

Before this commit, the final base layout of website was a fully
overridden layout of the one in portal, which was somehow a duplicated
one of the login one in web, which... so lots of duplicated code.

This commit is a first step towards a better organization:

1) The web app defines a frontend layout (to include base frontend
assets), with a base company logo as header.

2) The portal app modifies that layout in place to include the base
header, footer, ... It also uses a primary extension of it for
portal pages.

The survey app simply uses the above layout instead of defining its
own (by primary extension to include its own assets for its own
pages)

Same goes for the rating app and pages.

3) The website app modifies that layout in place to include the UI
assets, to add website UI, ... This allows to create frontend apps
which do not depend on website, with a non duplicated layout that
will be automatically adapted if website is ever installed (this
therefore allows to get rid of website_survey definitely)

This commit also fixes the session info system and the translation URL
on the frontend side to not require to redefine the whole session_info
for portal, website, ... Now the frontend session_info is defined in web
and http_routing extends it to add translation informations, then
website extends it again to add its own elements (not to redefine them
all as before). Note: before, http_routing defined the translation route
but only portal was adding it in its layout...
This is an adaptation of the work that was done with commit
https://github.com/odoo/odoo/commit/99821fdcf89aa66ac9561a972c6823135ebf65c0

Note 1: Many frontend but non-website apps (not only survey / rating)
could probably use this too but this would be the topic of another task.

Note 2: survey currently depends on http_routing but does not add itself
in the list of frontend apps to translate, it probably should.

Note 3: web_editor does currently not depend on http_routing but does
add itself in the list of frontend apps to translate, it thus uses a
function it does not really depend on... to check after its work-in-
progress refactoring.

task-1961045

closes odoo/odoo#33825

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2019-06-03 20:09:26 +00:00
Martin Geubelle c54caca54d [IMP] website: Cache translations forever
Generate a unique URL for translations and cache them forever in the
browser. This reduces the number of requests, in exchange for computing
the hash of the translations when the session object is added to the page
2019-05-22 07:52:07 +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
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 e57f7734ca [IMP] base, website: QWeb, raise the caller on unexisting t-call
Before this commit, when a t-call was calling an unexisting template, a QWeb
exception would be raised with the callee and not the caller as template.

That would be an issue since there was clean way to retrieve the view that did
the wrong t-call, for instance to be able to repair that view.

Now, in such a case the caller view will be returned.
That will avoid crapy code to retrieve the caller, eg searching on every Qweb
view archs.

Coming from #32009 (task-1943001)
2019-03-29 18:56:47 +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
Christophe Simonis 4eff0af02e [MERGE] forward port branch saas-12.1 up to 6878c9f342 2019-03-21 13:58:37 +01:00
Christophe Simonis c50d7d6bc5 [MERGE] forward port branch 12.0 up to 82c4393fd0 2019-03-19 15:14:23 +01:00
Christophe Simonis ff1bca32f3 [MERGE] forward port branch 12.0 up to a26496b6e7 2019-03-14 17:43:32 +01:00
Christophe Simonis bbedcdb190 [MERGE] forward port branch saas-12.1 up to ff1bca32f3 2019-03-14 19:44:55 +01:00
Christophe Simonis 71faa19af0 [MERGE] forward port branch saas-12.1 up to 2b3296bbf8 2019-03-11 14:42:34 +01:00
Christophe Simonis 2c5c9b8342 [MERGE] forward port branch 12.0 up to c023d0784f 2019-03-08 17:56:14 +01:00
Romain Derie 25a8b507b1 [FIX] website, website_sale: create utility method to check if frontend
Before this commit, at multiple places to check if we were in a frontend
context we would check if `request and hasattr(request, 'website')` and
then access `request.website`.

Now, we call an utility method to get that website if we are in a frontend
context. If not the method will return False.

This method will be usefull for incoming pricelist fixes & tests.
Indeed, we will have more check of that kind and this will be easier to mock as
mocking this method will be enough, instead of mocking every method doing that
if condition to simulate a frontend context (to do website tests in python
wihout having to go frontend with a tour).
2019-03-14 10:28:02 +00:00
Romain Derie 63ba2317f8 [FIX] website: get the error view without parsing the view tree
Before this commit:
The `if` condition doing a `View._views_get` was supposed to be a sort of
'hack' for when the error occured in a child view (as the template raised would
be the parent, not the broken child).
But since we refactored that part to use etree, it was actually going into that
condition for every error even if the error was in the called template.
Proof is, we only set `editable` in that if condition, meaning going in the
else would actually prevent to show reset template.

Indeed the following code would always be true:
   et = etree.fromstring(view.with_context(inherit_branding=False).read_combined(['arch'])['arch'])
   node = et.find(exception.path.replace('/templates/t/', './'))
as read_combined returns all the view hierarchy DOM

Note: We could not fix this by checking exception.path against `arch` as we
could have false positive (eg the child view replace the <p> element by another
<p> element which is broken, then the path would be found in the parent view
even if the error was in the child view).

closes odoo/odoo#31515

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2019-03-07 10:30:54 +00:00
Christophe Simonis b3766768f9 [FIX] website: correctly extract failed node in QWeb exceptions handling 2019-02-25 16:17:09 +01:00
Christophe Simonis 1d2b6f1bef [MERGE] forward port branch 12.0 up to 84143a34b3 2019-02-21 15:37:19 +01:00
Toufik Ben Jaa e8b28c02a0 [FIX] website: server images for website_published records
- When a record has `website_published` field set at True the method
  `binary_content` on `ir.http` should bypass the access rules and
  always deserve the content.

  This wasn't the case due to a mistake on the code. The code is
  checking the access rules and may in some cases not return the
  content.

closes odoo/odoo#31068
2019-02-13 13:48:33 +00:00
Jeremy Kersten 8eb1abf760 [FIX] website: reset template
Create new env with current user instead of admin.
Avoid to show odoo bot as connected into the exceptions pages.
2019-02-14 12:15:48 +01: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
Jeremy Kersten 3a4b5164b1 [FIX] website: missing replace from type to redirect_type
website.redirect feature is broken since commit 2924b77

related to odoo/odoo#27599 and odoo/odoo#28112

closes odoo/odoo#30446
2019-01-22 15:02:58 +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
7d85ab1eac [REF] base, *: refactor binary_content
*: tools, web, website, website_forum, mail, im_livechat

This commit refactors ir_http to make it more readable
and flexible.

Move the resize function of web/image to odoo.tools

Co-authored-by: XavierDo <xdo@odoo.com>
Co-authored-by: Antony Lesuisse <al@openerp.com>

closes: #28563
task: #1908896
2018-12-06 19:09: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 96dc825c8c [FIX] website: reset template
fix retro compatibilty

Old qweb template http_error_debug was wrong, but we never entry in the if.
Now that we fixed to enter in the if, we need to make retrocompatible code to
be able to display the QWebException from v9 with the old view from v8.

odoo.exceptions.QWebException
  vs
odoo.addons.base.models.qweb.QWebException

closes odoo/odoo#31383
2019-02-14 13:39:55 +00:00
qsm-odoo d9a589ad7a [FIX] base, website: review https://github.com/odoo/odoo/commit/89678c60412feea004cd3081200092365e6ef3b4
Share the common code in the ir.attachment model and add a sort order
and a limit to attachment serving.
2018-10-02 15:17:09 +02:00
qsm-odoo 89678c6041 [FIX] base, website: make attachment serving multi-website
- Reaching an attachment datas thanks to its URL was not multi-website
- Compiling assets with URLs to attachment datas was not multi-website
2018-10-01 21:33:32 +02:00
ThanhDodeurOdoo 2d82692648 [REF] documents, base: binary_content
- Changed the binary_content method
to make it more generic and allow alternative ways of checking
the access rights by using a new method check_access_mode.

   Reason: Asked by ODO following documents' security review.

- if all pages are processed, splitting a pdf will
archive the original attachment.

   Reason: FP feedback.

Task: 1853490
2018-09-26 19:18:38 +02:00
Romain Derie 569554b9e0 [FIX] website: website forced on wrong session with website selector
Forcing website on session before navigating to the other website would not
work as expected if the other website has a different URL (hostname).
It would force the website on session on current website, then navigate to
second website which could still had another website in session.

Now, we force the website in session once we land on the website in the
dispatch() method.

Step to reproduce:
  - Set website1 to 127.0.0.10
  - Set website2 to 127.0.0.20
  - From website1 click on website2 in website selector
  - Website2 is forced on website1 session (wrong)
  - You land correctly on website2 and see website2
  - From there (website2) click on website1 in website selector
  - Website1 is forced on website2 session (wrong)
  - You land on website1 but see website2 since website2 was forced on
    website1 session at steps 3/4.

This is even more trickier when there is a third website without a domain in
the equation (meaning this website can be seen from website1 and website2
without changing URL (hostname)).
2018-09-25 19:16:16 +02:00
ThanhDodeurOdooandPierre Paridans 16aeecc73d [REF] base, mail: Documents (enterprise) related changes
-removed force_ext from ir.http.
    -added signature arg to web/image to differentiate cache entries by URL.
    -added an embed youtube viewer for youtube URL's
    -added a PDF splitter to the PDF viewer UI
    -added tests for mail's Document Viewer
    -added a "signature" param to web/image to go around the browser cache

    -thumbnail field of ir.attachment is now stored in the filestore
    as a distinct attachment.

task 1853490

Co-authored-by: Pierre Paridans <app@odoo.com>
2018-09-07 16:06:47 +02:00
Jeremy KerstenandDerie Romain c0968e68ed [ADD] website_theme_install: try to make theme multi website compliant
From now, when you install a theme, it load the data from xml to template
table theme [ir.ui.view|ir.attachment|website.page|website.menu].

Data are only copied from this template table into the real table when you
choose a theme on a website; Making them website_specific and with a link
to the original to allow futur update.

A special case is done to create theme.ir.ui.view when you are installing
a theme, even if you continue to use template tag to create quick view.

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 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 602807acdf [FIX] website: improve/fix menu, copy on unlink, clone page, unique_path, sale_report, ...
Fix bug from the initial poc of JOV

Fix menu creation
   - creating a menu would create a 'container' menu in the DB (.create is call without website_id)
   then writing on it would copy (if condition to cow) the menu with a website_id leaving the first
   one as a menu container unused.
   - website_menu should always have a website_id
     we dont want to support the multiwebsite system that allow to have generic/specific menu
     unlink/write is useless now since we always have a website_id

Make unique_path website dependent, 2 distinct website can have a page with same name

Make Sale report multiwebsite compliant

Make website_id on sale_order / account.invoice as a related stored from partner_id.

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
60aa9ffd01 [IMP] base,mail,web: attachments adaptation for documents
This commit is the counter-part of an enteprise commit introducing
the Documents app.

Here is a summary of what has been done:
  - tweak unlink of ir_attachment to prevent unlink recursivity
    (when attachments are attached to ir_attachments)
  - improve ir_attachment kanban view
  - add several arguments to binary_content controller:
    - 'force_ext': to force the extension in the filename, base on
      mimetype
    - 'share_token' and 'share_id': to autorize download from a
      share link
  - add 'thumbnail' field on ir_attachment to optimize Kanban view
  - add 'upper_limit' argument to image to allow to bypass the
    500*500 size limit
  - DocumentViewer now handles text files

More information available on task 1853490

Co-authored-by: Pierre Paridans <app@odoo.com>
Co-authored-by: sri-odoo <sri@odoo.com>
Co-authored-by: ThanhDodeurOdoo <tso@odoo.com>
2018-08-13 09:11:53 +02:00
Christophe Simonis b05e4d5f95 [MERGE] forward port branch saas-15 up to a53bea49fe 2018-06-14 21:28:39 +02:00
Christophe Simonis 803df909b1 [MERGE] forward port branch saas-14 up to 804d68efe5 2018-06-14 18:05:38 +02:00
Christophe Simonis 23a1bce2a9 [MERGE] forward port branch 9.0 up to 90165e2d96 2018-06-14 17:29:56 +02:00
Christophe Simonis c13d67dd25 [FIX] website: valid time zone guessed from GeoIP
The timezone returned by GeoIP may be unknown by `pytz` due to
incompatibilities between GeoIP and pytz databases (which may be outdated).
2018-06-14 15:49:16 +02:00
Christophe Simonis bfa5af45df [MERGE] forward port branch saas-14 up to aab0908818 2018-04-16 14:21:00 +02:00
Christophe Simonis c92d43c04b [MERGE] forward port branch 9.0 up to 752dcc761c 2018-04-16 12:05:35 +02:00
Christophe Simonis 264398de3e [IMP] website: handle geoip2 databases
Since April 1, 2018, free versions of GeoLite Legac y databases are no
longer updated and free downloads not available [1].

[1] https://support.maxmind.com/geolite-legacy-discontinuation-notice/
2018-04-16 11:20:39 +02:00