changeset 53768a62b709 in modules/product:default
details: https://hg.tryton.org/modules/product?cmd=changeset;node=53768a62b709
description:
        Raise NotImplementedError when setting Function field without setter

        issue7985
        review265101002
diffstat:

 product.py |  7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diffs (17 lines):

diff -r a359ca37bd30 -r 53768a62b709 product.py
--- a/product.py        Fri Mar 22 15:33:43 2019 +0100
+++ b/product.py        Wed Mar 27 00:28:57 2019 +0100
@@ -239,6 +239,13 @@
                                 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):

Reply via email to