Skip to content

Fork Sync Branch 19.0 - #32

Merged
btl-bot merged 6 commits into
BTLzdravtech:19.0from
ingadhoc:19.0
Nov 16, 2026
Merged

btl-bot merged 6 commits into
BTLzdravtech:19.0from
ingadhoc:19.0

Conversation

@btl-bot

@btl-bot btl-bot commented Nov 16, 2026

Copy link
Copy Markdown

No description provided.

cem-adhoc and others added 6 commits November 12, 2026 13:24
…liation on import

The import runs the whole automatic reconciliation of the cron on the new
lines, which also matches open invoices and payments of the partner by
amount, and there was no way to turn it off. Customers that keep the cron
off because a paid invoice triggers their own processes got invoices paid
by the import itself.

It is now a company setting (Reconcile on Statement Import), on by default.

closes #509

Signed-off-by: rov-adhoc <rov@adhoc.com.ar>
Add the es translation for the "Select a field..." placeholder shown in
the empty field selector (automation rules, server actions).

closes #513

Signed-off-by: Juan Carreras <jc@adhoc.com.ar>
…e on import setting

closes #516

Signed-off-by: rov-adhoc <rov@adhoc.com.ar>
Cada mensaje nuevo en un chat de Discuss hace que Odoo 18 lea todos los mensajes de ese chat, una vez por cada pestaña abierta de cada participante, solo para saber cuál es el último. En chats de muchos años (decenas de miles de mensajes) eso pasa a ser lo que más SQL consume en la base y la frena. Este PR hace que lea solo el último mensaje.

Tarea: https://www.adhoc.inc/odoo/project.task/79479

## Qué pasa en upstream

- El cliente web llama a `discuss.channel.channel_fetched` cada vez que llega un mensaje nuevo por el bus a un canal que no es de tipo `channel` (`mail/static/src/discuss/core/common/discuss_core_common_service.js`). Lo llama cada pestaña de cada miembro.
- `channel_fetched` hace `channel.message_ids.ids[0]`: resuelve el one2many entero, con el chequeo de acceso de `mail.message._search`, para quedarse con el primer id.
- El filtro `channel_type in {chat, whatsapp}` está después de esa carga, así que en los grupos también lee todo el canal y después lo descarta.
- En `master` Odoo sacó `channel_fetched` y el campo `fetched_message_id`. En 18.0 y 19.0 sigue igual.

## Qué cambia

Override de `channel_fetched` en `mail_ux`:

- chequea `channel_type` antes de buscar nada;
- busca el último mensaje con el mismo dominio que `message_ids` (`model`, `res_id`, `message_type != user_notification`), `order="id desc"` y `limit=1`, como el usuario actual. Es lo mismo que hace `master` con `_search(..., order="id desc", limit=1)`.

El resto del método (búsqueda del miembro, `UPDATE ... SKIP LOCKED` y la notificación por bus) queda igual que upstream.

## Medición

En la base más afectada de la flota, `channel_fetched` era el 54,6% del tiempo SQL de un día hábil: 8.151 llamadas a 602 ms, y la consulta devolvía en promedio 15.256 filas por llamada. En la flota productiva de 18 y 19, 102 bases llamaron a `channel_fetched` ese día y en 77 cuesta menos de 50 ms por llamada.

## Pruebas

- `test_chat_fetched_reads_only_last_message`: en un chat con varios mensajes y un `user_notification` al final, `fetched_message_id` queda en el último mensaje visible y `mail.message._search` se llama una sola vez, con `limit=1`. Con el código de upstream falla, porque `message_ids` busca sin límite.
- `test_group_fetched_is_skipped`: en un grupo no se busca ningún mensaje.
- Prueba manual pendiente en una base de test con chats grandes: el tiempo de `channel_fetched` en el log de acceso tiene que bajar a pocos ms, sin depender del tamaño del chat.

Después del merge sale el forward-port a 19.0, donde el método es igual.

closes #503

Forward-port-of: #501
Signed-off-by: Filoquin adhoc <maq@adhoc.com.ar>
Signed-off-by: Andrés Zacchino <az@adhoc.inc>
run() committed the job work, its finish() and the user notification
together. When the notification failed (e.g. a serialization failure on
discuss_channel_member), the rollback discarded the work of a job that
had already finished, and the retry ran it again.

run() now commits the job work and finish() before notifying. The
notification runs in a savepoint and an error there is only logged, so
a finished job is not rolled back nor run again.

The runner change of the original commit (one job per cron run) is not
forward-ported: 19.0 already processes one job per run and re-triggers
the runner while enqueued jobs remain.

closes #519

X-original-commit: b074ac1
Signed-off-by: Filoquin adhoc <maq@adhoc.com.ar>
Signed-off-by: rov-adhoc <rov@adhoc.com.ar>

@sireko sireko left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Auto approved

@btl-bot
btl-bot merged commit 7c3f2d0 into BTLzdravtech:19.0 Nov 16, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants