diff --git a/dav_account/README.rst b/dav_account/README.rst new file mode 100644 index 0000000..968f457 --- /dev/null +++ b/dav_account/README.rst @@ -0,0 +1,7 @@ +===================== +dav_account +===================== + +This module adds dav implementation + +This is an Odoo addon. diff --git a/dav_account/__init__.py b/dav_account/__init__.py new file mode 100644 index 0000000..5305644 --- /dev/null +++ b/dav_account/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +from . import models \ No newline at end of file diff --git a/dav_account/__manifest__.py b/dav_account/__manifest__.py new file mode 100644 index 0000000..652fd6d --- /dev/null +++ b/dav_account/__manifest__.py @@ -0,0 +1,93 @@ +# Copyright 2022 Stéphan Sainléger (Elabore) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + "name": "dav_account", + "version": "14.0", + "author": "Elabore", + "website": "https://github.com/elabore-coop", + "maintainer": "Stéphan Sainléger", + "license": "AGPL-3", + "category": "Tools", + "summary": "This module adds dav implementation", + "description": """ + :image: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +=========== +dav_account +=========== + +This module adds dav implementation. + +Installation +============ + +Use Odoo normal module installation procedure to install +``dav_account``. + +Known issues / Roadmap +====================== + +None yet. + +Bug Tracker +=========== + +Bugs are tracked on `our issues website `_. 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. + +Credits +======= + +Contributors +------------ + +* Stéphan Sainléger (https://github.com/stephansainleger) +* Nicolas Jeudy (https://github.com/njeudy) + + +Funders +------- + +The development of this module has been financially supported by: +* Elabore (https://github.com/elabore-coop) + + +Maintainer +---------- + +This module is maintained by Elabore. + +""", + # any module necessary for this one to work correctly + "depends": [ + "base", + ], + "qweb": [ + # "static/src/xml/*.xml", + ], + "external_dependencies": { + "python": [], + }, + # always loaded + "data": [ + # "security/security.xml", + "security/ir.model.access.csv", + "views/res_users.xml", + "views/dav_server.xml", + # "views/menu.xml", + # "data/data.xml", + ], + # only loaded in demonstration mode + "demo": [], + "js": [], + "css": [], + "installable": True, + # Install this module automatically if all dependency have been previously + # and independently installed. Used for synergetic or glue modules. + "auto_install": False, + "application": False, +} \ No newline at end of file diff --git a/dav_account/i18n/README b/dav_account/i18n/README new file mode 100644 index 0000000..62197a1 --- /dev/null +++ b/dav_account/i18n/README @@ -0,0 +1 @@ +This directory should contain the *.po for Odoo translation. diff --git a/dav_account/i18n/fr.po b/dav_account/i18n/fr.po new file mode 100644 index 0000000..9d4326f --- /dev/null +++ b/dav_account/i18n/fr.po @@ -0,0 +1,122 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * dav_account +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2022-07-29 15:36+0000\n" +"PO-Revision-Date: 2022-07-29 15:36+0000\n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: dav_account +#: model:ir.model.fields,field_description:dav_account.field_dav_server__create_uid +msgid "Created by" +msgstr "Créé par" + +#. module: dav_account +#: model:ir.model.fields,field_description:dav_account.field_dav_server__create_date +msgid "Created on" +msgstr "Créé le" + +#. module: dav_account +#: model:ir.ui.menu,name:dav_account.menu_dav +msgid "DAV" +msgstr "" + +#. module: dav_account +#: model:ir.model.fields,field_description:dav_account.field_res_users__dav_server_ids +#: model_terms:ir.ui.view,arch_db:dav_account.dav_server_view_form +msgid "Dav Server" +msgstr "Serveur DAV" + +#. module: dav_account +#: model_terms:ir.ui.view,arch_db:dav_account.view_users_form_simple_modif_dav +msgid "Dav Server access" +msgstr "Accès serveur DAV" + +#. module: dav_account +#: model:ir.actions.act_window,name:dav_account.act_dav_server_list +#: model:ir.ui.menu,name:dav_account.menu_dav_servers +#: model_terms:ir.ui.view,arch_db:dav_account.dav_server_view_tree +msgid "Dav Servers" +msgstr "Serveurs DAV" + +#. module: dav_account +#: model_terms:ir.ui.view,arch_db:dav_account.view_users_form_simple_modif_dav +msgid "Dav Settings" +msgstr "Configuration DAV" + +#. module: dav_account +#: model:ir.model,name:dav_account.model_dav_server +msgid "Dav server" +msgstr "Serveur DAV" + +#. module: dav_account +#: model:ir.model.fields,field_description:dav_account.field_dav_server__display_name +#: model:ir.model.fields,field_description:dav_account.field_res_users__display_name +msgid "Display Name" +msgstr "Nom affiché" + +#. module: dav_account +#: model:ir.model.fields,field_description:dav_account.field_dav_server__id +#: model:ir.model.fields,field_description:dav_account.field_res_users__id +msgid "ID" +msgstr "" + +#. module: dav_account +#: model:ir.model.fields,field_description:dav_account.field_dav_server____last_update +#: model:ir.model.fields,field_description:dav_account.field_res_users____last_update +msgid "Last Modified on" +msgstr "Dernière modification le" + +#. module: dav_account +#: model:ir.model.fields,field_description:dav_account.field_dav_server__write_uid +msgid "Last Updated by" +msgstr "Dernière mise à jour par" + +#. module: dav_account +#: model:ir.model.fields,field_description:dav_account.field_dav_server__write_date +msgid "Last Updated on" +msgstr "Dernière mise à jour le" + +#. module: dav_account +#: model:ir.model.fields,field_description:dav_account.field_dav_server__password +msgid "Password" +msgstr "Mot de passe" + +#. module: dav_account +#: model:ir.model.fields,field_description:dav_account.field_dav_server__url +msgid "Server url" +msgstr "URL serveur" + +#. module: dav_account +#: model:ir.model.fields,field_description:dav_account.field_dav_server__status +msgid "Status" +msgstr "État" + +#. module: dav_account +#: model:ir.model.fields,field_description:dav_account.field_dav_server__user_id +msgid "User" +msgstr "Utilisateur" + +#. module: dav_account +#: model:ir.model.fields,field_description:dav_account.field_dav_server__username +msgid "Username" +msgstr "Nom utilisateur" + +#. module: dav_account +#: model:ir.model,name:dav_account.model_res_users +msgid "Users" +msgstr "Utilisateurs" + +#. module: dav_account +#: model:ir.model.fields,field_description:dav_account.field_dav_server__name +msgid "name" +msgstr "nom" diff --git a/dav_account/models/__init__.py b/dav_account/models/__init__.py new file mode 100644 index 0000000..dbe1119 --- /dev/null +++ b/dav_account/models/__init__.py @@ -0,0 +1,2 @@ +from . import dav_server +from . import res_users \ No newline at end of file diff --git a/dav_account/models/dav_server.py b/dav_account/models/dav_server.py new file mode 100644 index 0000000..02e18a7 --- /dev/null +++ b/dav_account/models/dav_server.py @@ -0,0 +1,33 @@ +import caldav +from odoo import api, fields, models + + +class DavServer(models.Model): + _name = "dav.server" + _description = "Dav server" + + name = fields.Char('name', required=True, copy=True) + url = fields.Char('Server url', required=True, copy=True) + username = fields.Char('Username', required=True, copy=True) + password = fields.Char('Password', required=True, copy=False) + user_id = fields.Many2one('res.users', string='User', required=True, copy=True, ondelete="cascade") + status = fields.Char(compute='_compute_status', string='Status', store=True) + + @api.depends("url", "username", "password") + def _compute_status(self): + try: + self.get_principal() + self.write({"status": "OK"}) + except: + self.write({"status": "KO"}) + + def get_principal(self): + ## When using the caldav library, we start with initiating a + ## DAVClient object, which should contain connection details and credentials. + ## Initiating the object does not cause any requests to the server, so this + ## will not break even if caldav url is set to example.com + client = caldav.DAVClient(url=self.url, username=self.username, password=self.password) + ## principal object will cause communication with the server. + principal = client.principal() + return principal + diff --git a/dav_account/models/res_users.py b/dav_account/models/res_users.py new file mode 100644 index 0000000..1640e1f --- /dev/null +++ b/dav_account/models/res_users.py @@ -0,0 +1,6 @@ +from odoo import _, api, fields, models + +class Users(models.Model): + _inherit="res.users" + + dav_server_ids = fields.One2many('dav.server', 'user_id', string='Dav Server') \ No newline at end of file diff --git a/dav_account/security/ir.model.access.csv b/dav_account/security/ir.model.access.csv new file mode 100644 index 0000000..ea97484 --- /dev/null +++ b/dav_account/security/ir.model.access.csv @@ -0,0 +1,2 @@ +id,name,model_id/id,group_id/id,perm_read,perm_write,perm_create,perm_unlink +access_dav_server_user,access_dav_server_user,model_dav_server,,1,1,1,1 \ No newline at end of file diff --git a/dav_account/views/dav_server.xml b/dav_account/views/dav_server.xml new file mode 100644 index 0000000..4100bfb --- /dev/null +++ b/dav_account/views/dav_server.xml @@ -0,0 +1,45 @@ + + + + + dav.server.view.tree + dav.server + + + + + + + + + + + + dav.server.view.form + dav.server + +
+ + + + + + + + + +
+
+
+ + + Dav Servers + dav.server + tree,form + + + + + + +
\ No newline at end of file diff --git a/dav_account/views/res_users.xml b/dav_account/views/res_users.xml new file mode 100644 index 0000000..1e6229b --- /dev/null +++ b/dav_account/views/res_users.xml @@ -0,0 +1,32 @@ + + + + res.users.preferences.form.dav + res.users + + + + + + + + + + + +
+ + + + + + + + +
+
+
+
+
+
+
\ No newline at end of file