Odoo Help


Triggering an action when an incoming shipment is 'received'

Bart Criel
on 3/9/14, 5:49 PM 850 views


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

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


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?


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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

0 follower(s)


Asked: 3/9/14, 5:49 PM
Seen: 850 times
Last updated: 3/16/15, 8:10 AM