From 91e4f8c8a58193787a877ecdfa359cd52c71701d Mon Sep 17 00:00:00 2001 From: AjmalCybro Date: Sat, 30 Sep 2023 11:43:15 +0800 Subject: [PATCH] Sep 30 : [FIX] Bug Fixed 'product_combo_pack' --- product_combo_pack/models/product_template.py | 4 +++- product_combo_pack/views/product_form_views.xml | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/product_combo_pack/models/product_template.py b/product_combo_pack/models/product_template.py index 4d70a52e7..2669560c9 100644 --- a/product_combo_pack/models/product_template.py +++ b/product_combo_pack/models/product_template.py @@ -93,6 +93,7 @@ class ProductPack(models.Model): """Update the list price of the product with the pack price.""" self.list_price = self.pack_price + def get_quantity(self): """Calculate the pack quantity based on the availability of pack products.""" @@ -125,12 +126,13 @@ class ProductPack(models.Model): if not location_id: raise UserError(_( 'You need to select the location to update the pack quantity...!')) - self.env['stock.quant'].with_context(inventory_mode=True).sudo().create( + new_quantity = self.env['stock.quant'].with_context(inventory_mode=True).sudo().create( { 'product_id': product_id, 'location_id': location_id, 'inventory_quantity': self.pack_quantity, }) + new_quantity.action_apply_inventory() @api.onchange('pack_location_id') def change_quantity_based_on_location(self): diff --git a/product_combo_pack/views/product_form_views.xml b/product_combo_pack/views/product_form_views.xml index f8a572a49..7902029a0 100644 --- a/product_combo_pack/views/product_form_views.xml +++ b/product_combo_pack/views/product_form_views.xml @@ -47,7 +47,9 @@