From 7718fe95084483c85c0bf5def9766e06b6f807a5 Mon Sep 17 00:00:00 2001 From: "Chong Wang (cwg)" Date: Tue, 4 Oct 2022 13:58:36 +0000 Subject: [PATCH] [FIX] core: assert translated fields cannot have size Translated fields are stored as jsonb columns. Since jsonb columns don't have size, the size attribute for Char field doesn't work. Setting the size attribute for a Char fild should raise an error closes odoo/odoo#103031 X-original-commit: 763fbb1c68385f202f5118fac5bc8b23b8760220 Signed-off-by: Raphael Collet --- odoo/fields.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/odoo/fields.py b/odoo/fields.py index c502ed52e3b..00b6dd99dba 100644 --- a/odoo/fields.py +++ b/odoo/fields.py @@ -1829,6 +1829,8 @@ class Char(_String): super()._setup_attrs(model_class, name) assert self.size is None or isinstance(self.size, int), \ "Char field %s with non-integer size %r" % (self, self.size) + assert not(self.translate and self.size), \ + "Translated field %s cannot have size %r" % (self, self.size) @property def column_type(self):