This question has been flagged

In OpenERP 7.0 i've noticed that in both the Sale Orders and Purchase Orders the button linking to the Shipment/Picking dissapears once the order is complete (In "Done" state, once the shipment has been sent and the invoice paid), and there is no way to see or open the associated Shipment/Picking from the Sale Orders and Purchase Orders, I have to mannually go to the Warehouse module and search there. I find this very counterproductive. 

Is this the normal behaviour? or a bug? I've even created a new  clean database to see if it was a problem with my production database, but I still run into the same problem...

Avatar
Discard
Author

Something like states="approved,done"

Best Answer

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.

Avatar
Discard
Author Best Answer

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"/>

Avatar
Discard