Hi,
how to auto validate stock.picking from API python / python code? i call the function "button_validate" in stock.picking model, but it doesn't work. Below my python code:
sales_order_object = request.env['sale.order'].search(
[('x_studio_agsi_order_id', '=', new_delivery_order['order_id'])])
for picking in sales_order_object.picking_ids:
picking.action_assign()
picking.action_confirm()
for move in picking.move_lines.filtered(
lambda m: m.state not in ["done", "cancel"]
):
rounding = move.product_id.uom_id.rounding
if (
float_compare(
move.quantity_done,
move.product_qty,
precision_rounding=rounding,
)
== -1
):
for move_line in move.move_line_ids:
move_line.qty_done = move_line.product_uom_qty
picking.button_validate()
Thanks