@ -0,0 +1,50 @@ |
|||
.. image:: https://img.shields.io/badge/license-AGPL--3-blue.svg |
|||
:target: https://www.gnu.org/licenses/agpl-3.0-standalone.html |
|||
:alt: License: AGPL-3 |
|||
|
|||
Work Report From Timesheet |
|||
========================== |
|||
Create workreport and send to manager based on timesheet created. |
|||
|
|||
Configuration |
|||
============= |
|||
* Enable 'Generate work report' from timesheet configuration settings |
|||
* Employees who should receive the work report can be chosen. |
|||
* Configure Outgoing Mail Server. |
|||
|
|||
License |
|||
------- |
|||
Affero General Public License v3.0 (AGPL v3) |
|||
(https://www.gnu.org/licenses/agpl-3.0-standalone.html) |
|||
|
|||
Company |
|||
------- |
|||
* `Cybrosys Techno Solutions <https://cybrosys.com/>`__ |
|||
|
|||
Credits |
|||
------- |
|||
* Developer: (V16) Anagha S, |
|||
(V18) Busthana shirin |
|||
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) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Anagha S (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL 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 AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################### |
|||
from . import models |
@ -0,0 +1,49 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################### |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Anagha S (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL 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 AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################### |
|||
{ |
|||
'name': "Work Report From Timesheet", |
|||
'version': '18.0.1.0.0', |
|||
'category': 'Project', |
|||
'summary': 'Work Report From Timesheet', |
|||
'description': """This module helps to generate employee daily work report |
|||
by creating timesheet from the timesheet module and sending them to the |
|||
corresponding manager by mail that is configured in the timesheet |
|||
configuration.""", |
|||
'author': 'Cybrosys Techno Solutions', |
|||
'company': 'Cybrosys Techno Solutions', |
|||
'maintainer': 'Cybrosys Techno Solutions', |
|||
'website': "https://www.cybrosys.com", |
|||
'depends': ['hr_timesheet', 'mail'], |
|||
'data': [ |
|||
'data/ir_cron_data.xml', |
|||
'data/mail_data.xml', |
|||
'views/account_analytic_line_views.xml', |
|||
'views/res_config_settings_views.xml', |
|||
], |
|||
'images': [ |
|||
'static/description/banner.jpg', |
|||
], |
|||
'license': 'AGPL-3', |
|||
'installable': True, |
|||
'auto_install': False, |
|||
'application': False, |
|||
} |
@ -0,0 +1,14 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
<!-- Cron Job: To check close date --> |
|||
<record id="send_daily_report" model="ir.cron"> |
|||
<field name="name">Timesheet: Send Daily Work Report</field> |
|||
<field name="model_id" ref="model_account_analytic_line"/> |
|||
<field name="state">code</field> |
|||
<field name="code">model.send_employee_daily_work_report()</field> |
|||
<field name='interval_number'>1</field> |
|||
<field name='interval_type'>days</field> |
|||
<field name="nextcall" |
|||
eval="(DateTime.now() + timedelta(days=1)).strftime('%Y-%m-%d 11:00:00')"/> |
|||
</record> |
|||
</odoo> |
@ -0,0 +1,331 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
<!--Employee task report Email template --> |
|||
<record id="email_template_work_report_from_timesheet" |
|||
model="mail.template"> |
|||
<field name="name">WorkReport: Task report from timesheet</field> |
|||
<field name="model_id" ref="work_report_from_timesheet.model_account_analytic_line"/> |
|||
<field name="subject">Task report_ {{ object.date.strftime('%b-%d-%Y') }} - {{ object.employee_id.name }}</field> |
|||
<field name="description">Send Daily work report of employee to the manager</field> |
|||
<field name="email_from">{{ (object.user_id.email_formatted or user.email_formatted) }} |
|||
</field> |
|||
<field name="body_html" type="html"> |
|||
<div style="margin: 0px; padding: 0px;"> |
|||
<p style="margin: 0px; padding: 0px; font-size: 13px;"> |
|||
Hello, |
|||
<br/> |
|||
Here is a report on my daily work. |
|||
<br/> |
|||
<br/> |
|||
<br/> |
|||
<!-- Content--> |
|||
<table width="75%" |
|||
style="color: #454748; font-size: 12px; border: 1px solid black; |
|||
border-collapse: collapse;"> |
|||
<tr style=" border: 1px solid black; background-color:rgb(183,183,183); |
|||
border-collapse: collapse;"> |
|||
<td width="5%" style=" border: 1px solid black;"> |
|||
<span style="font-weight:bold;">Sl.no</span> |
|||
</td> |
|||
<td width="15%" align="center" |
|||
style=" border: 1px solid black;"> |
|||
<span style="font-weight:bold;">Project</span> |
|||
</td> |
|||
<td width="20%" align="center" |
|||
style=" border: 1px solid black;"> |
|||
<span style="font-weight:bold;">Task</span> |
|||
</td> |
|||
<td width="20%" align="center" |
|||
style=" border: 1px solid black;"> |
|||
<span style="font-weight:bold;">Status</span> |
|||
</td> |
|||
<td width="15%" align="center" |
|||
style=" border: 1px solid black;"> |
|||
<span style="font-weight:bold;">Hours spent |
|||
</span> |
|||
</td> |
|||
<td width="25%" align="center" |
|||
style=" border: 1px solid black;"> |
|||
<span style="font-weight:bold;">Remark</span> |
|||
</td> |
|||
</tr> |
|||
</table> |
|||
<table width="75%" |
|||
style="color: #454748; font-size: 10px; border: 1px solid black;border-collapse: collapse;"> |
|||
<tr style=" border: 1px solid black; border-collapse: collapse;"> |
|||
<td colspan="4" width="5%" align="center" |
|||
style=" border: 1px solid black;"> |
|||
<span>1</span> |
|||
</td> |
|||
<td colspan="4" width="15%" align="center" |
|||
style=" border: 1px solid black;"> |
|||
<span style="font-weight:bold;" |
|||
t-out="object.project_id.name or ''"> |
|||
Project name |
|||
</span> |
|||
</td> |
|||
<td colspan="4" width="20%" align="center" |
|||
style=" border: 1px solid black;"> |
|||
<span style="font-weight:bold;" |
|||
t-out="object.task_id.name or ''"> |
|||
Task name |
|||
</span> |
|||
</td> |
|||
<td colspan="4" width="20%" align="center" |
|||
t-if="object.status == 'ongoing'" |
|||
style="background-color : rgb(255,217,102);border: 1px solid black;"> |
|||
<span style="font-weight:bold;" |
|||
t-out="object.status or ''"> |
|||
Status |
|||
</span> |
|||
</td> |
|||
<td colspan="4" width="20%" align="center" |
|||
t-if="object.status == 'completed'" |
|||
style="background-color : rgb(106,168,79); border: 1px solid black;"> |
|||
<span style="font-weight:bold;" |
|||
t-out="object.status or ''"> |
|||
Status |
|||
</span> |
|||
</td> |
|||
<td colspan="4" width="15%" align="center"> |
|||
<span style="font-weight:bold;" |
|||
t-out="object.unit_amount or ''"> |
|||
Hours spent |
|||
</span> |
|||
</td> |
|||
<td colspan="4" width="25%" align="center" |
|||
style=" border: 1px solid black;"> |
|||
<span style="font-weight:bold;" |
|||
t-out="object.name or ''"> |
|||
Remarks |
|||
</span> |
|||
</td> |
|||
</tr> |
|||
</table> |
|||
<br/> |
|||
<!-- FOOTER --> |
|||
<tr> |
|||
<td align="Left" style="min-width: 590px;"> |
|||
Thanks & Regard, |
|||
<table border="0" cellpadding="0" cellspacing="0" |
|||
width="590" |
|||
style="min-width: 590px; background-color: white; font-size: 11px; |
|||
padding: 0px 8px 0px 8px; border-collapse:separate;"> |
|||
<tr> |
|||
<td valign="middle" align="left"> |
|||
<t t-out="object.employee_id.name or ''"> |
|||
Employee |
|||
</t> |
|||
</td> |
|||
</tr> |
|||
<tr> |
|||
<td valign="middle" align="left"> |
|||
<t t-out="user.company_id.name or ''"> |
|||
YourCompany |
|||
</t> |
|||
</td> |
|||
</tr> |
|||
<tr> |
|||
<td valign="middle" align="left" |
|||
style="opacity: 0.7;"> |
|||
<t t-out="user.company_id.phone or ''"> |
|||
+1 650-123-4567 |
|||
</t> |
|||
<t t-if="user.company_id.phone and (user.company_id.email or user.company_id.website)"> |
|||
| |
|||
</t> |
|||
<t t-if="user.company_id.email"> |
|||
<a t-attf-href="'mailto:%s' % {{ user.company_id.email }}" |
|||
style="text-decoration:none; color: #454748;" |
|||
t-out="user.company_id.email or ''"> |
|||
info@yourcompany.com |
|||
</a> |
|||
</t> |
|||
<t t-if="user.company_id.email and user.company_id.website"> |
|||
| |
|||
</t> |
|||
<t t-if="user.company_id.website"> |
|||
<a t-attf-href="'%s' % {{ user.company_id.website }}" |
|||
style="text-decoration:none; color: #454748;" |
|||
t-out="user.company_id.website or ''"> |
|||
http://www.example.com |
|||
</a> |
|||
</t> |
|||
</td> |
|||
</tr> |
|||
</table> |
|||
</td> |
|||
</tr> |
|||
</p> |
|||
</div> |
|||
</field> |
|||
<field name="auto_delete" eval="True"/> |
|||
<field name="lang">{{ object.partner_id.lang }}</field> |
|||
</record> |
|||
<!--Employee daily work report Email template --> |
|||
<record id="email_template_daily_report_from_timesheet" |
|||
model="mail.template"> |
|||
<field name="name">WorkReport: Daily Work report from timesheet</field> |
|||
<field name="model_id" |
|||
ref="work_report_from_timesheet.model_account_analytic_line"/> |
|||
<field name="description">Send Daily work report of employee to the |
|||
manager |
|||
</field> |
|||
<field name="body_html" type="html"> |
|||
<div style="margin: 0px; padding: 0px;"> |
|||
<p style="margin: 0px; padding: 0px; font-size: 13px;"> |
|||
Hello, |
|||
<br/> |
|||
Here is a report on my daily work. |
|||
<br/> |
|||
<br/> |
|||
<br/> |
|||
<!-- Content--> |
|||
<table width="75%" |
|||
style="color: #454748; font-size: 12px; border: 1px solid black; |
|||
border-collapse: collapse;"> |
|||
<tr style=" border: 1px solid black; background-color:rgb(183,183,183); |
|||
border-collapse: collapse;"> |
|||
<td width="5%" style=" border: 1px solid black;"> |
|||
<span style="font-weight:bold;">Sl.no</span> |
|||
</td> |
|||
<td width="15%" align="center" |
|||
style=" border: 1px solid black;"> |
|||
<span style="font-weight:bold;">Project</span> |
|||
</td> |
|||
<td width="20%" align="center" |
|||
style=" border: 1px solid black;"> |
|||
<span style="font-weight:bold;">Task</span> |
|||
</td> |
|||
<td width="20%" align="center" |
|||
style=" border: 1px solid black;"> |
|||
<span style="font-weight:bold;">Status</span> |
|||
</td> |
|||
<td width="15%" align="center" |
|||
style=" border: 1px solid black;"> |
|||
<span style="font-weight:bold;">Hours spent |
|||
</span> |
|||
</td> |
|||
<td width="25%" align="center" |
|||
style=" border: 1px solid black;"> |
|||
<span style="font-weight:bold;">Remark</span> |
|||
</td> |
|||
</tr> |
|||
</table> |
|||
<t t-set="i" t-value="1"/> |
|||
<t t-foreach="ctx.get('data')" t-as="data"> |
|||
<table width="75%" |
|||
style="color: #454748; font-size: 10px; border: 1px solid black;border-collapse: collapse;"> |
|||
<tr style=" border: 1px solid black; border-collapse: collapse;"> |
|||
<td colspan="4" width="5%" align="center" |
|||
style=" border: 1px solid black;"> |
|||
<span t-esc="i"/> |
|||
<t t-set="i" t-value="i+1"/> |
|||
</td> |
|||
<td colspan="4" width="15%" align="center" |
|||
style=" border: 1px solid black;"> |
|||
<span style="font-weight:bold;" |
|||
t-out="data.project_id.name or ''"> |
|||
Project name |
|||
</span> |
|||
</td> |
|||
<td colspan="4" width="20%" align="center" |
|||
style=" border: 1px solid black;"> |
|||
<span style="font-weight:bold;" |
|||
t-out="data.task_id.name or ''"> |
|||
Task name |
|||
</span> |
|||
</td> |
|||
<td colspan="4" width="20%" align="center" |
|||
t-if="data.status == 'ongoing'" |
|||
style="background-color : rgb(255,217,102);border: 1px solid black;"> |
|||
<span style="font-weight:bold;" |
|||
t-out="data.status or ''"> |
|||
Status |
|||
</span> |
|||
</td> |
|||
<td colspan="4" width="20%" align="center" |
|||
t-if="data.status == 'completed'" |
|||
style="background-color : rgb(106,168,79); border: 1px solid black;"> |
|||
<span style="font-weight:bold;" |
|||
t-out="data.status or ''"> |
|||
Status |
|||
</span> |
|||
</td> |
|||
<td colspan="4" width="15%" align="center"> |
|||
<span style="font-weight:bold;" |
|||
t-out="data.unit_amount or ''"> |
|||
Hours spent |
|||
</span> |
|||
</td> |
|||
<td colspan="4" width="25%" align="center" |
|||
style=" border: 1px solid black;"> |
|||
<span style="font-weight:bold;" |
|||
t-out="data.name or ''"> |
|||
Remarks |
|||
</span> |
|||
</td> |
|||
</tr> |
|||
</table> |
|||
</t> |
|||
<br/> |
|||
<!-- FOOTER --> |
|||
<tr> |
|||
<td align="Left" style="min-width: 590px;"> |
|||
Thanks & Regard, |
|||
<table border="0" cellpadding="0" cellspacing="0" |
|||
width="590" |
|||
style="min-width: 590px; background-color: white; font-size: 11px; |
|||
padding: 0px 8px 0px 8px; border-collapse:separate;"> |
|||
<tr> |
|||
<td valign="middle" align="left"> |
|||
<t t-out="data.employee_id.name or ''"> |
|||
Employee |
|||
</t> |
|||
</td> |
|||
</tr> |
|||
<tr> |
|||
<td valign="middle" align="left"> |
|||
<t t-out="user.company_id.name or ''"> |
|||
YourCompany |
|||
</t> |
|||
</td> |
|||
</tr> |
|||
<tr> |
|||
<td valign="middle" align="left" |
|||
style="opacity: 0.7;"> |
|||
<t t-out="user.company_id.phone or ''"> |
|||
+1 650-123-4567 |
|||
</t> |
|||
<t t-if="user.company_id.phone and (user.company_id.email or user.company_id.website)"> |
|||
| |
|||
</t> |
|||
<t t-if="user.company_id.email"> |
|||
<a t-attf-href="'mailto:%s' % {{ user.company_id.email }}" |
|||
style="text-decoration:none; color: #454748;" |
|||
t-out="user.company_id.email or ''"> |
|||
info@yourcompany.com |
|||
</a> |
|||
</t> |
|||
<t t-if="user.company_id.email and user.company_id.website"> |
|||
| |
|||
</t> |
|||
<t t-if="user.company_id.website"> |
|||
<a t-attf-href="'%s' % {{ user.company_id.website }}" |
|||
style="text-decoration:none; color: #454748;" |
|||
t-out="user.company_id.website or ''"> |
|||
http://www.example.com |
|||
</a> |
|||
</t> |
|||
</td> |
|||
</tr> |
|||
</table> |
|||
</td> |
|||
</tr> |
|||
</p> |
|||
</div> |
|||
</field> |
|||
<field name="auto_delete" eval="True"/> |
|||
<field name="lang">{{ object.partner_id.lang }}</field> |
|||
</record> |
|||
</odoo> |
@ -0,0 +1,6 @@ |
|||
## Module <work_report_from_timesheet> |
|||
|
|||
#### 04.09.2025 |
|||
#### Version 18.0.1.0.0 |
|||
#### ADD |
|||
- Initial commit for Work Report From Timesheet |
@ -0,0 +1,23 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################### |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Anagha S (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL 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 AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################### |
|||
from . import account_analytic_line |
|||
from . import res_config_settings |
@ -0,0 +1,102 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################### |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Anagha S (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL 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 AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################### |
|||
from ast import literal_eval |
|||
from datetime import datetime |
|||
from odoo import fields, models |
|||
|
|||
|
|||
class AccountAnalyticLine(models.Model): |
|||
"""This model inherit Account analytic line.""" |
|||
_inherit = 'account.analytic.line' |
|||
|
|||
status = fields.Selection([('ongoing', 'Ongoing'), |
|||
('completed', 'Completed')], string='Status', |
|||
default='ongoing', help='Status of task.') |
|||
|
|||
def write(self, values): |
|||
"""Generate work report on creating new record.""" |
|||
work_report = self.env['ir.config_parameter'].sudo().get_param( |
|||
'work_report_from_timesheet.report_method') |
|||
if work_report == 'task_report': |
|||
self._send_daily_task_report() |
|||
result = super().write(values) |
|||
return result |
|||
|
|||
def _send_daily_task_report(self): |
|||
"""Work report for each task will be generated and sent to the |
|||
employee that chosen in timesheet settings.""" |
|||
params = self.env['ir.config_parameter'].sudo() |
|||
manager_email = params.get_param( |
|||
'work_report_from_timesheet.employee_id') |
|||
cc_employees = literal_eval( |
|||
params.get_param('work_report_from_timesheet.employee_ids')) |
|||
template_id = self.env.ref('work_report_from_timesheet.' |
|||
'email_template_work_report_from_timesheet') |
|||
for rec in self: |
|||
email_vals = { |
|||
'message_type': 'notification', |
|||
'is_notification': True, |
|||
'email_to': self.env['hr.employee'].browse( |
|||
int(manager_email)).work_email, |
|||
'email_cc': ", ".join( |
|||
[self.env['hr.employee'].browse(cc).work_email for cc in |
|||
cc_employees]), |
|||
'email_from': rec.employee_id.work_email, |
|||
"model": 'account.analytic.line', |
|||
"res_id": rec.id} |
|||
template_id.sudo().send_mail(rec.id, force_send=True, |
|||
email_values=email_vals) |
|||
|
|||
def send_employee_daily_work_report(self): |
|||
"""A daily work report for all employees will be sent.""" |
|||
params = self.env['ir.config_parameter'].sudo() |
|||
work_report = params.get_param( |
|||
'work_report_from_timesheet.report_method') |
|||
if work_report == 'daily_report': |
|||
manager_email = params.get_param( |
|||
'work_report_from_timesheet.employee_id') |
|||
cc_employees = literal_eval( |
|||
params.get_param('work_report_from_timesheet.employee_ids')) |
|||
template_id = self.env.ref('work_report_from_timesheet.' |
|||
'email_template_daily_report_from_timesheet') |
|||
email_vals = { |
|||
'message_type': 'notification', |
|||
'is_notification': True, |
|||
'email_to': self.env['hr.employee'].browse( |
|||
int(manager_email)).work_email, |
|||
'email_cc': ", ".join( |
|||
[self.env['hr.employee'].browse(cc).work_email for cc in |
|||
cc_employees]), |
|||
'model': 'account.analytic.line'} |
|||
timesheet = self.env['account.analytic.line'].search( |
|||
[('date', '=', datetime.today().date())]) |
|||
employees = list(timesheet.employee_id) |
|||
for employee in employees: |
|||
data = timesheet.filtered( |
|||
lambda emp: emp.employee_id.id == employee.id) # pylint: disable=cell-var-from-loop |
|||
email_vals['email_from'] = employee.work_email |
|||
email_vals[ |
|||
'subject'] = f"Daily work report_{datetime.today().date().strftime('%b-%d-%Y')}_{employee.name}" |
|||
res_id = [rec.id for rec in data] |
|||
template_id.with_context(data=data).send_mail(res_id=res_id[0], |
|||
email_values=email_vals, |
|||
force_send=True) |
@ -0,0 +1,67 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################### |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Anagha S (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL 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 AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################### |
|||
from ast import literal_eval |
|||
from odoo import api, fields, models |
|||
|
|||
|
|||
class ResConfigSettings(models.TransientModel): |
|||
"""Inherit configuration settings.""" |
|||
_inherit = 'res.config.settings' |
|||
|
|||
generate_work_report = fields.Boolean(string="Generate work report", |
|||
help="Generate work report on " |
|||
"creating timesheet.", |
|||
config_parameter='work_report_from_timesheet.generate_work_report') |
|||
report_method = fields.Selection( |
|||
[('task_report', 'Task Report'), ('daily_report', 'Daily Report')], |
|||
default='task_report', string="Report method", |
|||
config_parameter="work_report_from_timesheet.report_method", |
|||
help='Task Report: Send task report on creating timesheet.\nDaily ' |
|||
'Report: Send daily work report of each employee at end ' |
|||
'of the day.') |
|||
employee_id = fields.Many2one('hr.employee', string="Email to", |
|||
help='Select employee to whom work report ' |
|||
'to be send.', |
|||
config_parameter='work_report_from_timesheet.employee_id') |
|||
employee_ids = fields.Many2many(comodel_name='hr.employee', |
|||
string="Email CC", |
|||
help='Select employee for cc of email.') |
|||
|
|||
def set_values(self): |
|||
"""Inherit the set_values() method of class ResConfigSettings |
|||
to save values.""" |
|||
params = self.env['ir.config_parameter'].sudo() |
|||
params.set_param('work_report_from_timesheet.employee_ids', |
|||
self.employee_ids.ids) |
|||
return super(ResConfigSettings, self).set_values() |
|||
|
|||
@api.model |
|||
def get_values(self): |
|||
"""Inherit the get_values() method of class ResConfigSettings |
|||
to get the values and update settings.""" |
|||
res = super(ResConfigSettings, self).get_values() |
|||
email_cc = self.env['ir.config_parameter'].sudo().get_param( |
|||
'work_report_from_timesheet.employee_ids') |
|||
res.update( |
|||
employee_ids=[ |
|||
(6, 0, literal_eval(email_cc))] if email_cc else False) |
|||
return res |
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: 330 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: 142 KiB |
After Width: | Height: | Size: 869 KiB |
After Width: | Height: | Size: 184 KiB |
After Width: | Height: | Size: 126 KiB |
After Width: | Height: | Size: 1.1 MiB |
After Width: | Height: | Size: 627 KiB |
After Width: | Height: | Size: 627 KiB |
After Width: | Height: | Size: 97 KiB |
After Width: | Height: | Size: 232 KiB |
After Width: | Height: | Size: 100 KiB |
After Width: | Height: | Size: 316 KiB |
After Width: | Height: | Size: 880 KiB |
After Width: | Height: | Size: 788 KiB |
After Width: | Height: | Size: 41 KiB |
@ -0,0 +1,14 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<odoo> |
|||
<!-- Add new field to account analytic line tree view--> |
|||
<record id="hr_timesheet_line_tree" model="ir.ui.view"> |
|||
<field name="name">account.analytic.line.view.tree.inherit.work.report.from.timesheet</field> |
|||
<field name="model">account.analytic.line</field> |
|||
<field name="inherit_id" ref="hr_timesheet.hr_timesheet_line_tree"/> |
|||
<field name="arch" type="xml"> |
|||
<xpath expr="//list/field[@name='task_id']" position="after"> |
|||
<field name="status" /> |
|||
</xpath> |
|||
</field> |
|||
</record> |
|||
</odoo> |
@ -0,0 +1,62 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<odoo> |
|||
<!-- Timesheet settings form view inherited --> |
|||
<record id="res_config_settings_view_form" model="ir.ui.view"> |
|||
<field name="name"> |
|||
res.config.settings.view.form.inherit.work.report.from.timesheet |
|||
</field> |
|||
<field name="model">res.config.settings</field> |
|||
<field name="priority" eval="1"/> |
|||
<field name="inherit_id" |
|||
ref="hr_timesheet.res_config_settings_view_form"/> |
|||
<field name="arch" type="xml"> |
|||
<xpath expr="//div[@name='section_leaves']" position="after"> |
|||
<h2>Work Report</h2> |
|||
<div name="timesheet_work_report" |
|||
class="row mt16 o_settings_container"> |
|||
<div class="col-12 col-lg-6 o_setting_box" |
|||
id="work_report_setting "> |
|||
<div class="o_setting_left_pane"> |
|||
<field name="generate_work_report"/> |
|||
</div> |
|||
<div class="o_setting_right_pane"> |
|||
<label for="generate_work_report" |
|||
string="Generate work report"/> |
|||
<div class="text-muted mb16"> |
|||
Generate work report and send to manager |
|||
</div> |
|||
</div> |
|||
<div class="o_setting_right_pane row" |
|||
invisible="not generate_work_report"> |
|||
<label for="report_method" |
|||
class="col-4 o_light_label"/> |
|||
<field name="report_method" widget="radio" |
|||
class="o_light_label col" |
|||
required="generate_work_report"/> |
|||
</div> |
|||
<div class="o_setting_right_pane" |
|||
invisible="not generate_work_report" reuired="generate_work_report"> |
|||
<label for="employee_id" |
|||
string="Email To"/> |
|||
<div class="text-muted mb16"> |
|||
Choose the employee to whom you want to send the |
|||
work report. |
|||
</div> |
|||
<field name="employee_id"/> |
|||
</div> |
|||
<div class="content-group" |
|||
invisible="not generate_work_report" |
|||
required="generate_work_report"> |
|||
<div class="row mt16 ms-4"> |
|||
<label class="o_light_label col-lg-3" |
|||
string="Email CC" for="employee_ids"/> |
|||
<field name="employee_ids" |
|||
widget="many2many_tags"/> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</xpath> |
|||
</field> |
|||
</record> |
|||
</odoo> |