diff --git a/odoo/addons/base/models/ir_model.py b/odoo/addons/base/models/ir_model.py index 012bd3cd298..7602f002be2 100644 --- a/odoo/addons/base/models/ir_model.py +++ b/odoo/addons/base/models/ir_model.py @@ -610,7 +610,7 @@ class IrModelFields(models.Model): ('size_gt_zero', 'CHECK (size>=0)', 'Size of the field cannot be negative.'), ( "name_manual_field", - "CHECK (state != 'manual' OR name LIKE 'x_%')", + "CHECK (state != 'manual' OR name LIKE 'x\\_%')", "Custom fields must have a name that starts with 'x_'!" ), ] diff --git a/odoo/addons/base/tests/test_ir_actions.py b/odoo/addons/base/tests/test_ir_actions.py index f9ee8c395ad..dd65e50e2bb 100644 --- a/odoo/addons/base/tests/test_ir_actions.py +++ b/odoo/addons/base/tests/test_ir_actions.py @@ -380,13 +380,13 @@ class TestCustomFields(common.TransactionCase): def test_create_custom(self): """ custom field names must be start with 'x_' """ with self.assertRaises(IntegrityError), mute_logger('odoo.sql_db'): - self.create_field('foo') + self.create_field('xyz') def test_rename_custom(self): """ custom field names must be start with 'x_' """ - field = self.create_field('x_foo') + field = self.create_field('x_xyz') with self.assertRaises(IntegrityError), mute_logger('odoo.sql_db'): - field.name = 'foo' + field.name = 'xyz' def test_create_valid(self): """ field names must be valid pg identifiers """