Commit Graph
148346 Commits
Author SHA1 Message Date
Antoine GuenetandNicolas Bayet c40d9357fd [IMP] web_editor: apply rules only where needed
This improves performance of `classToStyle` by first selecting which
nodes and which rules will be concerned.
When parsing the css rules, we computed their specificity and normalized
their styles one by one. This applies these processes only on the
concerned rules, all at once.

X-original-commit: bb28624dcd69efe1aff546b37e66c05c001a5927
Part-of: odoo/odoo#84513
Co-authored-by: Nicolas Bayet <nby@odoo.com>
Co-authored-by: Antoine Guenet <age@odoo.com>
2022-02-14 14:51:25 +00:00
Antoine GuenetandNicolas Bayet 6ec2d52c6f [FIX] web_editor: remove rule grouping in css rules parsing
Since some css was loaded twice, when parsing rules, we grouped similar
rules in order to minimize the amount of rules on which to iterate
during conversion, so as to improve performance. This is not needed
anymore now css is loaded only once, so we can remove this extra
processing.

X-original-commit: 3db6f4a345015adf99c2a744066dcdf8f076a657
Part-of: odoo/odoo#84513
Co-authored-by: Antoine Guenet <age@odoo.com>
Co-authored-by: Nicolas Bayet <nby@odoo.com>
2022-02-14 14:51:25 +00:00
Nicolas BayetandAntoine Guenet 96c859eb0a [IMP] web_editor: batch write in formatTables to avoid layout thrashing
This batches all writes in the `formatTables` method of `convert_inline`
so as to minimize layout thrashing and therefore improve performance.

X-original-commit: f3c0f0c62b9f31e47ef8644c79e1b9751d0ba746
Part-of: odoo/odoo#84513
Co-authored-by: Nicolas Bayet <nby@odoo.com>
Co-authored-by: Antoine Guenet <age@odoo.com>
2022-02-14 14:51:25 +00:00
Nicolas BayetandAntoine Guenet 382b77bec2 [IMP] web_editor: batch write in classToStyle to avoid layout thrashing
This batches all writes in the `classToStyle` method of `convert_inline`
so as to minimize layout thrashing and therefore improve performance.

X-original-commit: addf3e8fa37f4f2cc212a55a332ec61090655232
Part-of: odoo/odoo#84513
Co-authored-by: Nicolas Bayet <nby@odoo.com>
Co-authored-by: Antoine Guenet <age@odoo.com>
2022-02-14 14:51:24 +00:00
Nicolas BayetandAntoine Guenet a8cf97bdee [FIX] web_editor: prevent double-loading css in mass_mailing
`web.assets_frontend` was called in `wysiwyg_iframe_editor_assets` _and_
in `iframe_css_assets_edit`. As a result, they were loaded twice in edit
mode.

X-original-commit: 4bea292681039c1954c6c9038742fa6e2cc2c31e
Part-of: odoo/odoo#84513
Co-authored-by: Nicolas Bayet <nby@odoo.com>
Co-authored-by: Antoine Guenet <age@odoo.com>
2022-02-14 14:51:24 +00:00
Nicolas Bayet 8f829fb7bc [REF] web_editor, mass_mailing: remove unused code
`__extraAssetsForIframe` had been kept in `mass_mailing` and
`web_editor` for historical reasons but was not used anymore. This
removes it.

X-original-commit: 88b91df3ff75bb0be9a84761cb251d0b7b3c976d
Part-of: odoo/odoo#84513
2022-02-14 14:51:24 +00:00
Antoine Guenet 0791c31654 [FIX] web_editor: correct reference to editable in tests
Some tests depended on a variable to be defined, which was only defined
in other tests.

X-original-commit: d3e30a532526e7be54d6153a3ed375ff30d8f8e3
Part-of: odoo/odoo#84513
2022-02-14 14:51:23 +00:00
Odoo's Mergebot 793b738d03 [MERGE] project sharing follow up
Follow up of tasks 2379518 and 2633229 (#73341 and #77156).

Purpose
=======

The main goal is to allow the portal user to click on some stat button shown in the task form view in the project sharing feature. Those stat button will redirect to a portal view if the portal user has access to the document(s).

Then, some refactoring is made to easily use the existing code for one route to another one and review the code for the project sharing tour.

Finally, the `/my/project` and `/my/task` routes have been renamed to follow the same *naming* in the another routes. That is, those routes will be named `/my/projects` and `/my/tasks`.

## Details of the implementation

- Allow the portal user to click on the sale order stat button in task form view. This stat button will be clickable if the user has access to the sale order of the current task shown in the form view, otherwise the stat button will be invisible. If a portal user clicks on this button, then he will be redirect to `/my/orders/<id of the sale order>`.
- Allow to show the parent task from another project than the one shown in project sharing. If the portal user has access to the other project than there is no reason to not allow him to see the parent task.
- Rename the `/my/project` route into `/my/projects`.
- Rename the `/my/task` route into `/my/tasks`.
- Create hook methods to avoid duplicating code when we want to use this code to another route. It will be the case for a new route used in the project sharing feature.
- Create hook method in controller of account module to easily reuse the existing code for another route for project sharing feature.
- Refactor tour js for project sharing feature to remove the duplicating code.
- Revert the disable click on avatar. This changes was initially done for project sharing feature. However, this changes is made `web` module instead of the `project`. Since this changes is no longer used in project sharing feature and no used in backend code, the changes is reverted.
- Move the `invoice_count` field from `sale_project` module to `industry_fsm_sale` one because it seems this field is only used in that module and not anywhere before installing that module.

task-2648955

--
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr

closes odoo/odoo#82379

Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
2022-02-14 15:50:59 +01:00
Barad Mahendra 16614b26fc [IMP] sale_stock: improve the error message
Currently, User/validation errors are sometimes not correct in English
and/or quite obscure and don't help the user understand/solve the issue.

So in this commit, done some copywriting to make the experience better.

task-2615469

closes odoo/odoo#81711

Related: odoo/enterprise#23013
Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
2022-02-14 14:50:53 +00:00
Florent de Labarre 395d150fc7 [FIX] website_sale: copied line is linked with the original order
- Create a sale.order with a product with an optional product
- Confirm order A
- Copy this order A, a new order B is created
--> Issue: the new line of order B are linked with an line of order A

closes odoo/odoo#84523

X-original-commit: 3d987fb55c74ea726a984f3091ff8ac565550172
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2022-02-14 13:06:39 +00:00
Xavier BOL (xbo) 78d3387a76 [IMP] project: update webclient in project sharing to OWL 2
task-2633229

Closes #82379
2022-02-14 13:24:11 +01:00
Xavier BOL (xbo) 2db820a171 [IMP] hr_timesheet: remove overtime filter in project sharing
task-2633229

Closes #82379
2022-02-14 13:23:13 +01:00
Xavier BOL (xbo) 97d477b0a0 [IMP] project: add subtasks stat button in project sharing form view
Before this commit, the "Sub-tasks" has been added in the basic form
view of project.task in backend.

This commit adds this stat button in the project sharing form view to
have the same button than the one in backend.

task-2648955

Closes #82379
2022-02-14 13:23:12 +01:00
Xavier BOL (xbo) c2b0656c12 [IMP] sale: create some hook methods to avoid duplicating code
This commit moves some code used in methods for `/my/quotes` and
`/my/orders` because the code was duplicated for the both routes.
So, with this commit, we can now call those hooks when we need this code
in another routes.

task-2648955

Closes #82379
2022-02-14 13:23:05 +01:00
Xavier BOL (xbo) 4099571e24 [REV] project,mail: disable click on avatar
This reverts commit 0e1961b1dd because the
`no_open_chat` option is removed, this commit becomes useless, that's
why the commit is revert.

task-2633229

Closes #82379
2022-02-14 13:22:54 +01:00
Xavier BOL (xbo) 94153e9765 [REF] project: refactor tour js for project sharing feature
Before this commit, we duplicate some steps of the tour js launched
with internal user to the tour js launched with portal user.

This commit avoid duplicating the steps. To do this, a list variable
stores the common steps of both tours and use this  list in both tour
js to avoid duplicating the steps in both tour js.

task-2648955

Closes #82379
2022-02-14 13:22:52 +01:00
Xavier BOL (xbo) 1439a6f34d [IMP] account: prepare values for invoices in seperate method
Before this commit, the values dict given to the template of
'/my/invoices' is built in the main method of the '/my/invoices' route.

This commit moves the building of the values dict in a separate method
to easily use in another route/method.

task-2648955

Closes #82379
2022-02-14 13:22:51 +01:00
Xavier BOL (xbo) 4220775a1d [MOV] sale_project: move the invoice_count field in field service
Before this commit, the `invoice_count` field is defined in
`project.task` in `sale_project` but it is not used in this module.

This commit moves this field in enterprise version, because we use
this field in Field Service app.

task-2648955

Closes #82379
2022-02-14 13:22:49 +01:00
Xavier BOL (xbo) 336befc0fb [FIX] project: add route to manage page in '/my/projects/:project_id'
Before this commit, we recently change the content of this route. The
content is the list of tasks to the project instead of the form view of
the project. The problem is we don't have a route to manage the page in
the case where we have more than the value stored in `_items_per_page`.

This commit adds a route in the method for '/my/projects/:project_id'
route. The new route is called '/my/projects/:project_id/page/:page' to
manage the page of the tasks linked to the project.

task-2648955

Closes #82379
2022-02-14 13:22:48 +01:00
Xavier BOL (xbo) 25ece8fe7b [IMP] project: refactor portal tasks routes
Before this commit, we recently added a new route in project portal
called '/my/projects/:project_id/tasks' to get the tasks related to the
project. The problem is most of the code in this route is duplicated
from the original route to see all tasks in portal view. That is, the
route called '/my/tasks'.

This commit refactors the code to have the common code in a common
method and changes the result in both routes to have the `values`
dictionary expected in those routes.

task-2648955

Closes #82379
2022-02-14 13:22:46 +01:00
Xavier BOL (xbo) b517fdc19d [IMP] project: rename the portal form view route of project and task
Before this commit, when the current user is in the '/my/projects'
route and selects a project the route becomes '/my/project/<id of
project>'. There is no reason to change the route and then adding the id
of the project. In sales order route, we keep the route and we add the
id of the SO to see the portal form view of the SO selected.

This commit renames the route of project and task form view to keep the
same route and the same logic of SO and quotations routes for instance.

task-2648955

Closes #82379
2022-02-14 13:22:42 +01:00
Xavier BOL (xbo) 70e5f6ccbb [IMP] project: get parent task of another project in project sharing
Before this commit, the portal user can see the parent stat button in
project sharing form view of task if the parent is in the same project.
This button can be clicked and it redirects the user to the parent task
form view in the project sharing.

This commit improves this button and its visibility in project sharing
feature. The button is visible only if the current user has access to
the project of the parent task. That is the privacy visibility of the
project should be set to 'portal'. If the portal user has access to the
project of the parent task and he is not a collaborator of this project,
then the current user will be redirected to the classic portal view of
the parent task. If it is a collaborator then we display the parent task
in the project sharing feature.

task-2648955

Closes #82379
2022-02-14 13:22:36 +01:00
Xavier BOL (xbo) 0829316038 [IMP] sale_project: allow portal user to click on sale order button
Before this commit, in project sharing feature, when the portal user is
in task form view, he can see the sale order stat button if a sale order
is defined in the task but this button is disabled.

This commit allows the portal user to click on this stat button if he
has access to the sale order of task. If he cannot access then the stat
button will be invisible.
And if the portal user clicks on this button, he will be redirect to
`/my/orders/<id of the sale order>`.

task-2633229

Closes #82379
2022-02-14 13:22:26 +01:00
Martin Trigaux 9fbf706ba8 [I18N] *: export saas-15.2 translations
closes odoo/odoo#84475

X-original-commit: 8ea2605fbfec6277d7a01b6e73548a9585866c61
Related: odoo/enterprise#24289
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2022-02-14 10:44:50 +00:00
Guillaume (gdi) 05d133c47c [FIX] website, web_editor: fix form ids generation
Commit [1] modified the function that generates HTML ids, unfortunately
this was not done correctly and should have been done in all versions
since 14.0. This commit fixes that by bringing the benefits that commit
[1] brings (correction so that HTML Ids don't start with a number) but
without the defaults that it has.
See the related discussion here [2].

[1]: https://github.com/odoo/odoo/commit/3dde03308d4adffd861570230edcef1c5f7fc1c4
[2]: https://github.com/odoo/odoo/pull/80217#discussion_r787975515

task-2760205

closes odoo/odoo#84474

X-original-commit: 105f80e57cacf48dcdafc41dc3d1cf418c75311e
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2022-02-14 10:44:46 +00:00
pedrambiria 36aae4f48f [FIX] sale_coupon: check coupon's date with present time
Before this commit: a coupon's start and end dates were compared with
the order date. When a customer adds a product to the cart, it creates
an order on the website. If the customer makes an order, it will remain
active until he completes it, even when the coupon is expired.

To reproduce the problem, add a product to the cart, create a coupon,
and set its end date to present time. Now you can use the coupon after
the end date has passed. So it's better to check the date with the
current time.

opw-2711987

closes odoo/odoo#84422

X-original-commit: e0b9fa49c4887ea4e6d1525e99eacf7c35e469a0
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2022-02-14 10:44:42 +00:00
Guillaume (gdi) a93286dc2a [FIX] website: ensure order of we-matrix's events
This commit ensures that changes are applied in the same order as the
events are triggered on the we-matrix. This was not the case because of
another bug we had to consider and which is not there anymore, this is
why this fix is done in 15.0 and not before.

This commit is the continuation of [1] which applied the same change for
we-input.

[1]: https://github.com/odoo/odoo/commit/db62a5fac123fc72e37e94709b1a0c80f32a8a29

task-2761187

closes odoo/odoo#84486

X-original-commit: 703e1ec69c2cbdbdbafeef9ac359db9f0f3b7021
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2022-02-14 09:55:18 +00:00
Fabien Pinckaers dab33d9307 [FIX] Missing icon, fix renaming to SVG
closes odoo/odoo#84500

Signed-off-by: Fabien Pinckaers <fp@odoo.com>
2022-02-14 08:49:57 +00:00
David MonjoieandAntoine Guenet d4835b20a8 [FIX] web_editor: properly solve image in image button bug
Commit 57701b2 resulted in another bug as links could not longer be
edited. This refines it so it fixes the bug it solved without the
nefarious side effect.

closes odoo/odoo#84464

X-original-commit: 84fd0b0a1bc1d874e7d6d6ff10b4fb6351f5a1af
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Co-authored-by: David Monjoie <dmo@odoo.com>
Co-authored-by: Antoine Guenet <age@odoo.com>
2022-02-14 08:49:51 +00:00
Nasreddin Boulif (bon) ad3cf187e2 [FIX] google_spreadsheet: migrate to new api (v3 -> v4)
Steps to Reproduce:

  - Install 'account' module
  - Go to Settings and set a token for Google Drive
  - Activate Google Spreadsheet
  - Go to Invoicing -> Invoices
  - Under Search bar, click on Favorites -> Add to Google Spreadsheet

Issue:

  A spreadsheet does open but with no data (no formula or config).

Cause:

  The V3 API we were using was turned down in August 2021 and therefore
  not able to use the api to write on the spreadsheet.
  https://cloud.google.com/blog/products/g-suite/migrate-your-apps-use-latest-sheets-api)

Note: In case that the system parameters `​google_drive_client_id` and
`google_drive_client_secret` has been changed (and therefore also the
default templates), it must be ensured that the `client` has the
Google Sheet API (v4) activated and the scope
`https://www.googleapis.com/auth/spreadsheets` set.

API activation and configuration available here :
https://console.developers.google.com/apis/dashboard?project=[PROJECT]
https://console.developers.google.com/apis/credentials/consent/edit?project=[PROJECT]
**[PROJECT]** : Google project that will be linked to `​google_drive_client_id`.

opw-2633951

closes odoo/odoo#84488

X-original-commit: 3268530a071d9351ca86776fe85289ee5feece3d
Signed-off-by: Nasreddin Boulif (bon) <bon@odoo.com>
2022-02-14 07:58:56 +00:00
Mathieu Duckerts-Antoine 3e2229db20 [FIX] web: flickering in graph view
Chart.js did badly compute the graph canvas container height (width) by
using clientHeight (resp. clientWidth) that may be rounded up by the
browser. This leads to the appearence of a useless scrollbar in the
graph view and makes it flicker on some update.

closes odoo/odoo#84476

X-original-commit: 6bceae94619da9f4943cbc1e58844fdbe0215802
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-02-14 07:58:52 +00:00
Christophe Monniez 4484fc1e7c [FIX] test_lint: properly gives optional argument
The es-check help specify that the `--module` optional argument as to be
given at the end of the cli. After an update to version `6.2.1` it led
to errors on runbot's where the Dockerfile was updated.  The error was
like if the `--module` cli argument was not given at all.  e.g.: `error:
SyntaxError: 'import' and 'export' may appear only with 'sourceType:
module'`

With this commit, the argument is given at the end of the cli as
expected.

closes odoo/odoo#84416

X-original-commit: dc74fd866d63003d987fc365a8137ff0e1c2d017
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
2022-02-14 07:58:49 +00:00
Cedric Prieels 7e35518129 [IMP] project: improve tags management
In big databases, the number of tags becomes rapidly huge. This makes
it very hard to find revelant tags. In practice, the same few tags are
usually used in a given project.

This commit:
- Limits the search of tags to the project's tags of the task as well
  as to the tasks' tags of the task's project.
- Prevents creating case sensitive variants of existing tags.
- Reuse existing tags from other projects and other projects' tasks
  when the user `creates` (or at least thinks creating as the
  _name_search would not return the searched tag) a new tag in his project.

task-2735833

closes odoo/odoo#82925

Related: odoo/enterprise#23814
Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
2022-02-12 19:26:16 +00:00
Fabien Pinckaers 10a5796d4b [IMP] speed up load_menus() by using SVG icons instead of png
Reduces load_menus answer size by 32% (between 20kb and 200kb savings
for the initial loading of the backend, depending on the number of apps
installed). Support for SVG icons in the web client for menus/apps.

Reduced PNG icons for apps list (8 bits PNG instead of 24 as our icons
don't need more colors as they are flat designs)

closes odoo/odoo#84280

Related: odoo/enterprise#24200
Signed-off-by: Fabien Pinckaers <fp@odoo.com>
2022-02-12 08:55:18 +00:00
Aaron Bohy 11cc762d7a [FIX] mail,project: remove chatter flickering
Before this commit, when a form view was re-rendered (e.g. when
switching to "edit" or "readonly" modes, when using the pager...),
the chatter briefly disappeared and then reappeared, which produced
a flickering. This has been introduced by the adaptation of the JS
codebase to owl 2 [1]: when the form view had to be re-rendered,
we reused the DOM element containing the chatter in the new
rendering (done in memory), which was thus detached from the DOM.
That element was re-inserted into the DOM later on, alongside the
rest of the newly rendered elements.

This commit fixes the issue by using a specific "hook" element when
rendering the form view, and replacing that hook by the actual
(unchanged) chatter container element when the rendering is done
and the DOM is patched.

This commit also removes unnecessary overrides in project:
- _renderNode was dead code, classname "oe_project_sharing_chatter"
 no longer exists in the codebase since [2]
- _makeChatterContainerTarget replicated what was originally
 already done in the mail FormRenderer (for appearently no valid
 reason), so obviously, that override wasn't synchronized with
 this fix.

[1] edd79ff560
[2] a28cc6333a

closes odoo/odoo#84429

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2022-02-11 18:19:57 +00:00
Touati Djamel (otd) fc276359fc [FIX] base: allow removing the contact barcode
Steps to reproduce the bug:
- Go to any Contact > Sales and Purchase tab
- Edit > Change the barcode, and click Save
- Then click Edit, and try to erase (empty) the barcode > save

Problem:
A validation error is triggered, the constraint will check if other partners do not have the same barcode
but as it is empty there will be several other partners

Solution:
When the barcode is empty, no need to check if other partners have the same

opw-2753291

closes odoo/odoo#84450

X-original-commit: 32754ebc6f5f1b3c739d0a39ef209822fa4ed3a1
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Djamel Touati (otd) <otd@odoo.com>
2022-02-11 17:33:39 +00:00
Antoine Guenet b822da476e [FIX] website: only apply default lazy loading on images in frontend
The `loading="lazy"` attribute was set by default on all images but this
affected the `mass_mailing` module as well while that attribute doesn't
work in emails and can cause some issues in edition.
One known such issue this addresses is to be reproduced as follows:
1. Create a new mail
2. Drop the "cover" snippet
It has height 0 so it won't load until another snippet (with a non-zero
height) is dropped.

task-2761074

closes odoo/odoo#84415

Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-02-11 16:42:47 +00:00
qsm-odoo 7c0b026487 [FIX] web_editor: remove divs created by default shadow computation
The shadow option needs to create a div on the fly to be able to
retrieve the default shadow value. This commit makes sure these divs
are also removed when no longer needed.

This also simplifies the code and actually avoids that div creation when
it is not needed.

task-2752326

closes odoo/odoo#84324

X-original-commit: 309f03c011fc8e5e0bec9882af54a8147025118f
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2022-02-11 15:04:48 +00:00
Agustín Castro Bugallo bc616dd053 [FIX] account: add default return for _compute_amount
The function `_compute_amount` on `account.tax` returns None if the value of
`amount_type` is not a standard Odoo value. During normal use, this will never
be the case, and if the value is  modified by a custom module the method is
overriden in its code to account for that case.

During an upgrade, however, custom modules are not available. During the tests,
if a field needs to be computed using that function, it will break with
`TypeError: unsupported operand type(s) for /: 'NoneType' and 'float'`

Adding a default return to the function in case the `amount_type` is not
recognisef will help prevent this.

closes odoo/odoo#84432

X-original-commit: 8489da59c7f30a978023c5c56824d9398b8590b4
Signed-off-by: Olivier Colson <oco@odoo.com>
2022-02-11 14:10:59 +00:00
sofiagvaladze 41ad15b761 [FIX] web: fix the traceback
Problem occurs when we try to export report data and click
'I want to update data (import-compatible export)'.
We might end up exporting data when only field to export
is - External ID (id).

To reproduce an issue (for example):
Go to Time Off/Reporting/by Type; Remove filters from search.
Select couple records, then Action/Export.
On the wizard, click on 'I want to update data (import-compatible export)'.
Click on External ID from 'Available fields' to add it to 'Fields to export'.
Click export.

It gives traceback -
File "/data/build/odoo/addons/web/controllers/main.py", line 710,
 in write_header self.worksheet.set_column(0, i, 30) # around 220 pixels
UnboundLocalError: local variable 'i' referenced before assignment

task - 2687370

closes odoo/odoo#84191

Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2022-02-11 13:21:02 +00:00
Pierre Paridans f6a9895d62 [IMP] web: move Burger Menu tests
Follow-up odoo/enterprise@3f78e5ade6

Standalone burger menu tests are moved to community, while we leave
other enterprise dependent tests in enterprise.

closes odoo/odoo#84406

Related: odoo/enterprise#24263
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
2022-02-11 11:40:38 +00:00
Benjamin Vray 705813e941 [FIX] website: remove autocomplete from inputs in page properties
Before this commit, on Chrome browser, the page url input and the
visiblity password input were autocompleted with the user's login and
password in the page properties options.

After this commit, they are no longer.

Regarding the url input page, it seems to be because Chrome considers
that the first text input located before a password input in the DOM is
a login input.

task-2502747

closes odoo/odoo#84393

X-original-commit: 7f45822919f8ef5f070a40a4dd41d22757a9da76
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2022-02-11 11:40:32 +00:00
oco-odoo 3f280a0190 [FIX] survey: Avoid forbidding access to survey when the answer cookie corresponds to no actual answer
To reproduce:

1) Create a survey and open it with a portal user with its /survey/start/*** link

2) In a private window, connect as the admin and remove the answer in 'Not started yet' state that step 1 created.

3) Go back to your portal user window and re-enter the same /survey/start/*** URL.
==> The portal user is brought back to the home page. He has no way to access the survey anymore, the link will always redirect him there.

This is because of cookies. The first time the user opens the survey, it creates a cookie in his browser allowing him to reload the answer he was working on. In our example, this answer has been deleted for some reason (maybe some cleaning of too old 'not started' or 'in progress' stuff); so the token stored in the cookie does not correspond to anything anymore. Instead of crashing and redirecting to home page, this commit makes it so that we now ignore the cookie in that case, so that the user directly has access to the survey to build a new answer.

Task-2729738

closes odoo/odoo#84390

X-original-commit: c642be8e1bc682af2919c1cfadfdc267f005272e
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Signed-off-by: Olivier Colson <oco@odoo.com>
2022-02-11 11:40:28 +00:00
oco-odoo 5d2b0c5baa [FIX] survey: Don't load answer from other user if a cookie exists
To reproduce the issue:

1) Create a survey requiring user login, with multiple pages

2) Create portal user A and B

3) With user A, go to URL /survey/start/****, where **** is the access token of your test survey. Fill in the first pages of the survey, but don't finish your submission (so: the answer has to stay 'in progress').

4) Logout from user A.

5) From the same browser window (or without cleaning cookies, at least), directly login with user B, and go to the same /survey/start/**** link

====> The 'in progress' answer from A is loaded, even though we are connected with B and should hence not have access to it. Instead, we should have created a new blank answer for B.

This is due to our cookie management. When a cookie is kept in the browser with the token of a previously entered answer, we reload it without checking its owner.

Task-2729738

X-original-commit: 0be94b7f0bcb370bb8e8dea5febbc1c4a0b0cf86
Part-of: odoo/odoo#84390
2022-02-11 11:40:28 +00:00
Antoine Vandevenne (anv) c29d94a6e8 [IMP] payment_*: reuse the common reference in test data
closes odoo/odoo#84385

X-original-commit: 0482826b77939d326fd8519ba888aacd3afa2e99
Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
2022-02-11 11:40:23 +00:00
Adrien Widart 77ca3a830d [FIX] mrp: produce SN product with lot of unbuilt product
To reproduce the issue:
1. Produce a SN product P with lot L
2. Unbuild it
3. Produce 1xP with lot L

Error: When setting the lot, an error is displayed. When marking the MO
as done, a second error is displayed

Both domains in `_onchange_lot_producing` and in the beginning of
`_check_sn_uniqueness` are incorrect. We should centralize the
uniqueness checking thanks to all existing computations in
`_check_sn_uniqueness`. This way, unbuilt/scrapped moves will be
considered

OPW-2721205

closes odoo/odoo#84374

X-original-commit: 2540104e95cea7baaa22ccfce97759771dbbaf34
Signed-off-by: Tiffany Chang <tic@odoo.com>
Signed-off-by: Adrien Widart <awt@odoo.com>
2022-02-11 11:40:19 +00:00
Mathieu Duckerts-Antoine 4308de6aab [REF] web: useAutofocus simplified API
We bring two changes to the API of useAutofocus:
    - it takes no parameter, the element focused is the one that is the
      target of a t-ref="autofocus".
    - it returns the element reference instead of a function to call if
      one wants to force the focus on a next patch.

Indeed, having access to the element reference makes it easy to focus
that element but also allow to remove an eventual useRef that would
target the same element. This in turn permits the use of t-ref="autofocus"
alone.

closes odoo/odoo#84306

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-02-11 11:40:12 +00:00
Mathieu Duckerts-Antoine f5b9638999 [FIX] point_of_sale: useAutofocus
In 6d13271aac, the API of useAutofocus was chanded but the calls to
useAutofocus in the module point_of_sale were not adapted accordingly.
We adapt them in this commit.

Part-of: odoo/odoo#84306
2022-02-11 11:40:12 +00:00
Yannick Tivisse 1bf7126116 [FIX] hr_holidays: Avoid duplicated resource.calendar.leaves
Purpose
=======

The existing resource.calendar.leaves are unlinked when refusing the
time off, but it could still be the case with python code changing
states without calling "action_refuse".

Make sure that the resource calendar leaves are always unlinked
on stage change for validated time off.

closes odoo/odoo#84269

X-original-commit: 83c283cb4256195975ec6dfb6096172d38393217
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2022-02-11 11:40:07 +00:00
Yannick Tivisse 959a05d00c [FIX] project_timesheet_holidays: Prevent duplicated timesheets + Imp Perfs
Purpose
=======

The existing timesheets linked to a time off are unlinked once the
time off is refused (which is the only action on the interface for
validated time off).

But nothing prevents to set in a python code a time off directly
in draft to validate it afterward.

In that case, the timesheet is duplicated and is impossible to unlink
as this is forbidden for timesheets linked to a time off.

Specification
=============

Make sure before creating timesheets linked to a time off that there
is not remaining linked timesheets.

On the other hand, modify the method to generate the timesheets in batch.

X-original-commit: 46a3394b960ba344d49a4e99ae5a6a7d7392dbf6
Part-of: odoo/odoo#84269
2022-02-11 11:40:07 +00:00