Saturday, May 17, 2025
8 changes · saas-18.2
Miscellaneous changes
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: We did not handle the date format in case the ewaybill is generated through IRN. After this commit: We handle the format where the ewaybill is generated through IRN --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr Forward-Port-Of: odoo/odoo#210316
Original PR description
Before this commit: We did not handle the date format in case the ewaybill is generated through IRN. After this commit: We handle the format where the ewaybill is generated through IRN --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr Forward-Port-Of: odoo/odoo#210316
Forward-Port-Of: odoo/odoo#210330
Original PR description
Forward-Port-Of: odoo/odoo#210330
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
Implement new Swiss municipality OFS number assignment for ERP systems based on 2025 AFC list. This commit updates the address validation and municipality assignment logic in the ERP system to align with the new "Liste des communes OFS 2025 pour l’attribution du numéro de commune au code postal" published by the Swiss Federal Tax Administration (AFC) for withholding tax purposes. Forward-Port-Of: odoo/enterprise#84859
Original PR description
Implement new Swiss municipality OFS number assignment for ERP systems based on 2025 AFC list. This commit updates the address validation and municipality assignment logic in the ERP system to align with the new "Liste des communes OFS 2025 pour l’attribution du numéro de commune au code postal" published by the Swiss Federal Tax Administration (AFC) for withholding tax purposes. Forward-Port-Of: odoo/enterprise#84859
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
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 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