Files
app-odoo/app_auto_backup/views/backup_view.xml
2024-11-06 15:53:11 +08:00

113 lines
6.4 KiB
XML

<odoo>
<data>
<record id="view_backup_config_form" model="ir.ui.view">
<field name="name">db.backup.form</field>
<field name="model">db.backup</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Back-up view">
<sheet>
<div class="oe_button_box" name="button_box">
<button name="action_view_cron" string="View Cron" type="object" class="oe_stat_button" icon="fa-clock-o"/>
<button name="action_run_cron" string="Run Backup" type="object" class="oe_stat_button" icon="fa-play-circle"/>
</div>
<group col="4" colspan="4">
<separator col="2" string="Local backup configuration"/>
</group>
<group name="configuration">
<field name="host" colspan="2"/>
<field name="name"/>
<field name="port"/>
<field name="backup_type"/>
<field name="folder"/>
<field name="autoremove"/>
<field name="days_to_keep" invisible="not autoremove"/>
</group>
<group name="allow_stfp" col="4" colspan="4">
<separator col="2" string="SFTP"/>
</group>
<div style="width:50%;border-radius:10px;margin: 10px 0px;padding:15px 10px 15px 10px;
background-repeat: no-repeat;background-position: 10px center;color: #9F6000;background-color: #FEEFB3;" invisible="not sftp_write">
<b>Warning:</b>
Use SFTP with caution! This writes files to external servers under the path you specify.
</div>
<group name="sftp_configuration">
<field name="sftp_write"/>
<field name="sftp_host" invisible="not sftp_write" required="sftp_write"/>
<field name="sftp_port" invisible="not sftp_write" required="sftp_write"/>
<field name="sftp_user" invisible="not sftp_write" required="sftp_write"/>
<field name="sftp_password" invisible="not sftp_write" required="sftp_write" password="True"/>
<field name="sftp_path" invisible="not sftp_write" required="sftp_write" placeholder="For example: /odoo/backups/"/>
<field name="days_to_keep_sftp" invisible="not sftp_write" required="sftp_write"/>
<field name="send_mail_sftp_fail" invisible="not sftp_write"/>
<field name="email_to_notify" invisible="not send_mail_sftp_fail or not sftp_write" required="send_mail_sftp_fail"/>
<button name="test_sftp_connection" type="object" invisible="not sftp_write" string="Test SFTP Connection"/>
</group>
<separator string="Help" colspan="2"/>
<div name="configuration_details">
This configures the scheduler for automatic backup of the given database running on given host
at given port on regular intervals.
<br/>
Automatic backups of the database can be scheduled as follows:
<ol>
<li>
Go to Settings / Technical / Automation / Scheduled Actions.
</li>
<li>
Search the action named 'Backup scheduler'.
</li>
<li>
Set the scheduler to active and fill in how often you want backups generated.
</li>
</ol>
<p style="font-size:18px;">
Need more help?
<a href="https://www.odooai.cn">Contact odooai.cn!</a>
</p>
</div>
<notebook>
<page name="backup_details" string="Backup records">
<field name="backup_details_ids" readonly="1">
<list>
<field name="name" optional="hide"/>
<field name="file_path"/>
<field name="url" optional="hide"/>
<button name="action_download_file" type="object" title="Download File" class="fa fa-download"/>
<button name="action_remove_file" type="object" title="Remove File" class="fa fa-trash"/>
</list>
</field>
</page>
</notebook>
</sheet>
</form>
</field>
</record>
<record id="view_backup_config_tree" model="ir.ui.view">
<field name="name">db.backup.tree</field>
<field name="model">db.backup</field>
<field name="type">list</field>
<field name="arch" type="xml">
<list string="Backups">
<field name='host'/>
<field name='port'/>
<field name='name'/>
<field name='folder'/>
<field name="autoremove"/>
<field name="sftp_host"/>
</list>
</field>
</record>
<record id="action_backup" model="ir.actions.act_window">
<field name="name">Configure backups</field>
<field name="res_model">db.backup</field>
<field name="view_mode">list,form</field>
<field name="view_id" ref="view_backup_config_tree"/>
</record>
<menuitem id="auto_backup_menu" name="Back-ups" sequence="9" parent="app_odoo_customize.menu_app_group"/>
<menuitem parent="auto_backup_menu" action="action_backup" id="backup_conf_menu" sequence="1"/>
</data>
</odoo>