I need to get products of sale order which product_uom_qty does not match qty_delivered but the stock.picking of this product should be validated by clicking on validate button as shown in the following screen:
Is the delivery button shown only when the sale order be in the sale state?
and how can i do the condition which to know that the Validating of stock.picking is done of this product?
I did the following code but i want to know how can i add the above condition
def action_print_errors(self):
sales = self.env['sale.order'].search([('state','=','sale')])
# Convert sales variable to a list of dictionaries
sales_list = []
for sale in sales:
sale_dict = {
'id': sale.id,
'name': sale.name,
'order_line': []
}
for line in sale["order_line"]:
line_dict = {
'id': line.id,
'product_id': line.product_id.id,
'product_name': line.product_id.name,
'product_uom_quantity':line.product_id.product_uom_quantity,
'qty_delivered':line.product_id.qty_delivered,
'different':line.product_id.product_uom_quantity-line.product_id.qty_delivered
}
if line_dict['product_uom_quantity'] !=line_dict['qty_delivered']:
sale_dict['order_line'].append(line_dict)
sales_list.append(sale_dict)
I need to make sure that the product stock picking is validated