When i am deleting a record in postgresql DB from odoo front-end and if again i am creating a new record then the primary key index changed like if i am deleting id=2 record and if again creating new record ,then it stores id =3.. How ??
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
Actually, Odoo automatically apply sequence on ID field. This is done by _sequence attribute on model and it's apply on 'ID' field here https://github.com/odoo/odoo/blob/12.0/odoo/models.py#L3630
If you check your table in Postgresql then ID column have description like id integer NOT NULL DEFAULT nextval('model_name_id_seq'::regclass). Here, nextval will execute sequence which will auto increment index.
You can read in detail what is exact nextval function? https://www.postgresql.org/docs/current/sql-createsequence.html
You can use _sequence attribute on model to change sequence field.
Thank you Jigar Patel
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ść | |
---|---|---|---|---|
|
0
lis 21
|
3064 | ||
|
0
lut 25
|
1569 | ||
|
2
sty 25
|
8178 | ||
Odoo backend to Google Data Studio
Rozwiązane
|
|
2
sty 24
|
10138 | |
|
3
paź 23
|
8657 |