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":
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?
will you share your module for community
Hi,
Refer the app:
https://apps.odoo.com/apps/modules/16.0/stock_picking_back2draft/