From 07aa1122502e92f2861685da76bc817acc31fe07 Mon Sep 17 00:00:00 2001 From: benjamin <benjamin@le-filament.com> Date: Wed, 2 Mar 2022 11:43:09 +0100 Subject: [PATCH] [fix] sql injection recommendation --- models/partner_activity.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/models/partner_activity.py b/models/partner_activity.py index 723ef1e..b0494ea 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())), ) -- GitLab