@ -0,0 +1,51 @@ |
|||||
|
.. image:: https://img.shields.io/badge/license-LGPL--3-green.svg |
||||
|
:target: https://www.gnu.org/licenses/lgpl-3.0-standalone.html |
||||
|
:alt: License: LGPL-3 |
||||
|
|
||||
|
All in one Schedule Activity Management |
||||
|
======================================= |
||||
|
* Schedule Activity Management for Odoo 18 |
||||
|
|
||||
|
Configuration |
||||
|
============= |
||||
|
* Set Schedule Management user inside the user |
||||
|
|
||||
|
Company |
||||
|
------- |
||||
|
* `Cybrosys Techno Solutions <https://cybrosys.com/>`__ |
||||
|
|
||||
|
License |
||||
|
------- |
||||
|
General Public License, Version 3 (LGPL v3). |
||||
|
(https://www.gnu.org/licenses/lgpl-3.0-standalone.html) |
||||
|
|
||||
|
Credits |
||||
|
------- |
||||
|
* Developer: |
||||
|
(v16) Rosmy , |
||||
|
(V17) Anjhana A K, |
||||
|
(V18) Adarsh K, |
||||
|
|
||||
|
* Contact: odoo@cybrosys.com |
||||
|
|
||||
|
Contacts |
||||
|
-------- |
||||
|
* Mail Contact : odoo@cybrosys.com |
||||
|
* Website : https://cybrosys.com |
||||
|
|
||||
|
Bug Tracker |
||||
|
----------- |
||||
|
Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. |
||||
|
|
||||
|
Maintainer |
||||
|
========== |
||||
|
.. image:: https://cybrosys.com/images/logo.png |
||||
|
:target: https://cybrosys.com |
||||
|
|
||||
|
This module is maintained by Cybrosys Technologies. |
||||
|
|
||||
|
For support and more information, please visit `Our Website <https://cybrosys.com/>`__ |
||||
|
|
||||
|
Further information |
||||
|
=================== |
||||
|
HTML Description: `<static/description/index.html>`__ |
@ -0,0 +1,22 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
################################################################################### |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author:Adarsh K(<https://www.cybrosys.com>) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from . import models |
@ -0,0 +1,63 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
################################################################################### |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author:Adarsh K(<https://www.cybrosys.com>) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
{ |
||||
|
'name': 'All in one Schedule Activity Management', |
||||
|
'version': '18.0.1.0.0', |
||||
|
'category': 'Tools', |
||||
|
'summary': """The module allows the manage all scheduled activities.""", |
||||
|
'description': """The module is a robust tool for organizing and overseeing |
||||
|
all scheduled tasks and events, and Activity manager could manage scheduled |
||||
|
activities. """, |
||||
|
'author': 'Cybrosys Techno Solutions', |
||||
|
'company': 'Cybrosys Techno Solutions', |
||||
|
'maintainer': 'Cybrosys Techno Solutions', |
||||
|
'website': "https://www.cybrosys.com", |
||||
|
'depends': ['base_setup', 'mail', 'sale_management'], |
||||
|
'data': [ |
||||
|
'security/all_in_one_schedule_activity_management_groups.xml', |
||||
|
'security/ir.model.access.csv', |
||||
|
'data/ir_cron_data.xml', |
||||
|
'views/mail_activity_views.xml', |
||||
|
'views/activity_tag_views.xml', |
||||
|
'views/my_activity_views.xml', |
||||
|
'views/activity_dashbord_views.xml', |
||||
|
'views/reporting_activity_views.xml', |
||||
|
'views/activity_history_views.xml', |
||||
|
'views/res_config_setting_views.xml', |
||||
|
'views/menu_views.xml', |
||||
|
], |
||||
|
'assets': { |
||||
|
'web.assets_backend': [ |
||||
|
'https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js', |
||||
|
'all_in_one_schedule_activity_management/static/src/xml/activity_dashboard_view.xml', |
||||
|
'all_in_one_schedule_activity_management/static/src/js/activity_dashboard.js', |
||||
|
'all_in_one_schedule_activity_management/static/src/css/dashboard.css', |
||||
|
'all_in_one_schedule_activity_management/static/src/css/style.scss', |
||||
|
'all_in_one_schedule_activity_management/static/src/css/material-gauge.css', |
||||
|
], |
||||
|
}, |
||||
|
'license': 'LGPL-3', |
||||
|
'images': ['static/description/banner.jpg'], |
||||
|
'installable': True, |
||||
|
'auto_install': False, |
||||
|
'application': True, |
||||
|
} |
@ -0,0 +1,14 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<!-- This XML code creates a scheduled action for checking the due activities. --> |
||||
|
<data noupdate="1"> |
||||
|
<record id="ir_cron_mail_on_due_action" model="ir.cron"> |
||||
|
<field name="name">Recurring Todo Activity</field> |
||||
|
<field name="model_id" ref="model_mail_activity"/> |
||||
|
<field name="state">code</field> |
||||
|
<field name="code">model.action_mail_on_due_date()</field> |
||||
|
<field name="user_id" ref="base.user_root"/> |
||||
|
<field name="interval_number">1</field> |
||||
|
<field name="interval_type">days</field> |
||||
|
<!-- <field name="numbercall">-1</field>--> |
||||
|
</record> |
||||
|
</data> |
@ -0,0 +1,6 @@ |
|||||
|
## Module <all_in_one_schedule_activity_management> |
||||
|
|
||||
|
#### 06.05.2025 |
||||
|
#### Version 18.0.1.0.0 |
||||
|
##### ADD |
||||
|
- Initial commit for All in one Schedule Activity Management |
@ -0,0 +1,25 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################## |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author:Adarsh K(<https://www.cybrosys.com>) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from . import mail_activity |
||||
|
from . import activity_tag |
||||
|
from . import res_config_settings |
||||
|
from . import res_users |
@ -0,0 +1,42 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
################################################################################### |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author:Adarsh K(<https://www.cybrosys.com>) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from odoo import fields, models |
||||
|
from random import randint |
||||
|
|
||||
|
|
||||
|
class ActivityTag(models.Model): |
||||
|
"""This class is used to create tags for activity""" |
||||
|
_name = "activity.tag" |
||||
|
_description = "Activity Tag" |
||||
|
|
||||
|
def _get_default_color(self): |
||||
|
"""to get colors for the tag""" |
||||
|
return randint(1, 11) |
||||
|
|
||||
|
name = fields.Char('Tag Name', required=True, translate=True, |
||||
|
help="Tag name") |
||||
|
color = fields.Integer('Color', default=_get_default_color, |
||||
|
help="Tag color") |
||||
|
|
||||
|
_sql_constraints = [ |
||||
|
('name_uniq', 'unique (name)', "Tag name already exists !"), |
||||
|
] |
@ -0,0 +1,172 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
################################################################################### |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author:Adarsh K(<https://www.cybrosys.com>) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from collections import defaultdict |
||||
|
from odoo import fields, models, _ |
||||
|
from odoo.exceptions import UserError |
||||
|
|
||||
|
|
||||
|
class MailActivity(models.Model): |
||||
|
"""This class is used to inherit the mail.activity model""" |
||||
|
_inherit = "mail.activity" |
||||
|
|
||||
|
state = fields.Selection( |
||||
|
[ |
||||
|
("overdue", "Overdue"), ("today", "Today"), ("planned", "Planned"), |
||||
|
("done", "Done"), ("cancel", "Cancelled"),], |
||||
|
"State", compute="_compute_state", store=True, |
||||
|
help="state for the activity",) |
||||
|
active = fields.Boolean("Active", default=True, |
||||
|
help="The record make Active") |
||||
|
activity_tag_ids = fields.Many2many( |
||||
|
"activity.tag", string="Activity Tags", |
||||
|
help="Activity Tags") |
||||
|
|
||||
|
def action_mail_on_due_date(self): |
||||
|
"""This function is used to send mails on due date""" |
||||
|
activity_email = self.env["mail.activity"].search([]) |
||||
|
notification_on_date = ( |
||||
|
self.env["ir.config_parameter"].sudo().get_param("notify_on_due_date") |
||||
|
) |
||||
|
notification_on_expiry = ( |
||||
|
self.env["ir.config_parameter"].sudo().get_param("notify_on_expiry") |
||||
|
) |
||||
|
for rec in activity_email: |
||||
|
if notification_on_expiry and rec.date_deadline < fields.date.today(): |
||||
|
self.env["mail.mail"].sudo().create( |
||||
|
{ |
||||
|
"email_from": self.env.company.email, |
||||
|
"author_id": self.env.user.partner_id.id, |
||||
|
"body_html": "Hello <br> You missed the %s activity for the document %s </br>" |
||||
|
% (rec.activity_type_id.name, rec.res_name), |
||||
|
"subject": "%s Activity missed" % rec.activity_type_id.name, |
||||
|
"email_to": rec.user_id.email, |
||||
|
} |
||||
|
).send(auto_commit=False) |
||||
|
if notification_on_date and rec.date_deadline == fields.date.today(): |
||||
|
self.env["mail.mail"].sudo().create( |
||||
|
{ |
||||
|
"email_from": self.env.company.email, |
||||
|
"author_id": self.env.user.partner_id.id, |
||||
|
"body_html": "Hello <br> Today is your %s activity for the document %s </br>" |
||||
|
% (rec.activity_type_id.name, rec.res_name), |
||||
|
"subject": "Today %s Activity" % rec.activity_type_id.name, |
||||
|
"email_to": rec.user_id.email, |
||||
|
} |
||||
|
).send(auto_commit=False) |
||||
|
|
||||
|
def action_activity_cancel(self): |
||||
|
"""cancel activity""" |
||||
|
for rec in self: |
||||
|
if rec.state == "cancel": |
||||
|
raise UserError(_("You Cant Cancelled this activity %s") % rec.res_name) |
||||
|
else: |
||||
|
rec.action_cancel() |
||||
|
|
||||
|
def action_activity_done(self): |
||||
|
"""done activity""" |
||||
|
for rec in self: |
||||
|
if rec.state == "done": |
||||
|
raise UserError(_("You Cant Cancelled this activity %s") % rec.res_name) |
||||
|
else: |
||||
|
rec._action_done() |
||||
|
|
||||
|
def get_activity_count(self): |
||||
|
"""get the activity count details""" |
||||
|
activity = self.env["mail.activity"] |
||||
|
return { |
||||
|
"len_all": len(activity.search([])), |
||||
|
"len_overdue": len(activity.search([("state", "=", "overdue")])), |
||||
|
"len_planned": len(activity.search([("state", "=", "planned")])), |
||||
|
"len_today": len(activity.search([("state", "=", "today")])), |
||||
|
"len_done": len(activity.search([("state", "=", "done"), ("active", "=", False)])), |
||||
|
"len_cancel": len(activity.search([("state", "=", "cancel")])), |
||||
|
} |
||||
|
|
||||
|
def get_activity(self, id): |
||||
|
"""Function for to get the activity""" |
||||
|
return {"model": self.env["mail.activity"].search([("id", "=", id)]).res_model, |
||||
|
"res_id": self.env["mail.activity"].search([("id", "=", id)]).res_id} |
||||
|
|
||||
|
def _action_done(self, feedback=False, attachment_ids=None): |
||||
|
"""action done function: rewrite the function""" |
||||
|
messages = self.env["mail.message"] |
||||
|
next_activities_values = [] |
||||
|
attachments = self.env["ir.attachment"].search_read( |
||||
|
[("res_model", "=", self._name), ("res_id", "in", self.ids)], |
||||
|
["id", "res_id"]) |
||||
|
activity_attachments = defaultdict(list) |
||||
|
for attachment in attachments: |
||||
|
activity_id = attachment["res_id"] |
||||
|
activity_attachments[activity_id].append(attachment["id"]) |
||||
|
for activity in self: |
||||
|
if activity.chaining_type == "trigger": |
||||
|
vals = activity.with_context( |
||||
|
activity_previous_deadline=activity.date_deadline |
||||
|
)._prepare_next_activity_values() |
||||
|
next_activities_values.append(vals) |
||||
|
records_sudo = self.env[activity.res_model].browse(activity.res_id) |
||||
|
records_sudo.message_post_with_source( |
||||
|
"mail.message_activity_done", |
||||
|
attachment_ids=attachment_ids, |
||||
|
author_id=self.env.user.partner_id.id, |
||||
|
render_values={ |
||||
|
"activity": activity, |
||||
|
"feedback": feedback, |
||||
|
"display_assignee": activity.user_id != self.env.user, |
||||
|
}, |
||||
|
mail_activity_type_id=activity.activity_type_id.id, |
||||
|
subtype_xmlid='mail.mt_activities', |
||||
|
) |
||||
|
if activity.activity_type_id.keep_done: |
||||
|
attachment_ids = ( |
||||
|
attachment_ids or []) + activity_attachments.get( |
||||
|
activity.id, []) |
||||
|
if attachment_ids: |
||||
|
activity.attachment_ids = attachment_ids |
||||
|
activity_message = records_sudo.message_ids[0] |
||||
|
message_attachments = self.env["ir.attachment"].browse( |
||||
|
activity_attachments[activity.id] |
||||
|
) |
||||
|
if message_attachments: |
||||
|
message_attachments.write( |
||||
|
{ |
||||
|
"res_id": activity_message.id, |
||||
|
"res_model": activity_message._name, |
||||
|
} |
||||
|
) |
||||
|
activity_message.attachment_ids = message_attachments |
||||
|
messages += activity_message |
||||
|
|
||||
|
next_activities = self.env['mail.activity'] |
||||
|
if next_activities_values: |
||||
|
next_activities = self.env['mail.activity'].create( |
||||
|
next_activities_values) |
||||
|
for rec in self: |
||||
|
rec.state = "done" |
||||
|
rec.active = False |
||||
|
return messages, next_activities |
||||
|
|
||||
|
def action_cancel(self): |
||||
|
self.state = "cancel" |
||||
|
"""cancel activities""" |
||||
|
self.unlink() |
||||
|
|
@ -0,0 +1,43 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
################################################################################### |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author:Adarsh K(<https://www.cybrosys.com>) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from odoo import api, fields, models |
||||
|
|
||||
|
|
||||
|
class ResConfigSettings(models.TransientModel): |
||||
|
_inherit = 'res.config.settings' |
||||
|
|
||||
|
notify_on_due_date = fields.Boolean('Notify on Due Date', |
||||
|
help="Notify the due date", |
||||
|
config_parameter="notify_on_due_date") |
||||
|
notify_on_expiry = fields.Boolean('Notify on Expiry', |
||||
|
help="Notify the Expiry date", |
||||
|
config_parameter="notify_on_expiry") |
||||
|
|
||||
|
@api.model |
||||
|
def get_values(self): |
||||
|
"""Returns a list of values for the given configuration fields""" |
||||
|
res = super(ResConfigSettings, self).get_values() |
||||
|
res['notify_on_due_date'] = self.env[ |
||||
|
'ir.config_parameter'].sudo().get_param('notify_on_due_date') |
||||
|
res['notify_on_expiry'] = self.env[ |
||||
|
'ir.config_parameter'].sudo().get_param('notify_on_expiry') |
||||
|
return res |
@ -0,0 +1,87 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
################################################################################### |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author:Adarsh K(<https://www.cybrosys.com>) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from odoo import _, api, models, modules |
||||
|
from collections import defaultdict |
||||
|
|
||||
|
|
||||
|
class Users(models.Model): |
||||
|
"""This class is used to create tags for activity""" |
||||
|
_inherit = 'res.users' |
||||
|
|
||||
|
@api.model |
||||
|
def _get_activity_groups(self): |
||||
|
search_limit = int(self.env['ir.config_parameter'].sudo().get_param('mail.activity.systray.limit', 1000)) |
||||
|
activities = self.env["mail.activity"].search( |
||||
|
[("user_id", "=", self.env.uid)], order='id desc', limit=search_limit) |
||||
|
activities_by_record_by_model_name = defaultdict(lambda: defaultdict(lambda: self.env["mail.activity"])) |
||||
|
for activity in activities: |
||||
|
record = self.env[activity.res_model].browse(activity.res_id) |
||||
|
activities_by_record_by_model_name[activity.res_model][record] += activity |
||||
|
activities_by_model_name = defaultdict(lambda: self.env["mail.activity"]) |
||||
|
user_company_ids = self.env.user.company_ids.ids |
||||
|
is_all_user_companies_allowed = set(user_company_ids) == set(self.env.context.get('allowed_company_ids') or []) |
||||
|
for model_name, activities_by_record in activities_by_record_by_model_name.items(): |
||||
|
res_ids = [r.id for r in activities_by_record] |
||||
|
Model = self.env[model_name].with_context(**self.env.context) |
||||
|
has_model_access_right = self.env[model_name].check_access_rights('read', raise_exception=False) |
||||
|
if has_model_access_right: |
||||
|
allowed_records = Model.browse(res_ids)._filter_access_rules('read') |
||||
|
else: |
||||
|
allowed_records = self.env[model_name] |
||||
|
unallowed_records = Model.browse(res_ids) - allowed_records |
||||
|
if has_model_access_right and unallowed_records and not is_all_user_companies_allowed: |
||||
|
unallowed_records -= unallowed_records.with_context( |
||||
|
allowed_company_ids=user_company_ids)._filter_access_rules('read') |
||||
|
for record, activities in activities_by_record.items(): |
||||
|
if record in unallowed_records: |
||||
|
activities_by_model_name['mail.activity'] += activities |
||||
|
elif record in allowed_records: |
||||
|
activities_by_model_name[model_name] += activities |
||||
|
model_ids = [self.env["ir.model"]._get_id(name) for name in activities_by_model_name] |
||||
|
user_activities = {} |
||||
|
for model_name, activities in activities_by_model_name.items(): |
||||
|
Model = self.env[model_name] |
||||
|
module = Model._original_module |
||||
|
icon = module and modules.module.get_module_icon(module) |
||||
|
model = self.env["ir.model"]._get(model_name).with_prefetch(model_ids) |
||||
|
user_activities[model_name] = { |
||||
|
"id": model.id, |
||||
|
"name": model.name, |
||||
|
"model": model_name, |
||||
|
"type": "activity", |
||||
|
"icon": icon, |
||||
|
"total_count": 0, |
||||
|
"today_count": 0, |
||||
|
"overdue_count": 0, |
||||
|
"planned_count": 0, |
||||
|
"view_type": getattr(Model, '_systray_view', 'list'), |
||||
|
} |
||||
|
if model_name == 'mail.activity': |
||||
|
user_activities[model_name]['activity_ids'] = activities.ids |
||||
|
for activity in activities: |
||||
|
if activity.state != "cancel": |
||||
|
user_activities[model_name]["%s_count" % activity.state] += 1 |
||||
|
if activity.state in ("today", "overdue"): |
||||
|
user_activities[model_name]["total_count"] += 1 |
||||
|
if "mail.activity" in user_activities: |
||||
|
user_activities["mail.activity"]["name"] = _("Other activities") |
||||
|
return list(user_activities.values()) |
@ -0,0 +1,7 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<odoo> |
||||
|
<!-- This XML code creates the user for schedule management. --> |
||||
|
<record id="group_schedule_management_user" model="res.groups"> |
||||
|
<field name="name">Schedule Management User</field> |
||||
|
</record> |
||||
|
</odoo> |
|
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 628 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 210 KiB |
After Width: | Height: | Size: 209 KiB |
After Width: | Height: | Size: 109 KiB |
After Width: | Height: | Size: 495 B |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 624 B |
After Width: | Height: | Size: 136 KiB |
After Width: | Height: | Size: 214 KiB |
After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 310 B |
After Width: | Height: | Size: 929 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 542 B |
After Width: | Height: | Size: 576 B |
After Width: | Height: | Size: 733 B |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 922 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 911 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 600 B |
After Width: | Height: | Size: 673 B |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 462 B |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 926 B |
After Width: | Height: | Size: 9.0 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 7.0 KiB |
After Width: | Height: | Size: 878 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 653 B |
After Width: | Height: | Size: 800 B |
After Width: | Height: | Size: 905 B |
After Width: | Height: | Size: 189 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 839 B |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 5.9 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 427 B |
After Width: | Height: | Size: 627 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 988 B |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 875 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 767 KiB |
After Width: | Height: | Size: 138 KiB |
After Width: | Height: | Size: 760 KiB |
After Width: | Height: | Size: 92 KiB |
After Width: | Height: | Size: 697 KiB |
After Width: | Height: | Size: 1.1 MiB |
After Width: | Height: | Size: 70 KiB |
After Width: | Height: | Size: 76 KiB |
After Width: | Height: | Size: 146 KiB |
After Width: | Height: | Size: 100 KiB |
After Width: | Height: | Size: 27 KiB |
After Width: | Height: | Size: 32 KiB |
After Width: | Height: | Size: 140 KiB |
After Width: | Height: | Size: 58 KiB |
After Width: | Height: | Size: 69 KiB |
After Width: | Height: | Size: 104 KiB |
After Width: | Height: | Size: 88 KiB |
After Width: | Height: | Size: 276 KiB |
After Width: | Height: | Size: 145 KiB |
After Width: | Height: | Size: 44 KiB |