Browse Source

Nov 3 : [FIX] Bug Fixed 'product_combo_pack'

pull/295/head
AjmalCybro 2 years ago
parent
commit
4073ace456
  1. 0
      product_combo_pack/README.rst
  2. 0
      product_combo_pack/__init__.py
  3. 0
      product_combo_pack/__manifest__.py
  4. 0
      product_combo_pack/doc/RELEASE_NOTES.md
  5. 0
      product_combo_pack/models/__init__.py
  6. 0
      product_combo_pack/models/pack_products.py
  7. 4
      product_combo_pack/models/product_template.py
  8. 28
      product_combo_pack/models/sale_order.py
  9. 0
      product_combo_pack/security/ir.model.access.csv
  10. 0
      product_combo_pack/static/description/assets/icons/check.png
  11. 0
      product_combo_pack/static/description/assets/icons/chevron.png
  12. 0
      product_combo_pack/static/description/assets/icons/cogs.png
  13. 0
      product_combo_pack/static/description/assets/icons/consultation.png
  14. 0
      product_combo_pack/static/description/assets/icons/ecom-black.png
  15. 0
      product_combo_pack/static/description/assets/icons/education-black.png
  16. 0
      product_combo_pack/static/description/assets/icons/hotel-black.png
  17. 0
      product_combo_pack/static/description/assets/icons/license.png
  18. 0
      product_combo_pack/static/description/assets/icons/lifebuoy.png
  19. 0
      product_combo_pack/static/description/assets/icons/manufacturing-black.png
  20. 0
      product_combo_pack/static/description/assets/icons/pos-black.png
  21. 0
      product_combo_pack/static/description/assets/icons/puzzle.png
  22. 0
      product_combo_pack/static/description/assets/icons/restaurant-black.png
  23. 0
      product_combo_pack/static/description/assets/icons/service-black.png
  24. 0
      product_combo_pack/static/description/assets/icons/trading-black.png
  25. 0
      product_combo_pack/static/description/assets/icons/training.png
  26. 0
      product_combo_pack/static/description/assets/icons/update.png
  27. 0
      product_combo_pack/static/description/assets/icons/user.png
  28. 0
      product_combo_pack/static/description/assets/icons/wrench.png
  29. 0
      product_combo_pack/static/description/assets/misc/categories.png
  30. 0
      product_combo_pack/static/description/assets/misc/check-box.png
  31. 0
      product_combo_pack/static/description/assets/misc/compass.png
  32. 0
      product_combo_pack/static/description/assets/misc/corporate.png
  33. 0
      product_combo_pack/static/description/assets/misc/customer-support.png
  34. 0
      product_combo_pack/static/description/assets/misc/cybrosys-logo.png
  35. 0
      product_combo_pack/static/description/assets/misc/features.png
  36. 0
      product_combo_pack/static/description/assets/misc/logo.png
  37. 0
      product_combo_pack/static/description/assets/misc/pictures.png
  38. 0
      product_combo_pack/static/description/assets/misc/pie-chart.png
  39. 0
      product_combo_pack/static/description/assets/misc/right-arrow.png
  40. 0
      product_combo_pack/static/description/assets/misc/star.png
  41. 0
      product_combo_pack/static/description/assets/misc/support.png
  42. 0
      product_combo_pack/static/description/assets/misc/whatsapp.png
  43. 0
      product_combo_pack/static/description/assets/modules/1.png
  44. 0
      product_combo_pack/static/description/assets/modules/2.png
  45. 0
      product_combo_pack/static/description/assets/modules/3.png
  46. 0
      product_combo_pack/static/description/assets/modules/4.png
  47. 0
      product_combo_pack/static/description/assets/modules/5.gif
  48. 0
      product_combo_pack/static/description/assets/modules/6.png
  49. 0
      product_combo_pack/static/description/assets/screenshots/1.png
  50. 0
      product_combo_pack/static/description/assets/screenshots/2.png
  51. 0
      product_combo_pack/static/description/assets/screenshots/3.png
  52. 0
      product_combo_pack/static/description/assets/screenshots/4.png
  53. 0
      product_combo_pack/static/description/assets/screenshots/5.png
  54. 0
      product_combo_pack/static/description/assets/screenshots/6.png
  55. 0
      product_combo_pack/static/description/assets/screenshots/7.png
  56. 0
      product_combo_pack/static/description/assets/screenshots/hero.gif
  57. 0
      product_combo_pack/static/description/banner.png
  58. 0
      product_combo_pack/static/description/icon.png
  59. 0
      product_combo_pack/static/description/index.html
  60. 4
      product_combo_pack/views/product_form_views.xml
  61. 2
      product_combo_pack/views/sale_order_views.xml

0
product_combo_pack/README.rst

0
product_combo_pack/__init__.py

0
product_combo_pack/__manifest__.py

0
product_combo_pack/doc/RELEASE_NOTES.md

0
product_combo_pack/models/__init__.py

0
product_combo_pack/models/pack_products.py

4
product_combo_pack/models/product_template.py

@ -93,7 +93,6 @@ 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."""
@ -126,13 +125,12 @@ class ProductPack(models.Model):
if not location_id:
raise UserError(_(
'You need to select the location to update the pack quantity...!'))
new_quantity = self.env['stock.quant'].with_context(inventory_mode=True).sudo().create(
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):

28
product_combo_pack/models/sale_order.py

@ -21,27 +21,35 @@
#
################################################################################
from odoo import api, fields, models
from collections import defaultdict
class SalePack(models.Model):
"""Model for extending the sale order to include a selection of packs."""
_inherit = 'sale.order'
product_pack_id = fields.Many2one('product.product', string='Select Pack',
domain=[('is_pack', '=', True)],
help='The selected pack product for'
' the sale order.')
product_pack_id = fields.Many2many('product.product', string='Select Pack',
domain=[('is_pack', '=', True)],
help='The selected pack product for'
' the sale order.')
@api.onchange('product_pack_id')
def onchange_product_pack_id(self):
"""Perform actions when the selected pack product changes."""
if self.product_pack_id:
self.order_line = [(0, 0, {
'product_id': self.product_pack_id.id,
'name': self.product_pack_id.name,
'product_uom_qty': 1,
'price_unit': self.product_pack_id.list_price,
})]
new_order_lines = []
for rec in self.product_pack_id:
product_already_added = any(
line.product_id.id == rec._origin.id for line in
self.order_line)
if not product_already_added:
new_order_lines.append((0, 0, {
'product_id': rec.id,
'name': rec.name,
'product_uom_qty': 1,
'price_unit': rec.pack_price,
}))
self.order_line = new_order_lines
elif not self.product_pack_id:
self.order_line = [(5, 0, 0)]

0
product_combo_pack/security/ir.model.access.csv

0
product_combo_pack/static/description/assets/icons/check.png

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

0
product_combo_pack/static/description/assets/icons/chevron.png

Before

Width:  |  Height:  |  Size: 310 B

After

Width:  |  Height:  |  Size: 310 B

0
product_combo_pack/static/description/assets/icons/cogs.png

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

0
product_combo_pack/static/description/assets/icons/consultation.png

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

0
product_combo_pack/static/description/assets/icons/ecom-black.png

Before

Width:  |  Height:  |  Size: 576 B

After

Width:  |  Height:  |  Size: 576 B

0
product_combo_pack/static/description/assets/icons/education-black.png

Before

Width:  |  Height:  |  Size: 733 B

After

Width:  |  Height:  |  Size: 733 B

0
product_combo_pack/static/description/assets/icons/hotel-black.png

Before

Width:  |  Height:  |  Size: 911 B

After

Width:  |  Height:  |  Size: 911 B

0
product_combo_pack/static/description/assets/icons/license.png

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

0
product_combo_pack/static/description/assets/icons/lifebuoy.png

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

0
product_combo_pack/static/description/assets/icons/manufacturing-black.png

Before

Width:  |  Height:  |  Size: 673 B

After

Width:  |  Height:  |  Size: 673 B

0
product_combo_pack/static/description/assets/icons/pos-black.png

Before

Width:  |  Height:  |  Size: 878 B

After

Width:  |  Height:  |  Size: 878 B

0
product_combo_pack/static/description/assets/icons/puzzle.png

Before

Width:  |  Height:  |  Size: 653 B

After

Width:  |  Height:  |  Size: 653 B

0
product_combo_pack/static/description/assets/icons/restaurant-black.png

Before

Width:  |  Height:  |  Size: 905 B

After

Width:  |  Height:  |  Size: 905 B

0
product_combo_pack/static/description/assets/icons/service-black.png

Before

Width:  |  Height:  |  Size: 839 B

After

Width:  |  Height:  |  Size: 839 B

0
product_combo_pack/static/description/assets/icons/trading-black.png

Before

Width:  |  Height:  |  Size: 427 B

After

Width:  |  Height:  |  Size: 427 B

0
product_combo_pack/static/description/assets/icons/training.png

Before

Width:  |  Height:  |  Size: 627 B

After

Width:  |  Height:  |  Size: 627 B

0
product_combo_pack/static/description/assets/icons/update.png

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

0
product_combo_pack/static/description/assets/icons/user.png

Before

Width:  |  Height:  |  Size: 988 B

After

Width:  |  Height:  |  Size: 988 B

0
product_combo_pack/static/description/assets/icons/wrench.png

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

0
product_combo_pack/static/description/assets/misc/categories.png

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

0
product_combo_pack/static/description/assets/misc/check-box.png

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

0
product_combo_pack/static/description/assets/misc/compass.png

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

0
product_combo_pack/static/description/assets/misc/corporate.png

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

0
product_combo_pack/static/description/assets/misc/customer-support.png

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

0
product_combo_pack/static/description/assets/misc/cybrosys-logo.png

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

0
product_combo_pack/static/description/assets/misc/features.png

Before

Width:  |  Height:  |  Size: 589 B

After

Width:  |  Height:  |  Size: 589 B

0
product_combo_pack/static/description/assets/misc/logo.png

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

0
product_combo_pack/static/description/assets/misc/pictures.png

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

0
product_combo_pack/static/description/assets/misc/pie-chart.png

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

0
product_combo_pack/static/description/assets/misc/right-arrow.png

Before

Width:  |  Height:  |  Size: 967 B

After

Width:  |  Height:  |  Size: 967 B

0
product_combo_pack/static/description/assets/misc/star.png

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

0
product_combo_pack/static/description/assets/misc/support.png

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

0
product_combo_pack/static/description/assets/misc/whatsapp.png

Before

Width:  |  Height:  |  Size: 5.0 KiB

After

Width:  |  Height:  |  Size: 5.0 KiB

0
product_combo_pack/static/description/assets/modules/1.png

Before

Width:  |  Height:  |  Size: 60 KiB

After

Width:  |  Height:  |  Size: 60 KiB

0
product_combo_pack/static/description/assets/modules/2.png

Before

Width:  |  Height:  |  Size: 56 KiB

After

Width:  |  Height:  |  Size: 56 KiB

0
product_combo_pack/static/description/assets/modules/3.png

Before

Width:  |  Height:  |  Size: 56 KiB

After

Width:  |  Height:  |  Size: 56 KiB

0
product_combo_pack/static/description/assets/modules/4.png

Before

Width:  |  Height:  |  Size: 59 KiB

After

Width:  |  Height:  |  Size: 59 KiB

0
product_combo_pack/static/description/assets/modules/5.gif

Before

Width:  |  Height:  |  Size: 1.8 MiB

After

Width:  |  Height:  |  Size: 1.8 MiB

0
product_combo_pack/static/description/assets/modules/6.png

Before

Width:  |  Height:  |  Size: 57 KiB

After

Width:  |  Height:  |  Size: 57 KiB

0
product_combo_pack/static/description/assets/screenshots/1.png

Before

Width:  |  Height:  |  Size: 438 KiB

After

Width:  |  Height:  |  Size: 438 KiB

0
product_combo_pack/static/description/assets/screenshots/2.png

Before

Width:  |  Height:  |  Size: 105 KiB

After

Width:  |  Height:  |  Size: 105 KiB

0
product_combo_pack/static/description/assets/screenshots/3.png

Before

Width:  |  Height:  |  Size: 70 KiB

After

Width:  |  Height:  |  Size: 70 KiB

0
product_combo_pack/static/description/assets/screenshots/4.png

Before

Width:  |  Height:  |  Size: 83 KiB

After

Width:  |  Height:  |  Size: 83 KiB

0
product_combo_pack/static/description/assets/screenshots/5.png

Before

Width:  |  Height:  |  Size: 91 KiB

After

Width:  |  Height:  |  Size: 91 KiB

0
product_combo_pack/static/description/assets/screenshots/6.png

Before

Width:  |  Height:  |  Size: 109 KiB

After

Width:  |  Height:  |  Size: 109 KiB

0
product_combo_pack/static/description/assets/screenshots/7.png

Before

Width:  |  Height:  |  Size: 94 KiB

After

Width:  |  Height:  |  Size: 94 KiB

0
product_combo_pack/static/description/assets/screenshots/hero.gif

Before

Width:  |  Height:  |  Size: 233 KiB

After

Width:  |  Height:  |  Size: 233 KiB

0
product_combo_pack/static/description/banner.png

Before

Width:  |  Height:  |  Size: 79 KiB

After

Width:  |  Height:  |  Size: 79 KiB

0
product_combo_pack/static/description/icon.png

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

0
product_combo_pack/static/description/index.html

4
product_combo_pack/views/product_form_views.xml

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

2
product_combo_pack/views/sale_order_views.xml

@ -8,7 +8,7 @@
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<field name="sale_order_template_id" position="before">
<field name="product_pack_id" options="{'no_create': True}"
<field name="product_pack_id" options="{'no_create': True}" widget="many2many_tags"
/>
</field>
</field>

Loading…
Cancel
Save