Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
6627 มุมมอง

I've created a new model. I've also created a form for it. So, if I click on the create button or on any record of this model in the tree view, my form is opened.

However, my form has no create button. Why? I don't know, but I've fixed it creating my own create button. It works, but now, if I open a record clicking on it (for reading), the create button I've made is there, and it doesn't work.

I want to make it disappear, but only when I open the form for reading (after clicking on a record in the tree view). Can I do this?

If not, how can I see the create button in my form without creating it?

อวตาร
ละทิ้ง
ผู้เขียน คำตอบที่ดีที่สุด

Well, finally, a kind co-worker gave me a trick to solve this problem.

May be there are righter ways to manage what I want, but this works perfectly:

I left my create button, which is inside a footer. What I did is to add a attrs tag to this footer, I made it invisible if the ID of the record is different from False. If I'm creating a record, it doesn't have an ID yet, but if I'm reading, it does. Obviously I also had to add the field ID to the fields shown in the form, otherwise it couldn't be used in the attrs tag.

<footer attrs="{'invisible': [('id','!=',False)]}">
    <button name="create_rplc" string="Create" type="object"
        class="oe_highlight" />
    or
    <button string="Discard" class="oe_link" special="cancel" />
</footer>

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
How to create my own view? แก้ไขแล้ว
4
ธ.ค. 23
19833
Detail Form View with SQL View Model แก้ไขแล้ว
2
ก.ค. 21
9920
1
พ.ค. 15
3805
6
ก.ค. 24
45709
2
มิ.ย. 17
5315