diff --git a/product_combo_pack/__manifest__.py b/product_combo_pack/__manifest__.py index d36a2a47a..54094a417 100644 --- a/product_combo_pack/__manifest__.py +++ b/product_combo_pack/__manifest__.py @@ -23,7 +23,7 @@ { 'name': 'Product Pack', - 'version': '15.0.1.0.0', + 'version': '15.0.1.1.1', 'summary': 'Manage Products as Pack', 'description': 'Manage Products as Pack', 'category': 'Sales', diff --git a/product_combo_pack/models/product_form.py b/product_combo_pack/models/product_form.py index 0bba24d0c..dd926e242 100644 --- a/product_combo_pack/models/product_form.py +++ b/product_combo_pack/models/product_form.py @@ -30,7 +30,8 @@ class ProductPack(models.Model): def default_pack_location(self): company_user = self.env.company - warehouse = self.env['stock.warehouse'].search([('company_id', '=', company_user.id)], limit = 1) + warehouse = self.env['stock.warehouse'].search([( + 'company_id', '=', company_user.id)], limit=1) if warehouse: return warehouse.lot_stock_id.id @@ -62,15 +63,16 @@ class ProductPack(models.Model): def write(self, values): super(ProductPack, self).write(values) - if self.is_pack: - if not self.pack_products_ids: - raise UserError(_( - 'You need to add atleast one product in the Pack...!')) - if self.type == 'service': - raise UserError(_('You cannot define a pack product as a service..!')) + for rec in self: + if rec.is_pack: + if not rec.pack_products_ids: + raise UserError(_( + 'You need to add atleast one product in the Pack...!')) + if rec.type == 'service': + raise UserError(_('You cannot define a pack product as a service..!')) def update_price_product(self): - self.lst_price = self.pack_price + self.list_price = self.pack_price def get_quantity(self): total_quantity = 1 @@ -93,7 +95,8 @@ class ProductPack(models.Model): product_id = len(self.product_variant_ids) == 1 and self.product_variant_id.id location_id = self.pack_location_id.id if not location_id: - warehouse = self.env['stock.warehouse'].search([('company_id', '=', company_user.id)], limit = 1) + warehouse = self.env['stock.warehouse'].search([( + 'company_id', '=', company_user.id)], limit = 1) location_id = warehouse.lot_stock_id.id if not location_id: raise UserError(_( @@ -108,9 +111,10 @@ class ProductPack(models.Model): def change_quantity_based_on_location(self): for line in self.pack_products_ids: stock_quant = self.env['stock.quant'].search( - [('product_id', '=', line.product_id.id), ('location_id', '=', self.pack_location_id.id)]) + [('product_id', '=', line.product_id.id), ( + 'location_id', '=', self.pack_location_id.id)]) if stock_quant: line.total_available_quantity = stock_quant.quantity else: - line.total_available_quantity = stock_quant.quantity \ No newline at end of file + line.total_available_quantity = stock_quant.quantity diff --git a/product_combo_pack/security/ir.model.access.csv b/product_combo_pack/security/ir.model.access.csv index b737db5c9..26465c7e6 100644 --- a/product_combo_pack/security/ir.model.access.csv +++ b/product_combo_pack/security/ir.model.access.csv @@ -1,2 +1,3 @@ id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink -access_pack_products,access.pack.products,model_pack_products,base.group_user,1,1,1,1 \ No newline at end of file +access_pack_products,access.pack.products,model_pack_products,base.group_user,1,1,1,1 +select_product_pack,access.select.product.pack,model_select_product_pack,base.group_user,1,1,1,1