From ea416d2aa6f87f30b9f7464569ec6cfc425342be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Br=C3=BCck?= Date: Thu, 4 Jul 2024 19:31:50 +1000 Subject: [PATCH] Wizzard write qty and confirm order if packaging fits --- .../wizard/sale_max_qty_chooser.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/nfu_sale_product_min_max_qty/wizard/sale_max_qty_chooser.py b/nfu_sale_product_min_max_qty/wizard/sale_max_qty_chooser.py index 6063b27..04c48a0 100644 --- a/nfu_sale_product_min_max_qty/wizard/sale_max_qty_chooser.py +++ b/nfu_sale_product_min_max_qty/wizard/sale_max_qty_chooser.py @@ -43,3 +43,12 @@ class SaleMaxQtyChooser(models.TransientModel): ) return res """ + + for sale_order in self.sale_order_ids: + can_confirm = True + for line in self.sale_max_qty_ids.filtered(lambda line: line.sale_line_id.order_id == sale_order): + line.sale_line_id.write({"product_uom_qty": line.qty}) + if not line.quantity_fits_packaging: + can_confirm = False + if can_confirm: + sale_order.action_confirm()