diff --git a/snippets/python.json b/snippets/python.json index 438d783..56d8e1e 100644 --- a/snippets/python.json +++ b/snippets/python.json @@ -214,6 +214,17 @@ ], "description": "Add a method compute" }, + "odoo_method_constrains": { + "prefix": "omconst", + "body": [ + "@api.constrains('${1:field_name}')", + "def _check_${1:field_name}(self):", + "\if 1==1:", + "\\raise ValidationError()", + "$0" + ], + "description": "Add a constraint method" + }, "odoo_method_onchange": { "prefix": "omchange", "body": [