From 7ad49a6d49fef12eb6b346e146e01d8a60f9dc79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 27 Mar 2019 00:28:57 +0100 Subject: [PATCH] Raise NotImplementedError when setting Function field without setter issue7985 review265101002 --- product.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/product.py b/product.py index 54a7d4e4c8..c367cb2263 100644 --- a/product.py +++ b/product.py @@ -239,6 +239,13 @@ class Product( fields.Many2Many))): order_method = TemplateFunction.order(attr) setattr(cls, 'order_%s' % attr, order_method) + if isinstance(tfield, fields.One2Many): + getattr(cls, attr).setter = '_set_template_function' + + @classmethod + def _set_template_function(cls, products, name, value): + # Prevent NotImplementedError for One2Many + pass @fields.depends('template') def on_change_template(self):