Browse Source

Add unique constraint on the view's name in PG

pull/245/head
Guewen Baconnier 9 years ago
parent
commit
5620949ca0
  1. 5
      sql_view/models/sql_view.py

5
sql_view/models/sql_view.py

@ -103,6 +103,11 @@ class SQLView(orm.Model):
['definition']), ['definition']),
] ]
_sql_constraints = [
('sql_name_uniq', 'unique (sql_name)',
'Another view has the same SQL name.')
]
def _sql_view_comment(self, cr, uid, sql_view, context=None): def _sql_view_comment(self, cr, uid, sql_view, context=None):
return "%s (created by the module sql_view)" % sql_view.name return "%s (created by the module sql_view)" % sql_view.name

Loading…
Cancel
Save