跳至内容
菜单
此问题已终结
4 回复
6536 查看

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

编写者

Updated the questions. Include write method and workflow.

编写者

any news?

编写者 最佳答案

I just used cr.execute to change the state.

Many thanks.


形象
丢弃
相关帖文 回复 查看 活动
0
2月 23
2506
0
3月 20
2612
2
10月 15
5784
2
5月 25
4826
1
4月 25
1116