Browse Source

Sep 28 : [UPDT] Feature Updated 'auto_database_backup'

pull/284/head
RisvanaCybro 2 years ago
parent
commit
d646406a7a
  1. 32
      auto_database_backup/README.rst
  2. 11
      auto_database_backup/__init__.py
  3. 39
      auto_database_backup/__manifest__.py
  4. 11
      auto_database_backup/controllers/__init__.py
  5. 35
      auto_database_backup/controllers/auto_database_backup.py
  6. 16
      auto_database_backup/data/ir_cron_data.xml
  7. 51
      auto_database_backup/data/mail_template_data.xml
  8. 9
      auto_database_backup/doc/RELEASE_NOTES.md
  9. 9
      auto_database_backup/models/__init__.py
  10. 875
      auto_database_backup/models/db_backup_configure.py
  11. 4
      auto_database_backup/security/ir.model.access.csv
  12. BIN
      auto_database_backup/static/description/assets/modules/1.png
  13. BIN
      auto_database_backup/static/description/assets/modules/2.png
  14. BIN
      auto_database_backup/static/description/assets/modules/3.jpg
  15. BIN
      auto_database_backup/static/description/assets/modules/3.png
  16. BIN
      auto_database_backup/static/description/assets/modules/4.png
  17. BIN
      auto_database_backup/static/description/assets/modules/5.gif
  18. BIN
      auto_database_backup/static/description/assets/modules/5.png
  19. BIN
      auto_database_backup/static/description/assets/modules/6.png
  20. BIN
      auto_database_backup/static/description/assets/modules/banner.jpg
  21. BIN
      auto_database_backup/static/description/assets/screenshots/add.png
  22. BIN
      auto_database_backup/static/description/assets/screenshots/amazon_s3_7.png
  23. BIN
      auto_database_backup/static/description/assets/screenshots/amazon_s3_8.png
  24. BIN
      auto_database_backup/static/description/assets/screenshots/amazon_s3_pci1.png
  25. BIN
      auto_database_backup/static/description/assets/screenshots/amazon_s3_pic 2.png
  26. BIN
      auto_database_backup/static/description/assets/screenshots/amazons3_4.png
  27. BIN
      auto_database_backup/static/description/assets/screenshots/amazons3_5.png
  28. BIN
      auto_database_backup/static/description/assets/screenshots/amazons3_6.png
  29. BIN
      auto_database_backup/static/description/assets/screenshots/amazons3_7.png
  30. BIN
      auto_database_backup/static/description/assets/screenshots/amazons3_access.png
  31. BIN
      auto_database_backup/static/description/assets/screenshots/amazons3_pick 3.png
  32. BIN
      auto_database_backup/static/description/assets/screenshots/amazons3_signup.png
  33. BIN
      auto_database_backup/static/description/assets/screenshots/drop1.png
  34. BIN
      auto_database_backup/static/description/assets/screenshots/drop2.png
  35. BIN
      auto_database_backup/static/description/assets/screenshots/drop3.png
  36. BIN
      auto_database_backup/static/description/assets/screenshots/drop4.png
  37. BIN
      auto_database_backup/static/description/assets/screenshots/enter15.png
  38. BIN
      auto_database_backup/static/description/assets/screenshots/enter17.png
  39. BIN
      auto_database_backup/static/description/assets/screenshots/enter_1.png
  40. BIN
      auto_database_backup/static/description/assets/screenshots/enter_10.png
  41. BIN
      auto_database_backup/static/description/assets/screenshots/enter_11.png
  42. BIN
      auto_database_backup/static/description/assets/screenshots/enter_12.png
  43. BIN
      auto_database_backup/static/description/assets/screenshots/enter_13.png
  44. BIN
      auto_database_backup/static/description/assets/screenshots/enter_2.png
  45. BIN
      auto_database_backup/static/description/assets/screenshots/enter_22.png
  46. BIN
      auto_database_backup/static/description/assets/screenshots/enter_3.png
  47. BIN
      auto_database_backup/static/description/assets/screenshots/enter_4.png
  48. BIN
      auto_database_backup/static/description/assets/screenshots/enter_5.png
  49. BIN
      auto_database_backup/static/description/assets/screenshots/enter_6.png
  50. BIN
      auto_database_backup/static/description/assets/screenshots/enter_7.png
  51. BIN
      auto_database_backup/static/description/assets/screenshots/enter_8.png
  52. BIN
      auto_database_backup/static/description/assets/screenshots/enter_9.png
  53. BIN
      auto_database_backup/static/description/assets/screenshots/enter_9999 (copy).png
  54. BIN
      auto_database_backup/static/description/assets/screenshots/enter_9999.png
  55. BIN
      auto_database_backup/static/description/assets/screenshots/enter_amazons3.png
  56. BIN
      auto_database_backup/static/description/assets/screenshots/enter_next1.png
  57. BIN
      auto_database_backup/static/description/assets/screenshots/enter_old1.png
  58. BIN
      auto_database_backup/static/description/assets/screenshots/enter_schedule (copy).png
  59. BIN
      auto_database_backup/static/description/assets/screenshots/enter_schedule.png
  60. BIN
      auto_database_backup/static/description/assets/screenshots/newcloud1.png
  61. BIN
      auto_database_backup/static/description/assets/screenshots/newcloud2.png
  62. BIN
      auto_database_backup/static/description/assets/screenshots/newcloud2_ds.png
  63. BIN
      auto_database_backup/static/description/assets/screenshots/next_cloud2.png
  64. BIN
      auto_database_backup/static/description/assets/screenshots/next_cloud_9.png
  65. BIN
      auto_database_backup/static/description/assets/screenshots/nextcloud_4.png
  66. BIN
      auto_database_backup/static/description/assets/screenshots/nextcloud_5.png
  67. BIN
      auto_database_backup/static/description/assets/screenshots/nextcloud_6.png
  68. BIN
      auto_database_backup/static/description/assets/screenshots/nextcloud_create_3.png
  69. BIN
      auto_database_backup/static/description/assets/screenshots/older_2.png
  70. BIN
      auto_database_backup/static/description/assets/screenshots/stat.gif
  71. BIN
      auto_database_backup/static/description/banner.gif
  72. 1609
      auto_database_backup/static/description/index.html
  73. 198
      auto_database_backup/views/db_backup_configure_views.xml
  74. 11
      auto_database_backup/wizard/__init__.py
  75. 38
      auto_database_backup/wizard/dropbox_auth_code.py
  76. 8
      auto_database_backup/wizard/dropbox_auth_code_views.xml

32
auto_database_backup/README.rst

@ -1,27 +1,31 @@
Automatic Database Backup To Local Server, Remote Server, Google Drive And Dropbox
==================================================================================
.. image:: https://img.shields.io/badge/licence-LGPL--3-green.svg
:target: https://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3
Automatic Database Backup To Local Server, Remote Server, Google Drive, Dropbox, Onedrive, Nextcloud and Amazon S3
==================================================================================================================
* Generate Database Backups and store to multiple locations
Installation
Configuration
============
- www.odoo.com/documentation/16.0/setup/install.html
- Install our custom addon
- www.odoo.com/documentation/16.0/setup/install.html
- Install our custom addon
License
-------
General Public License, Version 3 (LGPL v3).
(https://www.odoo.com/documentation/user/16.0/legal/licenses/licenses.html)
(https://www.gnu.org/licenses/lgpl-3.0-standalone.html)
Company
-------
* 'Cybrosys Techno Solutions <https://cybrosys.com/>`__
* `Cybrosys Techno Solutions <https://cybrosys.com/>`__
Credits
-------
* Developer:
(v15) Midilaj @ Cybrosys
(v16) Midilaj @ Cybrosys
* Developers : (v15) Midilaj,
(v16) Midilaj,
(v16 Amazon S3,NextCloud) Anfas Faisal K
Contact : odoo@cybrosys.com
Contacts
--------
@ -33,11 +37,13 @@ Bugs are tracked on GitHub Issues. In case of trouble, please check there if you
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 https://www.cybrosys.com
For support and more information, please visit `Our Website <https://cybrosys.com/>`__
Further information
===================
HTML Description: `<static/description/index.html>`__

11
auto_database_backup/__init__.py

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
#############################################################################
###############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2022-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>)
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Cybrosys Techno Solutions (odoo@cybrosys.com)
#
# You can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
@ -18,8 +18,7 @@
# (LGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
#############################################################################
###############################################################################
from . import controllers
from . import models
from . import wizard
from . import controllers

39
auto_database_backup/__manifest__.py

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
#############################################################################
###############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2022-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>)
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Cybrosys Techno Solutions (odoo@cybrosys.com)
#
# You can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
@ -18,29 +18,34 @@
# (LGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
#############################################################################
###############################################################################
{
'name': "Automatic Database Backup To Local Server, Remote Server, Google Drive, Dropbox and Onedrive",
'version': '16.0.1.0.0',
'summary': """Generate automatic backup of databases and store to local, google drive, dropbox, onedrive or remote server""",
'description': """This module has been developed for creating database backups automatically
and store it to the different locations.""",
'name': "Automatic Database Backup To Local Server, Remote Server,"
"Google Drive, Dropbox, Onedrive, Nextcloud and Amazon S3",
'version': '16.0.2.0.1',
'category': 'Extra Tools',
'summary': 'Generate automatic backup of databases and store to local, '
'google drive, dropbox, nextcloud, amazon S3, onedrive or '
'remote server',
'description': 'This module has been developed for creating database '
'backups automatically and store it to the different '
'locations.',
'author': "Cybrosys Techno Solutions",
'website': "https://www.cybrosys.com",
'company': 'Cybrosys Techno Solutions',
'maintainer': 'Cybrosys Techno Solutions',
'category': 'Tools',
'company': 'Cybrosys Techno Solutions',
'website': "https://www.cybrosys.com",
'depends': ['base', 'mail'],
'data': [
'security/ir.model.access.csv',
'data/data.xml',
'data/ir_cron_data.xml',
'data/mail_template_data.xml',
'views/db_backup_configure_views.xml',
'wizard/authentication_wizard_views.xml',
'wizard/dropbox_auth_code_views.xml',
],
'external_dependencies': {'python': ['dropbox']},
'license': 'LGPL-3',
'external_dependencies': {
'python': ['dropbox', 'pyncclient', 'boto3', 'nextcloud-api-wrapper','paramiko']},
'images': ['static/description/banner.gif'],
'license': 'LGPL-3',
'installable': True,
'auto_install': False,
'application': False,

11
auto_database_backup/controllers/__init__.py

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
#############################################################################
###############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2022-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>)
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Cybrosys Techno Solutions (odoo@cybrosys.com)
#
# You can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
@ -17,5 +17,6 @@
# 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 main
#
###############################################################################
from . import auto_database_backup

35
auto_database_backup/controllers/main.py → auto_database_backup/controllers/auto_database_backup.py

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
#############################################################################
###############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2022-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>)
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Cybrosys Techno Solutions (odoo@cybrosys.com)
#
# You can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
@ -17,27 +17,38 @@
# 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/>.
#
###############################################################################
import json
from odoo import http
from odoo.http import request
class OnedriveAuth(http.Controller):
"""Controller for handling authentication with OneDrive and Google Drive."""
@http.route('/onedrive/authentication', type='http', auth="public")
def oauth2callback(self, **kw):
"""
Callback function for OneDrive authentication.
:param kw: A dictionary of keyword arguments.
:return: A redirect response.
"""
state = json.loads(kw['state'])
backup_config = request.env['db.backup.configure'].sudo().browse(state.get('backup_config_id'))
backup_config = request.env['db.backup.configure'].sudo().browse(
state.get('backup_config_id'))
backup_config.get_onedrive_tokens(kw.get('code'))
url_return = state.get('url_return')
return request.redirect(url_return)
backup_config.hide_active = True
backup_config.active = True
return request.redirect(state.get('url_return'))
@http.route('/google_drive/authentication', type='http', auth="public")
def gdrive_oauth2callback(self, **kw):
"""Callback function for Google Drive authentication."""
state = json.loads(kw['state'])
backup_config = request.env['db.backup.configure'].sudo().browse(state.get('backup_config_id'))
backup_config = request.env['db.backup.configure'].sudo().browse(
state.get('backup_config_id'))
backup_config.get_gdrive_tokens(kw.get('code'))
url_return = state.get('url_return')
return request.redirect(url_return)
backup_config.hide_active = True
backup_config.active = True
return request.redirect(state.get('url_return'))

16
auto_database_backup/data/ir_cron_data.xml

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<data noupdate="1">
<!-- Schedule action for generating automatic database backup-->
<record id="ir_cron_auto_db_backup" model="ir.cron">
<field name="name">Backup : Automatic Database Backup</field>
<field name="model_id" ref="model_db_backup_configure"/>
<field name="state">code</field>
<field name="code">model._schedule_auto_backup()</field>
<field name="interval_number">1</field>
<field name="interval_type">days</field>
<field name="numbercall">-1</field>
<field name="active">False</field>
</record>
</data>
</odoo>

51
auto_database_backup/data/data.xml → auto_database_backup/data/mail_template_data.xml

@ -1,22 +1,5 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<data noupdate="1">
<!-- Schedule action for generating automatic database backup-->
<record id="ir_cron_auto_db_backup" model="ir.cron">
<field name="name">Backup : Automatic Database Backup</field>
<field name="model_id" ref="model_db_backup_configure"/>
<field name="state">code</field>
<field name="code">model._schedule_auto_backup()</field>
<field name="interval_number">1</field>
<field name="interval_type">days</field>
<field name="numbercall">-1</field>
<field name="active">False</field>
</record>
</data>
<data>
<!-- Database backup operation Successful email template-->
<record id="mail_template_data_db_backup_successful" model="mail.template">
@ -54,6 +37,12 @@
<t t-elif="object.backup_destination == 'onedrive'">
<i>Onedrive</i>
</t>
<t t-elif="object.backup_destination == 'next_cloud'">
<i>NextCloud</i>
</t>
<t t-elif="object.backup_destination == 'amazon_s3'">
<i>Amazon S3</i>
</t>
.
<br/>
<br/>
@ -79,6 +68,12 @@
<t t-elif="object.backup_destination == 'onedrive'">
Onedrive
</t>
<t t-elif="object.backup_destination == 'next_cloud'">
NextCloud
</t>
<t t-elif="object.backup_destination == 'amazon_s3'">
Amazon S3
</t>
<t t-if="object.backup_destination in ('local', 'ftp', 'sftp', 'dropbox')">
<br/>
Backup Path:
@ -94,6 +89,12 @@
<t t-elif="object.backup_destination == 'dropbox'">
<t t-out="object.dropbox_folder"/>
</t>
<t t-elif="object.backup_destination == 'next_cloud'">
<t t-out="object.nextcloud_folder_key"/>
</t>
<t t-elif="object.backup_destination == 'amazon_s3'">
<t t-out="object.aws_folder_name"/>
</t>
</t>
<br/>
Backup Type:
@ -148,7 +149,13 @@
<t t-elif="object.backup_destination == 'onedrive'">
Onedrive
</t>
<t t-if="object.backup_destination in ('local', 'ftp', 'sftp', 'dropbox')">
<t t-elif="object.backup_destination == 'next_cloud'">
NextCloud
</t>
<t t-elif="object.backup_destination == 'amazon_s3'">
Amazon S3
</t>
<t t-if="object.backup_destination in ('local', 'ftp', 'sftp', 'dropbox','next_cloud','amazon_s3')">
<br/>
Backup Path:
<t t-if="object.backup_destination == 'local'">
@ -163,6 +170,12 @@
<t t-elif="object.backup_destination == 'dropbox'">
<t t-out="object.dropbox_folder"/>
</t>
<t t-elif="object.backup_destination == 'next_cloud'">
<t t-out="object.nextcloud_folder_key"/>
</t>
<t t-elif="object.backup_destination == 'amazon_s3'">
<t t-out="object.aws_folder_name"/>
</t>
</t>
<br/>
Backup Type: <t t-out="object.backup_format"/>
@ -177,6 +190,4 @@
</field>
</record>
</data>
</odoo>

9
auto_database_backup/doc/RELEASE_NOTES.md

@ -3,4 +3,13 @@
#### 31.10.2022
#### Version 16.0.1.0.0
#### ADD
- Initial commit for auto_database_backup
## Module <auto_database_backup>
#### 26.09.2023
#### Version 16.0.2.0.1
#### ADD
- Next Cloud Integration and Amazon S3 are added and added active field customization if connection is successful only then active field will be able to edit.

9
auto_database_backup/models/__init__.py

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
#############################################################################
###############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2022-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>)
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Cybrosys Techno Solutions (odoo@cybrosys.com)
#
# You can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
@ -17,5 +17,6 @@
# 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 db_backup_configure

875
auto_database_backup/models/db_backup_configure.py

File diff suppressed because it is too large

4
auto_database_backup/security/ir.model.access.csv

@ -1,3 +1,3 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_db_backup_configure,access.db.backup.configure,model_db_backup_configure,base.group_user,1,1,1,1
access_authentication_wizard,access.authentication.wizard,model_authentication_wizard,base.group_user,1,1,1,1
access_db_backup_configure_user,access.db.backup.configure.user,model_db_backup_configure,base.group_user,1,1,1,1
access_dropbox_auth_code_user,access.dropbox.auth.code.user,model_dropbox_auth_code,base.group_user,1,1,1,1

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_db_backup_configure access_db_backup_configure_user access.db.backup.configure access.db.backup.configure.user model_db_backup_configure base.group_user 1 1 1 1
3 access_authentication_wizard access_dropbox_auth_code_user access.authentication.wizard access.dropbox.auth.code.user model_authentication_wizard model_dropbox_auth_code base.group_user 1 1 1 1

BIN
auto_database_backup/static/description/assets/modules/1.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB

After

Width:  |  Height:  |  Size: 82 KiB

BIN
auto_database_backup/static/description/assets/modules/2.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

After

Width:  |  Height:  |  Size: 81 KiB

BIN
auto_database_backup/static/description/assets/modules/3.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

BIN
auto_database_backup/static/description/assets/modules/3.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

BIN
auto_database_backup/static/description/assets/modules/4.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 59 KiB

After

Width:  |  Height:  |  Size: 84 KiB

BIN
auto_database_backup/static/description/assets/modules/5.gif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 MiB

BIN
auto_database_backup/static/description/assets/modules/5.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

BIN
auto_database_backup/static/description/assets/modules/6.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 57 KiB

After

Width:  |  Height:  |  Size: 18 KiB

BIN
auto_database_backup/static/description/assets/modules/banner.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

BIN
auto_database_backup/static/description/assets/screenshots/add.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 149 KiB

BIN
auto_database_backup/static/description/assets/screenshots/amazon_s3_7.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

BIN
auto_database_backup/static/description/assets/screenshots/amazon_s3_8.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

BIN
auto_database_backup/static/description/assets/screenshots/amazon_s3_pci1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 KiB

BIN
auto_database_backup/static/description/assets/screenshots/amazon_s3_pic 2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

BIN
auto_database_backup/static/description/assets/screenshots/amazons3_4.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 KiB

BIN
auto_database_backup/static/description/assets/screenshots/amazons3_5.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

BIN
auto_database_backup/static/description/assets/screenshots/amazons3_6.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 KiB

BIN
auto_database_backup/static/description/assets/screenshots/amazons3_7.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 KiB

BIN
auto_database_backup/static/description/assets/screenshots/amazons3_access.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB

BIN
auto_database_backup/static/description/assets/screenshots/amazons3_pick 3.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 171 KiB

BIN
auto_database_backup/static/description/assets/screenshots/amazons3_signup.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 190 KiB

BIN
auto_database_backup/static/description/assets/screenshots/drop1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

BIN
auto_database_backup/static/description/assets/screenshots/drop2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

BIN
auto_database_backup/static/description/assets/screenshots/drop3.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 KiB

BIN
auto_database_backup/static/description/assets/screenshots/drop4.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

BIN
auto_database_backup/static/description/assets/screenshots/enter15.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

BIN
auto_database_backup/static/description/assets/screenshots/enter17.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

BIN
auto_database_backup/static/description/assets/screenshots/enter_1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB

BIN
auto_database_backup/static/description/assets/screenshots/enter_10.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

BIN
auto_database_backup/static/description/assets/screenshots/enter_11.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

BIN
auto_database_backup/static/description/assets/screenshots/enter_12.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

BIN
auto_database_backup/static/description/assets/screenshots/enter_13.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

BIN
auto_database_backup/static/description/assets/screenshots/enter_2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

BIN
auto_database_backup/static/description/assets/screenshots/enter_22.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

BIN
auto_database_backup/static/description/assets/screenshots/enter_3.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

BIN
auto_database_backup/static/description/assets/screenshots/enter_4.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

BIN
auto_database_backup/static/description/assets/screenshots/enter_5.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

BIN
auto_database_backup/static/description/assets/screenshots/enter_6.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

BIN
auto_database_backup/static/description/assets/screenshots/enter_7.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

BIN
auto_database_backup/static/description/assets/screenshots/enter_8.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

BIN
auto_database_backup/static/description/assets/screenshots/enter_9.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

BIN
auto_database_backup/static/description/assets/screenshots/enter_9999 (copy).png

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

BIN
auto_database_backup/static/description/assets/screenshots/enter_9999.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

BIN
auto_database_backup/static/description/assets/screenshots/enter_amazons3.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

BIN
auto_database_backup/static/description/assets/screenshots/enter_next1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

BIN
auto_database_backup/static/description/assets/screenshots/enter_old1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

BIN
auto_database_backup/static/description/assets/screenshots/enter_schedule (copy).png

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 KiB

BIN
auto_database_backup/static/description/assets/screenshots/enter_schedule.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 KiB

BIN
auto_database_backup/static/description/assets/screenshots/newcloud1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

BIN
auto_database_backup/static/description/assets/screenshots/newcloud2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 171 KiB

BIN
auto_database_backup/static/description/assets/screenshots/newcloud2_ds.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

BIN
auto_database_backup/static/description/assets/screenshots/next_cloud2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

BIN
auto_database_backup/static/description/assets/screenshots/next_cloud_9.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 KiB

BIN
auto_database_backup/static/description/assets/screenshots/nextcloud_4.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 283 KiB

BIN
auto_database_backup/static/description/assets/screenshots/nextcloud_5.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

BIN
auto_database_backup/static/description/assets/screenshots/nextcloud_6.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

BIN
auto_database_backup/static/description/assets/screenshots/nextcloud_create_3.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

BIN
auto_database_backup/static/description/assets/screenshots/older_2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

BIN
auto_database_backup/static/description/assets/screenshots/stat.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

BIN
auto_database_backup/static/description/banner.gif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 284 KiB

After

Width:  |  Height:  |  Size: 652 KiB

1609
auto_database_backup/static/description/index.html

File diff suppressed because it is too large

198
auto_database_backup/views/db_backup_configure_views.xml

@ -1,11 +1,8 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<!-- Database backup configuration views-->
<record id="view_db_backup_configure_list" model="ir.ui.view">
<field name="name">db.backup.configure.list</field>
<!-- Database backup configuration views-->
<record id="db_backup_configure_view_tree" model="ir.ui.view">
<field name="name">db.backup.configure.view.tree</field>
<field name="model">db.backup.configure</field>
<field name="arch" type="xml">
<tree decoration-muted="(not active)">
@ -17,8 +14,8 @@
</field>
</record>
<record id="view_db_backup_configure_form" model="ir.ui.view">
<field name="name">db.backup.configure.form</field>
<record id="db_backup_configure_view_form" model="ir.ui.view">
<field name="name">db.backup.configure.view.form</field>
<field name="model">db.backup.configure</field>
<field name="arch" type="xml">
<form>
@ -33,46 +30,106 @@
<field name="db_name"/>
<field name="master_pwd" password="True"/>
<field name="backup_format"/>
<field name="active" widget="boolean_toggle"/>
<field name="active" widget="boolean_toggle" attrs="{'readonly': [('hide_active', '=', False)]}"/>
<field name="hide_active" invisible="1"/>
</group>
<group>
<field name="backup_destination" required="1"/>
<field name="backup_path" attrs="{'invisible': [('backup_destination', '!=', 'local')], 'required': [('backup_destination', '=', 'local')]}"/>
<field name="ftp_host" attrs="{'invisible': [('backup_destination', '!=', 'ftp')], 'required': [('backup_destination', '=', 'ftp')]}"/>
<field name="ftp_port" attrs="{'invisible': [('backup_destination', '!=', 'ftp')], 'required': [('backup_destination', '=', 'ftp')]}"/>
<field name="ftp_user" attrs="{'invisible': [('backup_destination', '!=', 'ftp')], 'required': [('backup_destination', '=', 'ftp')]}"/>
<field name="ftp_password" attrs="{'invisible': [('backup_destination', '!=', 'ftp')], 'required': [('backup_destination', '=', 'ftp')]}" password="True"/>
<field name="ftp_path" attrs="{'invisible': [('backup_destination', '!=', 'ftp')], 'required': [('backup_destination', '=', 'ftp')]}"/>
<field name="sftp_host" attrs="{'invisible': [('backup_destination', '!=', 'sftp')], 'required': [('backup_destination', '=', 'sftp')]}"/>
<field name="sftp_port" attrs="{'invisible': [('backup_destination', '!=', 'sftp')], 'required': [('backup_destination', '=', 'sftp')]}"/>
<field name="sftp_user" attrs="{'invisible': [('backup_destination', '!=', 'sftp')], 'required': [('backup_destination', '=', 'sftp')]}"/>
<field name="sftp_password" attrs="{'invisible': [('backup_destination', '!=', 'sftp')], 'required': [('backup_destination', '=', 'sftp')]}" password="True"/>
<field name="sftp_path" attrs="{'invisible': [('backup_destination', '!=', 'sftp')], 'required': [('backup_destination', '=', 'sftp')]}"/>
<field name="gdrive_client_id" string="Client ID" attrs="{'invisible': [('backup_destination', '!=', 'google_drive')], 'required': [('backup_destination', '=', 'google_drive')]}"/>
<field name="gdrive_client_secret" string="Client Secret" attrs="{'invisible': [('backup_destination', '!=', 'google_drive')], 'required': [('backup_destination', '=', 'google_drive')]}" password="True"/>
<field name="gdrive_redirect_uri" string="Redirect URI" attrs="{'invisible': [('backup_destination', '!=', 'google_drive')]}"/>
<field name="gdrive_access_token" password="True" invisible="1"/>
<field name="gdrive_refresh_token" password="True" invisible="1"/>
<field name="backup_path"
attrs="{'invisible': [('backup_destination', '!=', 'local')], 'required': [('backup_destination', '=', 'local')]}"/>
<field name="ftp_host"
attrs="{'invisible': [('backup_destination', '!=', 'ftp')], 'required': [('backup_destination', '=', 'ftp')]}"/>
<field name="ftp_port"
attrs="{'invisible': [('backup_destination', '!=', 'ftp')], 'required': [('backup_destination', '=', 'ftp')]}"/>
<field name="ftp_user"
attrs="{'invisible': [('backup_destination', '!=', 'ftp')], 'required': [('backup_destination', '=', 'ftp')]}"/>
<field name="ftp_password"
attrs="{'invisible': [('backup_destination', '!=', 'ftp')], 'required': [('backup_destination', '=', 'ftp')]}"
password="True"/>
<field name="ftp_path"
attrs="{'invisible': [('backup_destination', '!=', 'ftp')], 'required': [('backup_destination', '=', 'ftp')]}"/>
<field name="sftp_host"
attrs="{'invisible': [('backup_destination', '!=', 'sftp')], 'required': [('backup_destination', '=', 'sftp')]}"/>
<field name="sftp_port"
attrs="{'invisible': [('backup_destination', '!=', 'sftp')], 'required': [('backup_destination', '=', 'sftp')]}"/>
<field name="sftp_user"
attrs="{'invisible': [('backup_destination', '!=', 'sftp')], 'required': [('backup_destination', '=', 'sftp')]}"/>
<field name="sftp_password"
attrs="{'invisible': [('backup_destination', '!=', 'sftp')], 'required': [('backup_destination', '=', 'sftp')]}"
password="True"/>
<field name="sftp_path"
attrs="{'invisible': [('backup_destination', '!=', 'sftp')], 'required': [('backup_destination', '=', 'sftp')]}"/>
<field name="gdrive_client_key" string="Client ID"
attrs="{'invisible': [('backup_destination', '!=', 'google_drive')], 'required': [('backup_destination', '=', 'google_drive')]}"/>
<field name="gdrive_client_secret"
string="Client Secret"
attrs="{'invisible': [('backup_destination', '!=', 'google_drive')], 'required': [('backup_destination', '=', 'google_drive')]}"
password="True"/>
<field name="gdrive_redirect_uri"
string="Redirect URI"
attrs="{'invisible': [('backup_destination', '!=', 'google_drive')]}"/>
<field name="gdrive_access_token" password="True"
invisible="1"/>
<field name="gdrive_refresh_token" password="True"
invisible="1"/>
<field name="gdrive_token_validity" invisible="1"/>
<field name="google_drive_folderid" attrs="{'invisible': [('backup_destination', '!=', 'google_drive')], 'required': [('backup_destination', '=', 'google_drive')]}"/>
<field name="dropbox_client_id" string="App Key" attrs="{'invisible': [('backup_destination', '!=', 'dropbox')], 'required': [('backup_destination', '=', 'dropbox')]}" password="True"/>
<field name="dropbox_client_secret" string="App Secret" attrs="{'invisible': [('backup_destination', '!=', 'dropbox')], 'required': [('backup_destination', '=', 'dropbox')]}" password="True"/>
<field name="onedrive_client_id" string="Client ID" attrs="{'invisible': [('backup_destination', '!=', 'onedrive')], 'required': [('backup_destination', '=', 'onedrive')]}"/>
<field name="onedrive_client_secret" string="Client Secret" attrs="{'invisible': [('backup_destination', '!=', 'onedrive')], 'required': [('backup_destination', '=', 'onedrive')]}" password="True"/>
<field name="onedrive_redirect_uri" string="Redirect URI" attrs="{'invisible': [('backup_destination', '!=', 'onedrive')]}"/>
<field name="onedrive_folder_id" string="Folder ID" attrs="{'invisible': [('backup_destination', '!=', 'onedrive')], 'required': [('backup_destination', '=', 'onedrive')]}"/>
<field name="onedrive_access_token" string="Access Token" invisible="1" password="True"/>
<field name="onedrive_refresh_token" string="Refresh Token" invisible="1" password="True"/>
<field name="onedrive_token_validity" string="Token Validity" invisible="1"/>
<field name="is_onedrive_token_generated" invisible="1"/>
<field name="is_google_drive_token_generated" invisible="1"/>
<field name="google_drive_folder_key"
attrs="{'invisible': [('backup_destination', '!=', 'google_drive')], 'required': [('backup_destination', '=', 'google_drive')]}"/>
<field name="dropbox_client_key" string="App Key"
attrs="{'invisible': [('backup_destination', '!=', 'dropbox')], 'required': [('backup_destination', '=', 'dropbox')]}"
password="True"/>
<field name="dropbox_client_secret"
string="App Secret"
attrs="{'invisible': [('backup_destination', '!=', 'dropbox')], 'required': [('backup_destination', '=', 'dropbox')]}"
password="True"/>
<field name="onedrive_client_key" string="Client ID"
attrs="{'invisible': [('backup_destination', '!=', 'onedrive')], 'required': [('backup_destination', '=', 'onedrive')]}"/>
<field name="onedrive_client_secret"
string="Client Secret"
attrs="{'invisible': [('backup_destination', '!=', 'onedrive')], 'required': [('backup_destination', '=', 'onedrive')]}"
password="True"/>
<field name="onedrive_redirect_uri"
string="Redirect URI"
attrs="{'invisible': [('backup_destination', '!=', 'onedrive')]}"/>
<field name="onedrive_folder_key" string="Folder ID"
attrs="{'invisible': [('backup_destination', '!=', 'onedrive')], 'required': [('backup_destination', '=', 'onedrive')]}"/>
<field name="onedrive_access_token"
string="Access Token"
invisible="1" password="True"/>
<field name="onedrive_refresh_token"
string="Refresh Token" invisible="1"
password="True"/>
<field name="onedrive_token_validity"
string="Token Validity" invisible="1"/>
<field name="is_onedrive_token_generated"
invisible="1"/>
<field name="is_google_drive_token_generated"
invisible="1"/>
<field name="domain" string="Domain Name"
attrs="{'invisible': [('backup_destination', '!=', 'next_cloud')]}"/>
<field name="next_cloud_user_name"
string="User Name"
attrs="{'invisible': [('backup_destination', '!=', 'next_cloud')]}"/>
<field name="next_cloud_password" string="Password"
attrs="{'invisible': [('backup_destination', '!=', 'next_cloud')]}"/>
<field name="nextcloud_folder_key" string="Folder ID"
attrs="{'invisible': [('backup_destination', '!=', 'next_cloud')]}"/>
<field name="aws_access_key"
attrs="{'invisible': [('backup_destination', '!=', 'amazon_s3')]}"/>
<field name="aws_secret_access_key"
attrs="{'invisible': [('backup_destination', '!=', 'amazon_s3')]}"/>
<field name="bucket_file_name"
attrs="{'invisible': [('backup_destination', '!=', 'amazon_s3')]}"/>
<field name="aws_folder_name"
attrs="{'invisible': [('backup_destination', '!=', 'amazon_s3')]}"/>
<div attrs="{'invisible': [('backup_destination', '!=', 'dropbox')]}">
<div attrs="{'invisible': ['|', ('backup_destination', '!=', 'dropbox'), ('is_dropbox_token_generated', '=', False)]}">
<i class="text-success fa fa-check"></i>
<i class="text-success fa fa-check"/>
Refresh token set
</div>
<div attrs="{'invisible': ['|', ('backup_destination', '!=', 'dropbox'), ('is_dropbox_token_generated', '=', True)]}">
<i class="fa fa-exclamation-triangle text-warning"></i>
<i class="fa fa-exclamation-triangle text-warning"/>
No refresh token set
</div>
</div>
@ -81,7 +138,7 @@
<button class="btn btn-link"
name="action_get_dropbox_auth_code"
type="object">
<i class="fa fa-arrow-right"></i>
<i class="fa fa-arrow-right"/>
Setup Token
</button>
</div>
@ -89,18 +146,18 @@
<button class="btn btn-link"
name="action_get_dropbox_auth_code"
type="object">
<i class="fa fa-arrow-right"></i>
<i class="fa fa-arrow-right"/>
Reset Token
</button>
</div>
</div>
<div attrs="{'invisible': [('backup_destination', '!=', 'google_drive')]}">
<div attrs="{'invisible': ['|', ('backup_destination', '!=', 'google_drive'), ('is_google_drive_token_generated', '=', False)]}">
<i class="text-success fa fa-check"></i>
<i class="text-success fa fa-check"/>
Refresh token set
</div>
<div attrs="{'invisible': ['|', ('backup_destination', '!=', 'google_drive'), ('is_google_drive_token_generated', '=', True)]}">
<i class="fa fa-exclamation-triangle text-warning"></i>
<i class="fa fa-exclamation-triangle text-warning"/>
No refresh token set
</div>
</div>
@ -109,7 +166,7 @@
<button class="btn btn-link"
name="action_get_gdrive_auth_code"
type="object">
<i class="fa fa-arrow-right"></i>
<i class="fa fa-arrow-right"/>
Setup Token
</button>
</div>
@ -117,18 +174,18 @@
<button class="btn btn-link"
name="action_get_gdrive_auth_code"
type="object">
<i class="fa fa-arrow-right"></i>
<i class="fa fa-arrow-right"/>
Reset Token
</button>
</div>
</div>
<div attrs="{'invisible': [('backup_destination', '!=', 'onedrive')]}">
<div attrs="{'invisible': ['|', ('backup_destination', '!=', 'onedrive'), ('is_onedrive_token_generated', '=', False)]}">
<i class="text-success fa fa-check"></i>
<i class="text-success fa fa-check"/>
Refresh token set
</div>
<div attrs="{'invisible': ['|', ('backup_destination', '!=', 'onedrive'), ('is_onedrive_token_generated', '=', True)]}">
<i class="fa fa-exclamation-triangle text-warning"></i>
<i class="fa fa-exclamation-triangle text-warning"/>
No refresh token set
</div>
</div>
@ -137,7 +194,7 @@
<button class="btn btn-link"
name="action_get_onedrive_auth_code"
type="object">
<i class="fa fa-arrow-right"></i>
<i class="fa fa-arrow-right"/>
Setup Token
</button>
</div>
@ -145,7 +202,7 @@
<button class="btn btn-link"
name="action_get_onedrive_auth_code"
type="object">
<i class="fa fa-arrow-right"></i>
<i class="fa fa-arrow-right"/>
Reset Token
</button>
</div>
@ -153,7 +210,8 @@
</group>
<group>
<field name="notify_user"/>
<field name="user_id" attrs="{'invisible': [('notify_user', '=', False)]}"/>
<field name="user_id"
attrs="{'invisible': [('notify_user', '=', False)]}"/>
</group>
<group>
<field name="dropbox_refresh_token" invisible="1"/>
@ -168,8 +226,19 @@
attrs="{'required': [('auto_remove', '=', True)]}"/>
Days
</div>
<button name="test_connection" type="object" string="Test Connection" icon="fa-television"
<button name="action_sftp_connection" type="object"
string="Test Connection"
icon="fa-television"
attrs="{'invisible': [('backup_destination', 'not in', ('ftp', 'sftp'))]}"/>
<button name="action_nextcloud" type="object"
string="Test Connection"
icon="fa-television"
attrs="{'invisible': [('backup_destination', '!=', 'next_cloud')]}"/>
<button name="action_s3cloud" type="object"
string="Test Connection"
icon="fa-television"
attrs="{'invisible': [('backup_destination', '!=', 'amazon_s3')]}"/>
</group>
</group>
</sheet>
@ -177,24 +246,27 @@
</field>
</record>
<record id="view_db_backup_configure_search" model="ir.ui.view">
<field name="name">db.backup.configure.search</field>
<field name="model">db.backup.configure</field>
<record id="db_backup_configure_view_search" model="ir.ui.view">
<field name="name">db.backup.configure.view.search</field>
<field name="model">db.backup.configure</field>
<field name="arch" type="xml">
<search>
<field name="name"/>
<field name="db_name"/>
<filter string="All" name="all" domain="['|', ('active', '=', True), ('active', '!=', True)]"/>
<separator/>
<filter string="Archived" name="inactive" domain="[('active', '=', False)]"/>
<filter string="All" name="all"
domain="['|', ('active', '=', True), ('active', '!=', True)]"/>
<separator/>
<filter string="Archived" name="inactive"
domain="[('active', '=', False)]"/>
<group expand="0" string="Group By">
<filter string="Backup Type" name="backup_type" domain="[]" context="{'group_by': 'backup_destination'}"/>
<filter string="Backup Type" name="backup_type" domain="[]"
context="{'group_by': 'backup_destination'}"/>
</group>
</search>
</field>
</record>
<record id="action_db_backup_configure" model="ir.actions.act_window">
<record id="db_backup_configure_action" model="ir.actions.act_window">
<field name="name">Database Backup</field>
<field name="res_model">db.backup.configure</field>
<field name="view_mode">tree,form</field>
@ -206,7 +278,9 @@
<field name="context">{'search_default_all': 1}</field>
</record>
<menuitem id="menu_db_backup" name="Automatic Database Backup" parent="base.menu_custom" sequence="10"/>
<menuitem id="menu_db_backup_configuration" parent="menu_db_backup" name="Backup Configuration"
action="action_db_backup_configure"/>
<menuitem id="db_backup_menu_root" name="Automatic Database Backup"
parent="base.menu_custom" sequence="10"/>
<menuitem id="db_backup_configure_menu" parent="db_backup_menu_root"
name="Backup Configuration"
action="db_backup_configure_action"/>
</odoo>

11
auto_database_backup/wizard/__init__.py

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
#############################################################################
###############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2022-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>)
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Cybrosys Techno Solutions (odoo@cybrosys.com)
#
# You can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
@ -18,6 +18,5 @@
# (LGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
#############################################################################
from . import auth_code_wizard
###############################################################################
from . import dropbox_auth_code

38
auto_database_backup/wizard/auth_code_wizard.py → auto_database_backup/wizard/dropbox_auth_code.py

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
#############################################################################
###############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2022-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>)
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Cybrosys Techno Solutions (odoo@cybrosys.com)
#
# You can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
@ -18,31 +18,43 @@
# (LGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
#############################################################################
from odoo import models, fields, api, _
###############################################################################
from werkzeug import urls
from odoo import api, fields, models, _
GOOGLE_AUTH_ENDPOINT = 'https://accounts.google.com/o/oauth2/auth'
GOOGLE_TOKEN_ENDPOINT = 'https://accounts.google.com/o/oauth2/token'
class AuthenticationWizard(models.TransientModel):
_name = 'authentication.wizard'
"""Wizard to handle authentication for backup configuration.
This wizard allows users to enter the Dropbox authorization code and
sets up the Dropbox refresh token."""
_name = 'dropbox.auth.code'
_description = 'Authentication Code Wizard'
dropbox_authorization_code = fields.Char(string='Dropbox Authorization Code')
dropbox_auth_url = fields.Char(string='Dropbox Authentication URL', compute='_compute_dropbox_auth_url')
dropbox_authorization_code = fields.Char(
string='Dropbox Authorization Code',
help='The authorization code of dropbox')
dropbox_auth_url = fields.Char(string='Dropbox Authentication URL',
compute='_compute_dropbox_auth_url',
help='Dropbox authentication URL')
@api.depends('dropbox_authorization_code')
def _compute_dropbox_auth_url(self):
backup_config = self.env['db.backup.configure'].browse(self.env.context.get('active_id'))
"""Compute method to generate the Dropbox authentication URL based on
the provided authorization code."""
backup_config = self.env['db.backup.configure'].browse(
self.env.context.get('active_id'))
dropbox_auth_url = backup_config.get_dropbox_auth_url()
for rec in self:
rec.dropbox_auth_url = dropbox_auth_url
def action_setup_dropbox_token(self):
backup_config = self.env['db.backup.configure'].browse(self.env.context.get('active_id'))
"""Action method to set up the Dropbox refresh token using the
provided authorization code."""
backup_config = self.env['db.backup.configure'].browse(
self.env.context.get('active_id'))
backup_config.hide_active = True
backup_config.active = True
backup_config.set_dropbox_refresh_token(self.dropbox_authorization_code)

8
auto_database_backup/wizard/authentication_wizard_views.xml → auto_database_backup/wizard/dropbox_auth_code_views.xml

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="view_authcode_wizard_views_form" model="ir.ui.view">
<field name="name">authentication.wizard.form</field>
<field name="model">authentication.wizard</field>
<!-- Form view of authentication.wizard-->
<record id="dropbox_auth_code_view_form" model="ir.ui.view">
<field name="name">dropbox.auth.code.view.form</field>
<field name="model">dropbox.auth.code</field>
<field name="arch" type="xml">
<form>
<group invisible="not context.get('dropbox_auth')">
Loading…
Cancel
Save