Update db_backup.py to Fix Deprecation Warning in 16.0 & 17.0 and fixed Warning/Error Messages #266
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
2024-02-20 23:00:00,529 2816741 WARNING goodpi py.warnings: /opt/odoo16/odoo16/custom/auto_backup/models/db_backup.py:315: DeprecationWarning: Since 16.0, use
subprocess
directly.File "/usr/lib/python3.10/threading.py", line 973, in _bootstrap
self._bootstrap_inner()
File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
self.run()
File "/usr/lib/python3.10/threading.py", line 953, in run
self._target(*self._args, **self._kwargs)
File "/opt/odoo16/odoo16/odoo/service/server.py", line 497, in target
self.cron_thread(i)
File "/opt/odoo16/odoo16/odoo/service/server.py", line 478, in cron_thread
ir_cron._process_jobs(db_name)
File "/opt/odoo16/odoo16/odoo/addons/base/models/ir_cron.py", line 122, in _process_jobs
registry[cls._name]._process_job(db, cron_cr, job)
File "/opt/odoo16/odoo16/odoo/addons/base/models/ir_cron.py", line 331, in _process_job
ir_cron._callback(job['cron_name'], job['ir_actions_server_id'], job['id'])
File "/opt/odoo16/odoo16/odoo/addons/base/models/ir_cron.py", line 374, in _callback
self.env['ir.actions.server'].browse(server_action_id).run()
File "/opt/odoo16/odoo16/odoo/addons/base/models/ir_actions.py", line 674, in run
res = runner(run_self, eval_context=eval_context)
File "/opt/odoo16/odoo16/odoo/addons/base/models/ir_actions.py", line 544, in _run_action_code_multi
safe_eval(self.code.strip(), eval_context, mode="exec", nocopy=True, filename=str(self)) # nocopy allows to return 'action'
File "/opt/odoo16/odoo16/odoo/tools/safe_eval.py", line 362, in safe_eval
return unsafe_eval(c, globals_dict, locals_dict)
File "ir.actions.server(347,)", line 1, in
File "/opt/odoo16/odoo16/custom/auto_backup/models/db_backup.py", line 148, in schedule_backup
self._take_dump(rec.name, fp, 'db.backup', rec.backup_type)
File "/opt/odoo16/odoo16/custom/auto_backup/models/db_backup.py", line 315, in _take_dump
odoo.tools.exec_pg_command(*cmd)