Commit Graph
151539 Commits
Author SHA1 Message Date
Nicolas Bayet f3cbb27fc1 [FIX] web_editor: correct selection after applying a color
Ensure the selection in the fonts tags after `applyColor`, otherwise an
undetermined race condition could generate a wrong selection during
multiples call of `_processAndApplyColor` from the color picker.

task-2822221

closes odoo/odoo#92654

X-original-commit: 2b2aba49550cf7c2ba1914f03beef9cbdf60b166
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-06-01 16:26:40 +02:00
Kishan Gajjar 4e46181331 [FIX] website_sale_comparison_wishlist: don't show compare button if option is disable
closes odoo/odoo#92652

Closes: #92548
X-original-commit: 45aa45c35f07782fb91d3a3dc26ee493dd1b405c
Signed-off-by: William Braeckman (wbr) <wbr@odoo.com>
2022-06-01 16:26:37 +02:00
Alvaro Fuentes d5f2fc2e37 [FIX] payment: fix misplaced sudo
On 02eba891cb8cd58985837090f2b60cf263bce065
we changed
https://github.com/odoo/odoo/blob/b5cf1ee3e21f2e60b8edd64f24c04c952fb7df3f/addons/payment/models/account_payment.py#L47
to
https://github.com/odoo/odoo/blob/02eba891cb8cd58985837090f2b60cf263bce065/addons/payment/models/account_payment.py#L47-L48
Effectively moving the place where `sudo` is called.

This causes issues during migration of some DBs
upg-328570

closes odoo/odoo#92651

X-original-commit: 90c321cc8bad04f7f094a221a39ca6f647944f5d
Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
2022-06-01 16:26:32 +02:00
Ahmed Khalaf (ahkh) 964bfda3bf [FIX] mrp: transfers are created from manual moves in MO
When manfacture in 2 steps is setup on warehouse, transfers are created
when confirming an MO, manual moves added did not have a warehouse and thus not
included in the picking. The default warehouse is set to the source location
warehouse in MO.

closes odoo/odoo#91879

Related: odoo/enterprise#27577
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
2022-06-01 16:26:29 +02:00
Ahmed Khalaf (ahkh) 1b2cf66f6e [FIX] mrp: skip archived operations in bom
Part-of: odoo/odoo#91879
2022-06-01 16:26:29 +02:00
Ahmed Khalaf (ahkh) c7c835f7a3 [FIX] mrp: div id conflict between stock and mrp quality settings
Part-of: odoo/odoo#91879
2022-06-01 16:26:28 +02:00
Ahmed Khalaf (ahkh) 616aa3855f [IMP] mrp_account: analytic account added to MO tree view optional
Part-of: odoo/odoo#91879
2022-06-01 16:26:28 +02:00
Ahmed Khalaf (ahkh) 3734709ef1 [FIX] repair: manually set return picking on repair form
User Can now manually set return picking on repair form,
only pickings of return type

Part-of: odoo/odoo#91879
2022-06-01 16:26:28 +02:00
Ahmed Khalaf (ahkh) 20ce3cc03f [IMP] mrp: Routing Performance label to Operations performance
Part-of: odoo/odoo#91879
2022-06-01 16:26:27 +02:00
Odoo's Mergebot 2454f5e990 [MERGE][IMP] website_sale_slides: slightly improve "publish" management
This commit adds a couple improvement to the "publish" flow of courses:

- Improve the published synchronization between the course and its product
- Adapt wording when the course is unavailable on the frontend view

See underlying commits for details.

task-2842624

closes odoo/odoo#90736

Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
2022-06-01 16:26:09 +02:00
Jérémy Hennecart (jeh) d26c55698f [IMP] website_sale_slides: describe course unavailability
When a product linked to a course is unpublished, the course is not
buyable. This commit improves the design in this case.
- Change the text of disabled button into "Course Unavailable"
- Add an alert message to group_website_slides_officer letting them
know that the course is not buyable because the product is unpublished

task-2842624

Part-of: odoo/odoo#90736
2022-06-01 16:26:08 +02:00
Jérémy Hennecart (jeh) 5881195bfe [FIX] website_sale_slides: fix sync between product and course
Before, each time we created a course "on payment". The product
linked to it was automatically unpublished. If multiple course
share the same product this leads to issues. Indeed, with the
product unpublished all the courses depending on the product are
no longer buyable.
To avoid this, we synchronise the published value when the
course is published which published the product.
If we create a new course or unpublished a previous course linked
to a product, we don't update the published value of the product
unless all courses linked to this product are unpublished.

We also fix a Forbidden error raised when the product was unpublished
but not the course. This was leading to a previous member to not have
access to a course he previously buyed.

task-2842624

Part-of: odoo/odoo#90736
2022-06-01 16:26:08 +02:00
Adrien Schoffeniels 2e0490beb5 [IMP] website_slides: improve website_slides_survey integration
SPECS

1. Change the default content of the modal opened after the installation
of a module

When the installation of a suggested module from the upload dialog is
completed, the page is reloaded and the upload dialog is opened on load.
Since the user installed the module to add content of the category related to
this module, it is more convenient to open the modal directly on this category.

2. Replace the notification displayed when the user creates a new
certification by a permanent button allowing to add questions

When a user creates a certification, he must then add questions to this
certification. Instead of showing a notification after the creation
proposing to add questions that was shown only once, a permanent button
has been added to the view of the certification so that anyone with the
sufficient access rights can add questions, at any time, from the certification
view.

Task-2727654

closes odoo/odoo#86721

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2022-06-01 16:26:02 +02:00
Adrien Schoffeniels 99499a7c40 [IMP] website_slides: improve wording & editor integration
PURPOSE

This commit slightly changes the wording and improves the website editor
integration.

SPECS

Reword "slide" to "content"
As slide is a technical term that does not mean much to end-users.

Make some elements not editable by adding "o_not_editable", or non visible
in edit mode by adding "css_editable_mode_hidden".
The e-learning website interface allows the course editors to modify the course
content using various buttons ("Add Quiz", "Add Content", ...).

Those buttons should not be edited by the web-editor, as it could mess up the
display and break potential future changes to the module / features.

Task-2727654

Part-of: odoo/odoo#86721
2022-06-01 16:26:02 +02:00
Alexandre Kühn 106c76c236 [FIX] mail: allow use of raw field command inside FieldCommand
closes odoo/odoo#92644

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2022-06-01 15:23:14 +02:00
Nicolas Bayet 7ee954e84b [FIX] web_tour: observe iframe without body
In mass mailing, when an iframe is loaded, the `contentDocument.body`
could be `undefined` this caused a traceback when trying to observe
the iframe.

Observing the `contentDocument` is safer as it will always be defined.

task-2869490

closes odoo/odoo#92630

X-original-commit: 00a2843216128df6454d5c6ced3a34cd02e7d6d9
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-06-01 15:23:10 +02:00
pedrambiria 40d4679093 [FIX] google_calendar: allow to sync a private contact
Before this commit: if a user is the attendee of an event containing
a private contact, the user couldn't sync with google calendar. Because
of the "res.partner.rule.private.employee" record rule restriction.

Steps to reproduce the issue:
 1. Create users A and B
 2. Enable "Access to Private Addresses" for user A and disable it for B
 3. Login with user A
 4. Integrate with Google Calendar in setting
 5. Create a contact with private address (type = 'private')
 6. Sync with Google Calendar in the calendar module
 7. Create an event with user B and the private contact as attendees
 8. Reset account of google calendar from user A setting
 9. Login with user B
 10. Try to sync with Google Calendar

 => You will receive an access error

The solution is not to allow any user to add private contacts as an
attendee. Also, create a new contact with the same email if it wants to
match existing private contact with a google event attendee.

opw-2850552

closes odoo/odoo#92624

X-original-commit: 96ee1ef45954bd27632da9c2cef3cf9ba44caca0
Signed-off-by: Arnaud Joset <arj@odoo.com>
Signed-off-by: Pedram Bi Ria (pebr) <pebr@odoo.com>
2022-06-01 15:23:06 +02:00
Alexandre Kühn 669dccddd9 [IMP] mail: introduce Throttle model
Task-2831082

closes odoo/odoo#91502

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2022-06-01 15:22:59 +02:00
Horacio Tellez 557a3e28ed [IMP] payment, sale: prevent paying for a canceled SO/invoice
Before this commit, sales orders/invoices that had been canceled could
still be paid from a payment link. Now, when trying to pay for a
canceled sales order/invoice, the amount to pay is set to zero.

Task - 2735019

closes odoo/odoo#85728

Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
2022-06-01 15:22:55 +02:00
Parth Gajjar 760b4a5c14 [FIX] payment_mollie: mollie shows 404 page when only one payment method is active
Mollie supports multiple payments methods, these payment methods can be
enabled/disabled from the mollie dashboard. When you activate only one payment
method from mollie dashboard, you will get 404 page instead of payment page.
This commit will fix that issue by providing necessary query parameters in url.

closes odoo/odoo#92637

X-original-commit: 500be5b85d99ee4fa9590c18d3795977fbf48c4f
Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
2022-06-01 14:16:07 +02:00
Hiral Bhavsar a35c71690a [IMP] mail: chatter file drag and drop
PURPOSE

The attachment icon in the chatter is too discrete, a lot of users easily miss
it.

SPECIFICATIONS

- Allow for file upload through drag and drop and the whole chatter.
  It doesn't matter whether the file tray is unfolded.
  Hence, removed DropZone on attachmentBox as now have DropZone on
  the whole chatter.
- On the file tray, rename "Attachments" to "Files" and
  "Add attachments" to "Attach files".
- When there are files attached to the record, display "X files".
- when there is no file yet, display 'Attach files'. Although clicking on it
  opens the file explorer, but doesn't unfold the tray yet. Once the file is
  submitted, the file tray unfolds to show confirmed upload to the user.

Task-2413814

closes odoo/odoo#91335

Related: odoo/enterprise#27763
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2022-06-01 14:16:01 +02:00
Alexandre Kühn 7144d2fe7c [IMP] mail: remove useless min-height 0 on DiscussContainer
DiscussContainer is specific component for content of Discuss app
in "whole screen" client action. The parent is not flex, so
it needs `h-100` to take the whole screen.

Consequently, `min-height: 0` is useless, hence this commit
removes it.

closes odoo/odoo#92613

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2022-06-01 13:13:59 +02:00
Horacio Tellez e4c63126b4 [ADD] payment_authorize: add refund for Authorize.
Users can now ask for a refund from Odoo for their transactions done
through Authorize.net. A refund will be triggered from Odoo when
necessary.
Only full refunds are possible.
Note that unsettled transactions will be voided as they cannot be
refunded.

Task - 2678757

closes odoo/odoo#92279

Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
2022-06-01 13:13:55 +02:00
mafo-odoo 3a4cb6f59a [FIX] hr_holidays: right responsible for validation type set
Steps to reproduce:
- Create a Time off Type for which an allocation can be requested
by the employee and with approval "Set by Time Officer"
- Set a Time Off approver on the employee
- Create an allocation

Current behavior:
The allocation approval activity is assigned to the employee

Expected behavior:
The allocation approval activity is assigned to the time off officer

Explanation:
The first fix commit c2bac984f2de160008b27fb52b1d0ae7abd02abb didn't
take into consideration the "Set by Time Officer" approval, we add
here this possible value "set" in order to have a complete fix.

opw-2849972

closes odoo/odoo#92608

X-original-commit: 7239fad29c4b409097ba2a0d2f92d8b9fa8fd5ca
Signed-off-by: Kevin Baptiste <kba@odoo.com>
Signed-off-by: Fockedey Martin (mafo) <mafo@odoo.com>
2022-06-01 12:14:13 +02:00
tsm-odoo 7ddcf5d5b1 [FIX] mail: remove useless flex grow class from discuss container
The discuss container used to have a flex parent but hasn't anymore (its parent
is now the actionManagerContainer instead of the discussWidget). The flex-grow
class has now become useless. This PR removes it.

closes odoo/odoo#92597

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2022-06-01 12:14:09 +02:00
qsm-odoo 44a19384fc [FIX] tools, base: restore branding on siblings of a replaced root node
Since [1] which tried to fix the data-oe-xpath branding on nodes in some
cases, the branding actually became potentially incorrect on siblings of
a node which is replaced multiple times. E.g.

Parent view:

```xml
<hello>
    <world class="a"></world>
    <world class="b"></world>
    <world class="c"></world>
</hello>
```

Child view 1:

```xml
<xpath position="//world[hasclass('a')]" position="replace">
    <world class="new_a"></world>
</xpath>
```

Child view 2:

```xml
<xpath position="//world[hasclass('b')]" position="replace">
    <world class="new_b"></world>
</xpath>
```

No problem, two distincts elements are replaced, the system understands
that the `data-oe-xpath` of the third world of the parent view should be
`/hello[1]/world[3]`.

But in this other case:

Parent view:

```xml
<hello>
    <world class="a"></world>
    <world class="b"></world>
    <world class="c"></world>
</hello>
```

Child view:

```xml
<xpath position="//world[hasclass('a')]" position="replace">
    <world class="new_a"></world>
</xpath>
```

Child view of the child view:

```xml
<xpath position="//world[hasclass('new_a')]" position="replace">
    <world class="another_new_a"></world>
</xpath>
```

The `data-oe-xpath` of the third world of the parent view (in the
resulting view) was wrong: `/hello[1]/world[4]` -> because the system
saw two replacements + the unreplaced second `<world>`, so the index "4"
was computed.

Now the system will understand that the double replacement in fact acts
as a single replacement.

Note: this was also the same with "cross inheriting" (if the "new_a"
`<world>` of the child view was replaced by another child view of the
parent view).

At last, another 4th case was found and worth mentioning because it is
in fact the root cause of the problem. The problem is not actually the
double replacement as mentioned above but simply the replacement of a
root level element of a child view (which is what is basically done in
the last two mentioned cases). In that case, the root level nodes added
by the first child view have already their `data-oe-xpath` branding
computed before they are potentially replaced. Indicating the location
of the replacement in that case was thus only leading to bugs. E.g.

Parent view:

```xml
<hello>
    <world class="a"></world>
    <world class="b"></world>
</hello>
```

Child view:

```xml
<xpath expr="//world[hasclass('a')]" position="after">
    <world class="x"></world>
    <world class="y"></world>
</xpath>
```

Child view of the child view:

```xml
<xpath expr="//world[hasclass('x')]" position="replace"/>
```

Before this commit, before the branding is distributed, the result is:
```xml
<hello data-oe-model="ir.ui.view" data-oe-id="1439" data-oe-field="arch">
    <world class="a"/>
    <?apply-inheritance-specs-node-removal world?>
    <world class="y" data-oe-id="1440" data-oe-xpath="/data/xpath/world[2]" data-oe-model="ir.ui.view" data-oe-field="arch"/>
    <world class="b"/>
</hello>
```

=> Hence the `data-oe-xpath` of the last `<world>` was computed to
   `/hello[1]/world[3]` instead of `/hello[1]/world[2]` after branding
   distribution because the ProcessingInstruction marking the node
   removal location should not have been added: it could only be useful
   to following siblings which are not branded, which is not possible as
   the branding added on the second `<world>` of the child view
   (`/data/xpath/world[2]`) was computed before any removal.

Tests are added in this commit for the 3 last mentioned cases. As
explained, the last case is actually the same of the 2nd and 3rd ones
but it was decided to keep the 3 tests as it helps to understand the
problems better and, if the code evolves, it could become different
cases (= this is 3 cases which are currently technically equivalent but
these are different functionnal use cases). A test was written for the
first case then removed as it is basically a pure copy of other existing
tests written in [2] (trying to be improved by [1]).

[1]: https://github.com/odoo/odoo/commit/f67832a3ae0d9a3b5b53129132762e6bc1aed874
[2]: https://github.com/odoo/odoo/commit/c077ef05575d9677bce284195683f96c68386788

closes odoo/odoo#92589

X-original-commit: d6e0b3d570a4b27f72852eb261660ad09de12eeb
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2022-06-01 12:14:05 +02:00
tsm-odoo bfe78501ce [IMP] mail: adjust legacyPatchUiSize docstring
The legacyPatchUiSize function was supposed to be removed when introducing the
new environment in discuss. However, it appears it is still necessary for
form_renderer tests since it still relies on config.device.size_class. The
docstring has been updated accordingly.

closes odoo/odoo#92551

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2022-06-01 12:14:02 +02:00
Géry Debongnie 362f6b6d5b [IMP] web: update owl from 2.0.0-beta-7 to 2.0.0-beta-8
Release notes:
https://github.com/odoo/owl/releases/tag/v2.0.0-beta-8

Fixes
-----

- portal: allow use of expression to describe portal target
- compiler: fix issue with identifiers with same name
- reactivity: fix memory leak
- app: validate props for root component in dev mode

Improvements
------------

- component: display nice error for wrong child component
- props_validation: have clearer error messages
- component: only useState on props that are already reactive
- compiler: add better support for "in" and "new" operators in templates
- misc: export the validate function
- app: add setting to warn if no static props object
- add static App.registerTemplate and update Portal to use it
- add basic infrastructure to buid owl-runtime without compiler

closes odoo/odoo#92599

X-original-commit: 7fc0cc7c3f1c770dd80e8c3f3316c249d0708fe4
Related: odoo/enterprise#27916
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Géry Debongnie <ged@odoo.com>
2022-06-01 11:02:40 +02:00
Rémi Rahir f6c84d709a [FIX] project: prevent menu_service from loading
Continuity of b859d78c. The assets generated for project sharing feature
suffer from the same issue than `point_of_sale`. In master, we have to
properly declare every file we need instead of realying on the whole
`web.assets_backend`.

Part of task 2860257

closes odoo/odoo#92577

X-original-commit: 45db27c3230a7c341206e9f990e8e5a133342c9f
Related: odoo/enterprise#27914
Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
2022-06-01 11:02:30 +02:00
Rahul Prajapati 222ae02cea [IMP] mail: add hover download button on image attachments
PURPOSE

Improve how image attachments are downloaded from the chatter by adding the
`download` button when hovering image files

SPECIFICATIONS

add a `Download` button (icon) on the bottom right corner of image attachments
on hover

Task-2802810

closes odoo/odoo#92013

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2022-06-01 11:02:26 +02:00
Zelong Lin 947770ce7e [IMP] mail, *: display rating in systray
* = im_livechat, test_mail_full

Display the rating changes that generate a notification under the systray.
Using the rating faces to represent the result.

task-2794182

closes odoo/odoo#89537

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2022-06-01 11:02:22 +02:00
Yolann Sabaux 759df7a654 [FIX] website_crm: allow creation of opportunity
Steps to reproduce:
- In CRM seetings, activate Leads
- Create a sales team with "Pipeline" selected in Sales Teams Settings
- Set a form. The action is "create opportunity" and the Sales Team is the one you created
- Send a form

Issue:
A lead will be created. Not opportunity.

Solution:
Fetch the info related to the team

opw-2856520

closes odoo/odoo#92563

X-original-commit: 1e35d5a2f832901e1269c0f133eb846350f4ba0a
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: yosa-odoo <yosa@odoo.com>
2022-06-01 09:57:59 +02:00
mafo-odoo afd858eb3f [FIX] point_of_sale: misleading actions names for home action
Some user use home action to have internal users directly login on
the pos menu but trying to do so is difficult because of the current
misleading names:
"Open POS Menu" is a client action used in the code to reload the page
so a better fit would be "Reload POS Menu"

opw-2830883

closes odoo/odoo#90417

Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
2022-06-01 09:57:52 +02:00
Pierre-Yves Dufays aa32818c30 [IMP] [test_]mail[_full]: improves message recipients visibility
All the recipients of message were not always displayed in discuss and some
users were wondering if the message has been sent to everybody concerned.
This solves the problem by allowing to specify whether to display all
recipients based on the message sub type and defining for which sub type it
must.

Technical note:
- The added query count in some tests is due to the fact that the inbox
notification can now be displayed on the client. Before they were discarded
right away. Now additional check must be done. The added query is due to the
test self.res_partner_id.partner_share which is now also done on inbox
notifications (This has been determined by testing locally for all tests except
one: TestMailHeavyPerformancePost.test_complete_message_post, but it is likely
for the same reason).
- A speed optimization could be to add mail_notification.display as stored
computed field in order to avoid that extra read but it would add a little more
needed storage.

Task-2429708

closes odoo/odoo#90203

Related: odoo/upgrade#3487
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2022-06-01 09:57:47 +02:00
mafo-odoo 257132839a [FIX] l10n_fi: set the right tags for the finnish accounts
Some of the accounts in the finnish localization module add the wrong tag.
This commit modifies/delete/create the tags to have the right configuration.

opw-2702912

closes odoo/odoo#92542

X-original-commit: 643576233417eca9deaddcdbdfddc58932b6be9d
Signed-off-by: Josse Colpaert <jco@odoo.com>
Signed-off-by: Fockedey Martin (mafo) <mafo@odoo.com>
2022-06-01 08:51:54 +02:00
Aaron Bohy 4f884b1c37 [REF] web: merge mock server tests into one file
Also lint the mock_server file.

closes odoo/odoo#92539

Signed-off-by: Géry Debongnie <ged@odoo.com>
2022-06-01 08:51:50 +02:00
mafo-odoo 28b41a3246 [FIX] crm: no date_closed update between 2 won stages
Steps to reproduce:
	install crm and change a lead between two won
	stages

Expected behavior:
The date_closed does not change

Current behavior:
The date_closed changes

opw-2839298

closes odoo/odoo#92534

X-original-commit: 0c55c0d31021abe966c453c4827d5873a7af485c
Signed-off-by: Fockedey Martin (mafo) <mafo@odoo.com>
2022-06-01 08:51:46 +02:00
Nicolas Bayet a53b468201 [FIX] web_editor: remove style of a link
Before this commit
When removing the style of a link in an html_field, the style was
not removed.

After this commit
When removing the style of a link in an html_field, the style is
removed.

task-2857072

closes odoo/odoo#92573

X-original-commit: f98c6b1ffe3a788f2da6536a109efe68cb6c2da7
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-06-01 07:50:04 +02:00
Julien Castiaux da8def8e41 [IMP] core, web: Delegate delivery of static files
Rationnals
----------

Web servers can serve some resources (e.g. static files) right away
without any interaction with the web application. The network model of
most web servers makes them capable of handling thousands of
simultaneous requests when it comes to intensive IO operations such as
streaming data from a file. The network model of Odoo is different: it
is capable of a lot of processing power but can only serve a handful of
requests at a time, i.e. Odoo (with some help from postgres) is
optimized for CPU operations, not IO.

Some users don't configure their web server, they use a basic
configuration that relay all requests to Odoo. The result is that many
Odoo HTTP Workers can be busy streaming static files instead of
processing other requests. This can lead to a worker starvation, i.e.
all workers are busy streaming files and cannot process new requests.

X-Sendfile
----------

In this work, we add the support for the [X-Sendfile] header family,
they are multiples http headers that can be used by the web application
to communicate with the web server in order to delegate the delivery of
files stored on the file system. Odoo still receives the request but it
does no more stream the file content from within its HTTP worker,
instead it skips the response body altogether and sets the `X-Sendfile`
special header with the path of the file on the filesystem. The web
server intercepts that special header, open the file and stream it.

Using those headers, we can use the best of both the web application and
the web server. The web application is still responsible to locate the
resource and verify the access rights, the web server is still
responsible of streaming the content.

Using X-Sendfile is opt-in via the `--x-sendfile` CLI flag. We set both
`X-Sendfile` (apache) and `X-Accel-Redirect` (nginx). If you are using
apache, make sure `mod_xsendfile` is enabled. If you are using NGINX
you have to add the following location block:

    location /web/filestore {  # custom path, hardcoded within Odoo
        # Prevent access from the outside world, i.e. makes this
        # route only accessible via X-Accel. MANDATORY!!!
        internal;

        # Give access to the filestore using this server's
        # permissions. Odoo is in charge of verifying the access
        # rights.
        alias /path/to/odoo/data-dir/filestore;
    }

The Odoo [deployment documentation] has been updated accordingly.

[X-Sendfile]: https://www.nginx.com/resources/wiki/start/topics/examples/xsendfile/
[deployment documentation]: https://www.odoo.com/documentation/master/administration/install/deploy.html#serving-static-files-and-attachments

Changes to the API
------------------

To benefit most from X-Sendfile, all APIs related to streaming content
over HTTP has to be adapted. They are: (1) `request._serve_static`,
(2) `ir.http._serve_fallback`, (3) `/web/content` and (4) `/web/image`.

Each used it own way to deliver content: (1) `_serve_static` was using
`send_file` (flask's send_file that as been vendored with odoo 10
years ago and not maintenained since then), (2) _serve_fallback was
handcrafting a `werkzeug.wrappers.Response`, (3) /web/content-image were
using the "binary server" `ir.http.binary_content` API.

I has been decided to remove all 3 APIs and to merge the code inside of
the new `http.Stream` object and the `ir.binary` helper model.

A Stream wraps what is going to be sent to the browser, it can be a path
to a file on the locale filesystem, a blob of raw data or an URL to an
external resource. The Stream also holds various metadata that are
mainly used for caching. The preferred way to create a Stream is via one
of its three factories so that all the metadata are set. The factories
are: `from_path`, `from_attachment` and `from_binary_field`. A stream
instance exposes a single method `get_response()` used to create the
corresponding HTTP response object out of the stream.

Inside of `ir.http` were a few methods that were not related to the http
routing and formed what was called the "binary server". All those
methods have been removed and the feature have been refactored inside of
the new `ir.binary` model. The removed methods are:

- `_xmlid_to_obj`
- `_get_record_and_check`
- `_binary_ir_attachment_redirect_content`
- `_binary_record_content`
- `_binary_set_headers`
- `binary_content`
- `_response_by_status`
- `_get_content_common`
- `_content_image`
- `_content_image_get_response`
- `_placeholder_image_get_response`

The new `ir.binary` abstract model exposes the following utilities:

**`_find_record`**

Find an attachment or a record with a binary-field out of an xmlid or
out of a pair record-model/record-id. Check the access rights and the
access token.

**`_get_stream_from`**

Create a Stream from an attachment or a record with a binary-field.

**`_get_image_stream_from`**

Same as `_get_stream_from` but adapted for images. It sets a sensible
ETag on the stream and has image resizing support.

**`_placeholder`**

Get the image placeholder blob.

Testing
-------

It is possible to test the web server configuration using the
`test_http` module. Install the module then run the unittest using the
`webserver` test-tag. By default it attempts to connect to a web-server
running on `http://localhost:80`, you can change this URL by setting the
`WEB_SERVER_URL` environment variable.

    odoo-bin -i test_http --stop-after-init
    WEB_SERVER_URL='http://localhost:80' odoo-bin --test-tags webserver --stop-after-init

closes odoo/odoo#88134

Task: 2801675
Related: odoo/documentation#2083
Related: odoo/enterprise#26191
Signed-off-by: Julien Castiaux <juc@odoo.com>
2022-06-01 02:53:59 +02:00
Julien Castiaux 49efab6958 [IMP] core: utility to reraise errors as others
We introduce a new decorator/context-manager to catch some exceptions
and re-raise them as another error. This utility main's purpose is to
hide a route that a user has no access to behind a fake HTTP 404 Page
not Found error.

The utility is at `odoo.tools.misc.replace_exceptions(*exceptions, by)`.

Its usage is as follow:

    @route('/some/route', auth='public')
    @replace_exceptions(AccessError, AccessDenied, by=NotFound())
    def some_route(self):
        if not request.session.uid:
            raise AccessError("Must be connected to see this route")
        ...

Or as a context-manager if you don't want to except an entire function:

    @route('/some/route', auth='public')
    def some_route(self):
        with replace_exceptions(AccessError, AccessDenied, by=NotFound()):
            if not request.session.uid:
                raise AccessError("Must be connected to see this route")
        ...

Task: 2800772
Close: #90433
Part-of: odoo/odoo#88134
2022-06-01 02:53:59 +02:00
Alexandre Kühn 18e9076a8f [MOV] mail: rename RTC models (step 2)
- rename 'RtcCallViewer' to 'CallView' (files)
- rename 'RtcActivityNotice' to 'CallSystrayMenu' (files)
- rename 'RtcCallParticipantCard' to 'CallParticipantCard' (files)
- rename 'RtcLayoutMenu' to 'CallLayoutMenu' (files)
- rename 'RtcConfigurationMenu' to 'CallSettingsMenu' (files)

Task-2868876

closes odoo/odoo#92552

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2022-05-31 22:56:43 +02:00
Alexandre Kühn 4d14ba8a00 [IMP] mail: rename RTC models (step 2)
- rename 'RtcCallViewer' to 'CallView'
- rename 'RtcActivityNotice' to 'CallSystrayMenu'
- rename 'RtcCallParticipantCard' to 'CallParticipantCard'
- rename 'RtcLayoutMenu' to 'CallLayoutMenu'
- rename 'RtcConfigurationMenu' to 'CallSettingsMenu'

Task-2868876

Part-of: odoo/odoo#92552
2022-05-31 22:56:42 +02:00
mafo-odoo 5e0700417c [FIX] website_sale: remove animation when out-of-stock product is added
Steps to reproduce:
	1) Create a product with 0 on hand qty and under Sales tab,
	"Continue Selling" if Out of Stock unchecked.
	2) Navigate to the website's shop.
	Customize -> Add Feature -> enable Add to Cart.

Current behavior:
From the Shop's screen, the button to add to cart for this product
 is clickable and the animation plays, but no item is added (because
out of stock).

Expected behavior:
There is no animation when an out-of-stock product is added to the cart

This fix completes the fix at commit 8d3a4e1f7094ded889b652e5ec393f6eb2f2b6f6
that didn't take into account the possibility of an empty cart (0) that led to
an undefined value of card_quantity in the data returned from the rpc.

opw-2856711
opw-2745305

closes odoo/odoo#92578

X-original-commit: fdf97d84d1a331f3062bcda6707dfd8c3bc90532
Signed-off-by: William Braeckman (wbr) <wbr@odoo.com>
2022-05-31 22:01:54 +02:00
MerlinGuillaume 760d6ca2fa [FIX] website_forum: post image in forum with 30 karma
Users with 30 karma cannot use images in their forum post

Steps to reproduce:
1. Install the Forum app
2. Change the portal user's karma to 30 (you can use this command in
psql: `UPDATE public.res_users SET karma=30 WHERE id=7;`)
3. Connect as portal
4. Go to the forum and create a new post
5. Add a title and an image to the post and validate it
6. An error message is displayed preventing the user from posting the
image even though he should be able to

Solution:
Adapt the condition on the user's karma

opw-2648770

closes odoo/odoo#92556

X-original-commit: 43c2cbab6947628f58b5edc33d618e50d927f624
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Signed-off-by: Guillaume Merlin (megu) <megu@odoo.com>
2022-05-31 19:18:02 +02:00
Laurent Desausoi (lade) 27ff79bf37 [FIX] http_routing, web: fix translation on additional modules
Translations from non-standard modules on the website are not properly loaded,
thus no translation is done even though translated terms are valid (e.g.
signing a document shared).

Step to reproduce the issue:
1) Install the sign module & Install French language (or any execpt English)
2) Disable the English language
3) Go to Sign and Share on document
4) Open the link
You will see that the "Click to start" is not translated. Some other strings
too.

Solution: The issue appeared since commit [1]. In there, we changed the argument key
for additional modules while it was not changed on the backend resulting in
the module translation not loaded. Furthermore, in the backend the additional
modules were appended as if they were a list while it is a string.

[1]: https://github.com/odoo/odoo/commit/8cc066173dfb61bd95b8e1f0716f71f4e251810a

opw-2842699

closes odoo/odoo#92546

X-original-commit: b4eaaaa567ea306e6e86d133c3a805145d9ea4d0
Related: odoo/enterprise#27906
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Signed-off-by: Desausoi Laurent (lade) <lade@odoo.com>
2022-05-31 19:17:55 +02:00
tsm-odoo 889eed4a7a [IMP] mail: stop registering chatter container as messaging component
No container should be registered as messaging component. ChatterContainer is the
last one registering itself as such. This PR solves this issue.

closes odoo/odoo#92541

Related: odoo/enterprise#27905
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2022-05-31 19:17:49 +02:00
tsm-odoo 89c8abce53 [FIX] mail: correct mistakes introduced with new environment
Some mistakes slipped into the PR introducing the new environment in the discuss
app. This PR fixes those mistakes :

- triggers on this.env.bus that were listen on core.bus
- inconsistent service names between discuss_public_boot/main
- call to Component.env.services.messaging while messaging was available in this.env
- remaining useSubEnv in container that were not needed anymore

closes odoo/odoo#92533

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2022-05-31 19:17:45 +02:00
Alexandre Kühn 6da3e22926 [IMP] mail: consistent default visual of thread topbar icon buttons
- Consistent icon color by default (dark grey)
- Hover feedback visual for all buttons
- Rounded border on hover

Task-2860749

closes odoo/odoo#92209

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2022-05-31 19:17:41 +02:00
Odoo's Mergebot 6355ccd8f3 [MERGE][IMP] knowledge: fix and improve usability and design
Purpose
=======

Improve knowledge usability and design now that it is merged in master
and we get first testing feedbacks.

This includes notably
  - cleaning up fields names
  - adding placeholder when sections are empty.
  - fixing adding emoji behaviour
  - improve adding empty title
  - allowing frontend users to view public child articles
  - merge templates for displaying article name in sidebar
  - minor design changes and fixes

See sub commits for more details.

Task-2852908

closes odoo/odoo#91430

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2022-05-31 19:17:37 +02:00
Fabio Barbero 121c240dfd [IMP] knowledge: merge read only and edit article template
Purpose
=======
Clean up templates to avoid duplicate code for article sidebar.

Task-2852908

Part-of: odoo/odoo#91430
2022-05-31 19:17:36 +02:00