Browse Source

[FIX] rebased commit

pull/614/head
archetipo 9 years ago
committed by Dave Lasley
parent
commit
3cc3ef26b4
  1. 18
      auto_backup/backup_data.xml
  2. 112
      auto_backup/bkp_conf_view.xml
  3. 8
      auto_backup/model/backup_scheduler.py

18
auto_backup/backup_data.xml

@ -1,18 +0,0 @@
<?xml version="1.0" ?>
<openerp>
<data noupdate="1">
<record id="ir_cron_backupscheduler0" model="ir.cron">
<field eval="&quot;&quot;&quot;schedule_backup&quot;&quot;&quot;" name="function"/>
<field eval="&quot;&quot;&quot;work_days&quot;&quot;&quot;" name="interval_type"/>
<field name="user_id" ref="base.user_root"/>
<field eval="&quot;&quot;&quot;Backup scheduler&quot;&quot;&quot;" name="name"/>
<field eval="-1" name="numbercall"/>
<field eval="&quot;&quot;&quot;2010-01-07 11:35:28&quot;&quot;&quot;" name="nextcall"/>
<field eval="5" name="priority"/>
<field eval="0" name="doall"/>
<field eval="False" name="active"/>
<field eval="1" name="interval_number"/>
<field eval="&quot;&quot;&quot;db.backup&quot;&quot;&quot;" name="model"/>
</record>
</data>
</openerp>

112
auto_backup/bkp_conf_view.xml

@ -1,112 +0,0 @@
<?xml version="1.0"?>
<openerp>
<data>
<record model="ir.ui.view" id="view_backup_conf_form">
<field name="name">Configure Backup</field>
<field name="model">db.backup</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Test">
<group col="4" colspan="4">
<separator col="2" string="Local backup configuration"/>
</group>
<group>
<field name="host" colspan="2"/>
<field name="name" />
<field name="port" />
<field name="bkp_dir" />
<field name="autoremove" />
<field name="daystokeep" attrs="{'invisible': [('autoremove','=',False)]}"/>
</group>
<group 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;" attrs="{'invisible': [('sftpwrite','=',False)]}"><b>Warning:</b> Use SFTP with caution! This writes files to external servers under the path you specify.</div>
<group>
<field name="sftpwrite"/>
<field name="sftpip"
attrs="{'invisible':[('sftpwrite', '==', False)],'required':[('sftpwrite', '==', True)]}"/>
<field name="sftpport"
attrs="{'invisible':[('sftpwrite', '==', False)],'required':[('sftpwrite', '==', True)]}"/>
<field name="sftpusername"
attrs="{'invisible':[('sftpwrite', '==', False)],'required':[('sftpwrite', '==', True)]}"/>
<field name="sftppassword"
attrs="{'invisible':[('sftpwrite', '==', False)],'required':[('sftpwrite', '==', True)]}" password="True" />
<field name="sftppath"
attrs="{'invisible':[('sftpwrite', '==', False)],'required':[('sftpwrite', '==', True)]}" placeholder="For example: /odoo/backups/"/>
<field name="daystokeepsftp"
attrs="{'invisible':[('sftpwrite', '==', False)],'required':[('sftpwrite', '==', True)]}"/>
<field name="sendmailsftpfail" attrs="{'invisible': [('sftpwrite','=',False)]}"/>
<field name="emailtonotify" attrs="{'invisible':['|',('sendmailsftpfail', '==', False),
('sftpwrite', '==', False)],'required':[('sendmailsftpfail', '==', True)]}"/>
<button name="test_sftp_connection" type="object"
attrs="{'invisible': [('sftpwrite','=',False)]}" string="Test SFTP Connection" icon="gtk-network"/>
</group>
<separator string="Help" colspan="2" />
<div>
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="mailto:erp@vanroey.be">Contact us!</a>
</p>
</div>
</form>
</field>
</record>
<record model="ir.ui.view" id="view_backup_conf_tree">
<field name="name">Configure Backup</field>
<field name="model">db.backup</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Backups">
<field name='host'/>
<field name='port'/>
<field name='name'/>
<field name='bkp_dir'/>
<field name="autoremove" />
<field name="sftpip"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="view_backup_conf_search">
<field name="name">Configure Backup</field>
<field name="model">db.backup</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Search options">
<field name='host'/>
<field name='port'/>
<field name='name'/>
<field name='bkp_dir'/>
<field name="autoremove" />
<field name="sftpip"/>
</search>
</field>
</record>
<record model="ir.actions.act_window" id="action_backup_conf_form">
<field name="name">Configure Backup</field>
<field name="res_model">db.backup</field>
<field name="view_type">form</field>
<field name='view_mode'>tree,form</field>
<field name='view_id' ref='view_backup_conf_tree'/>
</record>
<menuitem parent="base.menu_config" action="action_backup_conf_form" id="backup_conf_menu"/>
</data>
</openerp>

8
auto_backup/model/backup_scheduler.py

@ -244,9 +244,6 @@ class db_backup(osv.Model):
tools.config['admin_passwd'], tools.config['admin_passwd'],
rec.name) rec.name)
except: except:
<<<<<<< HEAD
logger.notifyChannel('backup', netsvc.LOG_INFO, "Could'nt backup database %s. Bad database administrator password for server running at http://%s:%s" %(rec.name, rec.host, rec.port))
=======
_logger.notifyChannel( _logger.notifyChannel(
'backup', netsvc.LOG_INFO, 'backup', netsvc.LOG_INFO,
_( _(
@ -254,7 +251,6 @@ class db_backup(osv.Model):
"Bad database administrator" "Bad database administrator"
"password for server running at http://%s:%s" "password for server running at http://%s:%s"
) % (rec.name, rec.host, rec.port)) ) % (rec.name, rec.host, rec.port))
>>>>>>> f331fab... [FIX] bug logger --> _logger call
continue continue
bkp = base64.decodestring(bkp) bkp = base64.decodestring(bkp)
fp = open(file_path, 'wb') fp = open(file_path, 'wb')
@ -400,8 +396,4 @@ class db_backup(osv.Model):
db_backup() db_backup()
<<<<<<< HEAD
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=======
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
>>>>>>> f331fab... [FIX] bug logger --> _logger call
Loading…
Cancel
Save