Skip to content

[FIX] base_ux: keep quick activity badges when editing an activity#428

Open
zaoral wants to merge 1 commit into
ingadhoc:19.0from
adhoc-dev:19.0-t-71381-kz
Open

[FIX] base_ux: keep quick activity badges when editing an activity#428
zaoral wants to merge 1 commit into
ingadhoc:19.0from
adhoc-dev:19.0-t-71381-kz

Conversation

@zaoral

@zaoral zaoral commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

The quick activity badges customization was only applied to the creation flow, so the two dialogs behaved differently:

  • Scheduling a new activity goes through the mail.activity.schedule wizard, whose view is already inherited in views/mail_activity_schedule_view.xml to limit the selection_badge_icons widget to the first N types and to offer a dropdown for the rest.
  • Editing an existing activity opens an act_window on mail.activity (view mail.mail_activity_view_form_popup), which was not inherited at all. That dialog rendered a badge for every activity type in the system, which is unusable on a database with dozens of them.

Both dialogs are titled "Schedule Activity", which makes the difference easy to miss.

Changes

  • New views/mail_activity_view.xml inheriting mail.mail_activity_view_form_popup with the same domain on the badges widget plus the searchable fallback field. It also reaches mail.mail_activity_view_form (the full page view), which inherits from the popup one.
  • The lookup of the suggested types moved to mail.activity.type._get_quick_activity_types(), shared by both models instead of duplicating the parameter handling.
  • On mail.activity the computed field also includes the type currently set on the record. Without it, editing an activity whose type is not among the suggested ones would render no badge for the stored value.
  • README entry reworded to describe the actual behaviour and its configuration parameter.

No behaviour change on the creation wizard.

Test plan

New tests/test_mail_activity_quick_badges.py covers the three cases (parameter limit, wizard unchanged, existing activity keeping its own type). Run:

odoo-bin -d <db> -u base_ux --test-enable --test-tags /base_ux

Manually: on a database with more activity types than the configured limit (base_ux.activity_quick_badges, default 5), schedule an activity, save it, then hit Edit on it. Both dialogs must show the same short list of badges plus the search dropdown.

The quick badges customization was only applied to the mail.activity.schedule
wizard, used when scheduling a new activity. Editing an existing activity opens
an act_window on mail.activity instead (view mail_activity_view_form_popup), so
that dialog kept rendering a badge for every activity type in the system.

Inherit that view with the same treatment and share the lookup of the suggested
types through mail.activity.type._get_quick_activity_types(). On mail.activity
the computed field also includes the type currently set on the record: without
it, editing an activity whose type is not among the suggested ones would not
render the stored value at all.
Copilot AI review requested due to automatic review settings July 25, 2026 01:14
@roboadhoc

Copy link
Copy Markdown
Contributor

Pull request status dashboard

Copilot AI 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.

Pull request overview

Este PR corrige una inconsistencia de UX en base_ux para que el popup de edición de mail.activity use el mismo esquema de “badges rápidos + selector buscable” que ya existía en el wizard de creación, evitando mostrar decenas de badges cuando hay muchos tipos de actividad.

Changes:

  • Se hereda la vista popup de mail.activity para limitar badges a los “quick types” y agregar un selector alternativo.
  • Se centraliza el cálculo de tipos sugeridos en mail.activity.type._get_quick_activity_types() y se reutiliza desde wizard y actividad.
  • Se agrega cobertura de tests para límite por parámetro, wizard y edición preservando el tipo actual.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
base_ux/views/mail_activity_view.xml Hereda el popup de mail.activity para aplicar el mismo comportamiento de quick badges que el wizard.
base_ux/models/mail_activity.py Agrega quick_activity_ids computado en mail.activity e incluye el tipo actual al editar.
base_ux/models/mail_activity_type.py Introduce helper compartido _get_quick_activity_types() para obtener los tipos rápidos desde parámetro.
base_ux/models/mail_activity_schedule.py Reutiliza _get_quick_activity_types() en lugar de duplicar lectura/casteo del parámetro.
base_ux/tests/test_mail_activity_quick_badges.py Tests nuevos para los tres casos descritos en el plan de pruebas.
base_ux/tests/init.py Incluye el nuevo archivo de tests en el paquete.
base_ux/models/init.py Registra el nuevo modelo heredado mail_activity_type.
base_ux/README.rst Actualiza la descripción del comportamiento/configuración de quick badges.
base_ux/manifest.py Agrega la nueva vista al manifest para que se cargue en el módulo.

Comment on lines +16 to +17
limit_param = self.env["ir.config_parameter"].sudo().get_param("base_ux.activity_quick_badges", "5")
return self.search([], order="sequence, id", limit=int(limit_param))
Comment on lines +5 to +9
from odoo.tests import TransactionCase


class TestMailActivityQuickBadges(TransactionCase):
@classmethod
Comment thread base_ux/README.rst
* Keep the activity's description when changing the activity type, regardless of the activity type's description, and change the activity user only if the activity type has a default user.
* Make company_registry field on res.company invisible as it is useless now
* Show or hide the activity badge widget depending on the number of activity types defined in the system (configurable threshold, default to 5).
* On the "Schedule Activity" dialog, show only the first N activity types (ordered by sequence) as quick badges, plus a dropdown to search among all the remaining ones. It applies both when scheduling a new activity and when editing an existing one; on an existing activity its current type is always kept among the badges. N is set through the system parameter base_ux.activity_quick_badges (default to 5).
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.

3 participants