summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/promotion/promotion_program_line.py
diff options
context:
space:
mode:
Diffstat (limited to 'indoteknik_custom/models/promotion/promotion_program_line.py')
-rw-r--r--indoteknik_custom/models/promotion/promotion_program_line.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/indoteknik_custom/models/promotion/promotion_program_line.py b/indoteknik_custom/models/promotion/promotion_program_line.py
index 34a0fbb2..18a7e184 100644
--- a/indoteknik_custom/models/promotion/promotion_program_line.py
+++ b/indoteknik_custom/models/promotion/promotion_program_line.py
@@ -13,7 +13,6 @@ class PromotionProgramLine(models.Model):
("discount_loading", "Discount Loading"),
("merchandise", "Merchandise")
], 'Type')
- image = fields.Binary(string="Image")
package_limit = fields.Integer('Package limit')
package_limit_user = fields.Integer('Package limit / user')
@@ -21,6 +20,7 @@ class PromotionProgramLine(models.Model):
product_ids = fields.One2many('promotion.product', 'program_line_id', 'Product')
free_product_ids = fields.One2many('promotion.free_product', 'program_line_id', 'Free Product')
+ display_on_homepage = fields.Boolean('Display on Homepage')
price = fields.Float('Price')
discount_type = fields.Selection([
@@ -96,16 +96,21 @@ class PromotionProgramLine(models.Model):
weight = 0
if not any(x['package_weight'] == 0 for x in merged_products):
weight = sum(x['package_weight'] for x in merged_products)
-
+
+ # Sum of products and free products in 1 package quantity
+ products_total = sum(x['price']['price_discount'] * x['qty'] / qty for x in products)
+ free_products_total = sum(x['price']['price_discount'] * x['qty'] / qty for x in free_products)
+ package_price = products_total + free_products_total
+
response = {
'id': self.id,
'name': self.name,
- 'image': ir_attachment.api_image(self._name, 'image', self.id),
'remaining_time': self._get_remaining_time(),
'promotion_type': self._res_promotion_type(),
'limit_qty': limit_qty,
'remaining_qty': remaining_qty,
'used_percentage': percent_remaining,
+ 'package_price': package_price,
'price': {
'price': self.price,
'price_discount': self.price,