This question has been flagged
4 Replies
4007 Views

Hi,

Is there a way that I could make that when I cancel an invoice the number doesn't hide?

I check the action_cancel_invoice action in the button cancel but I don't know how to achieve this.

I'm trying so it looks like in Odoo 13 where if you cancel an invoice the number doesn't hide.

Thank you in advance.

EDIT: The answer is in the comments

Avatar
Discard
Best Answer

Hello Duvan, 

By default, in Odoo Version 12 when you will cancel an invoice then you cannot see the invoice number. 

To unhide the invoice number in Odoo V12 you need Inherit invoice_form; code to achieve this is

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

            <field name="name">invoice.form.draft.inherit</field>

            <field name="model">account.invoice</field>

            <field name="inherit_id" ref="account.invoice_form"/>

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

             <field name='number' position="replace">

              <field name="number" readonly="1" class="oe_inline"/>

              <field>

            </field>

        </record>

Hope your query is resolved by now. If you are stuck anywhere then feel free to ask. 

Regards

Anisha Bahukhandi

Technical Content Writer

Avatar
Discard
Author

Thank you for your answer, I tried as you said but the number still doesn't show, I have tried changing the attrs invisible of the view but I can't show the number when the state is cancelled.

Kindly update the code

actually "move_name" shows the invoice number

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

<field name="name">invoice.form.draft.inherit</field>

<field name="model">account.invoice</field>

<field name="inherit_id" ref="account.invoice_form"/>

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

<field name='number' position="after">

<field name="move_name" readonly="1" class="oe_inline" attrs="{'invisible': [('state','!=', 'cancel')]}"/>

<field>

</field>

</record>

Author

Thank you so much for your help! It works like that.