This question has been flagged
1944 Views

Hi,

I am trying to fire an action when an incoming shipment gets the state 'Received'. For a reason I don't understand, my basic function just doesn't start. I am working in the Warehouse section - Incoming Shipments. When a shipment gets the state 'Received', I want to do a number of actions. Here's my XML code:

<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
        <record id="stock_picking_in_inherit_test" model="ir.ui.view">
            <field name="name">Incoming Picking Inherited</field>
            <field name="model">stock.picking.in</field>
            <field name="inherit_id" ref="stock.view_picking_form"/>
            <field name="arch" type="xml">
                <xpath expr="//field[@name='state']" position="attributes">
                    <attribute name="on_change">on_change_state(purchase_id, context)</attribute>
                </xpath>
            </field>
        </record>       
    </data>
</openerp>

and here's the Python code:

class stock_picking_in(osv.osv):
    _inherit = "stock.picking.in"

    def on_change_state(self, cr, uid, ids, purchase_id, context=None):
        print 'purchase_id ', purchase_id
        print 'ids', ids

stock_picking_in()

I've done similar things a few times before, but in this case I don't see anything printed. I've put a breakpoint at the last print command, but the function 'on_change_state' just doesn't start.

Any suggestions?

Bart

Avatar
Discard