Files
odoo_source/addons/mail/models/__init__.py
T
Pierre-Yves Dufays 35d5342887 [IMP] {test_}mail, various: generalize activity plan + activity batch schedule
Generalize the hr.employee activity plan to any model, allowing to create
activity plan that can be launched on any model.

The activity can now be created in batch by selecting multiple record in the
list view and then clicking on a "clock" icon in a row similarly to the batch
records update (selecting multiple records allows to change for example their
name in batch in the list view). We implement also that functionality for the
plan, allowing to launch a plan on multiple records at once.

We also centralize the launching of activity or activity plan through either
the  "Activities" button in the chatter or the "clock" button in the view list.

Scheduling activity is now taken in charge by a wizard that can schedule a
single activity as well as a plan. We add/update tests for checking that the
wizard is launched with the right record selection (on a single record or a
batch) and add tests for checking the wizard itself.

The plan can be defined through an added menu in the technical admin menu but
also through configuration menu added in the module crm, project.

Technical notes:
In the added wizard, to determine that there is a error, we introduce the
has_error field because we cannot use easily the error field for that. Indeed,
to determine that there is no error, we have to compare it to "<p><br></p>"
(more precisely &lt;p&gt;&lt;br&gt;&lt;/p&gt;) which is not handy and may
change in the future. This is because when we write False on field error and
read it after, we get "<p><br></p>". Instead, we centralize this weird
comparison in the model in the compute method of has_error.

The ActivityListPopover still displays the activity of the record on which it
has been triggered but the button to schedule activity will launch a wizard
that create activities in batch for the selected records if more than one was
selected. For that, the ActivityListPopover component receives now an
additional prop: resIds (selected records) on top of the resId prop (record on
which the popup has been triggered). Note that when the line that trigger the
popup is not selected, the batch mode is disabled to avoid confusion.

Test are updated because the wizard is opened instead of the activity form to
schedule a new activity and as the form view is only used to edit already
existing activities, default_res_id and default_res_model are no longer passed.

We defines date_deadline and date_plan_deadline in the schedule wizard because
those date are managed differently (default value, required or not, ...).

Task-3390865

Part-of: odoo/odoo#137969
2023-10-12 16:12:09 +00:00

70 lines
1.9 KiB
Python

# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
# core models (required for mixins)
from . import mail_alias
from . import models
# mixin
from . import mail_activity_mixin
from . import mail_alias_mixin_optional
from . import mail_alias_mixin
from . import mail_render_mixin
from . import mail_composer_mixin
from . import mail_thread
from . import mail_thread_blacklist
from . import mail_thread_cc
from . import mail_thread_main_attachment
from . import mail_tracking_duration_mixin
from . import template_reset_mixin
# mail models
from . import fetchmail
from . import mail_notification # keep before as decorated m2m
from . import mail_activity_type
from . import mail_activity
from . import mail_activity_plan
from . import mail_activity_plan_template
from . import mail_blacklist
from . import mail_followers
from . import mail_gateway_allowed
from . import mail_link_preview
from . import mail_message_reaction
from . import mail_message_schedule
from . import mail_message_subtype
from . import mail_message
from . import mail_mail
from . import mail_tracking_value
from . import mail_template
# discuss
from . import mail_ice_server
from . import mail_shortcode
from . import res_users_settings
from . import res_users_settings_volumes
# odoo models
from . import bus_presence
from . import ir_action_act_window
from . import ir_actions_server
from . import ir_attachment
from . import ir_config_parameter
from . import ir_http
from . import ir_mail_server
from . import ir_model
from . import ir_model_fields
from . import ir_ui_view
from . import ir_qweb
from . import res_company
from . import res_config_settings
from . import res_users
from . import update
from . import web_push
from . import partner_devices
# after mail specifically as discuss module depends on mail
from . import discuss
# discuss_channel_member must be loaded first
from . import res_partner