Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
1 Balas
6615 Tampilan

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?

Avatar
Buang
Penulis Jawaban Terbai

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>

Avatar
Buang
Post Terkait Replies Tampilan Aktivitas
4
Des 23
19831
2
Jul 21
9918
1
Mei 15
3805
6
Jul 24
45694
2
Jun 17
5313