Skip to content

Commit

Permalink
[ADD] added module nextcloud_odoo_sync on customer Request
Browse files Browse the repository at this point in the history
  • Loading branch information
ByteMeAsap authored and tarteo committed Apr 16, 2024
1 parent d79b237 commit 73935ff
Show file tree
Hide file tree
Showing 50 changed files with 6,736 additions and 0 deletions.
102 changes: 102 additions & 0 deletions nextcloud_odoo_sync/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
===================
Nextcloud-Odoo Sync
===================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fvolendra--misc-lightgray.png?logo=github
:target: https://github.com/OCA/volendra-misc/tree/main/nextcloud_odoo_sync
:alt: OCA/volendra-misc
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/volendra-misc-main/volendra-misc-main-nextcloud_odoo_sync
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/webui/builds.html?repo=OCA/volendra-misc&target_branch=main
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module sync Nextcloud apps into Odoo counterpart app.

**Table of contents**

.. contents::
:local:

Usage
=====

Odoo Configuration
~~~~~~~~~~~~~~~~~~

#. Go to Settins/ Nextcloud
#. Click *Enable Calendar Sync*
#. Indicate the *Server URL* and the Nextcloud admin credentials then click Save. Do not put a trailing forward slash "/" at the end of the *Server URL*


User Configuration
~~~~~~~~~~~~~~~~~~

To use this module, you need to:

#. On the upper right corner of the Odoo web client, click the *User* menu and select *Preferences*
#. Click the button *Setup Nextcloud User*
#. On the pop-up dialog, input your Nextcloud *Username* and *Password* and click *Login to Nextcloud* button
#. It will try to login into Nextcloud and ask you to select a default Nextcloud Calendar to use

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/volendra-misc/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/volendra-misc/issues/new?body=module:%20nextcloud_odoo_sync%0Aversion:%20main%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
~~~~~~~

* iScale Solutions Inc.

Contributors
~~~~~~~~~~~~

* iScale Solutons <[email protected]>

Maintainers
~~~~~~~~~~~

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

.. |maintainer-iscale-solutions| image:: https://github.com/iscale-solutions.png?size=40px
:target: https://github.com/iscale-solutions
:alt: iscale-solutions

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-iscale-solutions|

This module is part of the `OCA/volendra-misc <https://github.com/OCA/volendra-misc/tree/main/nextcloud_odoo_sync>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
7 changes: 7 additions & 0 deletions nextcloud_odoo_sync/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Copyright (c) 2022 iScale Solutions Inc.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)

from . import models
from . import wizards
from . import tests
from .hooks import uninstall_hook
38 changes: 38 additions & 0 deletions nextcloud_odoo_sync/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Copyright (c) 2023 iScale Solutions Inc.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)
{
"name": "Nextcloud-Odoo Sync",
"version": "16.0.1.0.0",
"category": "Others",
"description": """Sync Nextcloud apps into Odoo""",
"author": "iScale Solutions Inc.",
"website": "http://iscale-solutions.com",
"external_dependencies": {"python": ["caldav"]},
"depends": ["base", "calendar", "resource", "contacts"],
"maintainers": ["iscale-solutions"],
"license": "AGPL-3",
"data": [
"data/res_groups_data.xml",
"data/nc_sync_error_data.xml",
"data/nc_event_status_data.xml",
"data/nextcloud_odoo_sync_cron_data.xml",
"data/nc_sync_log_capacity_cron_data.xml",
"data/calendar_alarm_data.xml",
"data/calendar_event_type_data.xml",
"security/ir.model.access.csv",
"security/ir_rule.xml",
"views/calendar_event_views.xml",
"views/nc_sync_user_views.xml",
"views/nc_sync_log_views.xml",
"views/nc_sync_error_views.xml",
"views/nc_calendar_views.xml",
"views/res_users_views.xml",
"views/res_config_settings_views.xml",
"wizards/run_sync_wizard_views.xml",
],
"installable": True,
"active": False,
"auto_install": False,
"application": True,
"uninstall_hook": "uninstall_hook",
}
29 changes: 29 additions & 0 deletions nextcloud_odoo_sync/data/calendar_alarm_data.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<odoo>
<record id="calendar_alarm_notif_at_event_start" model="calendar.alarm">
<field name="name">Notification - At the event's starts</field>
<field name="duration" eval="1" />
<field name="interval">minutes</field>
<field name="alarm_type">notification</field>
</record>

<record id="calendar_alarm_notif_5_mins" model="calendar.alarm">
<field name="name">Notification - 5 minutes</field>
<field name="duration" eval="5" />
<field name="interval">minutes</field>
<field name="alarm_type">notification</field>
</record>

<record id="calendar_alarm_notif_10_mins" model="calendar.alarm">
<field name="name">Notification - 10 minutes</field>
<field name="duration" eval="10" />
<field name="interval">minutes</field>
<field name="alarm_type">notification</field>
</record>

<record id="calendar_alarm_notif_2_days" model="calendar.alarm">
<field name="name">Notification - 2 Days</field>
<field name="duration" eval="2" />
<field name="interval">days</field>
<field name="alarm_type">notification</field>
</record>
</odoo>
61 changes: 61 additions & 0 deletions nextcloud_odoo_sync/data/calendar_event_type_data.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<odoo>
<record id="calendar_event_type_anniversary" model="calendar.event.type">
<field name="name">Anniversary</field>
</record>

<record id="calendar_event_type_appointment" model="calendar.event.type">
<field name="name">Appointment</field>
</record>

<record id="calendar_event_type_business" model="calendar.event.type">
<field name="name">Business</field>
</record>

<record id="calendar_event_type_education" model="calendar.event.type">
<field name="name">Education</field>
</record>

<record id="calendar_event_type_holiday" model="calendar.event.type">
<field name="name">Holiday</field>
</record>

<record id="calendar_event_type_meeting" model="calendar.event.type">
<field name="name">Meeting</field>
</record>

<record id="calendar_event_type_miscellaneous" model="calendar.event.type">
<field name="name">Miscellaneous</field>
</record>

<record id="calendar_event_type_non_working_hours" model="calendar.event.type">
<field name="name">Non-working hours</field>
</record>

<record id="calendar_event_type_not_in_office" model="calendar.event.type">
<field name="name">Not in office</field>
</record>

<record id="calendar_event_type_personal" model="calendar.event.type">
<field name="name">Personal</field>
</record>

<record id="calendar_event_type_phone_call" model="calendar.event.type">
<field name="name">Phone call</field>
</record>

<record id="calendar_event_type_sick_day" model="calendar.event.type">
<field name="name">Sick day</field>
</record>

<record id="calendar_event_type_special_occasion" model="calendar.event.type">
<field name="name">Special occasion</field>
</record>

<record id="calendar_event_type_travel" model="calendar.event.type">
<field name="name">Travel</field>
</record>

<record id="calendar_event_type_vacation" model="calendar.event.type">
<field name="name">Vacation</field>
</record>
</odoo>
13 changes: 13 additions & 0 deletions nextcloud_odoo_sync/data/nc_event_status_data.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<odoo>
<record id="nc_event_status_confirmed" model="nc.event.status">
<field name="name">Confirmed</field>
</record>

<record id="nc_event_status_tentative" model="nc.event.status">
<field name="name">Tentative</field>
</record>

<record id="nc_event_status_canceled" model="nc.event.status">
<field name="name">Canceled</field>
</record>
</odoo>
15 changes: 15 additions & 0 deletions nextcloud_odoo_sync/data/nc_sync_error_data.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<odoo>
<record id="nc_sync_error_1000" model="nc.sync.error">
<field name="name">ERR-1000</field>
<field name="description">Invalid user/password</field>
<field name="type">nextcloud</field>
<field name="severity">critical</field>
</record>

<record id="nc_sync_error_1001" model="nc.sync.error">
<field name="name">ERR-1001</field>
<field name="description">Invalid API URL</field>
<field name="type">nextcloud</field>
<field name="severity">critical</field>
</record>
</odoo>
16 changes: 16 additions & 0 deletions nextcloud_odoo_sync/data/nc_sync_log_capacity_cron_data.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<odoo>
<data noupdate="1">
<record id="ir_cron_nextcloud_sync_log_capacity" model="ir.cron">
<field name="active" eval="False"/>
<field name="name">NextCloud-Odoo Sync Log Deletion Cron</field>
<field name="interval_number">1</field>
<field name="interval_type">days</field>
<field name="numbercall">-1</field>
<field name="nextcall" eval="(DateTime.now() + timedelta(minutes=5)).strftime('%Y-%m-%d %H:%M:%S')" />
<field name="doall" eval="False"/>
<field name="model_id" ref="model_nc_sync_log"/>
<field name="code">model.delete_logs()</field>
<field name="state">code</field>
</record>
</data>
</odoo>
16 changes: 16 additions & 0 deletions nextcloud_odoo_sync/data/nextcloud_odoo_sync_cron_data.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<odoo>
<data noupdate="1">
<record id="ir_cron_nextcloud_odoo_sync_cron" model="ir.cron">
<field name="active" eval="False"/>
<field name="name">NextCloud-Odoo Sync Cron</field>
<field name="interval_number">12</field>
<field name="interval_type">hours</field>
<field name="numbercall">-1</field>
<field name="nextcall" eval="datetime.now().strftime('%Y-%m-%d 00:00:00')" />
<field name="doall" eval="False"/>
<field name="model_id" ref="model_nextcloud_caldav"/>
<field name="code">model.sync_cron()</field>
<field name="state">code</field>
</record>
</data>
</odoo>
8 changes: 8 additions & 0 deletions nextcloud_odoo_sync/data/res_groups_data.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<odoo>
<!-- Nextcloud sync Admin -->
<record id="group_nextcloud_sync_admin" model="res.groups">
<field name="name">Sync Admin</field>
<field name="category_id" eval="0"/>
<field name="users" eval="[(4, ref('base.user_root')), (4, ref('base.user_admin'))]"/>
</record>
</odoo>
19 changes: 19 additions & 0 deletions nextcloud_odoo_sync/hooks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# © 2023 Onestein
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import ast

from odoo import SUPERUSER_ID, api

ACTIONS = (
"calendar.action_calendar_event",
)

def uninstall_hook(cr, registry):
"""Restore calendar action"""
env = api.Environment(cr, SUPERUSER_ID, {})
for action_id in ACTIONS:
action = env.ref(action_id)
dom = ast.literal_eval(action.domain or "{}")
dom = [x for x in dom if x[0] != "nc_to_delete"]
dom = list(set(dom))
action.write({"domain": dom})
Loading

0 comments on commit 73935ff

Please sign in to comment.