Friday, December 16, 2022
36 changes · master
Enhancements to existing features
The event form now displays the responsible person with an avatar, making it easier for users to recognize who owns an event at a glance. This is a small usability improvement that adds visual context without changing event workflows.
Original PR description
This commit adds the avatar widget to the responsible field in the event form view. Task-3100951 --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr
This update removes unnecessary content from several app manifest files and adds an automated check to keep them concise in the future. It helps maintainers more easily spot meaningful custom behavior and reduces future cleanup work, with no expected impact on day-to-day users.
Employee contract forms in the Belgian payroll fleet module now show the vehicle fuel type. This helps HR and payroll teams see relevant fleet information directly on the contract, reducing the need to look it up elsewhere.
Original PR description
This commit adds the fuel type in the form view of hr.contract. task-3092624
Resolved issues and error corrections
This fixes an automated barcode receipt test so it waits until the confirmation button is ready before proceeding. It helps prevent false test failures in the inventory barcode workflow, improving confidence in future updates without changing user-facing behavior.
Original PR description
The tour `test_gs1_receipt_lot_serial` tests we can manually write and confirm a barcode, but by checking that, it doesn't wait the "Apply" button is clickable (it's disabled if the input is empty). runbot error id: 13671
Code cleanup and technical improvements
This update removes unnecessary empty configuration entries from several Odoo app manifests. It does not change business functionality, but keeps module definitions cleaner and easier to maintain.
Miscellaneous changes
The field was not taking the full size it was allowed to, hence it was not possible to write the content. task-3087717 Forward-Port-Of: odoo/odoo#108057
Original PR description
The field was not taking the full size it was allowed to, hence it was not possible to write the content. task-3087717 Forward-Port-Of: odoo/odoo#108057
Original PR description
Keep the manifests as light as possible, to easily see custom behavior/content. Complete the work of previous commits cleaning the manifests content: * https://github.com/odoo/odoo/commit/42bad1a6d21e086e3bb766f9813d65902b3c232a * https://github.com/odoo/odoo/commit/ef7005f52416912a9efab5ec2767432c4181fb4d and make sure this kind of cleanup commit is not necessary in the future because it is now automatically verified by a dedicated test. Enterprise PR: https://github.com/odoo/enterprise/pull/34903 --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr
Original PR description
Remove empty demo/data tags, uselessly specified since identical to the default manifest values. Community PR: https://github.com/odoo/odoo/pull/107735
Add an unique index for the t-foreach as it would raise an error in debug mode. Steps to reproduce: - Activate debug mode - Go to Inventory -> Products - Select Desk Combination (or any product that has some activity that will appear on the forecast report like purchases and sales) Part of task-2985735 --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr Forward-Port-Of: odoo/odoo#104969
Original PR description
Add an unique index for the t-foreach as it would raise an error in debug mode. Steps to reproduce: - Activate debug mode - Go to Inventory -> Products - Select Desk Combination (or any product that has some activity that will appear on the forecast report like purchases and sales) Part of task-2985735 --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr Forward-Port-Of: odoo/odoo#104969
Since this commit [1], the "avatar" image of the logged user is no longer displayed on the "boxed" header template. This is due to the "t-nocache" attribute which was forgotten for the "_avatar" parameter in the "user_dropdown" template. [1]: https://github.com/odoo/odoo/commit/b0a2a41d78292cb8b9e53788d40c6dc5915a466d task-3063878 Forward-Port-Of: odoo/odoo#105772
Original PR description
Since this commit [1], the "avatar" image of the logged user is no longer displayed on the "boxed" header template. This is due to the "t-nocache" attribute which was forgotten for the "_avatar" parameter in the "user_dropdown" template. [1]: https://github.com/odoo/odoo/commit/b0a2a41d78292cb8b9e53788d40c6dc5915a466d task-3063878 Forward-Port-Of: odoo/odoo#105772
Prior to this PR, the layout of the settings in the kanban card was broken task-3087801 Forward-Port-Of: odoo/odoo#107034
Original PR description
Prior to this PR, the layout of the settings in the kanban card was broken task-3087801 Forward-Port-Of: odoo/odoo#107034
Description of the issue/feature this PR addresses: install l10n_ph module and open any vendor bill, click on action button and click Download BIR 2307 XLS, in the opening wizard, the one2many field moves_to_export is not aligned well in the form due to missing colspan and currently the field is too compact in the form. Current behavior before PR: 
Original PR description
Description of the issue/feature this PR addresses: install l10n_ph module and open any vendor bill, click on action button and click Download BIR 2307 XLS, in the opening wizard, the one2many field moves_to_export is not aligned well in the form due to missing colspan and currently the field is too compact in the form. Current behavior before PR:  Desired behavior after PR is merged:  --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr Forward-Port-Of: odoo/odoo#107676
--- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr Forward-Port-Of: odoo/odoo#107866
Original PR description
--- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr Forward-Port-Of: odoo/odoo#107866
On clicking "add to cart" button, there is a simple animation of product image moving to the cart icon. However, if the cart icon is hidden because of disabled option "Show Empty Cart", the animation is broken: the image is moving to left corner of the navbar. Fix it by showing cart icon before starting the animation. opw-3078396 # Before [screencast-devel.16.localhost-2022.11.29-14_05_51.webm](https://user-images.githubusercontent.com/186131/204539334-741caed4-96cd-4e07-ba4c-0b31cfd05
Original PR description
On clicking "add to cart" button, there is a simple animation of product image moving to the cart icon. However, if the cart icon is hidden because of disabled option "Show Empty Cart", the animation is broken: the image is moving to left corner of the navbar. Fix it by showing cart icon before starting the animation. opw-3078396 # Before [screencast-devel.16.localhost-2022.11.29-14_05_51.webm](https://user-images.githubusercontent.com/186131/204539334-741caed4-96cd-4e07-ba4c-0b31cfd05cae.webm) # After [screencast-devel.16.localhost-2022.11.29-14_07_10.webm](https://user-images.githubusercontent.com/186131/204539378-beded981-d224-403e-9167-b5a6054e16f2.webm) Forward-Port-Of: odoo/odoo#106777
**Description of the issue/feature this PR addresses:** currently the web module can be uninstalled from the db and which will leads to non usable db. version: 14 and above **Current behavior before PR:** web module can be uninstalled from db. **Desired behavior after PR is merged:** web module cannot be uninstalled from db, similar to base module. --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr Forward-Port-Of: odoo/odoo#106377
Original PR description
**Description of the issue/feature this PR addresses:** currently the web module can be uninstalled from the db and which will leads to non usable db. version: 14 and above **Current behavior before PR:** web module can be uninstalled from db. **Desired behavior after PR is merged:** web module cannot be uninstalled from db, similar to base module. --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr Forward-Port-Of: odoo/odoo#106377
Steps to reproduce: - generate password reset link - access the link - the page redirects to login Bug: password reset and new account creation share the same path this [commit] made it so when you click on the new account link after it was activated you are redirected to login Fix: the distinction between both scenarios is made using the presence of 'signup_email' in the query. only add signup_email when creating a new account opw-3068790 [commit]:https://github.com/odoo-dev/odo
Original PR description
Steps to reproduce: - generate password reset link - access the link - the page redirects to login Bug: password reset and new account creation share the same path this [commit] made it so when you click on the new account link after it was activated you are redirected to login Fix: the distinction between both scenarios is made using the presence of 'signup_email' in the query. only add signup_email when creating a new account opw-3068790 [commit]:https://github.com/odoo-dev/odoo/commit/97658791306349456761ba4c18d504f861e3bb98 --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr Forward-Port-Of: odoo/odoo#107347
The URLs in notes created from the systray were not transformed into links. This solves the problem. Task-3052952 Description of the issue/feature this PR addresses: Current behavior before PR: Desired behavior after PR is merged: --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr Forward-Port-Of: odoo/odoo#105989
Original PR description
The URLs in notes created from the systray were not transformed into links. This solves the problem. Task-3052952 Description of the issue/feature this PR addresses: Current behavior before PR: Desired behavior after PR is merged: --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr Forward-Port-Of: odoo/odoo#105989
Prevent the editor to inserting html during pasting or dropping in editable zone that will not support the html content received. task-2990147 --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr Forward-Port-Of: odoo/odoo#108123 Forward-Port-Of: odoo/odoo#107640
Original PR description
Prevent the editor to inserting html during pasting or dropping in editable zone that will not support the html content received. task-2990147 --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr Forward-Port-Of: odoo/odoo#108123 Forward-Port-Of: odoo/odoo#107640
Steps to reproduce the bug: - Installe `sale_stock` - Create a storable product “P1” - Create a SO: - Add the product “P1” - Save - click on `See the Forecasted View.` Problem: A User error is triggered `”Record does not exist or has been deleted. (Record: product.template(43,), User: 2)”` Because the id of `product.product` is used in the model `product.template` When the button is clicked, https://github.com/odoo/odoo/blob/73155293d503e3a9dd65898b8e1ac489e279c33c/a
Original PR description
Steps to reproduce the bug: - Installe `sale_stock` - Create a storable product “P1” - Create a SO: - Add the product “P1” - Save - click on `See the Forecasted View.` Problem: A User error is…
Steps to reproduce the bug:
- Installe `sale_stock`
- Create a storable product “P1”
- Create a SO:
- Add the product “P1”
- Save
- click on `See the Forecasted View.`
Problem:
A User error is triggered `”Record does not exist or has been deleted. (Record: product.template(43,), User: 2)”`
Because the id of `product.product` is used in the model `product.template`
When the button is clicked,
https://github.com/odoo/odoo/blob/73155293d503e3a9dd65898b8e1ac489e279c33c/addons/sale_stock/static/src/widgets/qty_at_date_widget.xml#L63
The `openForecast` function on the js side is triggered, the correct report and model are set:
https://github.com/odoo/odoo/blob/73155293d503e3a9dd65898b8e1ac489e279c33c/addons/sale_stock/static/src/widgets/qty_at_date_widget.js#L16-L19
Then, the `_getReportValues` function is triggered, in which we check if it is a template or a variant. So we get the `active.model` from the context
https://github.com/odoo/odoo/blob/e176ba0b77aa692c16160a1e7bf471e19719e3fb/addons/stock/static/src/stock_forecasted/stock_forecasted.js#L40
but then we set the `res.model` to false, because `original_action` is not false and `originalContextAction` has no `active.model`
https://github.com/odoo/odoo/blob/e176ba0b77aa692c16160a1e7bf471e19719e3fb/addons/stock/static/src/stock_forecasted/stock_forecasted.js#L46-L49
so :
https://github.com/odoo/odoo/blob/e176ba0b77aa692c16160a1e7bf471e19719e3fb/addons/stock/static/src/stock_forecasted/stock_forecasted.js#L52 Will be true
opw-3100964
Forward-Port-Of: odoo/odoo#108113To Reproduce ============ - on a db with sales, website and Stripe payment aquirer activated - on the portal of a user add two payment methods, an expired card and a valid one - create a SO and generate its payment link - try to pay with the invalid card first -> and error (card was declined) - try to pay with the valid card -> error (same idempotency key) Problem ======= the generation of the idempotency key is based only on dbuuid, transaction's reference and the scope. So in this
Original PR description
To Reproduce ============ - on a db with sales, website and Stripe payment aquirer activated - on the portal of a user add two payment methods, an expired card and a valid one - create a SO and…
To Reproduce ============ - on a db with sales, website and Stripe payment aquirer activated - on the portal of a user add two payment methods, an expired card and a valid one - create a SO and generate its payment link - try to pay with the invalid card first -> and error (card was declined) - try to pay with the valid card -> error (same idempotency key) Problem ======= the generation of the idempotency key is based only on dbuuid, transaction's reference and the scope. So in this use case it will generate the same key. Solution ======== The idempotency key prevents issues where the customer is charged twice for the same thing. In this case, we don't want to prevent anything since the customer is on the page. It's suggested to use idempotency keys only for offline payment when the customer is not in front of the payment page (e.g. when the cron charges the customer for his subscription) opw-3091354 Forward-Port-Of: odoo/odoo#108130 Forward-Port-Of: odoo/odoo#107723
Steps to reproduce the bug: - Add a "Table of Content" on the website. - Try to save a "Block" of the table. - On -V14, you get an error message. -V15, it keeps loading forever. -V16, you get a white page. After discussion with the PO, it appears that the users should not have the possibility to save part of a snippet. The goal of this commit is to ensure that the save option applies on a snippet. If it is the case, the user has the possibility to save it. If not, the user d
Original PR description
Steps to reproduce the bug:
- Add a "Table of Content" on the website.
- Try to save a "Block" of the table.
- On -V14, you get an error message.
-V15, it keeps loading forever.
-V16, you get a white page.
After discussion with the PO, it appears that the users should not have
the possibility to save part of a snippet. The goal of this commit is
to ensure that the save option applies on a snippet. If it is the case,
the user has the possibility to save it. If not, the user does not have
the opportunity to save it.
opw-3056913
Forward-Port-Of: odoo/odoo#107012Before this commit, website_livechat_chatbot_flow_tour failed frequently and non-deterministically at 1st step "Hello! I'm a bot". This happens because the tour starts on url `/`, then reload the url `/`. The livechat button is configured in `auto_popup` mode, which could let chatbot starts running before the 2nd url that must precede the steps. The 2nd url reload is actually useless, and removing it also fixes the issue. Forward-Port-Of: odoo/odoo#108109
Original PR description
Before this commit, website_livechat_chatbot_flow_tour failed frequently and non-deterministically at 1st step "Hello! I'm a bot". This happens because the tour starts on url `/`, then reload the url `/`. The livechat button is configured in `auto_popup` mode, which could let chatbot starts running before the 2nd url that must precede the steps. The 2nd url reload is actually useless, and removing it also fixes the issue. Forward-Port-Of: odoo/odoo#108109
The default account was marked as required in the view (bold underline) but the validation didn't happen. This made it possible to set up journals without that required field. Since owl, only the last `required` attribute is remembered, so we need to define it at least correctly on the last field declaration. Related: 48ef812a635f70571b395f82ffdb2969ce99da9e bd6b98a65fca59e804faefea129c9e18acb196a6 [opw-3061073](https://www.odoo.com/web#id=3061073&model=project.task) Forward-Port-Of: o
Original PR description
The default account was marked as required in the view (bold underline) but the validation didn't happen. This made it possible to set up journals without that required field. Since owl, only the last `required` attribute is remembered, so we need to define it at least correctly on the last field declaration. Related: 48ef812a635f70571b395f82ffdb2969ce99da9e bd6b98a65fca59e804faefea129c9e18acb196a6 [opw-3061073](https://www.odoo.com/web#id=3061073&model=project.task) Forward-Port-Of: odoo/odoo#107222
The goal of this PR is to add some missing translation source terms for "Attribute Categories" view placeholder (added in [1]). [1]: https://github.com/odoo/odoo/commit/82e9afeff8bb4bd64c5f0fb95af4f4b7a66e722d task-2973149 Forward-Port-Of: odoo/odoo#107974
Original PR description
The goal of this PR is to add some missing translation source terms for "Attribute Categories" view placeholder (added in [1]). [1]: https://github.com/odoo/odoo/commit/82e9afeff8bb4bd64c5f0fb95af4f4b7a66e722d task-2973149 Forward-Port-Of: odoo/odoo#107974
**Current behavior before PR:** command prompt is not displayed when html field has placeholder. **Desired behavior after PR is merged:** placeholder is replaced with command prompt when focused. **Task**-2881079 Forward-Port-Of: odoo/odoo#108058 Forward-Port-Of: odoo/odoo#106305
Original PR description
**Current behavior before PR:** command prompt is not displayed when html field has placeholder. **Desired behavior after PR is merged:** placeholder is replaced with command prompt when focused. **Task**-2881079 Forward-Port-Of: odoo/odoo#108058 Forward-Port-Of: odoo/odoo#106305
# Current behaviour In the project update dashboard, invoices and bills that are created directly (without sales order or purchase order) are not taken into account in the calculations for profits/costs. # Expected behaviour They should be taken into account, as long as the line on them has the analytic account line on it. # Steps to reproduce - Install Project, Sales, Purchase, Accounting - Activate "Analytic Accounting" in Settings - Create a new Project and create a new analytic ac
Original PR description
# Current behaviour In the project update dashboard, invoices and bills that are created directly (without sales order or purchase order) are not taken into account in the calculations for…
# Current behaviour In the project update dashboard, invoices and bills that are created directly (without sales order or purchase order) are not taken into account in the calculations for profits/costs. # Expected behaviour They should be taken into account, as long as the line on them has the analytic account line on it. # Steps to reproduce - Install Project, Sales, Purchase, Accounting - Activate "Analytic Accounting" in Settings - Create a new Project and create a new analytic account for the project - Create a Bill with a product (storable/consumable) and the analytic account on the line - Post the bill - Go to your project update dashboard and notice the cost of the bill is not taken into account, but we do have a smart button that goes to the bills # Reason for the problem Profits/Costs calculations are done based on the sales/purchase orders, missing the "orphaned" invoices and bills. A side effect of this problem, storable products on sales are also not taken into account, since Sales Orders don't have an analytic account per line before version 16, unless that product is a service (all services intrinsically have an analytic account) # Fix Get all invoices/bills that have lines with the project's analytic account, and removing from those the lines that were already accounted for. # Affected versions - saas-15.3 - 16.0 - master --- opw-3058198 --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr Forward-Port-Of: odoo/odoo#108110 Forward-Port-Of: odoo/odoo#107307
Steps to reproduce: 1. Activate the hash mode on a journal 2. Create an account move 3. Choose a customer who is not a commercial partner (e.g. Brandon Freeman from Azure Interior) 4. Post the move 5. Error saying that we cannot modify the `partner_id` because the move has already been posted This is because currently we first post the move and then we modify the `partner_id` of the lines whose `partner_id` is different from the account's `commercial_partner_id`. We can easily fix this b
Original PR description
Steps to reproduce: 1. Activate the hash mode on a journal 2. Create an account move 3. Choose a customer who is not a commercial partner (e.g. Brandon Freeman from Azure Interior) 4. Post the move 5. Error saying that we cannot modify the `partner_id` because the move has already been posted This is because currently we first post the move and then we modify the `partner_id` of the lines whose `partner_id` is different from the account's `commercial_partner_id`. We can easily fix this by posting the move after the lines'`partner_id` have been modified. Forward-Port-Of: odoo/odoo#108142
Currently, the detailed reason appears too large (200%). In this commit I update the width to 100% instead of 200%. Forward-Port-Of: odoo/odoo#108152
Original PR description
Currently, the detailed reason appears too large (200%). In this commit I update the width to 100% instead of 200%. Forward-Port-Of: odoo/odoo#108152
Since the migration to Owl, the root of wysiwyg has been wrongly set. First, in renderElement, wysiwyg creates an editable element, which it sets as its $root and $el elements. Then in startEdition, wysiwyg_iframe creates a new editable element that it puts in an iframe appended to the $el element. It then failed to change the $root element to that new editable instead. Since we have a new editable element, the old one should also not be contenteditable=true. Because the $root element was wro
Original PR description
Since the migration to Owl, the root of wysiwyg has been wrongly set. First, in renderElement, wysiwyg creates an editable element, which it sets as its $root and $el elements. Then in startEdition, wysiwyg_iframe creates a new editable element that it puts in an iframe appended to the $el element. It then failed to change the $root element to that new editable instead. Since we have a new editable element, the old one should also not be contenteditable=true. Because the $root element was wrong (and outside the iframe), all listeners on it failed, with the effect that at least the link tools and link popover were broken. --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr Forward-Port-Of: odoo/odoo#108087
**Steps to reproduce the bug:** - Enable “subcontracting” in the mrp settings - Create a storable product “P1”: - Add a vendor: - supplier: “Azure interior” - currency: euro - price: 20 - Add a BoM: - Type: subcontracting - add any product as component - Save - Check that the currency of the company is in dollars - Click on BoM overview **Problem:** The seller's price is displayed with the dollar symbol, but it is not con
Original PR description
**Steps to reproduce the bug:**
- Enable “subcontracting” in the mrp settings
- Create a storable product “P1”:
- Add a vendor:
- supplier: “Azure interior”
- currency: euro
- price: 20
- Add a BoM:
- Type: subcontracting
- add any product as component
- Save
- Check that the currency of the company is in dollars
- Click on BoM overview
**Problem:**
The seller's price is displayed with the dollar symbol, but it is not converted into dollars
opw-3085392
Forward-Port-Of: odoo/odoo#108153
Forward-Port-Of: odoo/odoo#107888## Rationale Some ir_logging created during a test have a pathname pointing to case.py, runner.py,... This is mainly a side effect of the way unitest manages errors and mainly in subtests: an exception inside a subtest will have only a partial traceback, not containing the line triggering the error in the test method. This can also affect debugging since a part of the stack is missing. ## Expected tracebacks example ```python def test_assertQueryCount(self): with self.assertQ
Original PR description
## Rationale Some ir_logging created during a test have a pathname pointing to case.py, runner.py,... This is mainly a side effect of the way unitest manages errors and mainly in subtests: an…
## Rationale
Some ir_logging created during a test have a pathname pointing to case.py, runner.py,...
This is mainly a side effect of the way unitest manages errors and mainly in subtests: an exception inside a subtest will have only a partial traceback, not containing the line triggering the error in the test method.
This can also affect debugging since a part of the stack is missing.
## Expected tracebacks example
```python
def test_assertQueryCount(self):
with self.assertQueryCount(system=0):
self.env.cr.execute('SELECT 1')
```
Before/After
```patch
Traceback (most recent call last):
+ File "/home/xdo/osrc/14.0/odoo/odoo/addons/base/tests/test_test_suite.py", line 178, in test_assertQueryCount
+ self.env.cr.execute('SELECT 1')
+ File "/usr/lib/python3.8/contextlib.py", line 120, in __exit__
+ next(self.gen)
File "/home/xdo/osrc/14.0/odoo/odoo/tests/common.py", line 458, in assertQueryCount
self.fail(msg % (login, count, expected, funcname, filename, linenum))
AssertionError: Query count more than expected for user __system__: 1 > 0 in test_assertQueryCount at base/tests/test_test_suite.py:178
```
Another simpler example without contextmanager magic and a higer stack:
```python
def test_call_stack_subtest(self):
def a():
b()
def b():
with self.subTest():
c()
def c():
raise Exception('This is an error')
a()
```
Before/After
```patch
Traceback (most recent call last):
+ File "/home/xdo/osrc/14.0/odoo/odoo/addons/base/tests/test_test_suite.py", line 174, in test_call_stack_subtest
+ a()
+ File "/home/xdo/osrc/14.0/odoo/odoo/addons/base/tests/test_test_suite.py", line 168, in a
+ b()
File "/home/xdo/osrc/14.0/odoo/odoo/addons/base/tests/test_test_suite.py", line 171, in b
c()
File "/home/xdo/osrc/14.0/odoo/odoo/addons/base/tests/test_test_suite.py", line 173, in c
raise Exception('This is an error')
Exception: This is an error
```
This can also have a slight impact on test ran with decorators (see test_with_decorators):
```patch
Traceback (most recent call last):
+ File "<decorator-gen-118>", line 2, in test_with_decorators
File "/home/xdo/osrc/14.0/odoo/odoo/tests/common.py", line 1583, in _users
func(*args, **kwargs)
File "<decorator-gen-117>", line 2, in test_with_decorators
File "/home/xdo/osrc/14.0/odoo/odoo/tests/common.py", line 1606, in warmup
func(*args, **kwargs)
File "/home/xdo/osrc/14.0/odoo/odoo/addons/base/tests/test_test_suite.py", line 130, in test_with_decorators
raise Exception('This is an error')
Exception: This is an error
```
Even if in this case, this information is not really relevant, this is more "correct"
Note that for this last example we could decide to remove the decorator part. This could actually be done by tweaking the
`# remove traceback root part` but this is more a new specification to do than a change that should be done in the scope of this test. Having this information could be actually useful/
## Solution
Finding a solution for this was not trivial and lead to a solution quite defendant on the unittest implementation, but there wasn't any clean way to hook inside the library, and this was actually an opportunity to make another improvement. The OdooTestResult was historically created in order to log failure as close as possible from the test logs, in order to keep the temporal information of when the error occurred. But the logs are still only outputted at the end of the test method. This was mainly a problem for subtests, and the need to get the full traceback exactly when the error occurs and so on hooks where the information occurs gives the possibility to output the error when it occurs.
### unitest main interesting parts
How _outcome is managed and tests parts ar ran:
```python
outcome = _Outcome(result)
try:
self._outcome = outcome
with outcome.testPartExecutor(self):
self._callSetUp()
if outcome.success:
outcome.expecting_failure = expecting_failure
with outcome.testPartExecutor(self, isTest=True):
self._callTestMethod(testMethod)
outcome.expecting_failure = False
with outcome.testPartExecutor(self):
self._callTearDown()
self.doCleanups() # also uses testPartExecutor
for test, reason in outcome.skipped:
self._addSkip(result, test, reason)
self._feedErrorsToResult(result, outcome.errors)
...
outcome.errors.clear()
```
How a subtest contextmanager works:
```python
@contextlib.contextmanager
def subTest(self, msg=_subtest_msg_sentinel, **params):
...
with self._outcome.testPartExecutor(self._subtest, isTest=True):
yield
...
```
testPartExecutor usage of _outcome
```python
class _Outcome(object):
def __init__(self, result=None):
self.result = result
self.errors = []
...
@contextlib.contextmanager
def testPartExecutor(self, test_case, isTest=False):
...
try:
yield
...
except:
exc_info = sys.exc_info()
...
self.errors.append((test_case, exc_info))
```
Those snipets shows almost all usages of `Tescase._outcome.errors` and testPartExecutor
### Proposed solution
We can substitute Tescase._outcome.errors in a custom object and fix the traceback on append.
Moreover, also replaces the list append behaviour call _feedErrorsToResult immediatly.
Then the only last part is to combine the exception traceback with the current frame without adding to much noise.
This is done by `complete_tb`, finding a common frame between the traceback and the current traceback and stitching them together. The current solution is maybe not the cleanest but is trying to take care of as much use case as possible, improvements are still possible.
Alternative solutions could have been to override subTest but this would have created more duplicated code from unittest, or monkey patch the _Outcome class with the same.
## Side changes
- users.wrapper was renamed in users._users to improve traceback readability. (expecting other black magic alternative fix proposal for this one actually)
- `getErrorCallerInfo` will ensure that we have the root test to get the method name. Before that the test could be a **subtest** and the method name will always be `runTest`in this case and the caller info would fallback on `logger.findCaller`
- postpone return_infos to the end of the traceback. This is mainly to avoid getting an intermediate frame but not the root frame. With this pr, some of this logic could event be simplified since the frame we are interested in is most likely the last one.
Most of the logic in OdooTestResult could maybe be simplified, moved or removed with this pr but this is a target master.
## To discuss
Note that the frame to traceback transformation was a concern about reference cycles. Strongly believing in the garbage collector but looking at a little piece of code in testPartExecutor ...
```python
# explicitly break a reference cycle:
exc_info = None
```
... this may need to be discussed.
## To be done before merging
- [x] Add a test for setup failures
- [x] Add a test for teardown failures
- [x] Add a test for cleanup failures
- [x] more assertions on logged errors, mainly the traceback.
- [x] combination of all and error order, mainly with subtests with logs
Forward-Port-Of: odoo/odoo#108170
Forward-Port-Of: odoo/odoo#107572Before this commit, it was possible to resize a column so that it overflows the right border of the row. Steps to reproduce the bug: 1. In website edit mode, drop a `media list` snippet in the page. 2. Select a column. 3. Resize the column by dragging its left side to the right to make it smaller. 4. Drag its right side to make it bigger and go until the edge of the editor => The column overflows and ends outside of the content zone. This commit prevents the column from
Original PR description
Before this commit, it was possible to resize a column so that it overflows the right border of the row. Steps to reproduce the bug: 1. In website edit mode, drop a `media list` snippet in the page. 2. Select a column. 3. Resize the column by dragging its left side to the right to make it smaller. 4. Drag its right side to make it bigger and go until the edge of the editor => The column overflows and ends outside of the content zone. This commit prevents the column from overflowing when it has an offset. task-2837361 Forward-Port-Of: odoo/odoo#108022 Forward-Port-Of: odoo/odoo#96993
According to Factura Electrónica Colombia - Insumo Carvajal V5 limit for Terms & Conditions is 5000 chars opw-3048957 Forward-Port-Of: odoo/enterprise#35030 Forward-Port-Of: odoo/enterprise#34821
Original PR description
According to Factura Electrónica Colombia - Insumo Carvajal V5 limit for Terms & Conditions is 5000 chars opw-3048957 Forward-Port-Of: odoo/enterprise#35030 Forward-Port-Of: odoo/enterprise#34821
…menu This should fix the indeterministic test "can link an odoo menu to a gauge chart chart in the side panel". Runbot id 10346 Forward-Port-Of: odoo/enterprise#34956
Original PR description
…menu This should fix the indeterministic test "can link an odoo menu to a gauge chart chart in the side panel". Runbot id 10346 Forward-Port-Of: odoo/enterprise#34956
Open posted journal entry of bank statement Reset to draft Cancel Hit button "1 Bank Transaction" Traceback occur because the system will filter out canceled statements, so owl view is loaded with an empty resultset but a default statement id in context which causes the error However it is not correct to open the reconciliation widget for canceled statements so the button should be disabled opw-3084361 Forward-Port-Of: odoo/enterprise#34690
Original PR description
Open posted journal entry of bank statement Reset to draft Cancel Hit button "1 Bank Transaction" Traceback occur because the system will filter out canceled statements, so owl view is loaded with an empty resultset but a default statement id in context which causes the error However it is not correct to open the reconciliation widget for canceled statements so the button should be disabled opw-3084361 Forward-Port-Of: odoo/enterprise#34690
In the permission panel component of Knowledge, there are two issues: 1. We pass an asynchronous function to the `onWillStart` hook and that function does a blocking rpc call. As a result, owl waits that the rpc call resolves before mounting the component to the dom. Normally, the permission panel component is supposed to display a loader while the rpc call is pending but it doesn't because of that. This commit will ensure that the loader is displayed when the rpc call is pending. 2. When the
Original PR description
In the permission panel component of Knowledge, there are two issues: 1. We pass an asynchronous function to the `onWillStart` hook and that function does a blocking rpc call. As a result, owl waits that the rpc call resolves before mounting the component to the dom. Normally, the permission panel component is supposed to display a loader while the rpc call is pending but it doesn't because of that. This commit will ensure that the loader is displayed when the rpc call is pending. 2. When the rpc call is resolved, we overwrite the component state with a static variable (a json object). As a result, the component is no longer reactive: it will not be re-rendered whenever the state of the component changes. This commit will also ensure that the permission panel component remains reactive. task-3092974 Forward-Port-Of: odoo/enterprise#34812
Before this commit, the activity form view was a bit broken with the inline fields displayed on two separate rows. This fix the issue. This commit also adds placeholder on the template field. Task-3084669 Forward-Port-Of: odoo/enterprise#34519
Original PR description
Before this commit, the activity form view was a bit broken with the inline fields displayed on two separate rows. This fix the issue. This commit also adds placeholder on the template field. Task-3084669 Forward-Port-Of: odoo/enterprise#34519
How to reproduce: - Enable multilocation and package in the Inventory's settings; - Create a new package; - Create a product; - In the Barcode App, create a new internal transfert; - Scan the product then scan the package -> The package is assign as the result package on the line; - Scan a location -> Traceback. After scanned the location, it will try to get previous scanned line(s) to apply on it the scanned location as the destination. As a package has been scanned, it will check if s
Original PR description
How to reproduce: - Enable multilocation and package in the Inventory's settings; - Create a new package; - Create a product; - In the Barcode App, create a new internal transfert; - Scan the product then scan the package -> The package is assign as the result package on the line; - Scan a location -> Traceback. After scanned the location, it will try to get previous scanned line(s) to apply on it the scanned location as the destination. As a package has been scanned, it will check if some lines belong to this package, but there is an error in the condition. Forward-Port-Of: odoo/enterprise#34718 Forward-Port-Of: odoo/enterprise#34330