yenthe666 / auto_backup Goto Github PK
View Code? Open in Web Editor NEWAutomated database backups from Odoo, both locally and on an FTP server
License: MIT License
Automated database backups from Odoo, both locally and on an FTP server
License: MIT License
So I have been using for the last month or so with mixed results. I am on V9 enterprise. The backups will work fine for about a week and then they just stop working. I have setup a cron job to stop the odoo service right before backup and that seems to help, but I am still missing backups. Here is the error I see in the odoo log:
016-06-28 05:01:08,806 23340 ERROR openerp.addons.base.ir.ir_cron: Call of self.pool.get('db.backup').schedule_backup(cr, uid, _()) failed in Job 14
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/openerp/addons/base/ir/ir_cron.py", line 129, in _callback
getattr(model, method_name)(cr, uid, *args)
File "/usr/lib/python2.7/site-packages/openerp/api.py", line 250, in wrapper
return old_api(self, *args, *_kwargs)
File "/opt/odoo/custom-addons/auto_backup/backup_scheduler.py", line 147, in schedule_backup
db_list = self.get_db_list(cr, user, [], rec.host, rec.port)
File "/usr/lib/python2.7/site-packages/openerp/api.py", line 250, in wrapper
return old_api(self, _args, *_kwargs)
File "/opt/odoo/custom-addons/auto_backup/backup_scheduler.py", line 59, in get_db_list
db_list = execute(conn, 'list')
File "/opt/odoo/custom-addons/auto_backup/backup_scheduler.py", line 46, in execute
raise e
error: [Errno 111] Connection refused
My backup is coming in around 500mb. Any idea whats going on?
When I do "sudo pip install pysftp" on my Ubuntu server is says that pysftp is already installed?
ubuntu@ip-172-30-0-253:~$ sudo pip install pysftp
Requirement already satisfied (use --upgrade to upgrade): pysftp in /usr/local/lib/python2.7/dist-packages
Requirement already satisfied (use --upgrade to upgrade): paramiko>=1.7.7 in /usr/local/lib/python2.7/dist-packages (from pysftp)
I get the following error after I click Update Module List in Odoo:
Odoo Server Error
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 530, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 567, in dispatch
result = self._call_function(*_self.params)
File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 303, in _call_function
return checked_call(self.db, *args, *_kwargs)
File "/usr/lib/python2.7/dist-packages/openerp/service/model.py", line 113, in wrapper
return f(dbname, _args, *_kwargs)
File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 300, in checked_call
return self.endpoint(_a, *_kw)
File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 796, in call
return self.method(_args, *_kw)
File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 396, in response_wrap
response = f(_args, *_kw)
File "/usr/lib/python2.7/dist-packages/openerp/addons/web/controllers/main.py", line 940, in call_button
action = self._call_kw(model, method, args, {})
File "/usr/lib/python2.7/dist-packages/openerp/addons/web/controllers/main.py", line 928, in _call_kw
return getattr(request.registry.get(model), method)(request.cr, request.uid, _args, *_kwargs)
File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 241, in wrapper
return old_api(self, _args, *_kwargs)
File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 393, in old_api
result = new_api(recs, _args, *_kwargs)
File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 397, in new_api
result = [method(rec, _args, *_kwargs) for rec in self]
File "/usr/lib/python2.7/dist-packages/openerp/addons/base/module/wizard/base_module_update.py", line 15, in update_module
self.updated, self.added = self.env['ir.module.module'].update_list()
File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 239, in wrapper
return new_api(self, _args, *_kwargs)
File "/usr/lib/python2.7/dist-packages/openerp/api.py", line 462, in new_api
result = method(self._model, cr, uid, _args, *_kwargs)
File "/usr/lib/python2.7/dist-packages/openerp/addons/base/module/module.py", line 654, in update_list
handler.load_addons()
File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 1298, in load_addons
m = import('openerp.addons.' + module)
File "/usr/lib/python2.7/dist-packages/openerp/modules/module.py", line 80, in load_module
mod = imp.load_module('openerp.addons.' + module_part, f, path, descr)
File "/usr/lib/python2.7/dist-packages/openerp/addons/auto_backup/init.py", line 23, in
import backup_scheduler
File "/usr/lib/python2.7/dist-packages/openerp/addons/auto_backup/backup_scheduler.py", line 33, in
raise ImportError('This module needs pysftp to automaticly write backups to the FTP through SFTP. Please install pysftp on your system. (sudo pip install pysftp)')
ImportError: This module needs pysftp to automaticly write backups to the FTP through SFTP. Please install pysftp on your system. (sudo pip install pysftp)
Any idea?
Hello Yenthe,
when I set up the backup via "Configure Backup", I have to set a time for the backup. Can you tell me which time zone is being used by the module?
My server is located in Hong Kong, but we are administrating it from Germany, so the admins time zone is Germany.
If the backup file is bigger than 250 Mb, the module fails . It is very dangerous. Everyting is ok until, you have some data. You are confident about your backups and no backup is done.
It happend to me in two cases. One with 400 Mb file and other with 250 mb file.
Thanks.
I'm trying to restore the backup.
I'm trying to upload it, tried as restore, tried as copy of existing database.
Doesn't work.
I can't find how to restore it.
I need to restore a database with a different name, but I have tried both with correct name and the different one.
I'm using Odoo 8 (installed 10 days ago)
Dear @Yenthe666
we would like to include your module auto_backup
in OCA repo
https://github.com/OCA/server-tools
What do you think?
The module is scheduled to run every 5 minutes. (For Testing)
There is nothing in log about it.
There is no backups in the backup folder.
i am getting this error.
Odoo Server Error
Traceback (most recent call last):
File "/opt/odoo1/openerp/http.py", line 530, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/opt/odoo1/openerp/http.py", line 567, in dispatch
result = self._call_function(*_self.params)
File "/opt/odoo1/openerp/http.py", line 303, in _call_function
return checked_call(self.db, *args, *_kwargs)
File "/opt/odoo1/openerp/service/model.py", line 113, in wrapper
return f(dbname, _args, *_kwargs)
File "/opt/odoo1/openerp/http.py", line 300, in checked_call
return self.endpoint(_a, *_kw)
File "/opt/odoo1/openerp/http.py", line 796, in call
return self.method(_args, *_kw)
File "/opt/odoo1/openerp/http.py", line 396, in response_wrap
response = f(_args, *_kw)
File "/opt/odoo1/addons/web/controllers/main.py", line 953, in call_button
action = self._call_kw(model, method, args, {})
File "/opt/odoo1/addons/web/controllers/main.py", line 941, in _call_kw
return getattr(request.registry.get(model), method)(request.cr, request.uid, _args, *_kwargs)
File "/opt/odoo1/openerp/api.py", line 241, in wrapper
return old_api(self, _args, *_kwargs)
File "/opt/odoo1/addons/auto_backup/backup_scheduler.py", line 113, in test_sftp_connection
db_list = self.get_db_list(cr, uid, [], rec.host, rec.port)
File "/opt/odoo1/openerp/api.py", line 241, in wrapper
return old_api(self, _args, *_kwargs)
File "/opt/odoo1/addons/auto_backup/backup_scheduler.py", line 57, in get_db_list
db_list = execute(conn, 'list')
File "/opt/odoo1/addons/auto_backup/backup_scheduler.py", line 46, in execute
raise e
error: [Errno 111] Connection refused
Hello Yenthe666,
first of all I'd like to thank you for your module. I chosed it over all the alternatives that I found so far. I've just spent two days trying to figure out what is causing an issue with it but so far I could find a solution.
What I am doing is:
To try if the admin_passwd is working I am performing a backup with the web utility (/web/database/manager) and it is working fine.
Odoo10 what time can be used, look forward to!
v10
The module creates no access rule for the db.backup model. This causes the menu not to show (at least in a "copy" of the admin user).
I had to create a rule for the Admin/Settings group.
I backed up the folder odoo and copied to a new machine running odoo and replaced the folder. I believe my issue is user odoo does not have rights
Hi Yenthe
"sudo pip install pysftp" does not work. It says it's succesfully installed, but it is not. I've found out that paramiko is also necessary and not automatically installed. I did
"sudo apt-get install python-paramiko", it installed successfully.
But the error message of the module did not disappear. So I opened a python session and tried to import pysftp, and this is what I get:
import pysftp
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python2.7/dist-packages/pysftp.py", line 10, in
import paramiko
File "/usr/local/lib/python2.7/dist-packages/paramiko/init.py", line 30, in
from paramiko.transport import SecurityOptions, Transport
File "/usr/local/lib/python2.7/dist-packages/paramiko/transport.py", line 33, in
from paramiko import util
ImportError: cannot import name util
Now I'm stuck because I have no idea where to get this "util" from. Any advise?
I get this error, how can I fix that?
Here is what we got instead:
No hostkey for host backup.myserver.ch found.
But I think my configuration is correct, because I have other servers that works fine with this module
Hi Yenthe666,
Thanks for nice module, I was install auto backup, when I configure it's always said:
ValidateError
Field(s) `` failed against a constraint: Error ! No such database exists!
and my log:
2015-10-24 04:54:33,413 21714 ERROR lamnguyen openerp.http: Exception during JSON request handling.
Traceback (most recent call last):
File "/opt/odoo/odoo/openerp/http.py", line 537, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/opt/odoo/odoo/openerp/http.py", line 574, in dispatch
result = self._call_function(*_self.params)
File "/opt/odoo/odoo/openerp/http.py", line 310, in _call_function
return checked_call(self.db, *args, *_kwargs)
File "/opt/odoo/odoo/openerp/service/model.py", line 118, in wrapper
return f(dbname, _args, *_kwargs)
File "/opt/odoo/odoo/openerp/http.py", line 307, in checked_call
return self.endpoint(_a, *_kw)
File "/opt/odoo/odoo/openerp/http.py", line 803, in call
return self.method(_args, *_kw)
File "/opt/odoo/odoo/openerp/http.py", line 403, in response_wrap
response = f(_args, *_kw)
File "/opt/odoo/odoo/addons/web/controllers/main.py", line 944, in call_kw
return self._call_kw(model, method, args, kwargs)
File "/opt/odoo/odoo/addons/web/controllers/main.py", line 936, in _call_kw
return getattr(request.registry.get(model), method)(request.cr, request.uid, _args, *_kwargs)
File "/opt/odoo/odoo/openerp/api.py", line 250, in wrapper
return old_api(self, _args, *_kwargs)
File "/opt/odoo/odoo/openerp/api.py", line 345, in old_api
result = method(recs, _args, *_kwargs)
File "/opt/odoo/odoo/openerp/models.py", line 4092, in create
record = self.browse(self._create(old_vals))
File "/opt/odoo/odoo/openerp/api.py", line 248, in wrapper
return new_api(self, _args, *_kwargs)
File "/opt/odoo/odoo/openerp/api.py", line 481, in new_api
result = method(self._model, cr, uid, _args, *_kwargs)
File "/opt/odoo/odoo/openerp/models.py", line 4283, in _create
recs._validate_fields(vals)
File "/opt/odoo/odoo/openerp/api.py", line 248, in wrapper
return new_api(self, _args, *_kwargs)
File "/opt/odoo/odoo/openerp/models.py", line 1272, in _validate_fields
raise ValidationError('\n'.join(errors))
ValidationError: ('ValidateError', u'Field(s) `` failed against a constraint: Error ! No such database exists!')
Thanks for your hard work with this module. It's now an indispensable part of every Odoo instance I setup.
I'd like to submit a feature request. There is a FOSS project called Duplicati that offers a number of very powerful features, including incremental backups, and backups to a number of different services using their API's (eg. Google Drive, SkyDrive, and a number of others).
This project was originally based on:
http://duplicity.nongnu.org/
that is written in Python.
The backends for the services (in Dupliciti) are here:
https://github.com/duplicati/duplicati/tree/master/Duplicati/Library/Backend
I thought the project may be of interest to you for future enhancements in the auto_backup module.
While first configuring, I set the scheduler to run on weekdays, and to repeat missed. I noticed the next scheduled run date was in the past (2010), but didn't think much of it. After saving the settings, I hit the run manually button once and it started generating backups about one every 10 or 15 seconds. I tried to change the repeat missed option and save the record, but kept getting an error message that the cron job was executing. I finally got it to stop by stopping the odoo server, then hitting the save button, then restarting the odoo server.
I believe I have everything download and odoo 9 setup correctly but when I run the install the auto_backup on Odoo9, I got this error:
(I've to re-download and re-image odoo 9, but I still got the same error. Not sure what was the issue? Thank you for help.)
Odoo
Odoo Server Error
Traceback (most recent call last):
File "/odoo/odoo-server/openerp/http.py", line 643, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/odoo/odoo-server/openerp/http.py", line 680, in dispatch
result = self._call_function(*_self.params)
File "/odoo/odoo-server/openerp/http.py", line 316, in _call_function
return checked_call(self.db, *args, *_kwargs)
File "/odoo/odoo-server/openerp/service/model.py", line 118, in wrapper
return f(dbname, _args, *_kwargs)
File "/odoo/odoo-server/openerp/http.py", line 309, in checked_call
result = self.endpoint(_a, *_kw)
File "/odoo/odoo-server/openerp/http.py", line 959, in call
return self.method(_args, *_kw)
File "/odoo/odoo-server/openerp/http.py", line 509, in response_wrap
response = f(_args, *_kw)
File "/odoo/odoo-server/addons/web/controllers/main.py", line 896, in call_button
action = self._call_kw(model, method, args, {})
File "/odoo/odoo-server/addons/web/controllers/main.py", line 884, in _call_kw
return getattr(request.registry.get(model), method)(request.cr, request.uid, _args, *_kwargs)
File "/odoo/odoo-server/openerp/api.py", line 250, in wrapper
return old_api(self, _args, *_kwargs)
File "/odoo/odoo-server/openerp/addons/base/module/module.py", line 459, in button_immediate_install
return self._button_immediate_function(cr, uid, ids, self.button_install, context=context)
File "/odoo/odoo-server/openerp/api.py", line 250, in wrapper
return old_api(self, _args, *_kwargs)
File "/odoo/odoo-server/openerp/addons/base/module/module.py", line 533, in _button_immediate_function
registry = openerp.modules.registry.RegistryManager.new(cr.dbname, update_module=True)
File "/odoo/odoo-server/openerp/modules/registry.py", line 385, in new
openerp.modules.load_modules(registry._db, force_demo, status, update_module)
File "/odoo/odoo-server/openerp/modules/loading.py", line 338, in load_modules
loaded_modules, update_module)
File "/odoo/odoo-server/openerp/modules/loading.py", line 237, in load_marked_modules
loaded, processed = load_module_graph(cr, graph, progressdict, report=report, skip_modules=loaded_modules, perform_checks=perform_checks)
File "/odoo/odoo-server/openerp/modules/loading.py", line 156, in load_module_graph
_load_data(cr, module_name, idref, mode, kind='data')
File "/odoo/odoo-server/openerp/modules/loading.py", line 98, in _load_data
tools.convert_file(cr, module_name, filename, idref, mode, noupdate, kind, report)
File "/odoo/odoo-server/openerp/tools/convert.py", line 851, in convert_file
convert_xml_import(cr, module, fp, idref, mode, noupdate, report)
File "/odoo/odoo-server/openerp/tools/convert.py", line 938, in convert_xml_import
obj.parse(doc.getroot(), mode=mode)
File "/odoo/odoo-server/openerp/tools/convert.py", line 801, in parse
self.parse(rec, mode)
File "/odoo/odoo-server/openerp/tools/convert.py", line 804, in parse
self._tags[rec.tag](self.cr, rec, de, mode=mode)
File "/odoo/odoo-server/openerp/tools/convert.py", line 503, in _tag_menuitem
menu_parent_id = self.id_get(cr, rec.get('parent',''))
File "/odoo/odoo-server/openerp/tools/convert.py", line 782, in id_get
res = self.model_id_get(cr, id_str, raise_if_not_found)
File "/odoo/odoo-server/openerp/tools/convert.py", line 793, in model_id_get
raise_if_not_found=raise_if_not_found)
File "/odoo/odoo-server/openerp/api.py", line 250, in wrapper
return old_api(self, _args, *_kwargs)
File "/odoo/odoo-server/openerp/addons/base/ir/ir_model.py", line 960, in xmlid_to_res_model_res_id
return self.xmlid_lookup(cr, uid, xmlid)[1:3]
File "/odoo/odoo-server/openerp/api.py", line 250, in wrapper
return old_api(self, _args, *_kwargs)
File "", line 2, in xmlid_lookup
File "/odoo/odoo-server/openerp/tools/cache.py", line 85, in lookup
value = d[key] = self.method(_args, *_kwargs)
File "/odoo/odoo-server/openerp/addons/base/ir/ir_model.py", line 950, in xmlid_lookup
raise ValueError('External ID not found in the system: %s' % (xmlid))
ParseError: "External ID not found in the system: base.menu_config" while parsing /odoo/custom/addons/auto_backup/bkp_conf_view.xml:108, near
i'm writing this issue to help any one has got the same error
platform:
Odoo 10 enterprise
Linux Ubuntu 16.04.3 LTS
Steps to reproduce
1- pip install pysftp
2- restart odoo server
3-odoo server doesn't start and no error in log
4-try to start odoo from command line
and got that error
SSL_ST_INIT = _lib.SSL_ST_INIT
AttributeError: 'module' object has no attribute 'SSL_ST_INIT'
work around
1- need to uninstall pyOpenSSL and then reinstall it
unfortunately pip didn't work with me
i had to use
apt-get --auto-remove --yes remove python-openssl
then
sudo pip install pyOpenSSL==16.2.0
now restart odoo
it worked!
you can then install auto_backup module and it works fine
did any one had a similar problem?
is there is any way to avoid it from the beginning
Hi Yen,
Thank you so much for this plugin.
I've been using it a lot.
Recently though on all the installed instance, the backup is not working.
It was working before. and it is working on new installation.
I do not understand why I don't have the access anymore.
If I go to the database/manager url, I can do a manual backup.
If I try to add a new backup configuration. the system tell me that the database name does not exist when it does.
Any idea on what to do or look for will be great.
Back up is very important especially for my production instances. Looking forward for any help on this
in the log I get this error message.
2017-08-02 12:18:51,548 3754 ERROR marco odoo.addons.base.ir.ir_cron: Call of self.env[u'db.backup'].schedule_backup(*()) failed in Job 11
Traceback (most recent call last):
File "/opt/marcopolo/marcopolo-server/odoo/addons/base/ir/ir_cron.py", line 119, in _callback
getattr(model, method_name)(*args)
File "/opt/marcopolo/custom/addons/auto_backup/models/db_backup.py", line 138, in schedule_backup
db_list = self.get_db_list(rec.host, rec.port)
File "/opt/marcopolo/custom/addons/auto_backup/models/db_backup.py", line 62, in get_db_list
db_list = execute(conn, 'list')
File "/opt/marcopolo/custom/addons/auto_backup/models/db_backup.py", line 48, in execute
res = getattr(connector,method)(*args)
File "/usr/lib/python2.7/xmlrpclib.py", line 1233, in call
return self.__send(self.__name, args)
File "/usr/lib/python2.7/xmlrpclib.py", line 1591, in __request
verbose=self.__verbose
File "/usr/lib/python2.7/xmlrpclib.py", line 1273, in request
return self.single_request(host, handler, request_body, verbose)
File "/usr/lib/python2.7/xmlrpclib.py", line 1306, in single_request
return self.parse_response(response)
File "/usr/lib/python2.7/xmlrpclib.py", line 1482, in parse_response
return u.close()
File "/usr/lib/python2.7/xmlrpclib.py", line 794, in close
raise Fault(**self._stack[0])
Fault: <Fault AccessDenied: 'Access denied'>
Hey On installing, Its giving me an error:
ImportError: No module named Service.
Can you help?
Hy,
How can i backup to ftp server, and which port do i make (21,22)?
Thanks
Using Odoo v9 free and the 9.0 branch on a clean Debian Stretch x64 install, I forgot to install the pysftp module and then wondered why the web page was screwed up, no CSS and other resources were found.
Then I discovered this error in the log, and after installing pysftp, everything was back to normal (phew):
File "/usr/lib/python2.7/dist-packages/openerp/addons/auto_backup/backup_scheduler.py", line 35, in <module>
raise ImportError('This module needs pysftp to automaticly write backups to the FTP through SFTP. Please install pysftp on your system. (sudo pip install pysftp)')
ImportError: This module needs pysftp to automaticly write backups to the FTP through SFTP. Please install pysftp on your system. (sudo pip install pysftp)
This user error really shouldn't break the web site, but instead just logged as a normal error, also right on the auto-backup config-page:
Odoo Server Error
Traceback (most recent call last):
File "C:\GreenOdoo\source\openerp\http.py", line 537, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "C:\GreenOdoo\source\openerp\http.py", line 574, in dispatch
result = self._call_function(*_self.params)
File "C:\GreenOdoo\source\openerp\http.py", line 310, in _call_function
return checked_call(self.db, *args, *_kwargs)
File "C:\GreenOdoo\source\openerp\service\model.py", line 118, in wrapper
return f(dbname, _args, *_kwargs)
File "C:\GreenOdoo\source\openerp\http.py", line 307, in checked_call
return self.endpoint(_a, *_kw)
File "C:\GreenOdoo\source\openerp\http.py", line 803, in call
return self.method(_args, *_kw)
File "C:\GreenOdoo\source\openerp\http.py", line 403, in response_wrap
response = f(_args, *_kw)
File "C:\GreenOdoo\source\addons\web\controllers\main.py", line 948, in call_button
action = self._call_kw(model, method, args, {})
File "C:\GreenOdoo\source\addons\web\controllers\main.py", line 936, in _call_kw
return getattr(request.registry.get(model), method)(request.cr, request.uid, _args, *_kwargs)
File "C:\GreenOdoo\source\openerp\api.py", line 268, in wrapper
return old_api(self, _args, *_kwargs)
File "C:\GreenOdoo\source\openerp\addons\base\module\module.py", line 447, in button_immediate_install
return self._button_immediate_function(cr, uid, ids, self.button_install, context=context)
File "C:\GreenOdoo\source\openerp\api.py", line 268, in wrapper
return old_api(self, _args, *_kwargs)
File "C:\GreenOdoo\source\openerp\addons\base\module\module.py", line 495, in _button_immediate_function
registry = openerp.modules.registry.RegistryManager.new(cr.dbname, update_module=True)
File "C:\GreenOdoo\source\openerp\modules\registry.py", line 370, in new
openerp.modules.load_modules(registry._db, force_demo, status, update_module)
File "C:\GreenOdoo\source\openerp\modules\loading.py", line 355, in load_modules
loaded_modules, update_module)
File "C:\GreenOdoo\source\openerp\modules\loading.py", line 255, in load_marked_modules
loaded, processed = load_module_graph(cr, graph, progressdict, report=report, skip_modules=loaded_modules, perform_checks=perform_checks)
File "C:\GreenOdoo\source\openerp\modules\loading.py", line 176, in load_module_graph
_load_data(cr, module_name, idref, mode, kind='data')
File "C:\GreenOdoo\source\openerp\modules\loading.py", line 118, in _load_data
tools.convert_file(cr, module_name, filename, idref, mode, noupdate, kind, report)
File "C:\GreenOdoo\source\openerp\tools\convert.py", line 901, in convert_file
convert_xml_import(cr, module, fp, idref, mode, noupdate, report)
File "C:\GreenOdoo\source\openerp\tools\convert.py", line 987, in convert_xml_import
obj.parse(doc.getroot(), mode=mode)
File "C:\GreenOdoo\source\openerp\tools\convert.py", line 853, in parse
self._tags[rec.tag](self.cr, rec, n, mode=mode)
File "C:\GreenOdoo\source\openerp\tools\convert.py", line 763, in _tag_record
id = self.pool['ir.model.data']._update(cr, self.uid, rec_model, self.module, res, rec_id or False, not self.isnoupdate(data_node), noupdate=self.isnoupdate(data_node), mode=self.mode, context=rec_context )
File "C:\GreenOdoo\source\openerp\api.py", line 268, in wrapper
return old_api(self, _args, *_kwargs)
File "C:\GreenOdoo\source\openerp\addons\base\ir\ir_model.py", line 1064, in _update
res_id = model_obj.create(cr, uid, values, context=context)
File "C:\GreenOdoo\source\openerp\api.py", line 268, in wrapper
return old_api(self, _args, *_kwargs)
File "C:\GreenOdoo\source\openerp\addons\base\ir\ir_ui_view.py", line 255, in create
context=context)
File "C:\GreenOdoo\source\openerp\api.py", line 268, in wrapper
return old_api(self, _args, *_kwargs)
File "C:\GreenOdoo\source\openerp\api.py", line 372, in old_api
result = method(recs, _args, *_kwargs)
File "C:\GreenOdoo\source\openerp\models.py", line 4094, in create
record = self.browse(self._create(old_vals))
File "C:\GreenOdoo\source\openerp\api.py", line 266, in wrapper
return new_api(self, _args, *_kwargs)
File "C:\GreenOdoo\source\openerp\api.py", line 508, in new_api
result = method(self._model, cr, uid, _args, *_old_kwargs)
File "C:\GreenOdoo\source\openerp\models.py", line 4285, in _create
recs._validate_fields(vals)
File "C:\GreenOdoo\source\openerp\api.py", line 266, in wrapper
return new_api(self, _args, *_kwargs)
File "C:\GreenOdoo\source\openerp\models.py", line 1272, in _validate_fields
raise ValidationError('\n'.join(errors))
ParseError: "ValidateError
Field(s) arch
failed against a constraint: Invalid view definition
Error details:
\u5b57\u6bb5
autoremove`\u4e0d\u5b58\u5728\uff01
\u9519\u8bef\u7684context:
\u89c6\u56fe Configure Backup
[view_id: 1359, xml_id: n/a, model: db.backup, parent_id: n/a]" while parsing file:///C:/GreenOdoo/source/addons/auto_backup/bkp_conf_view.xml:4, near
Configure Backup
db.backup
form
</group>
<group col="4" colspan="4">
<separator col="2" string="SFTP"/>
</group>
<group>
<field name="sftpwrite"/>
<field name="sftpip" 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:[email protected]">Contact us!</a>
</p>
</div>
</form>
</field>
</record>
On V9 community the module will work fine.
On V9 Enterprise the module will totally freeze up and seems to need more CPU and RAM, which keeps stacking up.
Issue seems to happen on this part:
try:
bkp = execute(conn, 'dump', tools.config['admin_passwd'], rec.name, rec.backup_type)
except:
_logger.debug("Couldn't backup database %s. Bad database administrator password for server running at http://%s:%s" %(rec.name, rec.host, rec.port))
continue
Logfile:
2016-01-12 09:04:21,99 3783 INFO none openerp.service.db: DUMP DB: TestDb format zip
It starts the execute, keeps running an infinite time and eventually will freeze up the whole VM. Doesn't seem to go in the except or anything.
It is needed a port field in the SFTP configuration form. I've implemented the changes locally (it is easy if you take the sftpip variable as base), so I can contribute if you wish.
Error installing on Odoo v10.
The following error message is displayed:
Traceback (most recent call last):
File "/opt/adax/odoo/odoo/http.py", line 640, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/opt/adax/odoo/odoo/http.py", line 677, in dispatch
result = self._call_function(**self.params)
File "/opt/adax/odoo/odoo/http.py", line 333, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/opt/adax/odoo/odoo/service/model.py", line 101, in wrapper
return f(dbname, *args, **kwargs)
File "/opt/adax/odoo/odoo/http.py", line 326, in checked_call
result = self.endpoint(*a, **kw)
File "/opt/adax/odoo/odoo/http.py", line 935, in call
return self.method(*args, **kw)
File "/opt/adax/odoo/odoo/http.py", line 506, in response_wrap
response = f(*args, **kw)
File "/opt/adax/odoo/addons/web/controllers/main.py", line 889, in call_button
action = self._call_kw(model, method, args, {})
File "/opt/adax/odoo/addons/web/controllers/main.py", line 877, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "/opt/adax/odoo/odoo/api.py", line 681, in call_kw
return call_kw_multi(method, model, args, kwargs)
File "/opt/adax/odoo/odoo/api.py", line 672, in call_kw_multi
result = method(recs, *args, **kwargs)
File "/opt/adax/odoo/odoo/addons/base/module/module.py", line 410, in button_immediate_install
return self._button_immediate_function(type(self).button_install)
File "/opt/adax/odoo/odoo/addons/base/module/module.py", line 484, in _button_immediate_function
modules.registry.Registry.new(self._cr.dbname, update_module=True)
File "/opt/adax/odoo/odoo/modules/registry.py", line 82, in new
odoo.modules.load_modules(registry._db, force_demo, status, update_module)
File "/opt/adax/odoo/odoo/modules/loading.py", line 339, in load_modules
loaded_modules, update_module)
File "/opt/adax/odoo/odoo/modules/loading.py", line 237, in load_marked_modules
loaded, processed = load_module_graph(cr, graph, progressdict, report=report, skip_modules=loaded_modules, perform_checks=perform_checks)
File "/opt/adax/odoo/odoo/modules/loading.py", line 156, in load_module_graph
_load_data(cr, module_name, idref, mode, kind='data')
File "/opt/adax/odoo/odoo/modules/loading.py", line 95, in _load_data
tools.convert_file(cr, module_name, filename, idref, mode, noupdate, kind, report)
File "/opt/adax/odoo/odoo/tools/convert.py", line 845, in convert_file
convert_xml_import(cr, module, fp, idref, mode, noupdate, report)
File "/opt/adax/odoo/odoo/tools/convert.py", line 915, in convert_xml_import
obj.parse(doc.getroot(), mode=mode)
File "/opt/adax/odoo/odoo/tools/convert.py", line 796, in parse
self.parse(rec, mode)
File "/opt/adax/odoo/odoo/tools/convert.py", line 799, in parse
self._tags[rec.tag](rec, de, mode=mode)
File "/opt/adax/odoo/odoo/tools/convert.py", line 707, in _tag_record
id = self.env(context=rec_context)['ir.model.data']._update(rec_model, self.module, res, rec_id or False, not self.isnoupdate(data_node), noupdate=self.isnoupdate(data_node), mode=self.mode)
File "/opt/adax/odoo/odoo/addons/base/ir/ir_model.py", line 1228, in _update
record = record.create(values)
File "/opt/adax/odoo/odoo/addons/base/ir/ir_ui_view.py", line 362, in create
return super(View, self).create(self._compute_defaults(values))
File "/opt/adax/odoo/odoo/models.py", line 3838, in create
self._fields[key].determine_inverse(record)
File "/opt/adax/odoo/odoo/fields.py", line 1000, in determine_inverse
getattr(records, self.inverse)()
File "/opt/adax/odoo/odoo/addons/base/ir/ir_ui_view.py", line 220, in _inverse_arch
view.write(data)
File "/opt/adax/odoo/odoo/addons/base/ir/ir_ui_view.py", line 380, in write
return super(View, self).write(self._compute_defaults(vals))
File "/opt/adax/odoo/odoo/models.py", line 3564, in write
self._write(old_vals)
File "/opt/adax/odoo/odoo/models.py", line 3715, in _write
self._validate_fields(vals)
File "/opt/adax/odoo/odoo/models.py", line 1083, in validate_fields
raise ValidationError("%s\n\n%s" % (("Error while validating constraint"), tools.ustr(e)))
ParseError: "Error while validating constraint
Modelo n\xe3o encontrado: db.backup
Contexto de erro:
Veja Configure Backup
[view_id: 1063, xml_id: n/a, model: db.backup, parent_id: n/a]
None" while parsing /opt/adax/odoo-brasil/auto_backup/bkp_conf_view.xml:4, near
Configure Backup
db.backup
form
</group>
<group col="4" colspan="4">
<separator col="2" string="SFTP"/>
</group>
Need more help? Contact us!
cloned 8.0 branch
1st thing that looks unfamiliar to me is that there is the git folder auto_backup and inside there is a README and another folder auto_backup (which actually is the Module). At least if I make the 'mother' auto_backup folder available, the Module does not show inside of odoo.
now, when I finally make the 2nd tier auto_backup folder available to my addons_patch the "Update Modules List" command returns and error
XmlHttpRequestError INTERNAL SERVER ERROR
<title>500 Internal Server Error</title>The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is a
tested this twice with the same result. With your Module available this error pops up, without auto_backp "Update Mouldes List" works fine. I have no coding skills at all and the error message does not tell me anything. Maybe you can make some heads and tails to it
I'm having trouble with this error message:
Verbindungstest fehlgeschlagen!
Here is what we got instead:
Bad authentication type
[u'publickey', u'gssapi-keyex', u'gssapi-with-mic', u'keyboard-interactive']
I have configurate a ftp connection setting.
Is there anyone that can help me with this?
I think there is a problem that auto_backup module try to make an sftp connection and my server has it on ftp?
Thank you
Thank you for this great module - I love it!
I have 2 suggested improvements
Before copying the file using srv.put(pathToWriteTo)
check if the file exists using srv.exists(f)
Without this, older backups are copied over to the sftp server every time the scheduler runs.
I've cloned the github repository into my Odoo machine and added the correct dependency on odoo-server.conf file, but when I click "Update modules list" on the application, I got the following message:
Traceback (most recent call last):
File "/opt/odoo/openerp/http.py", line 544, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/opt/odoo/openerp/http.py", line 581, in dispatch
result = self._call_function(**self.params)
File "/opt/odoo/openerp/http.py", line 317, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/opt/odoo/openerp/service/model.py", line 118, in wrapper
return f(dbname, *args, **kwargs)
File "/opt/odoo/openerp/http.py", line 314, in checked_call
return self.endpoint(*a, **kw)
File "/opt/odoo/openerp/http.py", line 810, in __call__
return self.method(*args, **kw)
File "/opt/odoo/openerp/http.py", line 410, in response_wrap
response = f(*args, **kw)
File "/opt/odoo/addons/web/controllers/main.py", line 948, in call_button
action = self._call_kw(model, method, args, {})
File "/opt/odoo/addons/web/controllers/main.py", line 936, in _call_kw
return getattr(request.registry.get(model), method)(request.cr, request.uid, *args, **kwargs)
File "/opt/odoo/openerp/api.py", line 268, in wrapper
return old_api(self, *args, **kwargs)
File "/opt/odoo/openerp/api.py", line 439, in old_api
result = new_api(recs, *args, **kwargs)
File "/opt/odoo/openerp/api.py", line 443, in new_api
result = [method(rec, *args, **kwargs) for rec in self
File "/opt/odoo/openerp/addons/base/module/wizard/base_module_update.py", line 15, in update_module self.updated, self.added = self.env['ir.module.module'].update_list()
File "/opt/odoo/openerp/api.py", line 266, in wrapper
return new_api(self, *args, **kwargs)
File "/opt/odoo/openerp/api.py", line 508, in new_api
result = method(self._model, cr, uid, *args, **old_kwargs)
File "/opt/odoo/openerp/addons/base/module/module.py", line 651, in update_list
handler.load_addons()
File "/opt/odoo/openerp/http.py", line 1317, in load_addons
m = __import__('openerp.addons.' + module)
File "/opt/odoo/openerp/modules/module.py", line 80, in load_module
mod = imp.load_module('openerp.addons.' + module_part, f, path, descr)
File "/opt/odoo/auto_backup/auto_backup/__init__.py", line 23, in
import backup_scheduler
File "/opt/odoo/auto_backup/auto_backup/backup_scheduler.py", line 33, in
raise ImportError('This module needs pysftp to automaticly write backups to the FTP through SFTP.
Please install pysftp on your system. (sudo pip install pysftp)')
ImportError: This module needs pysftp to automaticly write backups to the FTP through SFTP. Please install pysftp on your system. (sudo pip install pysftp)
Then I typed sudo pip install pysftp
in the terminal and I got
Requirement already satisfied (use --upgrade to upgrade): pysftp in /usr/local/lib/python2.7/dist-packages
Requirement already satisfied (use --upgrade to upgrade): paramiko>=1.17 in /usr/local/lib/python2.7/dist-packages (from pysftp)
Cleaning up...
I even tryed to type sudo pip install pysftp --upgrade
but I got
Requirement already up-to-date: pysftp in /usr/local/lib/python2.7/dist-packages
Requirement already up-to-date: paramiko>=1.17 in /usr/local/lib/python2.7/dist-packages (from pysftp)
Cleaning up...
Could you help me on that, please?
i'm running a cloud server with different installation of odoo servers and all backups are working fine except on project , it's backup was working fine till 08-02-2016 and with no reason stopped i just noticed now , the backup is scheduled every day at 18:00:00 GMT
here is the log file :
ERROR xxxx openerp.addons.base.ir.ir_cron: Call of self.pool.get('db.backup').schedule_backup(cr, uid, *()) failed in Job 11
Traceback (most recent call last):
File "C:\Program Files (x86)\Odoo_xxxxx\server\openerp\addons\base\ir\ir_cron.py", line 138, in _callback
File "C:\Program Files (x86)\Odoo_xxxxx\server.\openerp\api.py", line 250, in wrapper
File "C:\Program Files (x86)\Odoo_xxxxx\server\openerp\addons\auto_backup\backup_scheduler.py", line 155, in schedule_backup
NameError: global name 'logger' is not defined
Hi Yenthe,
thank you for the great module.
I could install easily but unfortunately the menu item doesn not show up.
Odoo v8
branch 8.0 of your module.
server-log says:
openerp.modules.loading: module auto_backup: key 'update_xml' is deprecated in favor of 'data' for file 'bkp_conf_view.xml'.
openerp.modules.loading: module auto_backup: key 'update_xml' is deprecated in favor of 'data' for file 'backup_data.xml'.
Weird, isn't it?
auto_backup module with the current debian package installation of odoo8 is not working
Hello,
Due to changed view of Odoo 9, now I can't access to backup configuration. Can you please show me how to access Auto Backup config on Odoo 9?.
Thank you
Hi,
I'm running multiple databases on my server, with following configuraiton
dbfilter ^%h$"
list_db = False
I noticed when configuring auto_backup it fails with error 'Error ! No such database exists!'.
I had to set "list_db = True".
Hope this helps, in case someone faces same issue.
Some users report that they get a traceback / error saying that the db.backup model is not found.
This issue also seems to be possible if you have the module already installed and seems to happen somewhere randomly in time. Example from one of my production logs:
Line 325566: 2017-08-20 18:45:26,657 7423 INFO mydb openerp.addons.auto_backup.backup_scheduler: Copying File /odoo/backups/20_08_2017_18_00_20_mydb.zip------ success
Line 373775: 2017-08-21 18:00:03,605 2609 WARNING mydb openerp.addons.base.ir.ir_cron: Model `db.backup` does not exist.
Line 418334: 2017-08-22 18:00:11,203 2609 WARNING mydb openerp.addons.base.ir.ir_cron: Model `db.backup` does not exist.
Line 462467: 2017-08-23 18:00:23,201 2609 WARNING mydb openerp.addons.base.ir.ir_cron: Model `db.backup` does not exist.
Line 526564: 2017-08-24 18:00:32,859 2609 WARNING mydb openerp.addons.base.ir.ir_cron: Model `db.backup` does not exist
As you can see this in this logfile the backup worked fine the 20 augustus and since the 21'st of august is spits out Model db.backup does not exist.
for some reason.
Files are currently saved with the format DD_MM_YYYY_HH_MM_SS
, which makes the files appear in the wrong order when doing a simple ls
.
$ ls -l /opt/odoo/backups/
total 65868
-rw-r--r-- 1 root root 4490622 Mar 1 12:00 01_03_2017_18_00_18_moonglow.zip
-rw-r--r-- 1 root root 4490625 Mar 2 12:00 02_03_2017_18_00_50_moonglow.zip
-rw-r--r-- 1 root root 4490621 Mar 3 12:00 03_03_2017_18_00_21_moonglow.zip
-rw-r--r-- 1 root root 4491419 Mar 4 12:00 04_03_2017_18_00_49_moonglow.zip
-rw-r--r-- 1 root root 4491425 Mar 6 17:17 06_03_2017_23_17_22_moonglow.zip
-rw-r--r-- 1 root root 4491164 Mar 7 12:20 07_03_2017_18_20_13_moonglow.zip
-rw-r--r-- 1 root root 4540087 Mar 8 12:00 08_03_2017_18_00_07_moonglow.zip
-rw-r--r-- 1 root root 4490609 Feb 21 12:00 21_02_2017_18_00_27_moonglow.zip
-rw-r--r-- 1 root root 4490619 Feb 22 12:00 22_02_2017_18_00_41_moonglow.zip
-rw-r--r-- 1 root root 4490626 Feb 23 12:00 23_02_2017_18_00_10_moonglow.zip
-rw-r--r-- 1 root root 4490617 Feb 24 12:00 24_02_2017_18_00_42_moonglow.zip
-rw-r--r-- 1 root root 4490619 Feb 25 12:00 25_02_2017_18_00_14_moonglow.zip
-rw-r--r-- 1 root root 4490626 Feb 26 12:00 26_02_2017_18_00_44_moonglow.zip
-rw-r--r-- 1 root root 4490617 Feb 27 12:00 27_02_2017_18_00_15_moonglow.zip
-rw-r--r-- 1 root root 4490626 Feb 28 12:00 28_02_2017_18_00_47_moonglow.zip
I realize I could do ls -ltr
but I really see no benefit to the current filename over YYYY_MM_DD_HH_MM_SS
. The file modified dates can also be modified (e.g. when copying files) so in that case ls -ltr
wouldn't even work.
Where is the license file ? It would be great if there is one. I'm assuming it's using MIT license but I could be wrong
Good day
First of all I have to say thank you for this useful addon.
Now a suggestion: since many of us make backups of database and filestore separately, so database backups are kept at a reasonable size while filestore is copied to an external storage system, it would be a great enhancement if autobackup could be configured to backup only the database without filestore attachments.
Thank you again, best regards
Hello
Can be made of the following places, such as the translation of documents in
auto_backup\i18n\zh_CN.po
such as:
Local backup configuration
Auto. Remove Backups
Warning: Use SFTP with caution! This writes files to external servers under the path you specify.
Write to external server with sftp
Automatic backups of the database can be scheduled as follows:
Go to Settings / Technical / Automation / Scheduled Actions.
Search the action named 'Backup scheduler'.
Set the scheduler to active and fill in how often you want backups generated.
Need more help? Contact us!
In v9.0 menu-item 'General Settings' has no submenu's anymore. This menu-item doesn't work anymore when auto_backup module is installed because this is a submenu-item.
A solution is to remove menu-item 'Configure Backup' as a submenu from 'General Settings'
Hi
I used your install script for odoo 9 so odoo is running under the odoo user. Installing with Ubuntu 64 bit server 14.04 was straight forward, but even though everything with the module installed perfectly, and I see this sensible entry in the odoo log when I run the backup from the scheduler :-
ie 2015-12-16 16:42:53,293 3400 INFO None openerp.service.db: DUMP DB: elite format zip
the folder is created, everything appears fine but never are any backup files created.
I’m happy to help debug if you can help by supplying screenshots etc and config
It could be a permissions issue, but even setting 777 privs on the folder does not help. I tried changing the odoo log to debug but no further useful info was provided.
Hi
Went i try to test sftp connection i receive this message : Here is what we got instead:
Error reading SSH protocol banner
Environnement:
-> Odoo 10
-> Python 2.7
-> Pysftp : 0.2.8 (i have downgrade from 0.2.9 to 0.2.8 because i was facing the issue No hostkey? #47)
Thanks i in advance for your help !
Yenthe666,
I am unable to get the backup to run and the odoo-server.log log says it's a bad db admin password. After troubleshooting different passwords in the openerp-server.conf file, I think it's failing because of bad configuration settings in the module.
My server redirects from the default http://localhost:8069 to https://mangstor.com/ but when I enter mangstor or mangstor.com as the host I get a Validation Error: Field(s) `` failed against a constraint: Error ! No such database exists! I have also tried changing the port number to 443 but no luck.
What do I enter as my host?
Brad
File "/opt/orchiderp/test/odoo/openerp/addons/base/ir/ir_cron.py", line 138, in _callback
getattr(model, method_name)(cr, uid, *args)
File "/opt/orchiderp/test/odoo/openerp/api.py", line 241, in wrapper
return old_api(self, *args, **kwargs)
File "/opt/orchiderp/test/orchid_addons/auto_backup/backup_scheduler.py", line 158, in schedule_backup
logger.notifyChannel('backup', netsvc.LOG_INFO, "Couldn't backup database %s. Bad database administrator password for server running at http://%s:%s" %(rec.name, rec.host, rec.port))
AttributeError: 'Logger' object has no attribute 'notifyChannel'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.