Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

1

How to have button create in Supplier Invoices but not in Customer Invoices?

By
Anabela Damas
on 2/3/14, 10:51 AM 1,294 views

Hi,

I wounder if it is possible to have the button create in tree and form of Supplier Invoices, but not in Customer Invoices?

I removed but it disappear from both, every change that I make I always affect both...

To remove I have this code in addons/my_module/account_view.xml:

      <record id="invoice_tree_inherit" model="ir.ui.view">
        <field name="name">account.invoice.tree.inherit</field>
        <field name="model">account.invoice</field>
        <field name="inherit_id" ref="account.invoice_tree"/>
        <field name="arch" type="xml"> 
            <xpath expr='//tree[@string="Invoice"]' position='attributes'>
        <attribute name="create">false</attribute>    
    </xpath>
        </field>
    </record>      


    <record id="invoice_form_change" model="ir.ui.view">
        <field name="name">account.invoice.form.change</field>
        <field name="model">account.invoice</field>
        <field name="inherit_id" ref="account.invoice_form"/>
        <field name="priority">1000</field>
        <field name="arch" type="xml">
            <xpath expr='//form[@string="Invoice"]' position='attributes'>
        <attribute name="create">false</attribute>
        <!--<attribute name="edit">false</attribute>-->
    </xpath>
              .......SEVERAL OTHER CHANGES......
        </field>
    </record>

To have the button create just in Supplier Invoices I'va tryed like this:

<record id="invoice_tree_inherit_supplier" model="ir.ui.view">
        <field name="name">account.invoice.tree.inherit</field>
        <field name="model">account.invoice</field>
        <field name="inherit_id" ref="invoice_tree_inherit"/>
        <field name="arch" type="xml"> 
            <xpath expr='//tree[@string="Invoice"]' position='attributes'>
        <attribute name="create">true</attribute>    
    </xpath>
        </field>
    </record>    

<record id="action_invoice_tree_supplier" model="ir.actions.act_window.view">
        <field eval="1" name="sequence"/>
        <field name="view_mode">tree</field>
        <field name="view_id" ref="invoice_tree_inherit_supplier"/>
        <field name="act_window_id" ref="account.action_invoice_tree2"/>
    </record>

I notice that the last change that I make is the change that both have.... I can't change just one ...

1
Luís
On 2/10/14, 12:57 PM

Hi,

You need create a new view and after this create a action that have a reference for view that you have created. Something like this:

<record id="action_invoice_supplier" model="ir.actions.act_window.view">
        <field eval="2" name="sequence"/>
        <field name="view_mode">tree</field>
        <field name="view_id" ref="invoice_supplier_tree"/>
        <field name="act_window_id" ref="account.action_invoice_tree2"/>   
</record>

I hope this helps.

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

Asked: 2/3/14, 10:51 AM
Seen: 1294 times
Last updated: 3/16/15, 8:10 AM