Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
3 Odpowiedzi
12216 Widoki

Hello,

how can we apply sql unique constraint on a Many2one field in .line portion of a form.


_sql_constraints = [
('name_uniq', 'UNIQUE (subject)', 'You can not have two users with the same name !')
]
I wrote this but it is not working for me.
please help.
Awatar
Odrzuć

_sql_constraints = [('name_of_field_unique', 'unique(name_of_field)',

'Error Message')]

is subject your many2one field?

yes..Many2one field



Mailtrack Sender notified by
Mailtrack 26/11/19, 11:20:07

On Tue, 26 Nov 2019 at 11:17, shalin wilson <shalinwilson1994@gmail.com> wrote:

_sql_constraints = [('name_of_field_unique', 'unique(name_of_field)',

'Error Message')]

is subject your many2one field?

Sent by Odoo S.A. using Odoo.

how to set unique constraint on field using api

Najlepsza odpowiedź

Hi,

add the constraints in the many2one fields model

Awatar
Odrzuć