Daily updates from Odoo
Navigate
Branch
Friday, April 29, 2022
15 changes
Enhancements to existing features
Field Service screens and reports were refined to show cleaner customer information, improve report spacing, and avoid an unnecessary comments label when custom worksheet templates are off. A sales order line selection issue was also corrected so tasks can recover the right sales order item when delivery and customer addresses differ.
Original PR description
The purpose of this commit is to make improvements in Field Services. In this commit, following changes are made: Task: - only track the name of the partner, not his full address in chatter. Task Report: - when 'custom worksheet templates' feature is disabled remove 'comments' label. Worksheet Report: - add space between the 'time & material', 'timesheets' and 'worksheet' sections. task-2794072
This update replaces older internal command wording with clearer alternatives in approvals, enterprise mail, and website helpdesk live chat. It helps developers maintain these areas more easily without changing what business users see or do.
Original PR description
*: approvals, website_helpdesk_livechat This commit turns some `link`/`unlink`/`unlinkAll` to `replace`/`clear`. The commands `replace`/`clear` are easier to understand, and also clearly tells what’s the expected resulting value of this field. This change will help turning big and imperative code into smaller declarative code. Task-2834598 community: https://github.com/odoo/odoo/pull/89852
The EC Sales report and Belgian Partner VAT Listing now open with last month selected by default. This better matches the typical reporting period, helping users review and submit recent monthly tax information with fewer manual filter changes.
Original PR description
Default filter for EC Sales report and Partner VAT Listing report should be last month
Spreadsheet charts in Documents now connect more smoothly with Odoo menus, making chart-related actions easier to access. This update also fixes the chart menu placement so users can reliably open it from the top-right of a chart.
Original PR description
### Contains the following commits: https://github.com/odoo/o-spreadsheet/commit/ec08a525 [IMP] spreadsheet: link charts to odoo menus https://github.com/odoo/o-spreadsheet/commit/c838b590 [FIX] chart: context-menu on top-right of chart
This update changes several Odoo apps to use a shared messaging communication method behind the scenes. It reduces transition work and risk ahead of upcoming Discuss improvements, with little direct impact on day-to-day users.
Original PR description
*: approvals, documents, documents_spreadsheet, l10n_de_pos_cert, l10n_de_pos_res_cert, pos_l10n_se. This PR prepares the ground for the one introducing the new env in discuss. The signature of the rpc function has changed a lot from the one in the old env. In order to ease the transition and reduce the noise, the discuss models now rely on the messaging's rpc function. task-2582313 community: https://github.com/odoo/odoo/pull/89858
Timesheet reporting now opens in the grid view by default, making billing-type analysis quicker to access. The mobile timer and lock-date settings screens were also cleaned up with clearer labels and simpler controls.
Original PR description
**PURPOSE** Generic improvements for services. **SPECIFICATION** - Reporting > timesheets by billing type: set the grid view as the default view. - For timer on mobile: Removed 'or use a hot key'. Switched the letters for the fa-play icon. - Settings > lock dates feature: Added a line break between the description and the field. Displayed the 'block timesheets older than' label in bold **Related Community PR**: https://github.com/odoo/odoo/pull/85726 **task**-2766164
This update refreshes the spreadsheet component used in Documents and fixes the chart menu so it appears correctly at the top right of charts. Users get a smoother, less confusing experience when working with charts in spreadsheets.
Original PR description
### Contains the following commits: https://github.com/odoo/o-spreadsheet/commit/c838b590 [FIX] chart: context-menu on top-right of chart
Resolved issues and error corrections
This update corrects how Mexican electronic invoice reports display payment term and fiscal position notes. It avoids invalid page structure that could cause notes to appear outside their intended section or render inconsistently in browsers.
Original PR description
Linked to PR https://github.com/odoo/odoo/pull/88660
Current behavior:
The invoice payment term of the report is a p tag with another p tag inside like:
<p name="payment_term">
<span>
<p> This is a payment term note</p>
</span>
</p>
but because nested p tags are not supported in html de result in the browser is something like:
<p name="payment_term">
<span></span>
</p>
<p> This is a payment term note</p>
<p></p>
Similar behavior can be observe for the fiscal position note.
Expected behavior:
The code should respect html format rules and not have nested p tags.
Solution: We replace the parent p tags by div tags, and we modify xml file that have xpath relying
on this tag.
To prevent to breack the xml references we also modified the references from p to div
opw-2804933Code cleanup and technical improvements
This refactor reduces duplicated view and field information sent between the server and web client, which can improve loading performance and simplify future maintenance. It also updates related enterprise apps and tests to use the cleaner API while keeping older methods available with deprecation warnings.
Original PR description
# Main quest Refactor the `load_views` API so it no longer sends multiple times the same fields description. e.g. When `load_views` is called to get the kanban, tree and form views, the list of…
# Main quest Refactor the `load_views` API so it no longer sends multiple times the same fields description. e.g. When `load_views` is called to get the kanban, tree and form views, the list of fields of the model was sent 4 times: - Once for each view, with only the fields used in the view, in `['fields_views']['kanban']['fields']` for instance - Once globally, with all the fields of the model, in `['fields']` The goal of this revision is to change that so it sends the list of all fields only once. In addition, if a view contains x2many fields, the fields description of the comodel is also sent. It was sent in the `views` key of the view fields dict. e.g. When calling `load_views` of `res.partner` to get the kanban, tree and form views, the `res.partner` fields description was actually sent 6 times: - Once for each view - Once globally - Once for each view of the many2many field `child_ids` of the form view, in - `['fields_views']['form']['fields']['child_ids']['views']['kanban']['fields']` - `['fields_views']['form']['fields']['child_ids']['views']['form']['fields']` The change suggested in this revision is to: - Remove the fields description for each view in `['fields_views']`. As it no longer contains the fields, the key becomes `['views']` instead of `['fields_views']`. - Replace the dict key `['fields']` by `['models']`, which is a dict with as key the model name and as values the model fields description. It contains the fields description for all models implied in the view: the model of the main view and the model of all one2many and many2many fields. With this change, the fields description will only be sent once by model implied in the view. In addition, the web client was getting the information about the fields sometimes in the global fields description list (e.g. `['fields']`), sometimes in the fields description list of the view type (e.g. `['fields_views']['form']['fields']`), making it a pain to try to make changes / performance gain in these field description dictionaries, because you never knew in which dict the web client was getting its info. Now, as there is only one place to get the fields description from, it's clearer and cleaner. # Secondary quests - one2many and many2many fields views are passed directly in the main view architecture rather than being put in the `views` key of the field description. This is actually easier to treat by the web client, and this will allow in a future work to cache an entire view in one block of text rather than having to combine multiple cached blocks of text to return one view. - one2many and many2many fields which do not have directly embedded views have their views directly injected in the architecture, so the web client doesn't have to do RPC calls to `load_views` for each one2many and many2many fields not having embedded views. For instance, this allow to reduce the number of RPC calls to `load_views` from 8 to 1 when loading the form of `product.product`. Currently, this behavior is limited to 1 level deep but we consider making it go all the way down in future works. We did not do it for the moment because in certain cases it rises the processing time and the size (bytes) too much. e.g. the sale.order view can be 5 levels deep, meaning you can reach 4 dialogs on top the main view. ``` sale.order form > order_line > sale.order.line form > invoice_lines > account.move.line form > asset_ids > account.asset form > depreciation_move_ids > account.move form. ``` This will also benefit in future works to cache an entire view in one block of text rather to having to combine multiple cached block of text to get one view. - `fields_view_get` becomes `get_view`. As it no longer returns the fields description, keeping the `fields` in the name `fields_view_get` no longer makes sense. Hence removing `fields` from the method name, it becomes `view_get`. As it gets renamed anyway, we take the opportunity to rename it `get_view`, which is more in line with the general getter/setter guidelines in the model object world. - `_fields_view_get` becomes `_get_view`. For the same reasons than above. - `load_views` becomes `get_views`. This is not mandatory, there is no technical reason to rename `load_views` as it practically sends the same info as before, the view architectures and their fields description. Just in another way. We just take the opportunity of this pull request to suggest a cleaner API: `_get_view`, `get_view` and `get_views`. - Arguments `toolbar=False, submenu=False` fo the methods `_fields_view_get` and `fields_view_get` are converted to a kwargs `**options` in `_get_view` and `get_view`. The rationale is that submenu was already no longer used (deprecated) and the mobile options is introduced. The mobile options is necessary to tell the server to send the mobile views for x2many fields (kanban instead of tree). Instead of adding a new argument each time we add a new option to `fields_view_get`, it seems wiser to have a kwargs `**options` to avoid to re-write all overrides each time a new option is introduced. - `_fields_view_get` returned a dict containing the arch in text and some of the view information. Now, `get_view` returns a tuple with the view architecture as an `etree` node, and the view as a browse record. The rationale is that all overrides of `_fields_view_get` were about modifying the arch only (e.g. changing the address format/re-organizing the address related field nodes of the partner according to the company country). To do so, all these overrides were doing `etree.fromstring` to parse the arch which was sent in text to convert it to an `etree`, then operations were done on the `etree`, and then `etree.tostring` was called to convert back the arch to string. With this change of signature to send the arch as an `etree`, all these back and forth `etree.fromstring` -> `etree.tostring` are avoided, allowing some performance gain and less code in the end. - A cleanup of the keys returned in the dict of `fields_view_get` has been performed in `get_view`: - `fields` is removed, as explained above, - `view_id` is renamed `id`, - `name` is removed, it was unused by the web client, - `type` is removed, it was unused by the web client, - `field_parent` is removed, it was unused by the web client, - `base_model` is removed, it was unused by the web client. - `filters` is moved from the global dict returned by `load_views` (now `get_views`) to the dict returned by `fields_view_get` (now `get_view`) as it applies only to the `search` view type. - Retro-compatible methods for the 3 methods `fields_view_get`, `_fields_view_get` and `load_views` are provided, with deprecation warnings in them. # Future quests - The web client could cache the model fields description (as it already caches the views), so it doesn't need to fetch them again if it asks for another view of a model for which he already has the fields description. If we do so, `get_views` could return only the list of models used by the views, without the fields description as of now, and the web client would then call `fields_get` independently only for the models for which it doesn't have yet the fields description. This would avoid the server to return the fields description and to call `fields_get`, which is costly, for each `get_views`, therefore gaining performances. - Inject the views of the one2many and many2many fields all the way down, unlimited depth level, as explained above. - Cache with `ormcache` the architecture of back-end views. This is already done for qweb views, it's not done for back-end views. Therefore the postprocessing of the views is performed for each `get_views`, which is costly, while the view architecture doesn't change for users belonging to the same groups, according to the groups implied by the view. ### Credits This pull request is co-authored by Aaron Bohy (aab) for the web client part and Denis Ledoux (dle) for the server part.
Miscellaneous changes
If the company's invoice partner's phone number is missing, _raw_phonenumber breaks and the XML report can't be exported. In stable: pass the company's phone number if the partner's phone number is missing. In master: remove the check for the company's phone number and pass an empty string to export the XML. Forward-Port-Of: odoo/enterprise#26294
Original PR description
If the company's invoice partner's phone number is missing, _raw_phonenumber breaks and the XML report can't be exported. In stable: pass the company's phone number if the partner's phone number is missing. In master: remove the check for the company's phone number and pass an empty string to export the XML. Forward-Port-Of: odoo/enterprise#26294
Indicated by the 'shipTo' name in the 'addresses' part in an Avatax transaction API request: ``` { "addresses": { ... "shipTo": { ... } } ... } ``` The sale module adds partner_shipping_id on both account.move and sale.order so always use that if sale is installed. Using `_get_invoice_delivery_partner_id()` like in account_taxcloud was considered but it seems more understandable to directly use the partner on the record rather than sending a child d
Original PR description
Indicated by the 'shipTo' name in the 'addresses' part in an Avatax
transaction API request:
```
{
"addresses": {
...
"shipTo": {
...
}
}
...
}
```
The sale module adds partner_shipping_id on both account.move and
sale.order so always use that if sale is installed.
Using `_get_invoice_delivery_partner_id()` like in account_taxcloud was
considered but it seems more understandable to directly use the
partner on the record rather than sending a child delivery address to
Avatax without the user knowing this.
opw-2834229
Forward-Port-Of: odoo/enterprise#26714**1:/** Error in the test_mrp_avg_cost_calculation because it calls the do_finish() method that isn't defined in the module or its dependencies. The do_finish method is defined in the mrp_workorder module, which isn't part of the dependencies. _**Solution:**_ no need to call the do_finish method in this case **2:/** when the duration is set in the workorder: https://github.com/odoo/enterprise/blob/5572557916fd7133ee6d5bd0aec223de9be72915/mrp_account_enterprise/tests/test_report.py#L174
Original PR description
**1:/** Error in the test_mrp_avg_cost_calculation because it calls the do_finish() method that isn't defined in the module or its dependencies. The do_finish method is defined in the mrp_workorder module, which isn't part of the dependencies. _**Solution:**_ no need to call the do_finish method in this case **2:/** when the duration is set in the workorder: https://github.com/odoo/enterprise/blob/5572557916fd7133ee6d5bd0aec223de9be72915/mrp_account_enterprise/tests/test_report.py#L174 the timer continues to run between the assignment of the duration and the execution of the `button_mark_done`: https://github.com/odoo/enterprise/blob/5572557916fd7133ee6d5bd0aec223de9be72915/mrp_account_enterprise/tests/test_report.py#L178 which changes the total duration and impacts the production cost calculation _**Solution:**_ freeze the date so that the timer does not continue to run Forward-Port-Of: odoo/enterprise#26738 Forward-Port-Of: odoo/enterprise#26726
Steps to reproduce: - Install data_merge & contacts module - Create 2 new contact with same name but different address - Go to Data Cleaning -> Configuration -> Deduplication - Select 'Contact' - Set only `Name (res.partner)` in Deduplication Rules - Click on 'Deduplicate': 1 group with 2 contacts should be display (notice similarity value; let's assume it's 90%) - Go back and set a `Suggestion Threshold` above the similarity value (95% in this case if the c
Original PR description
Steps to reproduce:
- Install data_merge & contacts module
- Create 2 new contact with same name but different address
- Go to Data Cleaning -> Configuration -> Deduplication
- Select 'Contact'
- Set only `Name (res.partner)` in Deduplication Rules
- Click on 'Deduplicate':
1 group with 2 contacts should be display
(notice similarity value; let's assume it's 90%)
- Go back and set a `Suggestion Threshold` above the similarity value
(95% in this case if the contacts' similarity is 90%)
- Click on 'Deduplicate'
Issue:
Groups with similarity less than `Suggestion Threshold` are displayed.
Cause:
Not updating related group when `Suggestion Threshold` is changed.
Solution:
When updating `Suggestion Threshold`, unlink all group that have a
`Similiraty` under the threshold value.
opw-2833074
Forward-Port-Of: odoo/enterprise#26725Steps to reproduce the issue: - Let's consider two companies C1 and C2 - Set Synchronize invoices/bills on C2 - Log in C1 and create a customer invoice I for C2 - Add a line L at 50€ and create an analytic account AA - Validate I Bug: Incompatible companies on records because Odoo tried to create a vendor bill line with company C2 and AA on it. PS: Analytic accounts cannot be shared Same idea for analtic tag opw:2792301 Forward-Port-Of: odoo/enterprise#25668
Original PR description
Steps to reproduce the issue: - Let's consider two companies C1 and C2 - Set Synchronize invoices/bills on C2 - Log in C1 and create a customer invoice I for C2 - Add a line L at 50€ and create an analytic account AA - Validate I Bug: Incompatible companies on records because Odoo tried to create a vendor bill line with company C2 and AA on it. PS: Analytic accounts cannot be shared Same idea for analtic tag opw:2792301 Forward-Port-Of: odoo/enterprise#25668
opw-2789340 See also: - https://github.com/odoo/odoo/pull/89635 Forward-Port-Of: odoo/enterprise#26695 Forward-Port-Of: odoo/enterprise#26590
Original PR description
opw-2789340 See also: - https://github.com/odoo/odoo/pull/89635 Forward-Port-Of: odoo/enterprise#26695 Forward-Port-Of: odoo/enterprise#26590