Browse Source

Mar 15 [UPDT] : Updated 'auto_database_backup'

pull/164/merge
AjmalCybro 1 year ago
parent
commit
bbf49d834e
  1. 2
      auto_database_backup/README.rst
  2. 3
      auto_database_backup/__init__.py
  3. 17
      auto_database_backup/__manifest__.py
  4. 22
      auto_database_backup/controllers/__init__.py
  5. 53
      auto_database_backup/controllers/auto_database_backup.py
  6. 45
      auto_database_backup/data/data.xml
  7. 17
      auto_database_backup/doc/RELEASE_NOTES.md
  8. 9
      auto_database_backup/models/__init__.py
  9. 968
      auto_database_backup/models/db_backup_configure.py
  10. 3
      auto_database_backup/security/ir.model.access.csv
  11. BIN
      auto_database_backup/static/description/assets/screenshots/add.png
  12. BIN
      auto_database_backup/static/description/assets/screenshots/amazon_s3_7.png
  13. BIN
      auto_database_backup/static/description/assets/screenshots/amazon_s3_8.png
  14. BIN
      auto_database_backup/static/description/assets/screenshots/amazon_s3_pci1.png
  15. BIN
      auto_database_backup/static/description/assets/screenshots/amazon_s3_pic 2.png
  16. BIN
      auto_database_backup/static/description/assets/screenshots/amazons3-1.png
  17. BIN
      auto_database_backup/static/description/assets/screenshots/amazons3_4.png
  18. BIN
      auto_database_backup/static/description/assets/screenshots/amazons3_5.png
  19. BIN
      auto_database_backup/static/description/assets/screenshots/amazons3_6.png
  20. BIN
      auto_database_backup/static/description/assets/screenshots/amazons3_7.png
  21. BIN
      auto_database_backup/static/description/assets/screenshots/amazons3_access.png
  22. BIN
      auto_database_backup/static/description/assets/screenshots/amazons3_pick 3.png
  23. BIN
      auto_database_backup/static/description/assets/screenshots/amazons3_signup.png
  24. BIN
      auto_database_backup/static/description/assets/screenshots/backup7.png
  25. BIN
      auto_database_backup/static/description/assets/screenshots/backup8.png
  26. BIN
      auto_database_backup/static/description/assets/screenshots/backup9.png
  27. BIN
      auto_database_backup/static/description/assets/screenshots/drive1.png
  28. BIN
      auto_database_backup/static/description/assets/screenshots/drive2.png
  29. BIN
      auto_database_backup/static/description/assets/screenshots/drive3.png
  30. BIN
      auto_database_backup/static/description/assets/screenshots/drive4.png
  31. BIN
      auto_database_backup/static/description/assets/screenshots/drive5.png
  32. BIN
      auto_database_backup/static/description/assets/screenshots/drop1.png
  33. BIN
      auto_database_backup/static/description/assets/screenshots/drop2.png
  34. BIN
      auto_database_backup/static/description/assets/screenshots/drop3.png
  35. BIN
      auto_database_backup/static/description/assets/screenshots/drop4.png
  36. BIN
      auto_database_backup/static/description/assets/screenshots/dropbox-1.png
  37. BIN
      auto_database_backup/static/description/assets/screenshots/dropbox-2.png
  38. BIN
      auto_database_backup/static/description/assets/screenshots/hero.gif
  39. BIN
      auto_database_backup/static/description/assets/screenshots/hero.png
  40. BIN
      auto_database_backup/static/description/assets/screenshots/newcloud1.png
  41. BIN
      auto_database_backup/static/description/assets/screenshots/newcloud2.png
  42. BIN
      auto_database_backup/static/description/assets/screenshots/newcloud2_ds.png
  43. BIN
      auto_database_backup/static/description/assets/screenshots/next_cloud-1.png
  44. BIN
      auto_database_backup/static/description/assets/screenshots/next_cloud2.png
  45. BIN
      auto_database_backup/static/description/assets/screenshots/next_cloud_9.png
  46. BIN
      auto_database_backup/static/description/assets/screenshots/nextcloud_4.png
  47. BIN
      auto_database_backup/static/description/assets/screenshots/nextcloud_5.png
  48. BIN
      auto_database_backup/static/description/assets/screenshots/nextcloud_6.png
  49. BIN
      auto_database_backup/static/description/assets/screenshots/nextcloud_create_3.png
  50. BIN
      auto_database_backup/static/description/assets/screenshots/onedrive-1.png
  51. BIN
      auto_database_backup/static/description/assets/screenshots/onedrive1.png
  52. BIN
      auto_database_backup/static/description/assets/screenshots/onedrive2.png
  53. BIN
      auto_database_backup/static/description/assets/screenshots/onedrive3.png
  54. BIN
      auto_database_backup/static/description/assets/screenshots/onedrive4.png
  55. BIN
      auto_database_backup/static/description/assets/screenshots/onedrive5.png
  56. BIN
      auto_database_backup/static/description/assets/screenshots/onedrive6.png
  57. BIN
      auto_database_backup/static/description/assets/screenshots/onedrive7.png
  58. BIN
      auto_database_backup/static/description/assets/screenshots/onedrive8.png
  59. BIN
      auto_database_backup/static/description/assets/screenshots/onedrive9.png
  60. 1710
      auto_database_backup/static/description/index.html
  61. 182
      auto_database_backup/views/db_backup_configure_views.xml
  62. 22
      auto_database_backup/wizard/__init__.py
  63. 59
      auto_database_backup/wizard/dropbox_auth_code.py
  64. 35
      auto_database_backup/wizard/dropbox_auth_code_views.xml
  65. BIN
      customize_settings.zip

2
auto_database_backup/README.rst

@ -19,7 +19,7 @@ Company
Credits Credits
------- -------
* Developer: * Developer:
(v14) Midilaj @ Cybrosys (v14) Midilaj @ Cybrosys, Farhana Jahan PT @ Cybrosys,
Contacts Contacts

3
auto_database_backup/__init__.py

@ -19,5 +19,6 @@
# If not, see <http://www.gnu.org/licenses/>. # If not, see <http://www.gnu.org/licenses/>.
# #
############################################################################# #############################################################################
from . import controllers
from . import models from . import models
from . import wizard

17
auto_database_backup/__manifest__.py

@ -19,13 +19,14 @@
# If not, see <http://www.gnu.org/licenses/>. # If not, see <http://www.gnu.org/licenses/>.
# #
############################################################################# #############################################################################
{ {
'name': "Automatic Database Backup", 'name': "Automatic Database Backup",
'version': '14.0.1.0.0', 'version': '14.0.1.0.1',
'summary': """Generate automatic backup of databases and store to local, google drive or remote server""", 'summary': 'Generate automatic backup of databases and store to local, '
'description': """This module has been developed for creating database backups automatically 'google drive or remote server',
and store it to the different locations.""", 'description': 'his module has been developed for creating '
'database backups automatically '
'and store it to the different locations.',
'author': "Cybrosys Techno Solutions", 'author': "Cybrosys Techno Solutions",
'website': "https://www.cybrosys.com", 'website': "https://www.cybrosys.com",
'company': 'Cybrosys Techno Solutions', 'company': 'Cybrosys Techno Solutions',
@ -35,8 +36,12 @@
'data': [ 'data': [
'security/ir.model.access.csv', 'security/ir.model.access.csv',
'data/data.xml', 'data/data.xml',
'views/db_backup_configure_views.xml' 'views/db_backup_configure_views.xml',
'wizard/dropbox_auth_code_views.xml'
], ],
'external_dependencies': {
'python': ['dropbox', 'pyncclient', 'boto3', 'nextcloud-api-wrapper',
'paramiko']},
'license': 'LGPL-3', 'license': 'LGPL-3',
'images': ['static/description/banner.gif'], 'images': ['static/description/banner.gif'],
'installable': True, 'installable': True,

22
auto_database_backup/controllers/__init__.py

@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
###############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# 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.
#
# 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details.
#
# 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 auto_database_backup

53
auto_database_backup/controllers/auto_database_backup.py

@ -0,0 +1,53 @@
# -*- coding: utf-8 -*-
###############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# 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.
#
# 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details.
#
# 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.get_onedrive_tokens(kw.get('code'))
backup_config.hide_active = True
backup_config.active = True
return http.local_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.get_gdrive_tokens(kw.get('code'))
backup_config.active = True
return http.local_redirect(state.get('url_return'))

45
auto_database_backup/data/data.xml

@ -1,7 +1,5 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<odoo> <odoo>
<data noupdate="1"> <data noupdate="1">
<!-- Schedule action for generating automatic database backup--> <!-- Schedule action for generating automatic database backup-->
<record id="ir_cron_auto_db_backup" model="ir.cron"> <record id="ir_cron_auto_db_backup" model="ir.cron">
@ -14,23 +12,28 @@
<field name="numbercall">-1</field> <field name="numbercall">-1</field>
<field name="active">True</field> <field name="active">True</field>
</record> </record>
</data> </data>
<data> <data>
<!-- Database backup operation Successful email template--> <!--Database backup operation Successful email template-->
<record id="mail_template_data_db_backup_successful" model="mail.template"> <record id="mail_template_data_db_backup_successful"
model="mail.template">
<field name="name">Database Backup: Notification Successful</field> <field name="name">Database Backup: Notification Successful</field>
<field name="model_id" ref="auto_database_backup.model_db_backup_configure"/> <field name="model_id"
<field name="subject">Database Backup Successful: ${object.db_name}</field> ref="auto_database_backup.model_db_backup_configure"/>
<field name="email_to">${object.user_id.email_formatted | safe}</field> <field name="subject">Database Backup Successful:
${object.db_name}
</field>
<field name="email_to">${object.user_id.email_formatted | safe}
</field>
<field name="body_html" type="xml"> <field name="body_html" type="xml">
<p style="margin: 0px;"> <p style="margin: 0px;">
<span>Dear ${object.user_id.sudo().name}, <span>Dear ${object.user_id.sudo().name},
</span> </span>
<br/> <br/>
<br/> <br/>
<span style="margin-top: 8px;">Backup of the database <i>${object.db_name}</i> has been successfully <span style="margin-top: 8px;">Backup of the database <i>
${object.db_name}
</i> has been successfully
generated and stored to generated and stored to
% if object.backup_destination in ('local'): % if object.backup_destination in ('local'):
<i>Local</i> <i>Local</i>
@ -56,7 +59,8 @@
% elif object.backup_destination in ('sftp'): % elif object.backup_destination in ('sftp'):
<i>SFTP Server</i> <i>SFTP Server</i>
% endif % endif
% if object.backup_destination in ('local', 'ftp', 'sftp') % if object.backup_destination in ('local', 'ftp',
'sftp')
<br/> <br/>
Backup Path: Backup Path:
% if object.backup_destination in ('local'): % if object.backup_destination in ('local'):
@ -75,20 +79,23 @@
</p> </p>
</field> </field>
</record> </record>
<!--Database backup operation failed email templated-->
<!-- Database backup operation failed email templated-->
<record id="mail_template_data_db_backup_failed" model="mail.template"> <record id="mail_template_data_db_backup_failed" model="mail.template">
<field name="name">Database Backup: Notification Failed</field> <field name="name">Database Backup: Notification Failed</field>
<field name="model_id" ref="auto_database_backup.model_db_backup_configure"/> <field name="model_id"
<field name="subject">Database Backup Failed: ${object.db_name}</field> ref="auto_database_backup.model_db_backup_configure"/>
<field name="email_to">${object.user_id.email_formatted | safe}</field> <field name="subject">Database Backup Failed: ${object.db_name}
</field>
<field name="email_to">${object.user_id.email_formatted | safe}
</field>
<field name="body_html" type="xml"> <field name="body_html" type="xml">
<p style="margin: 0px;"> <p style="margin: 0px;">
<span>Dear ${object.user_id.sudo().name}, <span>Dear ${object.user_id.sudo().name},
</span> </span>
<br/> <br/>
<br/> <br/>
<span style="margin-top: 8px;">Backup generation of the database <i>${object.db_name}</i> has been <span style="margin-top: 8px;">Backup generation of the
database <i>${object.db_name}</i> has been
Failed. Failed.
<br/> <br/>
<br/> <br/>
@ -104,7 +111,8 @@
% elif object.backup_destination in ('sftp'): % elif object.backup_destination in ('sftp'):
<i>SFTP Server</i> <i>SFTP Server</i>
% endif % endif
% if object.backup_destination in ('local', 'ftp', 'sftp') % if object.backup_destination in ('local', 'ftp',
'sftp')
<br/> <br/>
Backup Path: Backup Path:
% if object.backup_destination in ('local'): % if object.backup_destination in ('local'):
@ -127,5 +135,4 @@
</field> </field>
</record> </record>
</data> </data>
</odoo> </odoo>

17
auto_database_backup/doc/RELEASE_NOTES.md

@ -5,5 +5,22 @@
#### ADD #### ADD
- Initial commit for auto_database_backup - Initial commit for auto_database_backup
#### 16.02.2024
#### Version 14.0.1.0.1
#### ADD
- Dropbox integration added. Backup can be stored in to dropbox.
#### 16.02.2024
#### Version 14.0.1.0.1
#### ADD
- Onedrive integration added. Backup can be stored in to onedrive.
#### 16.02.2024
#### Version 14.0.1.0.1
#### ADD
- Google Drive authentication updated.
#### 16.02.2024
#### Version 14.0.1.0.1
#### ADD
- Nextcloud and Amazon S3 integration added. Backup can be stored into Nextcloud and Amazon S3.

9
auto_database_backup/models/__init__.py

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

968
auto_database_backup/models/db_backup_configure.py

File diff suppressed because it is too large

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

@ -1,2 +1,3 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink 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_db_backup_configure,access.db.backup.configure,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 model_db_backup_configure base.group_user 1 1 1 1
3 access_dropbox_auth_code_user access.dropbox.auth.code.user model_dropbox_auth_code base.group_user 1 1 1 1

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-1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 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/backup7.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 102 KiB

After

Width:  |  Height:  |  Size: 77 KiB

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 76 KiB

After

Width:  |  Height:  |  Size: 39 KiB

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 91 KiB

After

Width:  |  Height:  |  Size: 63 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 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/dropbox-1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

BIN
auto_database_backup/static/description/assets/screenshots/dropbox-2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 200 KiB

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 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_cloud-1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 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/onedrive-1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

1710
auto_database_backup/static/description/index.html

File diff suppressed because it is too large

182
auto_database_backup/views/db_backup_configure_views.xml

@ -1,9 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<odoo> <odoo>
<!--Database backup configuration views-->
<!-- Database backup configuration views-->
<record id="view_db_backup_configure_list" model="ir.ui.view"> <record id="view_db_backup_configure_list" model="ir.ui.view">
<field name="name">db.backup.configure.list</field> <field name="name">db.backup.configure.list</field>
<field name="model">db.backup.configure</field> <field name="model">db.backup.configure</field>
@ -16,13 +13,14 @@
</tree> </tree>
</field> </field>
</record> </record>
<record id="view_db_backup_configure_form" model="ir.ui.view"> <record id="view_db_backup_configure_form" model="ir.ui.view">
<field name="name">db.backup.configure.form</field> <field name="name">db.backup.configure.form</field>
<field name="model">db.backup.configure</field> <field name="model">db.backup.configure</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<form> <form>
<sheet> <sheet>
<field name="gdrive_backup_error_test" invisible="1"/>
<field name="onedrive_backup_error_test" invisible="1"/>
<div class="oe_title"> <div class="oe_title">
<h1> <h1>
<field name="name" placeholder="Name..."/> <field name="name" placeholder="Name..."/>
@ -37,10 +35,6 @@
</group> </group>
<group> <group>
<field name="backup_destination" required="1"/> <field name="backup_destination" required="1"/>
<div class="text-muted"
attrs="{'invisible': [('backup_destination', '!=', 'google_drive')]}">Enable and
configure Google Drive option from General Settings
</div>
<field name="backup_path" <field name="backup_path"
attrs="{'invisible': [('backup_destination', '!=', 'local')], 'required': [('backup_destination', '=', 'local')]}"/> attrs="{'invisible': [('backup_destination', '!=', 'local')], 'required': [('backup_destination', '=', 'local')]}"/>
<field name="ftp_host" <field name="ftp_host"
@ -65,8 +59,69 @@
password="True"/> password="True"/>
<field name="sftp_path" <field name="sftp_path"
attrs="{'invisible': [('backup_destination', '!=', 'sftp')], 'required': [('backup_destination', '=', 'sftp')]}"/> attrs="{'invisible': [('backup_destination', '!=', 'sftp')], 'required': [('backup_destination', '=', 'sftp')]}"/>
<field name="google_drive_folderid" <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_folder"
attrs="{'invisible': [('backup_destination', '!=', 'google_drive')], 'required': [('backup_destination', '=', 'google_drive')]}"/> attrs="{'invisible': [('backup_destination', '!=', 'google_drive')], 'required': [('backup_destination', '=', 'google_drive')]}"/>
<field name="is_google_drive_token_generated"
invisible="1"/>
<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="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="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')]}"/>
<field name="auto_remove"/> <field name="auto_remove"/>
<label for="days_to_remove" class="oe_inline" <label for="days_to_remove" class="oe_inline"
attrs="{'invisible': [('auto_remove', '=', False)]}"/> attrs="{'invisible': [('auto_remove', '=', False)]}"/>
@ -75,8 +130,110 @@
attrs="{'required': [('auto_remove', '=', True)]}"/> attrs="{'required': [('auto_remove', '=', True)]}"/>
Days Days
</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"/>
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"/>
No refresh token set
</div>
</div>
<div attrs="{'invisible': [('backup_destination', '!=', 'google_drive')]}">
<div attrs="{'invisible': ['|', ('backup_destination', '!=', 'google_drive'), ('is_google_drive_token_generated', '=', True)]}">
<button class="btn btn-link"
name="action_get_gdrive_auth_code"
type="object">
<i class="fa fa-arrow-right"/>
Setup Token
</button>
</div>
<div attrs="{'invisible': ['|', ('backup_destination', '!=', 'google_drive'), ('is_google_drive_token_generated', '=', False)]}">
<button class="btn btn-link"
name="action_get_gdrive_auth_code"
type="object">
<i class="fa fa-arrow-right"/>
Reset Token
</button>
</div>
</div>
<div class="alert alert-danger" role="alert" style="margin-bottom:0px;width: 229%;" attrs="{'invisible': [('gdrive_backup_error_test', '=', False)]}">
Something went wrong during your token generation. Maybe your Authorization Code is invalid
</div>
<div attrs="{'invisible': [('backup_destination', '!=', 'dropbox')]}">
<div attrs="{'invisible': ['|', ('backup_destination', '!=', 'dropbox'), ('is_dropbox_token_generated', '=', False)]}">
<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"/>
No refresh token set
</div>
</div>
<div attrs="{'invisible': [('backup_destination', '!=', 'dropbox')]}">
<div attrs="{'invisible': ['|', ('backup_destination', '!=', 'dropbox'), ('is_dropbox_token_generated', '=', True)]}">
<button class="btn btn-link"
name="action_get_dropbox_auth_code"
type="object">
<i class="fa fa-arrow-right"/>
Setup Token
</button>
</div>
<div attrs="{'invisible': ['|', ('backup_destination', '!=', 'dropbox'), ('is_dropbox_token_generated', '=', False)]}">
<button class="btn btn-link"
name="action_get_dropbox_auth_code"
type="object">
<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"/>
Refresh token set
</div>
<div attrs="{'invisible': ['|', ('backup_destination', '!=', 'onedrive'), ('is_onedrive_token_generated', '=', True)]}">
<i class="fa fa-exclamation-triangle text-warning"/>
No refresh token set
</div>
</div>
<div attrs="{'invisible': [('backup_destination', '!=', 'onedrive')]}">
<div attrs="{'invisible': ['|', ('backup_destination', '!=', 'onedrive'), ('is_onedrive_token_generated', '=', True)]}">
<button class="btn btn-link"
name="action_get_onedrive_auth_code"
type="object">
<i class="fa fa-arrow-right"/>
Setup Token
</button>
</div>
<div attrs="{'invisible': ['|', ('backup_destination', '!=', 'onedrive'), ('is_onedrive_token_generated', '=', False)]}">
<button class="btn btn-link"
name="action_get_onedrive_auth_code"
type="object">
<i class="fa fa-arrow-right"/>
Reset Token
</button>
</div>
</div>
<div class="alert alert-danger" role="alert" style="margin-bottom:0px;width: 91%%;" attrs="{'invisible': [('onedrive_backup_error_test', '=', False)]}">
Bad microsoft onedrive request. Maybe your Authorization Code is invalid
</div>
<field name="dropbox_refresh_token" invisible="1"/>
<field name="is_dropbox_token_generated" invisible="1"/>
<field name="dropbox_folder"
attrs="{'invisible': [('backup_destination', '!=', 'dropbox')], 'required': [('backup_destination', '=', 'dropbox')]}"/>
<button name="test_connection" type="object" string="Test Connection" icon="fa-television" <button name="test_connection" type="object" string="Test Connection" icon="fa-television"
attrs="{'invisible': [('backup_destination', 'not in', ('ftp', 'sftp'))]}"/> 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>
<group> <group>
<field name="notify_user"/> <field name="notify_user"/>
@ -87,7 +244,6 @@
</form> </form>
</field> </field>
</record> </record>
<record id="view_db_backup_configure_search" model="ir.ui.view"> <record id="view_db_backup_configure_search" model="ir.ui.view">
<field name="name">db.backup.configure.search</field> <field name="name">db.backup.configure.search</field>
<field name="model">db.backup.configure</field> <field name="model">db.backup.configure</field>
@ -105,7 +261,6 @@
</search> </search>
</field> </field>
</record> </record>
<record id="action_db_backup_configure" model="ir.actions.act_window"> <record id="action_db_backup_configure" model="ir.actions.act_window">
<field name="name">Database Backup</field> <field name="name">Database Backup</field>
<field name="res_model">db.backup.configure</field> <field name="res_model">db.backup.configure</field>
@ -117,8 +272,7 @@
</field> </field>
<field name="context">{'search_default_all': 1}</field> <field name="context">{'search_default_all': 1}</field>
</record> </record>
<menuitem id="menu_db_backup" name="Automatic Database Backup" parent="base.menu_custom" sequence="10"/> <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" <menuitem id="menu_db_backup_configuration" parent="menu_db_backup" name="Backup Configuration"
action="action_db_backup_configure"/> action="action_db_backup_configure"/>
</odoo> </odoo>

22
auto_database_backup/wizard/__init__.py

@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
###############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# 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.
#
# 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details.
#
# 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 dropbox_auth_code

59
auto_database_backup/wizard/dropbox_auth_code.py

@ -0,0 +1,59 @@
# -*- coding: utf-8 -*-
###############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# 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.
#
# 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details.
#
# 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 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):
"""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',
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):
"""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):
"""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)

35
auto_database_backup/wizard/dropbox_auth_code_views.xml

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<!--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')">
<span>Get an authorization code and set it in the field
below.
</span>
<field name="dropbox_auth_url"
class="fa fa-arrow-right"
widget="url"
text="Get Authorization Code"
nolabel="1"/>
</group>
<group>
<field name="dropbox_authorization_code"
required="context.get('dropbox_auth')"
invisible="not context.get('dropbox_auth')"/>
</group>
<footer>
<button string="Confirm" type="object"
name="action_setup_dropbox_token"
class="btn-primary"
invisible="not context.get('dropbox_auth')"/>
<button string="Cancel" class="btn-secondary"
special="cancel"/>
</footer>
</form>
</field>
</record>
</odoo>

BIN
customize_settings.zip

Binary file not shown.
Loading…
Cancel
Save