Browse Source

Sep 30 : [FIX] Bug Fixed 'product_combo_pack'

pull/284/head
AjmalCybro 2 years ago
parent
commit
91e4f8c8a5
  1. 4
      product_combo_pack/models/product_template.py
  2. 4
      product_combo_pack/views/product_form_views.xml

4
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):

4
product_combo_pack/views/product_form_views.xml

@ -47,7 +47,9 @@
<field name="pack_price"/>
<button name="update_price_product"
type="object"
string="Update Price"/>
string="Update Price ">
</button>
</div>
</group>
<group string="Pack Quantity"

Loading…
Cancel
Save