Skip to content

Commit 00f8631

Browse files
committed
[MIG] fs_storage_backup: Migration to 18.0
fs_storage_backup: Use body_is_html in post_message
1 parent f18ed7a commit 00f8631

File tree

7 files changed

+23
-35
lines changed

7 files changed

+23
-35
lines changed

fs_storage_backup/README.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ Filesystem Storage Backup
1717
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
1818
:alt: License: AGPL-3
1919
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fstorage-lightgray.png?logo=github
20-
:target: https://github.com/OCA/storage/tree/16.0/fs_storage_backup
20+
:target: https://github.com/OCA/storage/tree/18.0/fs_storage_backup
2121
:alt: OCA/storage
2222
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23-
:target: https://translation.odoo-community.org/projects/storage-16-0/storage-16-0-fs_storage_backup
23+
:target: https://translation.odoo-community.org/projects/storage-18-0/storage-18-0-fs_storage_backup
2424
:alt: Translate me on Weblate
2525
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26-
:target: https://runboat.odoo-community.org/builds?repo=OCA/storage&target_branch=16.0
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/storage&target_branch=18.0
2727
:alt: Try me on Runboat
2828

2929
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -68,7 +68,7 @@ Bug Tracker
6868
Bugs are tracked on `GitHub Issues <https://github.com/OCA/storage/issues>`_.
6969
In case of trouble, please check there if your issue has already been reported.
7070
If you spotted it first, help us to smash it by providing a detailed and welcomed
71-
`feedback <https://github.com/OCA/storage/issues/new?body=module:%20fs_storage_backup%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
71+
`feedback <https://github.com/OCA/storage/issues/new?body=module:%20fs_storage_backup%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
7272

7373
Do not contact contributors directly about support or help with technical issues.
7474

@@ -98,6 +98,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
9898
mission is to support the collaborative development of Odoo features and
9999
promote its widespread use.
100100

101-
This module is part of the `OCA/storage <https://github.com/OCA/storage/tree/16.0/fs_storage_backup>`_ project on GitHub.
101+
This module is part of the `OCA/storage <https://github.com/OCA/storage/tree/18.0/fs_storage_backup>`_ project on GitHub.
102102

103103
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

fs_storage_backup/__manifest__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "Filesystem Storage Backup",
33
"category": "Technical",
4-
"version": "16.0.1.0.1",
4+
"version": "18.0.1.0.0",
55
"license": "AGPL-3",
66
"author": "Onestein, Odoo Community Association (OCA)",
77
"website": "https://github.com/OCA/storage",

fs_storage_backup/data/ir_cron_data.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@
44
<field name="name">Backup database and delete old backups</field>
55
<field name="interval_number">1</field>
66
<field name="interval_type">days</field>
7-
<field name="numbercall">-1</field>
87
<field name="active">True</field>
9-
<field name="doall" eval="False" />
108
<field name="model_id" ref="fs_storage.model_fs_storage" />
119
<field name="state">code</field>
1210
<field name="code">model.cron_backup_db()</field>

fs_storage_backup/models/fs_storage.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
class FSStorage(models.Model):
1414
_name = "fs.storage"
15-
_inherit = ["fs.storage", "mail.thread"] # Use queue_job_cron instead?
15+
_inherit = ["fs.storage", "mail.thread"]
1616

1717
use_for_backup = fields.Boolean(string="Use For Backups")
1818
backup_include_filestore = fields.Boolean(
@@ -65,7 +65,7 @@ def backup_db(self):
6565
backup_path = self._get_backup_path()
6666
self.fs.makedirs(self.backup_dir, exist_ok=True)
6767
if self.fs.exists(backup_path):
68-
raise Exception("File already exists (%s)." % backup_path)
68+
raise Exception(f"File already exists ({backup_path}).")
6969
backup_file = self.fs.open(backup_path, "w")
7070
list_db = tools.config["list_db"]
7171
if not list_db:
@@ -80,7 +80,8 @@ def backup_db(self):
8080
_logger.exception("Database backup failed: %s", e)
8181
self.message_post(
8282
subject=_("Database backup failed"),
83-
body="<pre>%s</pre>" % tools.html_escape(traceback.format_exc()),
83+
body=f"<pre>{tools.html_escape(traceback.format_exc())}</pre>",
84+
body_is_html=True,
8485
subtype_id=self.env.ref(
8586
"fs_storage_backup.message_subtype_backup_failed"
8687
).id,
@@ -101,7 +102,8 @@ def cleanup_old_backups(self):
101102
_logger.exception("Failed to clean up old backups: %s", e)
102103
self.message_post(
103104
subject=_("Failed to clean up old backups"),
104-
body="<pre>%s</pre>" % tools.html_escape(traceback.format_exc()),
105+
body=f"<pre>{tools.html_escape(traceback.format_exc())}</pre>",
106+
body_is_html=True,
105107
subtype_id=self.env.ref(
106108
"fs_storage_backup.message_subtype_cleanup_failed"
107109
).id,

fs_storage_backup/pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[build-system]
2+
requires = ["whool"]
3+
build-backend = "whool.buildapi"

fs_storage_backup/static/description/index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ <h1 class="title">Filesystem Storage Backup</h1>
369369
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
370370
!! source digest: sha256:3292ef4f97f5dcf8a5364cba204599da2169dd30020b9b488ddb72885f85f85b
371371
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
372-
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/storage/tree/16.0/fs_storage_backup"><img alt="OCA/storage" src="https://img.shields.io/badge/github-OCA%2Fstorage-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/storage-16-0/storage-16-0-fs_storage_backup"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/storage&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
372+
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/storage/tree/18.0/fs_storage_backup"><img alt="OCA/storage" src="https://img.shields.io/badge/github-OCA%2Fstorage-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/storage-18-0/storage-18-0-fs_storage_backup"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/storage&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
373373
<p>With this module you can configure one or more database backup
374374
locations.</p>
375375
<p><strong>Table of contents</strong></p>
@@ -419,7 +419,7 @@ <h1><a class="toc-backref" href="#toc-entry-4">Bug Tracker</a></h1>
419419
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/storage/issues">GitHub Issues</a>.
420420
In case of trouble, please check there if your issue has already been reported.
421421
If you spotted it first, help us to smash it by providing a detailed and welcomed
422-
<a class="reference external" href="https://github.com/OCA/storage/issues/new?body=module:%20fs_storage_backup%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
422+
<a class="reference external" href="https://github.com/OCA/storage/issues/new?body=module:%20fs_storage_backup%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
423423
<p>Do not contact contributors directly about support or help with technical issues.</p>
424424
</div>
425425
<div class="section" id="credits">
@@ -445,7 +445,7 @@ <h2><a class="toc-backref" href="#toc-entry-8">Maintainers</a></h2>
445445
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
446446
mission is to support the collaborative development of Odoo features and
447447
promote its widespread use.</p>
448-
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/storage/tree/16.0/fs_storage_backup">OCA/storage</a> project on GitHub.</p>
448+
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/storage/tree/18.0/fs_storage_backup">OCA/storage</a> project on GitHub.</p>
449449
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
450450
</div>
451451
</div>

fs_storage_backup/views/fs_storage_view.xml

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,13 @@
77
<xpath expr="//field[@name='options']" position="after">
88
<separator string="Backups" />
99
<field name="use_for_backup" />
10-
<field
11-
name="backup_include_filestore"
12-
attrs="{'invisible': [('use_for_backup', '=', False)]}"
13-
/>
14-
<field
15-
name="backup_dir"
16-
attrs="{'invisible': [('use_for_backup', '=', False)]}"
17-
/>
18-
<field
19-
name="backup_filename_format"
20-
attrs="{'invisible': [('use_for_backup', '=', False)]}"
21-
/>
22-
<field
23-
name="backup_keep_time"
24-
attrs="{'invisible': [('use_for_backup', '=', False)]}"
25-
/>
10+
<field name="backup_include_filestore" invisible="not use_for_backup" />
11+
<field name="backup_dir" invisible="not use_for_backup" />
12+
<field name="backup_filename_format" invisible="not use_for_backup" />
13+
<field name="backup_keep_time" invisible="not use_for_backup" />
2614
</xpath>
2715
<xpath expr="//sheet" position="after">
28-
<div class="oe_chatter">
29-
<field name="message_follower_ids" widget="mail_followers" />
30-
<field name="message_ids" widget="mail_thread" />
31-
</div>
16+
<chatter />
3217
</xpath>
3318
</field>
3419
</record>

0 commit comments

Comments
 (0)