Saturday, May 17, 2025
8 changes · saas-18.1
Miscellaneous changes
PR #189568 removes the focus from the project sharing composer by setting the `inFrontendPortalChatter` to true, which goes against the whole idea of having this parameter. The correct fix is to remove the `autofocus` (prop) from the composer, because it was only there to keep the focus on the project sharing composer. This commit undoes the change in the mentioned PR and removes the `autofocus` from the portal chatter composer. Consequently, the composer placeholder in project sharing becomes
Original PR description
PR #189568 removes the focus from the project sharing composer by setting the `inFrontendPortalChatter` to true, which goes against the whole idea of having this parameter. The correct fix is to remove the `autofocus` (prop) from the composer, because it was only there to keep the focus on the project sharing composer. This commit undoes the change in the mentioned PR and removes the `autofocus` from the portal chatter composer. Consequently, the composer placeholder in project sharing becomes the one related to `note`, so this commit adds `type="'message'"` to the composer to ensure consistency with the backend when sending a message. Forward-Port-Of: odoo/odoo#207455
Forward-Port-Of: odoo/odoo#210330
Original PR description
Forward-Port-Of: odoo/odoo#210330
1.Fix issue encountered in debug mode Repro steps: 1. Install l10n_jo_edi module 2. Enter debug mode 3. Inside an invoice form view, attempt to view the raw record data then you will get an error 2.Change l10n_jo_edi_state The EDI state is not read-only (to give users flexibility in timeout scenarios), so we need to do the following: Not hide it if it's false (because the user can set it to false) and only hide it in non-Jordanian companies Make the field trackable (so it's more clear
Original PR description
1.Fix issue encountered in debug mode Repro steps: 1. Install l10n_jo_edi module 2. Enter debug mode 3. Inside an invoice form view, attempt to view the raw record data then you will get an error 2.Change l10n_jo_edi_state The EDI state is not read-only (to give users flexibility in timeout scenarios), so we need to do the following: Not hide it if it's false (because the user can set it to false) and only hide it in non-Jordanian companies Make the field trackable (so it's more clear to the users when it changes) Make it readonly in case the invoice has a QR code --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr Forward-Port-Of: odoo/odoo#207080
Before this commit, the filename for pdf reports when previewed from the portal is "\<database ID\>.pdf" instead of a readable name like "Sales-Order-S00001".pdf. This can be especially confusing if the database ID is a different number from the record's sequence number. Steps to reproduce ----- 1. Open a sales order in the customer portal 2. Select the Print button 3. From the pdf preview, Print -> Save to PDF 4. The downloaded filename is "\<database ID\>.pdf", also the browser title b
Original PR description
Before this commit, the filename for pdf reports when previewed from the portal is "\<database ID\>.pdf" instead of a readable name like "Sales-Order-S00001".pdf. This can be especially confusing if the database ID is a different number from the record's sequence number. Steps to reproduce ----- 1. Open a sales order in the customer portal 2. Select the Print button 3. From the pdf preview, Print -> Save to PDF 4. The downloaded filename is "\<database ID\>.pdf", also the browser title bar is just the database ID Cause ----- No filename is being set in the Content-Disposition header, so the browser takes the filename from the last segment of the URL which is the database ID. Solution ----- Set an inline Content-Disposition with the filename argument when previewing, similar to what is done when downloading. opw-4710501 Forward-Port-Of: odoo/odoo#210002 Forward-Port-Of: odoo/odoo#207357
Currently a traceback occurs if no QST instutions were defined, making it hard for users to understand where the error is coming from, in this PR we specify the missing institution. Forward-Port-Of: odoo/enterprise#85148 Forward-Port-Of: odoo/enterprise#85104
Original PR description
Currently a traceback occurs if no QST instutions were defined, making it hard for users to understand where the error is coming from, in this PR we specify the missing institution. Forward-Port-Of: odoo/enterprise#85148 Forward-Port-Of: odoo/enterprise#85104
### Steps to reproduce: - Create an invoice with a due date past for long time - Accounting > Customers, click on the partner of the invoice - In the page "Accounting" the "Follow-up Status" should be "In need of action" - Go to the Scheduled Action "Account Report Followup; Execute followup" and Run manually - Go back to the partner - The follow-up is send without the invoices ### Cause: This [commit](https://github.com/odoo/enterprise/pull/84114) moved a part of code to fix a bug but
Original PR description
### Steps to reproduce:
- Create an invoice with a due date past for long time
- Accounting > Customers, click on the partner of the invoice
- In the page "Accounting" the "Follow-up Status" should be "In need of action"
- Go to the Scheduled Action "Account Report Followup; Execute followup" and Run manually
- Go back to the partner
- The follow-up is send without the invoices
### Cause:
This [commit](https://github.com/odoo/enterprise/pull/84114) moved a part of code to fix a bug but it also changed it: it moved `'attachment_ids' not in options` from the end to the beginning. By doing that the line
`options.get('attachment_ids', self._get_invoices_to_print(options).message_main_attachment_id.ids)`
does not work anyore because `attachment_ids` is always in `options` so `_get_invoices_to_print` is never called.
### Solution:
Use `setdefault` instead of `get`.
opw-4716458
Forward-Port-Of: odoo/enterprise#85124The _compute_l10n_mx_edi_cfdi_cancel_id method is calling the following search https://github.com/odoo/enterprise/blob/fd01cf3d57109424725727d7eb40afbe34ef67a9/l10n_mx_edi/models/account_move.py#L685-L691 ```python move.l10n_mx_edi_cfdi_cancel_id = move.search([ ('l10n_mx_edi_cfdi_origin', '=like', f'04|{move.l10n_mx_edi_cfdi_uuid}%'), ('company_id', '=', move.company_id.id)], limit=1, ) ``` It is generating the following sql query ```sql SE
Original PR description
The _compute_l10n_mx_edi_cfdi_cancel_id method is calling the following search…
The _compute_l10n_mx_edi_cfdi_cancel_id method is calling the following search
https://github.com/odoo/enterprise/blob/fd01cf3d57109424725727d7eb40afbe34ef67a9/l10n_mx_edi/models/account_move.py#L685-L691
```python
move.l10n_mx_edi_cfdi_cancel_id = move.search([
('l10n_mx_edi_cfdi_origin', '=like', f'04|{move.l10n_mx_edi_cfdi_uuid}%'),
('company_id', '=', move.company_id.id)],
limit=1,
)
```
It is generating the following sql query
```sql
SELECT id
FROM account_move
WHERE l10n_mx_edi_cfdi_origin :: text LIKE '04|55555-5555-5555-5555-555%'
AND company_id = 1
ORDER BY date DESC,
name DESC,
invoice_date DESC,
id DESC
LIMIT 1
```
Running a analyze for a database with ~7M of `account_move` records the result is
```txt
Limit (cost=73029.67..137055.68 rows=1 width=26) (actual time=1610.419..1637.035 rows=0 loops=1)
-> Incremental Sort (cost=73029.67..649263.71 rows=9 width=26) (actual time=1600.475..1627.091 rows=0 loops=1)
Sort Key: date DESC, name DESC, invoice_date DESC, id DESC
Presorted Key: date
Full-sort Groups: 1 Sort Method: quicksort Average Memory: 25kB Peak Memory: 25kB
-> Gather Merge (cost=1000.46..649263.30 rows=9 width=26) (actual time=1600.466..1627.082 rows=0 loops=1)
Workers Planned: 2
Workers Launched: 2
-> Parallel Index Scan Backward using account_move__date_index on account_move (cost=0.43..648262.24 rows=4 width=26) (actual time=1586.469..1586.469 rows=0 loops=3)
Filter: (((l10n_mx_edi_cfdi_origin)::text ~~ '04|55555-5555-5555-5555-555%'::text) AND (company_id = 1))
Rows Removed by Filter: 2274213
Planning Time: 0.197 ms
JIT:
Functions: 13
Options: Inlining false, Optimization false, Expressions true, Deforming true
Timing: Generation 3.044 ms, Inlining 0.000 ms, Optimization 2.327 ms, Emission 34.202 ms, Total 39.574 ms
Execution Time: 1637.815 ms
```
PostgreSQL query stats from production returns the following top 1 slow query
```txt
Total Time Average Time Calls
4,981 min 1,351 ms 221,238
SELECT "account_move"."id"
FROM "account_move"
WHERE (("account_move"."l10n_mx_edi_cfdi_origin"::text LIKE $1)
AND ("account_move"."company_id" = $2))
AND (("account_move"."company_id" IN ($3)) OR "account_move"."company_id" IS NULL)
ORDER BY "account_move"."date" DESC , "account_move"."name" DESC , "account_move"."invoice_date" DESC , "account_move"."id" DESC
LIMIT $4
```
Creating the following index
```sql
CREATE INDEX account_move_l10n_mx_edi_cfdi_origin_index
ON account_move (l10n_mx_edi_cfdi_origin)
WHERE l10n_mx_edi_cfdi_origin IS NOT NULL
```
Similar to define the field `account_move.l10n_mx_edi_cfdi_origin(index='btree_not_null')`
The same query analyze result is
```txt
Limit (cost=4.49..4.49 rows=1 width=26) (actual time=0.018..0.018 rows=0 loops=1)
-> Sort (cost=4.49..4.51 rows=9 width=26) (actual time=0.017..0.017 rows=0 loops=1)
Sort Key: date DESC, name DESC, invoice_date DESC, id DESC
Sort Method: quicksort Memory: 25kB
-> Index Scan using account_move_l10n_mx_edi_cfdi_origin_index on account_move (cost=0.42..4.44 rows=9 width=26) (actual time=0.011..0.012 rows=0 loops=1)
Index Cond: (((l10n_mx_edi_cfdi_origin)::text >= '04|55555-5555-5555-5555-555'::text) AND ((l10n_mx_edi_cfdi_origin)::text < '04|55555-5555-5555-5555-556'::text))
Filter: (((l10n_mx_edi_cfdi_origin)::text ~~ '04|55555-5555-5555-5555-555%'::text) AND (company_id = 1))
Planning Time: 0.147 ms
Execution Time: 0.036 ms
```
It is ~9k times faster
Forward-Port-Of: odoo/enterprise#85427See test in this commit. opw-4744627 Forward-Port-Of: odoo/enterprise#85697
Original PR description
See test in this commit. opw-4744627 Forward-Port-Of: odoo/enterprise#85697