odoo/odoo#158441

Created by Lucas Vermeulen (luve)
Closed
label
odoo-dev:master-top-bar-actions-luve
head
c96be45e806f00e06d1f7ff6cd79fcf627a03ee1
odoo/odoo odoo/enterprise
master #158441 #59043 missing statuses missing r+

[IMP] web, project: Add topbar actions

This update introduces the implementation of topbar actions, enabling
the addition of a topbar in the control panel for seamless toggling
among various actions.

Functionnal specifications:

  • This task aims to centralize and access models related to the current
    parent model.

  • We introduce the concept of topbar action. If a model has topbar
    actions, then a button with an 'eye' icon is displayed in the control
    panel.

  • When the user clicks the button, the topbar appears.

  • The top bar consists of the various topbar actions chosen as visible
    by the user. By default, the topbar only displays the current action
    (or the first available).

  • There is a dropdown button to the right of the topbar that displays
    all the actions available to the user. These actions depend on the model
    , but it's also possible that there is a domain on these actions making
    them invisible. For example, a project without the 'allow timesheets'
    option will not display the 'Timesheets' action.

  • The default actions cannot be deleted by the user; they can only
    decide whether to display them or not. The visibility of actions is
    different for each model but also for each model ID, meaning, for
    example, that the actions visible in one project will not be the same
    for another.

  • Each user can also save the current view and thus create a new topbar
    action. They can decide to share this topbar action so that it is
    visible to everyone, or not. The view type and filters are saved when
    creating a new topbar action. Those saved filters are saved as favorites
    filters that cannot be deleted while the topbar action exists.

  • If the user has the rights, they can also drag and drop the actions to
    reorder them. This order will be the same for everyone, and if the
    concerned actions are default actions, the order will also be common to
    all records of the concerned model.

  • On Mobile, only a dropdown is displayed with the current action. When
    the dropdown is unfolded, all available actions are displayed. It is
    not possible to drag and drop. Deleting is always available, as well as
    the creation of new actions.

  • The breadcrumbs should never push new items. When navigating between
    topbar actions, the breadcrumbs should be replaced.


In order to create a new default topbar action for a model, the
developer has to create an xml record of that structure:

<record id="<id>" model="ir.actions.topbar">
    <field name="res_model"><parent_res_model></field>
    <field name="parent_action_id" ref="<xml_id_parent_action>"/>

    <!--
        for the triggered action, the developer can either choose
        between a xml action id or a python action
    -->
    <field name="action_id" ref=<triggered_action_id>/>
    <field name="python_action"><python_action></field>

    <!-- name is optionnal if the an action_id is declared -->
    <field name="name"><name_of_the_topbar_action></field>

    <!-- optionnal -->
    <field name="sequence"><sequence_order_integer></field>
    <field name="domain"><domain_to_filter_topbar_actions></field>
    <field name="context"><additional_context_keys></field>
    <field name="default_view_mode"><default_view></field>
</record>

task-3750721


I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr