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.

0

Triggering an action when an incoming shipment is 'received'

By
Bart Criel
on 3/9/14, 5:52 PM 504 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

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: 3/9/14, 5:52 PM
Seen: 504 times
Last updated: 3/16/15, 8:10 AM