This question has been flagged
4 Replies
5399 Views

I'm using odoo 8 and already added new state "On Delivery" to stock.picking model.

How can i change the state from the Default state "Ready to Transfer" to my new state "On Delivery" ?

Already try using self.write(cr,uid,ids,{'state':'on_delivery'}), not working. 

write method (inherit stock.picking):

    def do_delivery(self, cr, uid, ids, context=None):

        self.write(cr, uid, ids, {'state':'on_delivery'}) #change state to On Delivery in Odoo

        return True

Also modified the existing workflow, not working as well

workflow approach(sale.order.basic):

<?xml version="1.0" encoding="utf-8"?>

<openerp>

    <data>

        <record id="act_delivery" model="workflow.activity">

            <field name="wkf_id" ref="sale.wkf_sale"/>

            <field name="name">OnDelivery</field>

            <field name="kind">function</field>

            <field name="action">do_delivery()</field>

        </record>


        <record id="trans_ship_delivery" model="workflow.transition">

            <field name="act_from" ref="sale.act_ship"/>

            <field name="act_to" ref="act_delivery"/>

            <field name="signal">do_delivery_button</field>

        </record>


        <record id="trans_ship_delivered" model="workflow.transition">

            <field name="act_from" ref="act_delivery"/>

            <field name="act_to" ref="sale.act_ship_end"/>

        </record>

    </data>

</openerp>

Any helps? 


Thanks in advance.

Avatar
Discard

I think that the correct change in the workflow would give a success result. Pls provide us with the changes you did in the workflow so one can lend a hand

Author

Updated the questions. Include write method and workflow.

Author

any news?

Author Best Answer

I just used cr.execute to change the state.

Many thanks.


Avatar
Discard