콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
3 답글
6149 화면

Every time I create a new db the id of a module changes. Since I would like to create some server actions linked to my xml I need to put a specific id (for both server actions AND models).

Populating the ID "manually" isn't an option, because those values are used on various places and I fear there is a great risk of using the same ID twice.
Is there a way to reserve an unique ID on creation stage trough python or xml without mess up the DB? 

아바타
취소
작성자 베스트 답변

Solved the server action issue!

The problem is how do you create a server action: if you create it by GUI then you don't have an external ID but just an ID number, while if you create via XML you can use the ID name as a button name and Odoo will assign automatically an ID number.

I have a server action called rest_checkout_send, then on button name I wrote

<button name="%(rest_checkout_send)d" string="Enviar" type="action" attrs="{'invisible':[('status','=','1')]}"/> 

and it was automatically update in

<button name="723" string="Enviar" type="action" attrs="{'invisible':[('status','=','1')]}"/>           	   

 That's simply perfect!

 

아바타
취소
베스트 답변

Federico,

It's not possible to keep same ID, because sometimes you install "xyz" first and sometimes "abc" first. Obviously ID will be changed every time. It's simple logic.

However External ID never gets changed. ( That is why it is stands for) Why you are not thinking for to use "External ID" instead of "ID" ???

Are you aware about "External ID" ?

아바타
취소
작성자

Thanks for your reply.
I know the logic behind the ID field, for that reason I'm looking for a way to reserve numbers. And yes, I'm aware of external ID but it doesn't apply to server actions: as far as I know is just for models.
If you look on ir.model table you can just declare the model name (crud_model_name) and the relative ID (crud_model_id). This means every time I install my custom module I need to edit the xml view and correct the IDs of server actions. Am I missing something?

작성자

Solved!

관련 게시물 답글 화면 활동
5
12월 19
7850
0
7월 15
3945
1
6월 15
6245
0
6월 15
120
1
3월 15
3918