diff --git a/models/partner_activity.py b/models/partner_activity.py
index 723ef1e42cfeb2d329494924a178b78575fe3523..b0494eae00d57237cbcf614e0fc20d64e9f5c395 100644
--- a/models/partner_activity.py
+++ b/models/partner_activity.py
@@ -2,6 +2,7 @@
 # © 2021 Confédération Générale des Scop (<https://www.les-scop.coop>)
 # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
 
+from psycopg2.extensions import AsIs
 
 from odoo import api, fields, models, tools
 
@@ -100,5 +101,6 @@ class ScopPartnerActivity(models.Model):
     def init(self):
         tools.drop_view_if_exists(self.env.cr, self._table)
         self.env.cr.execute(
-            "CREATE or REPLACE VIEW %s as (%s)", (self._table, self._select())
+            "CREATE or REPLACE VIEW %s as (%s)",
+            (AsIs(self._table), AsIs(self._select())),
         )