Daily updates from Odoo
Navigate
Branch
Wednesday, May 4, 2022
15 changes
Enhancements to existing features
This update changes how Enterprise styling settings build on the Community version, making custom visual overrides easier and more consistent across releases. It also removes duplicate styling values and prepares the interface foundation for future theme capabilities such as dark mode.
Original PR description
Following the assumption that enterprise variables were "definitive", prior to this PR 'primary_variables.scss' and 'bootstrap_overridden.scss' files were injected "on top" of their community counterparts. This PR inverts the order and makes use of SCSS '!default' directive to handle the inheriting process. The aim is to ease variables overrides across versions and to achieve that in a more consistent way. These changes will also pave the way for dynamic variables changes, see dark-mode. This PR also removes variables in favor of the values defined in community. community: https://github.com/odoo/odoo/pull/87521 task-2810274
The Sign app was updated to better organize its internal screen logic around reusable view models. This should make future changes easier and safer to maintain, with little direct impact on day-to-day users.
Original PR description
This commit introduces models that define records being 1:1 map with components, as a step to move further to having essentially all business code in models. Having code in models is desirable to have very maintainable code, thanks to robust and declarative code with an ORM-like architecture. Task-2831082 community: https://github.com/odoo/odoo/pull/90427
The Approvals app was adjusted to use a newer internal approach for background operations. This helps keep the module aligned with current platform standards and reduces maintenance risk without changing the user-facing approval workflow.
Original PR description
Task-2837854
Resolved issues and error corrections
Task analysis now shows more accurate customer rating averages by using the right rating link and averaging task ratings correctly. The rating measure is also only shown when customer ratings are enabled, reducing confusion for users.
Code cleanup and technical improvements
The spreadsheet styling files in Documents were reorganized into smaller, more focused files. This is an internal cleanup that should make future maintenance easier without changing how users work with spreadsheets.
Miscellaneous changes
while computing `non_deductible_tax_val` from `AccountAsset`. In function `_compute_non_deductible_tax_value`, to retrieve the value of `company_id`, `self` is used instead of the loop object `record`. This creates a problem when `self` holds more than one record with different currencies, as `res_currency.round` will fail on `self.ensure_one()`. This error was spotted during a failed upgrade while installing the module: ``` Traceback (most recent call last): File "/home/odoo/src
Original PR description
while computing `non_deductible_tax_val` from `AccountAsset`. In function `_compute_non_deductible_tax_value`, to retrieve the value of `company_id`, `self` is used instead of the loop object…
while computing `non_deductible_tax_val` from `AccountAsset`.
In function `_compute_non_deductible_tax_value`, to retrieve the value of
`company_id`, `self` is used instead of the loop object `record`.
This creates a problem when `self` holds more than one record with different
currencies, as `res_currency.round` will fail on `self.ensure_one()`.
This error was spotted during a failed upgrade while installing the module:
```
Traceback (most recent call last):
File "/home/odoo/src/odoo/15.0/odoo/models.py", line 5196, in ensure_one
_id, = self._ids
ValueError: too many values to unpack (expected 1)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/odoo/src/odoo/15.0/odoo/service/server.py", line 1258, in preload_registries
registry = Registry.new(dbname, update_module=update_module)
File "/home/odoo/src/odoo/15.0/odoo/modules/registry.py", line 87, in new
odoo.modules.load_modules(registry, force_demo, status, update_module)
File "/home/odoo/src/odoo/15.0/odoo/modules/loading.py", line 474, in load_modules
processed_modules += load_marked_modules(cr, graph,
File "/home/odoo/src/odoo/15.0/odoo/modules/loading.py", line 363, in load_marked_modules
loaded, processed = load_module_graph(
File "/home/odoo/src/odoo/15.0/odoo/modules/loading.py", line 199, in load_module_graph
registry.init_models(cr, model_names, {'module': package.name}, new_install)
File "/home/odoo/src/odoo/15.0/odoo/modules/registry.py", line 444, in init_models
env['base'].flush()
File "/home/odoo/src/odoo/15.0/odoo/models.py", line 5641, in flush
self.recompute()
File "/home/odoo/src/odoo/15.0/odoo/models.py", line 6114, in recompute
process(field)
File "/home/odoo/src/odoo/15.0/odoo/models.py", line 6098, in process
field.recompute(recs)
File "/home/odoo/src/odoo/15.0/odoo/fields.py", line 1243, in recompute
self.compute_value(recs)
File "/home/odoo/src/odoo/15.0/odoo/fields.py", line 1265, in compute_value
records._compute_field_value(self)
File "/home/odoo/src/odoo/15.0/addons/mail/models/mail_thread.py", line 411, in _compute_field_value
return super()._compute_field_value(field)
File "/home/odoo/src/odoo/15.0/odoo/models.py", line 4255, in _compute_field_value
getattr(self, field.compute)()
File "/home/odoo/src/enterprise/15.0/account_asset_ndt/models/account_asset.py", line 23, in _compute_non_deductible_tax_value
record.non_deductible_tax_val = self.currency_id.round(non_deductible_tax_value / quantity)
File "/home/odoo/src/odoo/15.0/odoo/addons/base/models/res_currency.py", line 194, in round
self.ensure_one()
File "/home/odoo/src/odoo/15.0/odoo/models.py", line 5199, in ensure_one
raise ValueError("Expected singleton: %s" % self)
ValueError: Expected singleton: res.currency(6, 95, 92, 3)
```
Forward-Port-Of: odoo/enterprise#26956
Forward-Port-Of: odoo/enterprise#26930When updating the followup line and date on unreconciled amls, amls from all companies are updated with fllowups of the (one) current company. Where only amls from this company should be updated. To reproduce : - Create 2 companies - Create one autoexecute followup level sending an email for each company - Create one invoice triggering the followup report on each company with the same customers - Set both companies on allowed companies for the "System" user (id 1) > Run "Account Report F
Original PR description
When updating the followup line and date on unreconciled amls, amls from all companies are updated with fllowups of the (one) current company. Where only amls from this company should be updated. To reproduce : - Create 2 companies - Create one autoexecute followup level sending an email for each company - Create one invoice triggering the followup report on each company with the same customers - Set both companies on allowed companies for the "System" user (id 1) > Run "Account Report Followup; Execute followup" manually -> only one email is send instead of 2. - Redo the same steps, but now create one more followup level (at 10 days) for company 1. > Run "Account Report Followup; Execute followup" manually -> an error triggers Task: 2804715 & 2761238 Forward-Port-Of: odoo/enterprise#26671
## Goal: Add a test ensuring the global tax report is working correclty even with miscellaneous move in which there are an invoice line and a refund line with the same tax. ### reproduction step pre-requisite: - a simple sale tax A - miscellaneous contains 2 lines, - amount X debit with sale tax A - amount Y credit with purchase tax A - 2 tax lines gets automatically created ### Before this commit: The global tax report will display a base amount of 2*(X-Y) which is wrong. ##
Original PR description
## Goal: Add a test ensuring the global tax report is working correclty even with miscellaneous move in which there are an invoice line and a refund line with the same tax. ### reproduction step…
## Goal: Add a test ensuring the global tax report is working correclty even with miscellaneous move in which there are an invoice line and a refund line with the same tax. ### reproduction step pre-requisite: - a simple sale tax A - miscellaneous contains 2 lines, - amount X debit with sale tax A - amount Y credit with purchase tax A - 2 tax lines gets automatically created ### Before this commit: The global tax report will display a base amount of 2*(X-Y) which is wrong. ### After this commit: The global tax report will display a base amount of (X-Y) which is correct. ### Context: The tax details query was giving back twice the amount as result for the base amount coming from misc move in which you have 2 opposite lines with both having the same tax. This is making the generic tax report taking into account twice the base of the lines. ### Solution: Fixing the mapping in the tax details Community-PR: https://github.com/odoo/odoo/pull/90399 Enterprise-PR: https://github.com/odoo/enterprise/pull/26827 Ticket: 2832745 Forward-Port-Of: odoo/enterprise#26827
Editing an asset's depreciation move leads to a wrong computation of the depreciable value preventing the user from confirming the asset Steps to reproduce: 1. Install Accounting 2. Go to Accounting > Accounting > Management > Assets 3. Create an asset with values: - 'Original Value' = 60 - 'Not Depreciable Value' = 20 - Any account and journal in the Accounting section 4. Save the asset and click on 'Compute Depreciation' 5. Edit the Depreciation (amount_total) of any of the asse
Original PR description
Editing an asset's depreciation move leads to a wrong computation of the depreciable value preventing the user from confirming the asset Steps to reproduce: 1. Install Accounting 2. Go to Accounting > Accounting > Management > Assets 3. Create an asset with values: - 'Original Value' = 60 - 'Not Depreciable Value' = 20 - Any account and journal in the Accounting section 4. Save the asset and click on 'Compute Depreciation' 5. Edit the Depreciation (amount_total) of any of the asset's depreciation move to 9 then put it back to 8 6. The Depreciable Value of the last depreciation move is different than 0 although nothing has changed 7. It is impossible to confirm the asset because of this Solution: Take the 'Not Depreciable Value' into account when computing the remaining depreciable value opw-2715264 Forward-Port-Of: odoo/enterprise#26905 Forward-Port-Of: odoo/enterprise#26720
It's possible _description will change across versions and this would cause mismatches between what's in Avatax and what's in Odoo. This could cause reports to not be accurate and it could also cause errors. E.g. in case an invoice is committed in one version and that invoice is uncommitted in the new version (provided the _description changed). The provided _get_avatax_description implementations have copied the previously used _description fields, so nothing should change. Discusse
Original PR description
It's possible _description will change across versions and this would cause mismatches between what's in Avatax and what's in Odoo. This could cause reports to not be accurate and it could also cause errors. E.g. in case an invoice is committed in one version and that invoice is uncommitted in the new version (provided the _description changed). The provided _get_avatax_description implementations have copied the previously used _description fields, so nothing should change. Discussed in #26855 and related to task-2824272 Forward-Port-Of: odoo/enterprise#26924
Before this commit unlinking a draft invoice without ever calling button_update_avatax() would raise: odoo.exceptions.UserError: Odoo could not void the transaction related to Draft Invoice (* xxx) in AvaTax Please check the status of `Journal Entry xxx` in the AvaTax portal. We could do an extra API request to check if the invoice exists before voiding but it's simpler and faster to simply ignore EntityNotFoundError. task-2824272 Forward-Port-Of: odoo/enterprise#26923
Original PR description
Before this commit unlinking a draft invoice without ever calling button_update_avatax() would raise: odoo.exceptions.UserError: Odoo could not void the transaction related to Draft Invoice (* xxx) in AvaTax Please check the status of `Journal Entry xxx` in the AvaTax portal. We could do an extra API request to check if the invoice exists before voiding but it's simpler and faster to simply ignore EntityNotFoundError. task-2824272 Forward-Port-Of: odoo/enterprise#26923
Stop sending browser notifications on incoming call if the current tab is not the master tab, so that users don't get the notification as many times as they have open tabs. Task-2841841 Forward-Port-Of: odoo/enterprise#26897
Original PR description
Stop sending browser notifications on incoming call if the current tab is not the master tab, so that users don't get the notification as many times as they have open tabs. Task-2841841 Forward-Port-Of: odoo/enterprise#26897
after connection failure To communicate with the SII service, Odoo automatically requests an authentication token from it, and then uses this token in further requests to the SII service. Sometimes, the stored authentication token becomes invalid. When this happens, the ‘Accept Document’ and 'Claim Document' functions should request a new one. However, instead of doing so, they simply try again with the invalid token, leading to the error: 'Document acceptance or claim failed due to:
Original PR description
after connection failure To communicate with the SII service, Odoo automatically requests an authentication token from it, and then uses this token in further requests to the SII service. Sometimes, the stored authentication token becomes invalid. When this happens, the ‘Accept Document’ and 'Claim Document' functions should request a new one. However, instead of doing so, they simply try again with the invalid token, leading to the error: 'Document acceptance or claim failed due to: - It was not possible to get a seed after 20 retries.' This fix clears the authentcation token after a connection failure, so that a new, valid, token will be requested when the user retries 'Accept Document' or 'Claim Document'. Forward-Port-Of: odoo/enterprise#26606 Forward-Port-Of: odoo/enterprise#25990
After multiplying the rate returned by Avatax by 100, it may have a bunch of extraneous digits due to how floats work. Example: An MO state tax has a rate of 0.04225. Multiplying it by 100 gives: ``` >>> 0.04225 * 100 4.2250000000000005 ``` Which results in this tax name: MO STATE TAX [29] (4.2250000000000005 %) Solve it with round and repr using 4 precision digits since that's what amount on account.tax uses. After this fix the tax from above has the following name: M
Original PR description
After multiplying the rate returned by Avatax by 100, it may have a bunch of extraneous digits due to how floats work. Example: An MO state tax has a rate of 0.04225. Multiplying it by 100 gives: ``` >>> 0.04225 * 100 4.2250000000000005 ``` Which results in this tax name: MO STATE TAX [29] (4.2250000000000005 %) Solve it with round and repr using 4 precision digits since that's what amount on account.tax uses. After this fix the tax from above has the following name: MO STATE TAX [29] (4.2250 %) task-2824272 Forward-Port-Of: odoo/enterprise#26852
Before this commit The home menu arrows navigation is broken. This is due to its hidden input being protected by the hotkey service. See odoo/odoo@43463a1 for an explanation. After this commit The home menu hidden input now allows any hotkeys. Forward-Port-Of: odoo/enterprise#26882 Forward-Port-Of: odoo/enterprise#25991
Original PR description
Before this commit The home menu arrows navigation is broken. This is due to its hidden input being protected by the hotkey service. See odoo/odoo@43463a1 for an explanation. After this commit The home menu hidden input now allows any hotkeys. Forward-Port-Of: odoo/enterprise#26882 Forward-Port-Of: odoo/enterprise#25991