Skip to Content
मेन्यू
This question has been flagged
2 Replies
3041 Views

I need a new field in res.partner for account number. The number should only belong to one contact and must be created manually (no sequencing). How do we get a uniqueness check on that field to prevent duplicate entries and warn the user that the value already exists?

Avatar
Discard
Best Answer

Hello, would you by any chance know the python code to use ?

Thanks a lot.

Avatar
Discard

Hi,

You can use sql constraints.
_sql_constraints = [('name_uniq', "unique(name, applicability, country_id)", "A tag with the same name and applicability already exists in this country.")]

Best Answer

Hi,

You can create an automated action in the database, that is getting triggered on writing or creating record in this model and you can raise warning if duplicates are found.


Check whether base_automation module is installed in the database, if not install it, then keeping the developer mode activated, navigate to Automated Actions menu under the settings and create a new record here, select triggered on Create & Update and execute a python code, that check and raises the warning.

Thanks

Avatar
Discard
Related Posts Replies Views Activity
1
फ़र॰ 22
3611
1
दिस॰ 24
2544
0
दिस॰ 21
2199
4
मार्च 15
11866
2
अग॰ 24
9601