From b5d0fb473ff5a5f847d5daf07fb59029da52cbaf Mon Sep 17 00:00:00 2001 From: elmerdpadilla Date: Sat, 11 May 2019 13:07:47 -0600 Subject: [PATCH] [NEW] Add constrain method snippet --- snippets/python.json | 11 +++++++++++ 1 file changed, 11 insertions(+) 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": [