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?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Księgowość
- Zapasy
- PoS
- Project
- MRP
To pytanie dostało ostrzeżenie
Hello, would you by any chance know the python code to use ?
Thanks a lot.
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.")]
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
Podoba Ci się ta dyskusja? Dołącz do niej!
Stwórz konto dzisiaj, aby cieszyć się ekskluzywnymi funkcjami i wchodzić w interakcje z naszą wspaniałą społecznością!
Zarejestruj sięPowiązane posty | Odpowiedzi | Widoki | Czynność | |
---|---|---|---|---|
|
1
lut 22
|
3580 | ||
Restrict Studio ,to users
Rozwiązane
|
|
1
gru 24
|
2505 | |
|
0
gru 21
|
2199 | ||
|
4
mar 15
|
11849 | ||
|
2
sie 24
|
9516 |