[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 <rco@odoo.com>
This commit is contained in:
Chong Wang (cwg)
2022-10-11 14:10:16 +02:00
parent 25e4a53753
commit 7718fe9508
+2
View File
@@ -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):