[ADD] dependant modules

This commit is contained in:
Muhammad
2024-04-07 12:46:04 +05:00
parent fa3d921e2d
commit e8bc408a7a
42 changed files with 1952 additions and 0 deletions

View File

@@ -0,0 +1 @@
from . import backup_restore

View 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")

View 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>