From c1a6a9613c3ee3bd5d163a09bbb3d20994fbdfe6 Mon Sep 17 00:00:00 2001 From: younes Date: Sun, 4 May 2025 13:15:06 +0100 Subject: [PATCH] correct asset qty --- .../purchase_custom_stock/models/purchase_request.py | 6 ++++-- .../purchase_custom_stock/views/purchase_request.xml | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/odex25_purchase/purchase_custom_stock/models/purchase_request.py b/odex25_purchase/purchase_custom_stock/models/purchase_request.py index 2c905ffe4..7dbfd7e0c 100644 --- a/odex25_purchase/purchase_custom_stock/models/purchase_request.py +++ b/odex25_purchase/purchase_custom_stock/models/purchase_request.py @@ -191,14 +191,16 @@ class PurchaseRequest(models.Model): lambda line: line.product_id.type == 'consu' and not line.product_id.asset_ok) non_storable_product = self.line_ids - storable_product_lines - asset_product_lines - consu_product_not_asset_lines if any(storable_product_lines.filtered(lambda line: line.available_qty > 0)) or any( - consu_product_not_asset_lines.filtered(lambda line: line.available_qty > 0)): + consu_product_not_asset_lines.filtered(lambda line: line.available_qty > 0)) or any( + asset_product_lines.filtered(lambda line: line.available_qty > 0)): available = True if any(storable_product_lines.filtered( lambda store_line: store_line.qty > store_line.available_qty)) or any( asset_product_lines.filtered(lambda asset_line: asset_line.qty > asset_line.available_qty)) or any( consu_product_not_asset_lines.filtered(lambda asset_line: asset_line.qty > asset_line.available_qty)): if self.has_asset_product_line: - if not self.asset_request_line_ids and any(asset_product_lines.filtered(lambda line: line.available_qty > 0)): + if not self.asset_request_line_ids and any( + asset_product_lines.filtered(lambda line: line.available_qty > 0)): raise Warning(_('Please Select an asset')) self.create_asset_operation() context = {} diff --git a/odex25_purchase/purchase_custom_stock/views/purchase_request.xml b/odex25_purchase/purchase_custom_stock/views/purchase_request.xml index edad9c9aa..33cd7e285 100644 --- a/odex25_purchase/purchase_custom_stock/views/purchase_request.xml +++ b/odex25_purchase/purchase_custom_stock/views/purchase_request.xml @@ -35,7 +35,7 @@