Browse Source

[RM] useless field

pull/620/head
archetipo 9 years ago
committed by Dave Lasley
parent
commit
38911a2661
  1. 38
      auto_backup/model/backup_scheduler.py
  2. 8
      auto_backup/view/bkp_conf_view.xml

38
auto_backup/model/backup_scheduler.py

@ -48,48 +48,16 @@ def execute(connector, method, *args):
class DbBackup(models.Model):
_name = 'db.backup'
def get_connection_uri(self, host, port, secure=False):
uri = 'http://%s:%s' % (host, port)
if secure:
uri = 'https://%s:%s' % (host, port)
return uri
def get_connection(self, host, port, secure=False):
uri = self.get_connection_uri(host, port, secure)
return xmlrpclib.ServerProxy(uri + '/xmlrpc/db')
def get_db_list(self, host, port, secure=False):
conn = self.get_connection(host, port, secure)
db_list = execute(conn, 'list')
return db_list
@api.model
def _get_db_name(self):
return self.env.cr.dbname
# Columns local server
host = fields.Char(
string='Host', default='localhost', size=100, required=True)
securehost = fields.Boolean(string='Secure Host')
port = fields.Char(
string='Port', default='8069', size=10, required=True)
name = fields.Char(
string='Database', size=100, required=True,
default=_get_db_name,
help='Database you want to schedule backups for'
)
adminpassword = fields.Char(
string='Admin user Password',
help=(
"The password Admin password of Odoo Instance."
),
required=True
)
bkp_dir = fields.Char(
string='Backup Directory', size=100,
default='/odoo/backups',
@ -271,6 +239,9 @@ class DbBackup(models.Model):
# user made a typo in his path with multiple slashes
# (/odoo//backups/) it will be fixed by this regex.
pathToWriteTo = re.sub('/+', '/', pathToWriteTo)
_logger.debug(
'Start to copy files..'
)
try:
srv.chdir(pathToWriteTo)
except IOError:
@ -293,9 +264,6 @@ class DbBackup(models.Model):
pass
srv.chdir(pathToWriteTo)
# Loop over all files in the directory.
_logger.debug(
'Start to copy files...'
)
for f in os.listdir(dir):
fullpath = os.path.join(dir, f)
if os.path.isfile(fullpath):

8
auto_backup/view/bkp_conf_view.xml

@ -12,11 +12,7 @@
<separator col="2" string="Local backup configuration"/>
</group>
<group>
<field name="host" colspan="2"/>
<field name="securehost" colspan="2"/>
<field name="name"/>
<field name="port"/>
<field name="adminpassword" password="True"/>
<field name="bkp_dir"/>
<field name="autoremove"/>
<field name="daystokeep" attrs="{'invisible': [('autoremove','=',False)]}"/>
@ -69,8 +65,6 @@
<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"/>
@ -85,8 +79,6 @@
<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"/>

Loading…
Cancel
Save