Because the `savepoint` and `clear` calls are nested inside the
`assertRaises` context, if one of them happens to throw *the exception
we're looking for* the interpreter will jump back to the `with`, the
`assertRaises` will swallow the exception (and count it as a success)
and the function will end having not gone through a `yield`.
This is rather frustrating to debug as it's easy to forget that a
`with` is a control flow structure, leading to a seemingly impossible
error.
We can fix this by initializing and `__enter__`-ing the savepoint
first, but doing this by hand is a bit iffy and not really
future-proof as the addition of more fallible steps during the
initialization phase of `_assertRaises` could lead to the savepoint
not being properly disposed of. Furthermore once in the scope of the
"actual" assertRaises we want the savepoint to unwind first (otherwise
the savepoint won't be rolled back when the exception *we are
expecting* gets raised).
As it turns out `ExitStack` offers the solution to our woes though
it's a bit tricky at first glance: while modifying the cleanup queue
in-place is haram, `pop_all` allows moving cleanup callbacks from one
queue to the next.
This means we can first add the savepoint to one stack and get its
errors (if any) correctly reported, cover the rest of the
initialization, then move the savepoint from one stack to an other, in
order to correctly order the coverage of the `yield` (and the userland
code).
closesodoo/odoo#87733
X-original-commit: b1cd4e4e3c918b4b08d27b30b1017fc898d4b08a
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
Purpose
=======
As it has been done for Gmail, we want to add the OAuth authentication
for the incoming / outgoing mail server.
Specifications
==============
The user has to create a project on Outlook and fill the credentials
in Odoo. Once it's done, he can create an incoming / outgoing mail
server.
For the authentication flow is a bit different from Gmail. For Outlook
the user is redirected to Outlook where he'll accept the permission.
Once it's done, he's redirected again to the mail server form view and
the tokens are automatically added on the mail server.
Technical
=========
There are 3 tokens used for the OAuth authentication.
1. The authentication code. This one is only used to get the refresh
token and the first access token. It's the code returned by the user
browser during the authentication flow.
2. The refresh token. This one will never change once the user is
authenticated. This token is used to get new access token once they
are expired.
3. The access token. Those tokens have an expiration date (1 hour) and
are used in the XOAUTH2 protocol to authenticate the IMAP / SMTP
connection.
During the authentication process, we can also give a state that will
be returned by the user browser. This state contains
1. The model and the ID of the mail server (as the same mixin manage
both incoming and outgoing mail server)
2. A CSRF token which sign those values and is verified once the browser
redirect the user to the Odoo database. This is useful so a malicious
user can not send a link to an admin to disconnect the mail server.
Task-2751996
closesodoo/odoo#87731
Forward-port-of: odoo/odoo#87682
Forward-port-of: odoo/odoo#87040
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Purpose
=======
As it has been done for Gmail, we want to add the OAuth authentication
for the incoming / outgoing mail server.
Specifications
==============
The user has to create a project on Outlook and fill the credentials
in Odoo. Once it's done, he can create an incoming / outgoing mail
server.
For the authentication flow is a bit different from Gmail. For Outlook
the user is redirected to Outlook where he'll accept the permission.
Once it's done, he's redirected again to the mail server form view and
the tokens are automatically added on the mail server.
Technical
=========
There are 3 tokens used for the OAuth authentication.
1. The authentication code. This one is only used to get the refresh
token and the first access token. It's the code returned by the user
browser during the authentication flow.
2. The refresh token. This one will never change once the user is
authenticated. This token is used to get new access token once they
are expired.
3. The access token. Those tokens have an expiration date (1 hour) and
are used in the XOAUTH2 protocol to authenticate the IMAP / SMTP
connection.
During the authentication process, we can also give a state that will
be returned by the user browser. This state contains
1. The model and the ID of the mail server (as the same mixin manage
both incoming and outgoing mail server)
2. A CSRF token which sign those values and is verified once the browser
redirect the user to the Odoo database. This is useful so a malicious
user can not send a link to an admin to disconnect the mail server.
Task-2751996
X-original-commit: 18dad5b13b0af81ef2089fc039b3a866a2895a53
Part-of: odoo/odoo#87731
Purpose
=======
Do not reset the email configuration when unchecking "is Gmail".
Task-2751996
X-original-commit: d65aef9829cf5554c8d4a6c107ba5269a054ed78
Part-of: odoo/odoo#87731
Bug
===
When we copy a GMail outgoing / incoming mail server, an error
occurs because we try to refetch the access token, based on the same
authorization code (which can be used only once).
To fix this issue, we do not copy the authorization code (and other
related fields).
Task-2751996
X-original-commit: 47c056215c5f50d8a1d9e862ee275eceefdb09e7
Part-of: odoo/odoo#87731
* Redesign views
* New layout for the job kanban card + redesigned menu
* Create new reports
* Candidate Sources: get a better view on where applicants are
coming from;
* Time in Stage: shows how long an applicant is in the current
stage.
* Archiving a job archives applicants as well
odoo/enterprise#24816odoo/upgrade#3395closesodoo/odoo#85479
Taskid: 2738082
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
The resequence feature and the possibility to edit the invoice number in
draft are powerful flexibility tools. Though, misusing them can lead to
holes in a sequence that can be hard to detect.
This task aims at providing alerts on the dashboard (on Sales and
Purchases journals' cards) highlighting the holes in the sections
_____________
Suppose the following sequence on a journal
BILL/2022/01/0001
BILL/2022/01/0002
BILL/2022/01/0004
> BILL/2022/01/0003 is missing.
Then show a link on this journal's card in the kanban view of journals
(accounting dashboard) mentioning.
> Check the sequence
Pressing the button opens the list view of bills on this specific
journal.
BILL/2022/01/0004 appears in red ; since it is after a hole
task-2767272
closesodoo/odoo#84788
Signed-off-by: Laurent Smet <las@odoo.com>
This commit adds an information in the topbar (thus always visible)
to indicate the number of tests that have passed, failed and the
number of tests that have been skipped.
closesodoo/odoo#87713
Signed-off-by: Samuel Degueldre <sad@odoo.com>
In 2685472 new computed fields were added in calendar_event. This commit
updates the query counter tests that were failing.
task-2685472
closesodoo/odoo#79654
Related: odoo/upgrade#3182
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
This commit aims to integrate the calendar module with discuss video calls.
Now it is possible to add discuss videocalls by clicking on a button below
the videocall_location field. The discuss videocall_location is a URL that
is computed and it creates a discuss channel only when someone accesses that
URL.
For recurring events, the same discuss channel is used for all events.
However, each event in the recurrency has its own videocall_location URL.
This is done on purpose in order to allow the functionality even if the base
event of the recurrency is deleted. For single events, each event will create
a discuss channel.
task-2685472
Part-of: odoo/odoo#79654
Currently in calendar if you double click an event in the calendar view, it
opens a dialog with the event title as undefined. This occurs, because the
title is not correctly passed in the context. This commit adds the correct
title to it, therefore fixing the error.
task-2685472
Part-of: odoo/odoo#79654
Italian translation added.
Add string parameter to the fields so that the filter names are more
usable. Since the filter names are taken automatically from the field
names, the string paramter allows us to change the filter names:
L10N It Edi Transaction -> FatturaPA Transaction
L10N It Edi Attachment -> FatturaPA Attachment
L10N It Send State -> FatturaPA Send State
closesodoo/odoo#87711
Task-id: 2795241
X-original-commit: 6473aa55f08d130119aceb15deee68eb041bf25e
Signed-off-by: Josse Colpaert <jco@odoo.com>
Signed-off-by: Daniel Kosky (dako) <dako@odoo.com>
This commit adds a name argument to the create_group method as it is
useful to create a group channel and set its name directly on the
create.
task-2685472
closesodoo/odoo#87703
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
In mail we currently create the invitation URL by concatenating the values when
needed. However this could be improved so that when this url is used in other
places we don't need to create it again. Therefore it makes sense to have a
computed field that does that for us.
task-2685472
closesodoo/odoo#87701
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
In preparation of test adaptation after introducing a new way to
seed test data, the fake model present on the m2x avatar employee test
has been registered to the model definitions instead of being
declared on it's test.
task-2792108
closesodoo/odoo#87665
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
When getting l10n_ar/l10n_cl starting_squence check with the proper
company (self.company_id) and not self.env.company_id
We do not put a journal_id anymore as it should take the correct one
automatically in v15.
Original commit d6f4fee58edf103c63836ac488be240961fd671a
closesodoo/odoo#87219
X-original-commit: f2f76dfa195226b7604076830412706447c168f2
Signed-off-by: Josse Colpaert <jco@odoo.com>
Before this change, we have the errors that documents generated on
pre-printed sales journals mark as unified book were wrongly
named using the wrong doc prefix code.
This was visible thanks to the demo data were we notices that the credit
notes were having FA- doc prefix instead of NC-
This was because we are reusing the shared sequence directly, now we
check and fix the doc prefix for those cases and all documents generated
on shared sequences are properly named.
closesodoo/odoo#86612
X-original-commit: df5bfd22c20d3a3bd72b04acbdae63657e025ce3
Signed-off-by: Josse Colpaert <jco@odoo.com>
Currently, when changing qty_producing on a MO, consumed number of each
component will always be updated. In this commit, we add a new boolean
field manual_consumption to bom.line. If checked, that line won't be
updated when changing qty_producing.
The same but invisible field manual_consumption is also added to each
line on MO. It will use the value on BOM as defualt value. When user
manually set the consued qty, it will be checked automatically. Also,
when user manually update the SML, the field on SM will also be set to
true.
Task-2687494
closesodoo/odoo#80118
Related: odoo/enterprise#25607
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Before this commit:
At least if website_livechat is installed, the livechat visitor (website visitor)
country is displayed twice in channel name: once from the country inside the
name of livechat_visitor and once from the country of the actual
website_visitor.
After this commit:
Livechat visitor country will be displayed only once instead of twice
Task-2668051
closesodoo/odoo#81398
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Prior to this commit the create_employee option was enabled by default
even from the employee's form view which would lead to a loop.
closesodoo/odoo#87670
Signed-off-by: Kevin Baptiste <kba@odoo.com>
Use case
--------
Field computed with precompute=True at creation get the value
of the float without beeing rounded this can lead to rounding
issue where the value computed at creation is different from
the value computed later.
This can lead to the following issue
A so line is create with a unit price of 192 and a discount of
74.246 the price subtotal it thus 49.45
Later a invoice is created based on the same unit price and a discount
rounded at 74.25 and thus a subtotal 49.44
Solution
--------
Since the issue is not fixed (yet) in the orm, we have to format the
provided discount before the record creation (and precomputation)
to make sure the decimal precision is properly applied and that
no incoherence is introduced in the final record values.
closesodoo/odoo#87661
X-original-commit: 2257ac71596033d8d9f1deaf642071124817de3f
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
How to reproduce the bug:
- Install the account app
- Get a FacturX invoice with a discount on item
- Upload the invoice
- Check that the price of the discounted item takes the
discount into account
Bug:
If you want to upload a FacturX invoice that contains a discount,
Odoo will take the original price into account instead of the
discounted one.
opw-2705291
closesodoo/odoo#87509
X-original-commit: 43fb1c47b4867ac9b1fe7c3dd30e8bed7bd93f13
Signed-off-by: Adrien Minet <admi@odoo.com>
Signed-off-by: William André (wan) <wan@odoo.com>
When a contract is about to end, an activity is scheduled for the hr
responsible to act on it. Also, from task 2759601, a new warning was created
showing the contracts that are about to end. Therefore, sending an email to
the hr responsible started being too intrusive. This commit drops the email
sending for this case.
task-2759601
closesodoo/odoo#86379
Related: odoo/upgrade#3359
Related: odoo/enterprise#24287
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
The get_model_definitions method returns default values for each field. Those default
values are wrong most of the time (dynamic values, reference to non created records on
the client side, ...).
task-2792108
closesodoo/odoo#87641
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Define "Bootstrap v5 ready" utility-class to handle font-style.
This class definition can be safely removed after migrating to v5.
This class is needed for https://github.com/odoo/odoo/pull/87639
task-2811202
closesodoo/odoo#87637
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
The target "main" feature has been lost during the conversion of
the ActionManager into the action service. An action with target
"main" should always clear the breadcrumbs. This commit
re-introduces the feature.
Fixes#83865closesodoo/odoo#87610
X-original-commit: 78ec7281ed550eb24629c1b81445b753314d292f
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Co-authored-by: "Aaron Bohy <aab@odoo.com>"
Unpaid orders are preserved in the local storage and can be recovered
even if you close the session and open a new one. But they would be
removed if they didn't contain any lines (articles).
On the other hand, it's possible to remove all of the order's lines
after receiving payment. So it's essential to preserve an order which
contains a payment.
Steps to reproduce the issue:
1_ Open a PoS session and create a new order
2_ Add some articles and proceed with the payment
3_ Select one of the payment methods to make the payment
4_ Do not validate the session and click on the "Back" button
5_ Remove all of the order's article and close the session
6_ Open a new session from the same PoS
=> The order with the received payment is removed
The solution is to preserve the orders with a payment line.
opw-2766658
closesodoo/odoo#87502
X-original-commit: c15bc2818d928a102fc58f4cb2ea1a4a7f8755a2
Signed-off-by: Quentin Lejeune (qle) <qle@odoo.com>
Signed-off-by: Masereel Pierre <pim@odoo.com>
Step to reproduce:
- Create a pricelist with 20% discount and
Show discount to the user
- In a SO with public pricelist, add option line OL
- Change pricelist to the one created earlier
Current behaviour:
- OL unit price is 80% of list price
- OL discount is 0%
Behaviour after PR:
- OL unit price is 100% of list price
- OL discount is 20%
opw-2761252
closesodoo/odoo#87640
X-original-commit: 0d4293da09821016d9db56ec1f36fbeff3bf8ef2
Signed-off-by: Damhaut Florian (flda) <flda@odoo.com>
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
Steps to reproduce
- Install procurement_jit
- Go to settings
- Search for 'serv'
-> Re**serv**ation is highlighted but also ba**se**d
closesodoo/odoo#87611
X-original-commit: 8bbfbfbf0eb6c2238542166984b558b5734c7a2a
Signed-off-by: Hubert Van De Walle <huvw@odoo.com>
Steps to follow
- Go to Settings
- Type 'Import' in the search bar
-> 'Import & Export' is displayed
Cause of the issue
`_wordHighlighter` works on the HTML as a string
Solution
- Use textContent to get the correct text value
- Replace the content of the highlighted element by
* a textnode with the text before the matched substring
* a `span.highlighter` with the search word
* a textnode with the text after the matcher substring
Other issues
A string concatanated css rule was used to filter the matching elements
This could cause an invalid selector
-> Filter nodes by their textContent instead.
opw-2778304
X-original-commit: fba1b833eab46ff7a20f7151978394da3aaaa566
Part-of: odoo/odoo#87611
On a SO, the delivered quantity of a dropshipped kit is incorrect in
case of a return
To reproduce the issue:
1. Activate Dropshipping
2. Create 3 products: KIT AB, A, B:
- All have the Dropship route and a supplier set
3. Create a BOM of type kit: KIT AB is composed of A & B
4. Create a SO for 1 unit of KIT AB, validate
5. Validate the created PO
6. Deliver the products
7. Create a return for these products
- Error: On the SO, the delivered quantity is 0 but the return is
not validated yet. This quantity should still be 1
8. Validate the return
- Error: On the SO, the delivered quantity is now 1, it should be 0
The 'all or nothing' policy should correctly consider the returns: all
moves (to customer) must be done and the returns must be delivered back
to the customer
OPW-2759250
closesodoo/odoo#87596
X-original-commit: f259d10db577bbf1b11fffd028e678b38d5f402d
Signed-off-by: Tiffany Chang <tic@odoo.com>
Signed-off-by: Adrien Widart <awt@odoo.com>
Steps to reproduce:
1. Install sales
2. Change Mitchell Admin contacts so that he is set in the "YourCompany" company
3. Create a quotation with Michell Admin as the customer
4. Put any item and confirm the quote
5. Receive the product and create the invoice
6. Go to the invoice, confirm the payment and register it
Issue:
-> Error with the journal id
Cause:
The payment is considered as internal payment and in https://github.com/odoo/odoo/blob/6d129783b53115927f664499207c8c800d40bca2/addons/account/models/account_payment.py#L886-L895
There is no destination_journal which violates not-null constraint
Solution:
Be sure that there is a destination journal when `is_internal_transfer` is computed.
opw-2753819
closesodoo/odoo#87625
X-original-commit: 362d8cbf7724431672b8b73fb5f4682d4d2c3f66
Signed-off-by: William André (wan) <wan@odoo.com>
Signed-off-by: yosa-odoo <yosa@odoo.com>