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

Change state to custom new state in stock.picking Odoo 8

By
ahmad
on 12/22/15, 8:46 PM 805 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.

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

Tarek Mohamed Ibrahim
on 12/22/15, 11:38 PM

Updated the questions. Include write method and workflow.

ahmad
on 12/22/15, 11:44 PM

any news?

ahmad
on 1/19/16, 8:01 PM
0
ahmad
On 1/21/16, 3:19 AM

I just used cr.execute to change the state.

Many thanks.


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

1 follower(s)

Stats

Asked: 12/22/15, 8:46 PM
Seen: 805 times
Last updated: 1/21/16, 3:19 AM