diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2024-02-07 10:45:51 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2024-02-07 10:45:51 +0700 |
| commit | f6be42d37a363b86f4a9ec71ccb38c78cbe2d887 (patch) | |
| tree | 9c297e776f67e35671012e94d3c64007bd5090d7 /indoteknik_custom/models/promotion | |
| parent | edb3c1c80931078d40a8f56149aeca9efdcdc07d (diff) | |
| parent | 29a9ec94f1ad131f398cf119a03a7b927a4c6cba (diff) | |
Merge branch 'production' into purchasing-job
# Conflicts:
# indoteknik_custom/__manifest__.py
# indoteknik_custom/models/__init__.py
# indoteknik_custom/models/automatic_purchase.py
# indoteknik_custom/models/purchase_order_line.py
# indoteknik_custom/security/ir.model.access.csv
# indoteknik_custom/views/automatic_purchase.xml
# indoteknik_custom/views/purchase_order.xml
Diffstat (limited to 'indoteknik_custom/models/promotion')
| -rw-r--r-- | indoteknik_custom/models/promotion/promotion_program.py | 1 | ||||
| -rw-r--r-- | indoteknik_custom/models/promotion/promotion_program_line.py | 11 |
2 files changed, 9 insertions, 3 deletions
diff --git a/indoteknik_custom/models/promotion/promotion_program.py b/indoteknik_custom/models/promotion/promotion_program.py index 29aaa753..1a1ee6bf 100644 --- a/indoteknik_custom/models/promotion/promotion_program.py +++ b/indoteknik_custom/models/promotion/promotion_program.py @@ -6,6 +6,7 @@ class PromotionProgram(models.Model): name = fields.Char(string="Name") banner = fields.Binary(string="Banner") + image = fields.Binary(string="Image") icon = fields.Binary(string="Icon", help="Image 1:1 ratio") icon_top = fields.Binary(string="Icon Top", help="Icon ini ditampilkan sebagai atribut pada atas gambar di product card pada website") icon_bottom = fields.Binary(string="Icon Bottom", help="Icon ini ditampilkan sebagai atribut pada bawah gambar di product card pada website") 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, |
