@ -0,0 +1,51 @@ |
|||
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg |
|||
:target: https://www.gnu.org/licenses/agpl-3.0-standalone.html |
|||
:alt: License: AGPL-3 |
|||
|
|||
Google Calendar Integration for Project and Task |
|||
========================================= |
|||
* Sync Project Task with Google Calendar. |
|||
* Auto Update Task with Google Calendar. |
|||
* Option to Sync Selected Task with Google Calendar. |
|||
* Email Notification. |
|||
|
|||
Configuration |
|||
============= |
|||
* No additional configurations needed |
|||
|
|||
Company |
|||
------- |
|||
* `Cybrosys Techno Solutions <https://cybrosys.com/>`__ |
|||
|
|||
License |
|||
------- |
|||
General Public License, Version 3 (AGPL v3). |
|||
(https://www.gnu.org/licenses/agpl-3.0-standalone.html) |
|||
|
|||
Credits |
|||
------- |
|||
* Developers: (V17) Ayana KP, |
|||
(V16)Jumana Jabin MP, |
|||
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: Ayana KP (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,48 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
|||
# Author: Ayana KP (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': 'Google Calendar Integration For Project And Task', |
|||
'version': '17.0.1.0.0', |
|||
'category': 'Project', |
|||
'summary': 'Module For Integrating Odoo Project With Google Calender.', |
|||
"description": """Google Calendar Integration for Project Tasks odoo app |
|||
helps users to sync project tasks with google Calendar. Users can get all |
|||
task information like name, description, create date time, deadline, and |
|||
attende, If a user updates a task then google calendar events also get |
|||
updated.""", |
|||
'author': 'Cybrosys Techno Solutions', |
|||
'company': 'Cybrosys Techno Solutions', |
|||
'maintainer': 'Cybrosys Techno Solutions', |
|||
'website': "https://www.cybrosys.com", |
|||
'depends': ['project', 'google_calendar'], |
|||
'data': [ |
|||
'views/res_users_views.xml', |
|||
'views/project_task_views.xml', |
|||
], |
|||
'images': [ |
|||
'static/description/banner.jpg' |
|||
], |
|||
'license': 'AGPL-3', |
|||
'installable': True, |
|||
'auto_install': False, |
|||
'application': False |
|||
} |
@ -0,0 +1,6 @@ |
|||
## Module <sync_task_with_google_calender> |
|||
|
|||
#### 17.08.2023 |
|||
#### Version 17.0.1.0.0 |
|||
#### ADD |
|||
- Initial commit for Google Calendar Integration For Project And Task |
@ -0,0 +1,23 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Ayana KP (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 project_task |
|||
from . import res_users |
@ -0,0 +1,190 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
|||
# Author: Ayana KP (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/>. |
|||
# |
|||
############################################################################# |
|||
import requests |
|||
from odoo import api, fields, models, _ |
|||
from odoo.exceptions import UserError |
|||
|
|||
|
|||
class ProjectTask(models.Model): |
|||
""" Extend 'project.task' model to add Google Calendar integration.""" |
|||
_inherit = 'project.task' |
|||
|
|||
is_add_in_gcalendar = fields.Boolean(string="Add In G-Calendar Event", |
|||
help="Set this field True if you want to" |
|||
" add this task to Google Calendar.") |
|||
task_event = fields.Char(string="Task Google Calendar Event ID", |
|||
help="This field stores the unique ID of Google" |
|||
" Calendar event associated with the task.") |
|||
task_created = fields.Char(string="Task Creator ID", |
|||
help="This field stores the unique ID of the " |
|||
"task creator or owner.") |
|||
|
|||
@api.model |
|||
def create(self, vals): |
|||
"""Override create() method to sync task to Google Calendar if |
|||
enabled.""" |
|||
task = super().create(vals) |
|||
if task.is_add_in_gcalendar: |
|||
self.sync_task_to_google_calendar(task) |
|||
return task |
|||
|
|||
def write(self, vals): |
|||
"""Override write() method to update Google Calendar event if relevant |
|||
fields are modified.""" |
|||
res = super().write(vals) |
|||
if any(field in ['user_id', 'partner_id', 'name', 'description', |
|||
'date_deadline', 'due_date', 'is_add_in_gcalendar'] for |
|||
field in vals): |
|||
task = self |
|||
self.update_google_calendar_event(task) |
|||
return res |
|||
|
|||
def sync_task_to_google_calendar(self, task): |
|||
"""Sync the task to Google Calendar by creating a new event.""" |
|||
if self.is_add_in_gcalendar and ( |
|||
not self.partner_id or not self.date_deadline): |
|||
required_fields = [] |
|||
if not self.partner_id: |
|||
required_fields.append(self._fields['partner_id'].string) |
|||
if not self.date_deadline: |
|||
required_fields.append(self._fields['date_deadline'].string) |
|||
raise UserError(_( |
|||
f"The following fields are required when 'Add In G-Calendar" |
|||
f" Event' is enabled: {', '.join(required_fields)}")) |
|||
headers, url = self._prepare_headers_and_url( |
|||
self.env.user.google_user_mail) |
|||
project_name = task.project_id.name.capitalize() if task.project_id \ |
|||
else '' |
|||
event = { |
|||
"summary": f"Project: {project_name} - Task: {task.name}", |
|||
"description": task.description, |
|||
"start": {"date": str(task.date_deadline.date())} if task.date_deadline else { |
|||
"date": ""}, |
|||
"end": { |
|||
"date": str(task.date_deadline.date())} if task.date_deadline else { |
|||
"date": ""}, |
|||
"extendedProperties": { |
|||
"private": { |
|||
"create_date_time": str(task.create_date), |
|||
"user": task.activity_user_id.name if task.activity_user_id else "", |
|||
} |
|||
}, |
|||
"attendees": [{"email": attendee.email} for attendee in |
|||
task.user_ids if attendee.email], |
|||
"reminders": { |
|||
"useDefault": False, |
|||
"overrides": [ |
|||
{"method": "email", "minutes": 0}, |
|||
{"method": "email", "minutes": 24 * 60}, |
|||
] |
|||
} |
|||
} |
|||
if task.partner_id and task.partner_id.email: |
|||
event["attendees"].append({"email": task.partner_id.email}) |
|||
event["reminders"]["overrides"].append( |
|||
{"method": "email", "minutes": 60}) |
|||
response = requests.post(url, headers=headers, json=event) |
|||
if response.status_code == 200: |
|||
event_id = response.json().get('id') |
|||
creator_email = response.json().get('creator', {}).get('email') |
|||
message = f'Google Calendar Event created\nTask ID: {task.id}\n' \ |
|||
f'Event ID: {event_id}\nCreator Email: {creator_email}' |
|||
task.message_post(body=message) |
|||
task.task_event = event_id |
|||
task.task_created = creator_email |
|||
else: |
|||
message = 'Failed to create event in Google Calendar' |
|||
task.message_post(body=message) |
|||
|
|||
def update_google_calendar_event(self, task): |
|||
"""Update the Google Calendar event associated with the task.""" |
|||
event_id = task.task_event |
|||
if not event_id: |
|||
self.sync_task_to_google_calendar(task) |
|||
return |
|||
event = { |
|||
"summary": task.name, |
|||
"description": task.description, |
|||
"start": {"date": str(task.date_deadline.date())} if task.date_deadline else { |
|||
"date": ""}, |
|||
"end": { |
|||
"date": str(task.date_deadline.date())} if task.date_deadline else { |
|||
"date": ""}, |
|||
"extendedProperties": { |
|||
"private": { |
|||
"create_date_time": str(task.create_date), |
|||
"user": task.activity_user_id.name if task.activity_user_id else "", |
|||
} |
|||
}, |
|||
"attendees": [{"email": attendee.email} for attendee in |
|||
task.user_ids if attendee.email], |
|||
} |
|||
headers, url = self._prepare_headers_and_url( |
|||
self.env.user.google_user_mail, event_id) |
|||
response = requests.patch(url, headers=headers, json=event) |
|||
if response.status_code == 200: |
|||
message = f'Event updated in Google Calendar' |
|||
task.message_post(body=message) |
|||
else: |
|||
message = f'Failed to update event in Google Calendar' |
|||
task.message_post(body=message) |
|||
|
|||
def _prepare_headers_and_url(self, google_calendar_id, event_id=None): |
|||
""" |
|||
Prepare headers and URL for Google Calendar API requests. |
|||
""" |
|||
headers = { |
|||
"Authorization": f"Bearer {self.env.user.user_token}", |
|||
"Content-Type": "application/json", |
|||
"Accept": "application/json" |
|||
} |
|||
api_key = self.env.user.api_key |
|||
url = f"https://www.googleapis.com/calendar/v3/calendars/" \ |
|||
f"{google_calendar_id}/events" |
|||
if event_id: |
|||
url += f"/{event_id}" |
|||
url += f"?key={api_key}" |
|||
return headers, url |
|||
|
|||
def unlink(self): |
|||
"""Override unlink method to delete associated Google Calendar |
|||
events.""" |
|||
self.delete_google_calendar_events() |
|||
return super(ProjectTask, self).unlink() |
|||
|
|||
def delete_google_calendar_events(self): |
|||
"""Delete associated events from Google Calendar.""" |
|||
event_ids = self.mapped('task_event') |
|||
if event_ids: |
|||
headers = { |
|||
"Authorization": f"Bearer {self.env.user.user_token}", |
|||
"Content-Type": "application/json", |
|||
"Accept": "application/json" |
|||
} |
|||
for event_id in event_ids: |
|||
url = f"https://www.googleapis.com/calendar/v3/calendars/" \ |
|||
f"{self.env.user.google_user_mail}/events/{event_id}" \ |
|||
f"?key=" \ |
|||
f"{self.env.user.api_key}" |
|||
# Delete event from Google Calendar |
|||
response = requests.delete(url, headers=headers) |
|||
return response |
@ -0,0 +1,141 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
|||
# Author: Ayana KP (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/>. |
|||
# |
|||
############################################################################# |
|||
import requests |
|||
import re |
|||
from datetime import timedelta |
|||
from odoo import fields, models, _ |
|||
from odoo.exceptions import UserError |
|||
from odoo.addons.google_account.models.google_service import \ |
|||
GOOGLE_TOKEN_ENDPOINT |
|||
|
|||
|
|||
class ResUsers(models.Model): |
|||
"""Extend res.users model to include Google Calendar integration.""" |
|||
|
|||
_inherit = 'res.users' |
|||
|
|||
refresh_token = fields.Char(string='Refresh Token', |
|||
help='Refresh token used for token ' |
|||
'authentication with Google Calendar' |
|||
' service.') |
|||
user_token = fields.Char(string='User Token', |
|||
help='User token or access token obtained from ' |
|||
'Google Calendar service.') |
|||
last_sync_date = fields.Datetime(string='Token Validity', |
|||
help='Date and time indicating the ' |
|||
'validity' |
|||
' period of the user token.') |
|||
api_key = fields.Char(string="Enter API Key", |
|||
help='API key required for authentication and access ' |
|||
'to Google Calendar service.') |
|||
google_user_mail = fields.Char(string='User Mail', |
|||
help='The Mail address where the task is ' |
|||
'to be created') |
|||
|
|||
def _set_auth_tokens(self, access_token, refresh_token, ttl): |
|||
"""Set the authentication tokens for the user.""" |
|||
self.write({ |
|||
'refresh_token': refresh_token, |
|||
'user_token': access_token, |
|||
'last_sync_date': fields.Datetime.now() + timedelta( |
|||
seconds=ttl) if ttl else False, |
|||
}) |
|||
|
|||
def authenticate_button(self): |
|||
"""Authenticate the user with Google Calendar service.""" |
|||
self.ensure_one() |
|||
get_param = self.env['ir.config_parameter'].sudo().get_param |
|||
client_id = get_param('google_calendar_client_id') |
|||
client_secret = get_param('google_calendar_client_secret') |
|||
if not client_id or not client_secret: |
|||
raise UserError(_("The account for the Google Calendar " |
|||
"service is not configured.")) |
|||
# Validate the API key and email credentials |
|||
if not (self.api_key and len( |
|||
self.api_key) > 10 and self.is_valid_email()): |
|||
raise UserError(_("Invalid credentials. Please provide valid " |
|||
"API key or email.")) |
|||
self.refresh_token = self.google_calendar_account_id.calendar_rtoken |
|||
self.user_token = self.google_calendar_account_id.calendar_token |
|||
self.last_sync_date = self.google_calendar_account_id. \ |
|||
calendar_token_validity |
|||
notification = { |
|||
'type': 'ir.actions.client', |
|||
'tag': 'display_notification', |
|||
'params': { |
|||
'title': _('Successful'), |
|||
'type': 'success', |
|||
'message': 'Authentication successful!', |
|||
'sticky': True, |
|||
} |
|||
} |
|||
return notification |
|||
|
|||
def is_valid_email(self): |
|||
""" Return True if the email is valid, False otherwise""" |
|||
pattern = r'^[\w\.-]+@[\w\.-]+\.\w+$' |
|||
if self.google_user_mail and re.match(pattern, self.google_user_mail): |
|||
return True |
|||
return False |
|||
|
|||
def refresh_button(self): |
|||
"""Refresh the user token using the refresh token.""" |
|||
get_param = self.env['ir.config_parameter'].sudo().get_param |
|||
client_id = get_param('google_calendar_client_id') |
|||
client_secret = get_param('google_calendar_client_secret') |
|||
if not client_id or not client_secret: |
|||
raise UserError( |
|||
_("The account for the Google Calendar service is" |
|||
" not configured.")) |
|||
headers = {"content-type": "application/x-www-form-urlencoded"} |
|||
data = { |
|||
'refresh_token': self.refresh_token, |
|||
'client_id': client_id, |
|||
'client_secret': client_secret, |
|||
'grant_type': 'refresh_token', |
|||
} |
|||
try: |
|||
_dummy, response, _dummy = self.env['google.service']._do_request( |
|||
GOOGLE_TOKEN_ENDPOINT, params=data, |
|||
headers=headers, method='POST', preuri='') |
|||
ttl = response.get('expires_in') |
|||
self.write({ |
|||
'user_token': response.get('access_token'), |
|||
'last_sync_date': fields.Datetime.now() + timedelta( |
|||
seconds=ttl), |
|||
}) |
|||
except requests.HTTPError as error: |
|||
if error.response.status_code in ( |
|||
400, 401): # invalid grant or invalid client |
|||
# Delete refresh token and make sure it's committed |
|||
self.env.cr.rollback() |
|||
self._set_auth_tokens(False, False, 0) |
|||
self.env.cr.commit() |
|||
error_key = error.response.json().get("error", "nc") |
|||
error_msg = _( |
|||
"An error occurred while generating the token. " |
|||
"Your authorization code may be invalid or has already" |
|||
" expired [%s].You should check your Client ID and secret on " |
|||
"the Google APIs platform try to stop and restart your " |
|||
"calendar synchronization.", |
|||
error_key) |
|||
raise UserError(error_msg) |
After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 310 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 576 B |
After Width: | Height: | Size: 733 B |
After Width: | Height: | Size: 911 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 673 B |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 878 B |
After Width: | Height: | Size: 653 B |
After Width: | Height: | Size: 905 B |
After Width: | Height: | Size: 839 B |
After Width: | Height: | Size: 427 B |
After Width: | Height: | Size: 627 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 988 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 80 KiB |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 565 B |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 43 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 38 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 82 KiB |
After Width: | Height: | Size: 49 KiB |
After Width: | Height: | Size: 48 KiB |
After Width: | Height: | Size: 85 KiB |
After Width: | Height: | Size: 82 KiB |
After Width: | Height: | Size: 86 KiB |
After Width: | Height: | Size: 30 KiB |
After Width: | Height: | Size: 42 KiB |
After Width: | Height: | Size: 90 KiB |
After Width: | Height: | Size: 105 KiB |
After Width: | Height: | Size: 70 KiB |
After Width: | Height: | Size: 92 KiB |
After Width: | Height: | Size: 137 KiB |
After Width: | Height: | Size: 61 KiB |
After Width: | Height: | Size: 116 KiB |
After Width: | Height: | Size: 58 KiB |
After Width: | Height: | Size: 109 KiB |
After Width: | Height: | Size: 70 KiB |
After Width: | Height: | Size: 55 KiB |
After Width: | Height: | Size: 120 KiB |
After Width: | Height: | Size: 86 KiB |
After Width: | Height: | Size: 165 KiB |
After Width: | Height: | Size: 62 KiB |
After Width: | Height: | Size: 42 KiB |
After Width: | Height: | Size: 137 KiB |
After Width: | Height: | Size: 110 KiB |
After Width: | Height: | Size: 88 KiB |
After Width: | Height: | Size: 93 KiB |
After Width: | Height: | Size: 42 KiB |
After Width: | Height: | Size: 708 KiB |
After Width: | Height: | Size: 112 KiB |
After Width: | Height: | Size: 6.1 KiB |
@ -0,0 +1,31 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<odoo> |
|||
<!-- XML view to inherit from project.task.form view --> |
|||
<record id="view_task_form2" model="ir.ui.view"> |
|||
<field name="name"> |
|||
project.task.view.form.inherit.sync.task.with.google.calender |
|||
</field> |
|||
<field name="model">project.task</field> |
|||
<field name="inherit_id" ref="project.view_task_form2"/> |
|||
<field name="arch" type="xml"> |
|||
<xpath expr="//field[@name='date_deadline']" position="attributes"> |
|||
<attribute name="required">is_add_in_gcalendar</attribute> |
|||
</xpath> |
|||
<xpath expr="//page[@name='extra_info']" position="after"> |
|||
<!-- Add a new page for Google Calendar Task Event --> |
|||
<page string="Google Calender Task Event" |
|||
name="sync_google_cal_project_task" |
|||
invisible="not is_add_in_gcalendar"> |
|||
<!-- Group to display task_event and task_created --> |
|||
<group class="text-break"> |
|||
<field name="task_event" readonly="1"/> |
|||
<field name="task_created" readonly="1"/> |
|||
</group> |
|||
</page> |
|||
</xpath> |
|||
<field name="partner_id" position="before"> |
|||
<field name="is_add_in_gcalendar"/> |
|||
</field> |
|||
</field> |
|||
</record> |
|||
</odoo> |
@ -0,0 +1,37 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<odoo> |
|||
<!-- XML view to inherit from project.task.form view --> |
|||
<record id="view_users_form" model="ir.ui.view"> |
|||
<field name="name"> |
|||
res.users.view.form.inherit.sync.task.with.google.calender |
|||
</field> |
|||
<field name="model">res.users</field> |
|||
<field name="inherit_id" ref="base.view_users_form"/> |
|||
<field name="arch" type="xml"> |
|||
<xpath expr="//page[@name='access_rights']" position="after"> |
|||
<!-- Add a new page for syncing Project Task --> |
|||
<page string="Sync of Project Task" name="sync_project_task"> |
|||
<!-- Group to display fields related to synchronization --> |
|||
<group class="text-break"> |
|||
<field name="api_key"/> |
|||
<field name="google_user_mail"/> |
|||
<field name="refresh_token" readonly="1"/> |
|||
<field name="user_token" readonly="1"/> |
|||
<field name="last_sync_date" readonly="1"/> |
|||
</group> |
|||
<group> |
|||
<!-- Button to trigger authentication --> |
|||
<button name="authenticate_button" string="AUTHENTICATE" |
|||
type="object" class="oe_highlight" |
|||
groups="base.group_system"/> |
|||
<!-- Button to refresh the token --> |
|||
<button name="refresh_button" string="REFRESH TOKEN" |
|||
type="object" class="oe_highlight" |
|||
groups="base.group_system" |
|||
style="float: right; margin-bottom: 10px; margin-right: 10px;"/> |
|||
</group> |
|||
</page> |
|||
</xpath> |
|||
</field> |
|||
</record> |
|||
</odoo> |