Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
3 Odpowiedzi
149 Widoki

I have this code in my view:

<record id="view_packing_order_form" model="ir.ui.view">

        <field name="name">packing.order.form</field>

        <field name="model">packing.order</field>

        <field name="arch" type="xml">

            <form string="Packing Order">

                <sheet>

​...

​ <footer>

                        <button name="action_start_packing"

                                type="object"

                                string="Start packing"

                                class="btn-primary"

                                invisible="state != 'draft'"/>

                        <button name="action_cancel_order"

                                type="object"

                                string="Cancel"

                                class="btn-secondary"

                                invisible="state == 'cancel'"/>

                    </footer>

And this code in my model:

def action_start_packing(self):

        self.write({'state': 'in_progress'})

def action_cancel_order(self):

        return {

            'type': 'ir.actions.act_window',

            'res_model': 'packing.order.cancel.reason.wizard',

            'view_mode': 'form',

            'target': 'new',

            'context': {'active_id': self.id},

        }

I get no errors but I see no buttons where they should be (in draft packing order).

How can I fix it?



Awatar
Odrzuć
Najlepsza odpowiedź

Following these steps should make it work:

  1. Place this inside your <sheet> tag: <field name="state" invisible="1"/>
  1. After that, upgrade the exact module where this code is applied.


Awatar
Odrzuć
Autor Najlepsza odpowiedź

Thank you. It seems to work

Awatar
Odrzuć
Najlepsza odpowiedź

Thank Hasan, I got the same problem, it's helpful.

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
4
sie 25
1393
1
cze 25
1034
1
maj 25
998
1
maj 25
1122
1
kwi 25
1572