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

Hi,

I want to set to draft the stock picking out when state is cancel. How can I do that?

I know that is possible create a button and set the state to draft, but in this particulary case change the state isn't enough because it has movement of products in stock move and in stock inventory.

I have created a button "Set to Confirmed":

image description

This button call this function:

def set_to_confirmed(self, cr, uid, ids, context=None):
    """ Changes picking state to delivered.
    @return: True
    """      
    for stock_picking_out_ids in ids:

        stock_picking_out_obj = self.browse(cr, uid, stock_picking_out_ids, context)
        move_lines = stock_picking_out_obj.move_lines

        for move_lines_obj in move_lines:

            self.pool.get('stock.move').write(cr, uid, move_lines_obj.id, {'state': 'confirmed'} )

    self.write(cr, uid, ids, {'state': 'confirmed'})
    return True

This works and change the state to confirmed but after this I can't continue the workflow, in others words, the button that appears in this state "Check Availability" and "Force Availability" doesn't work and give me a error:

Not enough stock, unable to reserve the products

Any ideia the steps that I have to do to this functionality works?

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

will you share your module for community

Câu trả lời hay nhất

Hi Bati,

thank you for sharing stock_picking_back_to_draft link. I wish to try this, however the link takes to an error page. Can you post the correct link ?

Thanks


Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

I think the correct answer to the question described in the title is: using a module like

stock_picking_back_to_draft

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 4 16
5239
1
thg 11 24
18829
5
thg 12 24
33345
0
thg 8 22
12190
1
thg 4 20
5204