Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
4 Trả lời
6629 Lượt xem

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.

Ảnh đại diện
Huỷ bỏ

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

Tác giả

Updated the questions. Include write method and workflow.

Tác giả

any news?

Tác giả Câu trả lời hay nhất

I just used cr.execute to change the state.

Many thanks.


Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 2 23
2573
0
thg 3 20
2657
2
thg 10 15
5864
2
thg 5 25
4972
1
thg 4 25
1185