first commit
This commit is contained in:
1
ct_client_backup/wizards/__init__.py
Executable file
1
ct_client_backup/wizards/__init__.py
Executable file
@@ -0,0 +1 @@
|
||||
from . import backup_restore
|
||||
23
ct_client_backup/wizards/backup_restore.py
Executable file
23
ct_client_backup/wizards/backup_restore.py
Executable file
@@ -0,0 +1,23 @@
|
||||
from odoo import fields, models
|
||||
import logging
|
||||
from odoo.exceptions import UserError, MissingError
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class BackupRestore(models.TransientModel):
|
||||
_name = 'saas.client.backup.restore.wizard'
|
||||
name = fields.Char('Name')
|
||||
backup_id = fields.Many2one('kk_odoo_saas.app.backup', 'Backup Name')
|
||||
restore_to = fields.Many2one('kk_odoo_saas.app', 'Restore Backup To')
|
||||
|
||||
def action_call_restore_function(self):
|
||||
"""
|
||||
It will call the Backup Function Async, Thanks to queue_job module
|
||||
:return:
|
||||
"""
|
||||
if self.backup_id and self.backup_id.app and self.restore_to:
|
||||
self.backup_id.action_restore_backup_to_instance(self.restore_to)
|
||||
else:
|
||||
_logger.error("Cant restore Backup, Backup Id, or Restore App Missing")
|
||||
raise UserError("Cant restore Backup, Backup Id, or Restore App Missing")
|
||||
45
ct_client_backup/wizards/backup_restore.xml
Executable file
45
ct_client_backup/wizards/backup_restore.xml
Executable file
@@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<data>
|
||||
<record id="saas_client_backup_restore_view_form" model="ir.ui.view">
|
||||
<field name="name">saas_client_backup_restore_view_form</field>
|
||||
<field name="model">saas.client.backup.restore.wizard</field>
|
||||
<field name="arch" type="xml">
|
||||
<form>
|
||||
<sheet>
|
||||
<group>
|
||||
<group>
|
||||
<field name="name"/>
|
||||
<field name="backup_id" required="1"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="restore_to" string="Restore to SaaS Instance" required="1"/>
|
||||
</group>
|
||||
</group>
|
||||
</sheet>
|
||||
<footer>
|
||||
<button
|
||||
name="action_call_restore_function"
|
||||
string="Start Restoring Process"
|
||||
type="object"
|
||||
class="oe_highlight"
|
||||
/>
|
||||
<button string="Cancel" class="oe_link" special="cancel"/>
|
||||
</footer>
|
||||
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_saas_client_backup_restore_wizard" model="ir.actions.act_window">
|
||||
<field name="name">Restore the Backup to SaaS App</field>
|
||||
<field name="res_model">saas.client.backup.restore.wizard</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="saas_client_backup_restore_view_form"/>
|
||||
<field name="target">new</field>
|
||||
<field name="binding_model_id" ref="ct_client_backup.model_kk_odoo_saas_app_backup"/>
|
||||
</record>
|
||||
|
||||
|
||||
</data>
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user