Commit Graph
149350 Commits
Author SHA1 Message Date
Philippe Wauthy b328f0b09f [FIX] hr: fix employee ux
After installing l10n_be_hr_payroll, the address, email, phone and bank account number take half of the dedicated space.

This commit makes the fields take the dedicated space

task-2790206

closes odoo/odoo#86098

Related: odoo/enterprise#25126
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2022-03-25 15:54:23 +01:00
David Tran 242d81e66e [IMP] hr_holidays: separate value preparation and record creation into 2
methods for others to extend functionality

1. _prepare_resource_leave_vals_list() that will prepare value for
creation
later in _create_resource_leave()
2. _create_resource_leave() now calls the
_prepare_resource_leave_vals_list()
instead of having done the job itself

closes odoo/odoo#87081

X-original-commit: 6040670f24da60b1f1b2f1814423c473cc060c8c
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2022-03-25 14:44:27 +01:00
Touati Djamel (otd) 3892e472f7 [FIX] mrp: prevent MO creation with the same component as product to produce
Steps to reproduce the bug:
- Create a storable product “P1”
   - Add a BOM
   - Try to add the product P1 as a component > save > validation error is triggered
	>  it's not possible to add the same component as the product to produce > correct behavior

- Create a manufacturing order:
    - Select the product “P1” as product to produce
    - Add the product “P1” as component
    - save

Problem:
no validation error is triggered, It's possible to create a MO in which the final product is included in the component > wrong behavior

opw-2796750

closes odoo/odoo#87262

X-original-commit: f38727ee4e7b6596a9da5f3285c7622da0ac6772
Signed-off-by: Arnold Moyaux <arm@odoo.com>
Signed-off-by: Djamel Touati (otd) <otd@odoo.com>
2022-03-25 12:40:11 +01:00
Jinjiu Liu 588578c365 [FIX] survey: refined the IF conditions in the controller
Reproduction:
1. Create a survey or use an existing one
2. Share it via mail
3. Try to open a link provided in the mail

Reason: the conditions for public users in _check_validity() are not
refined enough. The link in the email has answer_token, while the
general Survey URL is a direct link to the survey. However, the
condition ”request.env.user._is_public() ” is true for both cases. This
leads to redirection to the homepage for survey links in the email.
Tested locally that sending two different recipients same survey by
email will assign two different answer tokens

Fix: add the answer_token to the condition. If there is an answer_token
part, it means this link is specific for a partner, and no user check is
needed. Because ideally, only this partner received the link. If there’s
a leakage, it’s probably his/her problem

Original commit: 3c71f66bb541fcf31f31e75b60f7825d26109bc4
First fix: cffc732e58c14541abcf06bb0d58add224396b7c

opw-2795134

closes odoo/odoo#87258

X-original-commit: 5599995d80d1cefaa7ddcb91a201756acc8cbf02
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2022-03-25 12:40:08 +01:00
Vincent Larcin d2716b3f6c [FIX] resource: update default calendar timezone on first admin login
When the admin user logs in for the first time, their timezone can be updated based on the cookies of their browser.
In such case, the timezone of the default working calendar should be updated too.

Related: https://github.com/odoo/odoo/pull/83262/

Task 2759592

closes odoo/odoo#87061

X-original-commit: 3c56be1732d219ed69efe5f18bd7931959b7c333
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2022-03-25 12:40:00 +01:00
Goffin Simon a6031a9905 [FIX] account: Show analytic_tag_ids with widget many2many_tags
Show the optional field analytic_tag_ids with widget many2many_tags in
view account.move.line.tree.grouped

opw:2778260

closes odoo/odoo#86990

X-original-commit: fa4d41bcebde71c5aa7bbf53dd19bdaab748f4c8
Signed-off-by: William André (wan) <wan@odoo.com>
Signed-off-by: Simon Goffin <sig@odoo.com>
2022-03-25 12:39:57 +01:00
Brieuc-brd 76369d33b7 [REF] mail: ChatterTopbar, review and simplify scss
Part of the overall v16 SCSS optimization/restyle, task-2704984

task-2781992

closes odoo/odoo#86461

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2022-03-25 12:39:53 +01:00
Alexandre Kühn 7544078420 [IMP] mail: turn "RtcSession/isConnected" into field
Task-2734101

closes odoo/odoo#85032

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2022-03-25 12:39:50 +01:00
Thibault Libioulle d77e7f9472 [IMP] website_sale: keep the cart quantity up-to-date
This commit updates the cart quantity even if the html page comes from
browser cache, i.e. the user comes back to a previous page with the
browser back method.

task-2741846

closes odoo/odoo#84861

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2022-03-25 12:39:46 +01:00
Pierre-Yves Dufays f89fce4501 [IMP] portal[_rating],website_slides: improve star filtering interface
The implementation seemed buggy as you had to click twice on a rating to
activate the filter; this fixes the problem.

It also improves a bit the interface:
- by allowing to click on another rating directly without having to deactivate
first the current filter
- by replacing "Remove Selection" by a red fa-times
- by adding a spinner on the messages zone while the messages are loading when
the connection is slow (the spinner appears only after half a second if the
server doesn't response in the meantime)
- by setting some minimal heights to avoid seeing the footer moving when
switching from course to review and when changing the star filter (which change
the number of message displayed)

Technical notes:
The double click problem was caused by an update of the view when the rating
filter is changed. When re-clicking on the same rating the view was not
re-rendered and the change (selection) in the view were kept.

To solve that problem we have implemented the selection directly in the view
and the css. As it doesn't rely anymore on changes performed in javascript
in the dom, the re-render of the view after fetching the data from the server
reflect the selection done by the user.

Task-2754954

closes odoo/odoo#85757

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2022-03-25 11:22:45 +01:00
Ruben Gomes 8bae2f6227 [IMP] account menu item : move Analytic Items
Move Analytics Items menu item from Configuration > Management to Configuration > Analytics Accounting

closes odoo/odoo#85266

Task: task-2774909
Signed-off-by: Ruben Gomes <rugo@odoo.com>
Signed-off-by: William André (wan) <wan@odoo.com>
2022-03-25 11:22:41 +01:00
Abdelouahab (abla) d44af30816 [FIX] hr : fixing access rule to be able to update its own res users record
To reproduce
============

- Connect with Mitchell Admin

- Go to Employee -> Settings and uncheck "Skills Management"

- Go to Settings -> Users, create a user "Test" and give him access to 2 companies (e.g. My Company [San Fransisco] and My Company [Chicago])

- Set current company to My Company [San Fransisco], go to Employees, create an employee record and associate it with your test user (in HR Settings tab)

- Set current company to My Company [Chicago] and create another employee and associate it with your test user too

- Connect as "test" user and go to my profile

- Try to change your langage (From English US to French) ==> Access rights error

Purpose
=======

When the `OnChange` is triggred we try to read the two employees linked to this user, but one of this employees is in unslected company
which leads to Access rights error.

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

To solve the issue the domain in the security rule **Employee multi company rule** has been updated, where we added the condition
`('user_id', '=', user.id)` which gives the user the ability to read the needed data.

opw-2793123

closes odoo/odoo#87244

X-original-commit: 5916e15f6fa29fd89e12472b316475e757001945
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2022-03-25 10:23:20 +01:00
Pablo Montenegro f0b90c9fa8 [FW][FIX] l10n_ar: AFIP currency rate.
We have a bug when we were computing the invoice rate that is used to
report to AFIP. The rate we were setting was an old rate that references
the day that the invoice was created and not the rate of the day where
the invoice was validated.  This was happening because the
l10n_ar_currency_rate field that stores this value was computed before
posting the invoice. At that time the date field store the value of the
date where the invoice was created and had not been updated yet with the
accounting date.

Moving the l10n_ar_currency_rate field calculation after the invoice
post solves the problem and now the l10n_ar_currency_rate has the rate
of the accounting date.

Part-of: odoo/odoo#84470

Original commit: aac1165655d31ba3bca4b105e0c905534e91df93

closes odoo/odoo#87163

X-original-commit: ac57ac559d973a1c4c2050fa514668d20bd610f0
Signed-off-by: Josse Colpaert <jco@odoo.com>
2022-03-25 10:23:16 +01:00
Touati Djamel (otd) b131f57a88 [FIX] stock: print all barcodes when picking qty done is at 0
Steps to reproduce the bug:
- Go to Inventory > Transfers > Select a ready transfer with no qty done
- Print > barcodes (ZPL) or barcodes (PDF)

Problem:
The file is empty because there is no qty_done.

Solution:
If no qty is done, then print all barcodes as if picking is done.
It makes sense, for example, when a user wants to print the barcodes before the product is delivered

but if at least one move_line has a Qty_done then do not print the other move_lines which have a qty_done of 0

opw-2780365

closes odoo/odoo#87151

X-original-commit: 3229d73dd11ddb02415d61c47f41e857742887b7
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Djamel Touati (otd) <otd@odoo.com>
2022-03-25 08:27:42 +01:00
Ryoko c1040a4e80 [FIX] l10n_jp: wrong assignments of tax accounts
closes odoo/odoo#87234

X-original-commit: 0e0c7b7f817948044f56267bef91eb1ed2b29150
Signed-off-by: William André (wan) <wan@odoo.com>
2022-03-24 23:29:54 +01:00
Hubert Van de Walle (huvw) f1fa85fe65 [FIX] web: FieldBinaryImage size attribute not applied correctly in CSS
Steps to follow

  - Go to the product page
  - Open studio
  - Click on the picture and set the size to large
  - Save and quit studio
  -> The size doesn't change

Cause of the issue

  Studio sets the size attribute on the field as `[0, 270]`
  This means the picture should have a height of 270px and an unspecified width.
  But for that to work, we need to handle the case were only one
  dimension is set.

opw-2745625

closes odoo/odoo#87226

X-original-commit: 50368a9db8ac67986cf64ff84ee625cbf7a90a1f
Signed-off-by: Anh Thao PHAM <pta@odoo.com>
Signed-off-by: Hubert Van De Walle <huvw@odoo.com>
2022-03-24 22:28:43 +01:00
Andrea Arce fca16554e1 [CLA] Update Vauxoo's CLA
Incorporate Andrea Arce (andreaarce) as Vauxoo's contributor
I confirm I have signed the CLA and read the PR guidelines at
www.odoo.com/submit-pr

closes odoo/odoo#87218

X-original-commit: 89a086c8fe06a4823f405e4f14a77396b520fe88
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2022-03-24 21:38:47 +01:00
Aaron Bohy e5db9d8743 [FIX] web: action service: concurrency issue
There is a concurrency issue in the action service:
 1) be in an action with several views
 2) execute another action (e.g. by clicking on a menu)
  -> [calls the route "/web/action/load", and it takes a while]
 3) meanwhile, click on another view in the view switcher

If the call to "/web/action/load" is long enough, it may happen
that the view requested in step 3 is briefly shown before the
action associated with the menu clicked in step 2.

In this scenario, the action of step 2 should never be displayed,
because the user requested something else afterwards (in this
case a switch view).

One can produce a similar issue when restoring a previous action
of the breadcrumbs instead of switching view.

This commit fixes those two issues by registering a resolved
promise in the keepLast (concurrency utils), s.t. it "cancels"
the potential current operation (in this case, the call to
"/web/load/action").

closes odoo/odoo#87204

X-original-commit: fb9c8cd6fee476d2506b8c1338bf88c4520ea7b6
Signed-off-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-03-24 21:38:44 +01:00
Alexandre Kühn 714948cb97 [IMP] mail: introduce 'MessageView/isHovered' field
Task-2793280

closes odoo/odoo#86694

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2022-03-24 20:47:46 +01:00
Alexandre Kühn c44f35f61d [IMP] mail: turn 'MessageAuthorPrefixView/message' into field
Task-2793280

closes odoo/odoo#86980

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2022-03-24 18:58:26 +01:00
Nicolas Bayet 6b8bf0dd41 [FIX] web_editor: prevent opening linktool on uneditable links
Before this commit
When trying to open the linktool on link that are not
`isContentEditable`, the linktool was initialized and not
showed in the sidebar.

After this commit
As it does not make sense to edit a link that is not editable,
prevent the linktool from being initialized in the first place.

task-2802592

closes odoo/odoo#87203

X-original-commit: 4a634f2c5bfceb3f2dc200f9b391ef1cdbc0e697
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-03-24 18:10:55 +01:00
Antoine Guenet ad7c0d8ea4 [FIX] web_editor: prevent traceback on remove highlight color
This prevents a traceback when no closest block to the root node can be
found in the sanitizer.

task-2796371

closes odoo/odoo#87187

X-original-commit: 2104f33985472cd59f067d2f1403518a332fac6d
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-03-24 18:10:51 +01:00
Alexandre Kühn 6b0a59c951 [IMP] mail: turn 'MessageView/isClicked' into field
Task-2793280

closes odoo/odoo#86966

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2022-03-24 18:10:47 +01:00
Achraf (abz) 571d67a53f [FIX] base: Allow users read_group with reified field inside the view
Until now using a groupby on a view containing a reified field added
with studio was not possible.

Because `read_group` uses these pseudofields as simple fields when they
are not actually columns in the table.

With `read`, `write`, `create` and `fields_get` it was already
supported.

This commit solves this problem by ignoring reified fields in an
override of `read_group`

opw-2793148

closes odoo/odoo#87186

X-original-commit: a25e25aeab3ed6aa1af57fac13312346b723dbf8
Signed-off-by: Raphael Collet <rco@odoo.com>
2022-03-24 17:12:38 +01:00
Abdelouahab (abla) 8293ae5d37 [FIX] hr_holidays : ignore inactive leaves for IM status
To reproduce
============

- In a belgian company, set legal time type as no need approval

- as admin, take a day in the future with this time off

- in the time off form, a cancel appears (near refuse)

- Cancel the time off

The day of the time off, the flight icon is set on the employee

Purpose
=======

When cancelling a time off, we set it's `active` field to False, but its state remains `validate`,
but when fetching for users on leave, there is no check on the `active` field.

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

To solve the issue a check on `active` field was added to the query.

opw-2784173

closes odoo/odoo#87183

X-original-commit: 5d80d7c91fe05716602e2182515a4e26ea957e41
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2022-03-24 17:12:34 +01:00
Nicolas (vin) 7d0e3cd7e3 [FIX] account: remove default journal in cut-off
The journal in a cut-off has to be of type general. But there is an
issue at the moment where a default_journal_id would be provided in
the context (coming from the dashboard for example) and thus, fill
the journal in the cut-off wizard with a wrong value (vendor bill for
example).

This change make sure no default values are provided to the wizard.

closes odoo/odoo#87179

X-original-commit: 5b099bf6135b2ff517078d1839b513da7830f718
Signed-off-by: Florian Gilbert <flg@odoo.com>
Signed-off-by: Nicolas Viseur <vin@odoo.com>
2022-03-24 17:12:30 +01:00
Goffin Simonandmart-e e759e02ff3 [FIX] mrp: mrp document not displayed on product
Steps to reproduce the issue:

- create product P
- create a Engineering Change ders ECO in PLM app
- attach documents to ECO and apply changements

Bug:
- go to the product, try to open uploaded documents. they are not found

This bug happened since odoo/odoo@114b71f

opw:2762448

closes odoo/odoo#87176

X-original-commit: 779a0df6732db51af652d6c282490187d11244a1
Signed-off-by: Simon Goffin <sig@odoo.com>
Co-authored-by: mart-e <mat@odoo.com>
2022-03-24 17:12:26 +01:00
Sébastien Theys 4708c12ce5 [IMP] mail: remove _loadMore from message list component
Useless indirection.

Part of task-2801089

closes odoo/odoo#87117

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2022-03-24 17:12:22 +01:00
Antoine Guenet c4bfedc37b [ADD] mass_mailing, web_editor: add options to design a mailing globally
This adds options to the "Design" tab of mass_mailing so the user can
edit its stylesheet directly.

task-2789287

closes odoo/odoo#86881

Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-03-24 17:12:12 +01:00
Antoine Guenet a9e79f8bda [ADD] web_editor, mass_mailing: add a "Design" tab to mass_mailing
This adds a tab to mass_mailing, that will be used to style the mailing
globally.

task-2789287

Part-of: odoo/odoo#86881
2022-03-24 17:12:12 +01:00
Antoine Guenet bc86183d37 [REM] mass_mailing: remove the option to change templates during edition
The "Select a template" tab will be replaced with a a design tab. This
removes the code that managed that tab.

task-2789287

Part-of: odoo/odoo#86881
2022-03-24 17:12:12 +01:00
Brieuc-brd 9ead1efcfa [REF] mail: FollowerListMenu, review and simplify scss
Part of the overall v16 SCSS optimization/restyle, task-2704984

task-2781992

closes odoo/odoo#86727

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2022-03-24 17:12:05 +01:00
Brieuc-brd fa278c83d8 [REF] mail: ChatterContainer, review and simplify scss
Part of the overall v16 SCSS optimization/restyle, task-2704984

task-2781992

closes odoo/odoo#86331

Related: odoo/enterprise#25227
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2022-03-24 17:11:55 +01:00
Brieuc-brd 8b1e8899aa [IMP] mail: ChatWindowHiddenMenu, update the layout
Prior this commit, the `ChatWindowHiddenMenu` had a fixed width and the
`windowCounter` was truncated when the number was higher than 9.
Also, when the `unreadCounter` was displayed, it was partially hidden by
the chat windows.

After this commit, this element uses a fluid width and is in front of
the chat windows to correctly display the `unreadCounter` badge.

task-2781992

closes odoo/odoo#86244

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2022-03-24 17:11:51 +01:00
Brieuc-brd f1555eac93 [REF] mail: ChatWindowHiddenMenu, review and simplify scss
Part of the overall v16 SCSS optimization/restyle, task-2704984

task-2781992

Part-of: odoo/odoo#86244
2022-03-24 17:11:51 +01:00
Alexandre Kühn 1b5fa72056 [IMP] mail: 'ComposerSuggestion' + 'ComposerView/mainSuggestions'
Task-2793280

closes odoo/odoo#87092

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2022-03-24 13:57:46 +01:00
Odoo's Mergebot e27fcdf42e [MERGE] (test_)mail(_full): cleanup composer and post tests, add portal / rating
PURPOSE

Cleanup and improve test coverage in test_mail(_full), notably about composer,
message_post API (and its sub-methods) and attachments management.

SPECIFICATIONS

Improve tooling of mail tests. Use SMTP mockup class available in base tests
in mail tests to have a better and simplified mock tool when dealing with
mail tests. Remove old fashioned code.

Add tests related to mail failure management and its effect on mail.mail
and related mail.notification records.

Cleanup and improve composer-related tests. As composer will soon be improved
better ensure we don't break flows.

Cleanup and improve post-related tests. As composer and posting methods will
soon be improved better ensure we don't break flows.

Add some first tests about rating and rating mixin:
  * rating preparation: token, information from the record to rate;
  * rating apply: posting message, author;

See sub commits for more details.

LINKS

Task-2673913 (TestMail: Cleanup and improve test coverage)
Task-2704390 (TestMailFull: add first rating tests)

Prepares Task-2088884 (Mail: Composer Onchange to Editable Computed Stored)
Prepares Task-2710804 (Mail: Clean MailThread API)
Prepares Task-2684479 (Mail: Better send errors management)
Prepares Task-36879 (Mail: Support MultiCompany Aliases)

closes odoo/odoo#86393

Related: odoo/enterprise#25267
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2022-03-24 13:57:37 +01:00
Thibault Delavallée bf1adc2d2c [IMP] test_mail_full: add portal and rating dependencies and tests
Purpose of this commit is to add some first tests about rating and rating
mixin. Indeed those are not really tested by standard python unit tests.

In this commit we add tests about

  * rating preparation: token, information from the record to rate;
  * rating apply: posting message, author;

Task-2673913 (TestMail: Cleanup and improve test coverage)
Task-2704390 (TestMailFull: add first rating tests)

Part-of: odoo/odoo#86393
2022-03-24 13:57:36 +01:00
Thibault Delavallée 363f626a1b [IMP] test_mail_full: add performance tests
Purpose is to add some query counters tests in test_mail_full that allows to
test more complete flows. Soon portal and rating will be added as dependencies
to see their potential impact. This also serves as a basis for adding new
tests with all sub mail modules in a near future.

Task-2673913 (TestMail: Cleanup and improve test coverage)

Part-of: odoo/odoo#86393
2022-03-24 13:57:36 +01:00
Thibault Delavallée 41c3ed7693 [IMP] test_mail: add and improve posting tests
PURPOSE

Cleanup and improve post-related tests. As composer and posting methods will
soon be improved better ensure we don't break flows.

SPECIFICATIONS

Cleanup tests added for message_post and the related API (notify, log, with
view or template, ...) as well as sub-methods (notify, recipients computation
and classification, ...).

Use existing tools, reorder and add some details check on content. Add some
tests with attachments, notably with main_attachment management.

Task-2673913 (TestMail: Cleanup and improve test coverage)

Part-of: odoo/odoo#86393
2022-03-24 13:57:36 +01:00
Thibault Delavallée 94ab6963cf [IMP] test_mail: add and improve tests for composer
PURPOSE

Cleanup and improve composer-related tests. As composer will soon be improved
better ensure we don't break flows.

SPECIFCIATIONS

Cleanup existing tests: rename, make it use tools, reoder them.

Add some tests about composer in order to better spot changes and differences
as well as to help debugging mail composer code update. Notably add tests
with Form tool, add tests for reply-to computation, auto-delete, mail server.

Performance tests about composer are added, notably using the Form tool. This
helps determining differences between creating / manipulating a composer in
code and in UI. Indeed notably onchange and some side effects may lead to
different query counters, which is the case as highlighted here. Tests
involving attachments are also added to see their impact on posting process.

Task-2673913 (TestMail: Cleanup and improve test coverage)

Part-of: odoo/odoo#86393
2022-03-24 13:57:36 +01:00
Thibault Delavallée bf508a808e [IMP] test_mail: add multicompany test models
PURPOSE

Purpose of this commit is to add a company field on test mail models used to
replicate ticket / project behavior (``mail.test.ticket`` and ``mail.test.
container``).

SPECIFICATIONS

To avoid messing with existing tests and ease comparison through all Odoo
versions (notably performance) this is done by adding new models inheriting
from current mail models. A company_id field is added as well as MC rules.

Those models will be used to add tests for mail thread behavior in a multi
company environment (aliases management, performance, emails and notification
layouts, ...).

In this commit we also update ACLs for ticket-like models to add rules for
portal users, based on followers. This mimics classic rules from Odoo used
notably in a light project-like environment. This allows to test a bit more
in details recipients, access tokens, links in emails, ...

Task-2673913 (TestMail: Cleanup and improve test coverage)

Part-of: odoo/odoo#86393
2022-03-24 13:57:35 +01:00
Thibault Delavallée d895f3514e [IMP] test_mail: add tests for mail failure management
PURPOSE

Add tests related to mail failure management and its effect on mail.mail
and related mail.notification records.

SPECIFICATIONS

Test wrong configurations when sending emails (email_from, email_to) and/or
use mocks to enable sending issues (SMTP issues, Memory errors, assertion
errors, ...) that may happen when sending emails.

Add unit tests for as much use cases as possible to assert current behavior
even if some tests show that it is not always accurate. Notably

  * invalid / missing email failure types that are not correctly distinguished
    even if it should;
  * email_from invalid value goes a bit incognito;
  * sometimes mail is marked as sent even if it was not sent;

Future commits will (probably) fix or improve behavior while impacting as
less as possible the global behavior of the outgoing gateway that is quite
tricky to modify.

Task-2673913 (TestMail: Cleanup and improve test coverage)

Part-of: odoo/odoo#86393
2022-03-24 13:57:35 +01:00
Thibault Delavallée e31504f3a3 [IMP] test_mail: make performance test use standard mail test class
PURPOSE

Improve tooling of mail tests. Lessen custom code, try to use same tools
in all tests.

SPECIFICATIONS

Use MailCommon as a base class for performance test. It now uses the same
boilerplate as other tests, leading to easier to reproduce and understand
testing setup.

This notably now adds outgoing mail servers which means adding one query
to some tests involving emails.

Task-2673913 (TestMail: Cleanup and improve test coverage)

Part-of: odoo/odoo#86393
2022-03-24 13:57:35 +01:00
Thibault Delavallée 6d166d6088 [IMP] base, mail_*: use MockSmtplibCase and improve tests tooling
mail_* = mail, test_mail, test_mail_full, test_mass_mailing

PURPOSE

Improve tooling of mail tests. Use SMTP mockup class available in base tests
in mail tests to have a better and simplified mock tool when dealing with
mail tests. Remove old fashioned code.

SPECIFICATIONS

Include ``MockSmtplibCase`` directly into ``MockEmail`` so that we re-use
existing components for mocking outgoing emails. Also make parameters for
gateway coherent between those two classes (use same test values).

Remove 'sim_error' weird parameter of Mail ``mock_mail_gateway`` and use
standard mock 'side_effect' instead in some specific tests, notably on
SMTP.connect() mock.

Add some assert / tools method and improve existing tools, used for creating
or improving test data. This will be used in future commits when adding new
tests.

Add outgoing mail servers data in mail tests, allowing to make tests closer
to real life use cases.

Remove unnecessary calls to ``_init_mail_gateway`` as it is automatically
done in ``MailCommon.setUpClass()``.

Try to consolidate starting test data, notably with countries, phone numbers
or email in mind to be sure test mail are deterministic.

Task-2673913 (TestMail: Cleanup and improve test coverage)

Part-of: odoo/odoo#86393
2022-03-24 13:57:35 +01:00
Thibault Delavallée c2fd9a4965 [IMP] (test_)mail: allow attachment propagation in all activity feedback methods
Activity-level feedback method accepts attachment_ids but not its mixin-level
counterpart. This commit fixes that by adding the parameter. The activity-level
action_feedback_schedule_next method now also accepts attachments in addition
to the feedback, making the API coherent through all entry points.

At activity level ``action_done`` now goes through ``action_feedback``. This
means it now has two main methods
  * ``action_feedback``;
  * ``action_feedback_schedule_next``;

All methods finally end up calling ``_action_done`` and correctly propagate
feedback and attachments. We have a bit less entry points with possible API
changes.

Test mail models are updated to be able to use this small addition.

Task-2710804 (Mail: Clean MailThread API)

Part-of: odoo/odoo#86393
2022-03-24 13:57:34 +01:00
Davan CHIEM DAO dc9ebd3472 [FIX] l10n_it_edi: Discount computation from invoice import
This fixes the how general discounts and product discounts are represented in the Italian EDI.

Previously, discounts were erroneously calculated and represented on several invoice lines not linked to the product.
Now, cascading discounts are summaries as 1 percentage discount for products and 1 amount for the general discount.

closes odoo/odoo#85863

Task: 2764978
X-original-commit: 5769f13e48c5b68bf19fc82377b9ea716ea4a85e
Signed-off-by: Josse Colpaert <jco@odoo.com>
2022-03-24 13:57:15 +01:00
Pouya Malekinejad eb23c0c9d5 [IMP] *: unify contact widget usage with VAT
The contact widget supports displaying VAT but it was added manually in the reports after contact. This commit fixes this behavior and results in fewer code and an easier way for the l10n modules which may modify VAT display.

closes odoo/odoo#83733

Related: odoo/enterprise#25195
Signed-off-by: Laurent Smet <las@odoo.com>
2022-03-24 13:57:11 +01:00
Adrien Widart c3fff714c5 [IMP] stock: set partner for inter-warehouse transfers
Test af13e76629

closes odoo/odoo#87118

X-original-commit: cb93c259bf5e3aac4ae8fbbd071c68c8dd049911
Signed-off-by: Steve Van Essche <svs@odoo.com>
Signed-off-by: Adrien Widart <awt@odoo.com>
2022-03-24 12:57:33 +01:00
Andrea Grazioso (agr-odoo) 7d028396e0 [FIX] l10n_cl: unable to issue credit note
Have a CL company setup
Issue an invoice
Then generate the credit note via 'Add Credit Note' wizard
Add a reason (credit method is locked to 'partial refund') and confirm
Error will raise “You can not use a invoice document type with a refund
invoice”

This occur after
https://github.com/odoo/enterprise/commit/9e049b833b23809e4287ef61ddf7482413debefd

We now fall back to the logic of l10n_latam_invoice_document
which, in turns, fall back to the l10n_cl, ignoring the 'credit_note'
case.

opw-2794515

closes odoo/odoo#87116

X-original-commit: c9ff9d28ab75c02093ca54d9fbd1d2e203c5ee2e
Signed-off-by: Josse Colpaert <jco@odoo.com>
Signed-off-by: Grazioso Andrea (agr) <agr@odoo.com>
2022-03-24 12:57:29 +01:00