Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
5 Odpovědi
13870 Zobrazení

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?

Avatar
Zrušit

will you share your module for community

Nejlepší odpověď

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


Avatar
Zrušit
Nejlepší odpověď

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

stock_picking_back_to_draft

Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
1
dub 16
5155
1
lis 24
18665
5
pro 24
33167
0
srp 22
12023
1
dub 20
5118