Odoo Help

0

1
2 Answers
1
Richmond Ang
10/07/14, 12:52

If you go to /addons/purchase/ there is a file called stock_view.xml and look for the code below in bold.

        <record id="purchase_order_2_stock_picking" model="ir.ui.view">
            <field name="name">Purchase Picking Inherited</field>
            <field name="model">purchase.order</field>
            <field name="inherit_id" ref="purchase.purchase_order_form"/>
            <field name="arch" type="xml">
                 <xpath expr="//div[contains(@class, 'oe_title')]" position="before">
                    <div class="oe_right oe_button_box" name="buttons">
                        <button type="object"
                            name="view_picking"
                            string="Incoming Shipments" states="approved"/>

                        <button type="object"  name="invoice_open"
                            string="Invoices" attrs="{'invisible': [('state', '=', 'draft')]}"/> 
                    </div>
                </xpath>
            </field>
        </record>

You can inherit this view and change the states in which it is shown.

0
Santi
11/07/14, 05:51

Just what I was looking for! Thanks Richmond!

For anyone else trying to figure out how to accomplish the same for Sale Orders, you must change the following line in:

model: sale.order

view: sale.order.form

inherit_id: sale_stock.view_order_form_inherit

from: 

<button name="action_view_delivery" string="View Delivery Order" type="object" class="oe_highlight" attrs="{'invisible': ['|','|','|',('picking_ids','=',False),('picking_ids','=',[]), ('state', 'not in', ('progress','manual')),('shipped','=',True)]}" groups="base.group_user"/>

to: 

<button name="action_view_delivery" string="View Delivery Order" type="object" class="oe_highlight" attrs="{'invisible': ['|','|','|',('picking_ids','=',False),('picking_ids','=',[]), ('state', 'not in', ('progress','manual','done'))]}" groups="base.group_user"/>

Ask a Question
Writer
Keep Informed
1 follower(s)
About This Community

This platform 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.

Register
Odoo Training Center

Access to our eLearning platform and experience all Odoo Apps through learning videos, use cases and quizzes.

Test it now