summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/promotion
diff options
context:
space:
mode:
authortrisusilo48 <tri.susilo@altama.co.id>2024-12-05 14:47:42 +0700
committertrisusilo48 <tri.susilo@altama.co.id>2024-12-05 14:47:42 +0700
commit1e9e0c28ee4dc63f1465affac6d98ae213d9f283 (patch)
treee48922d3885f3c1870f24cfad2c708389468d722 /indoteknik_custom/models/promotion
parent4d5a0a6e2d997e323f8670172226f613b7673d62 (diff)
parent4eac4d0709ec5d9e03b517a39cb67acbc35e2932 (diff)
Merge branch 'production' of https://bitbucket.org/altafixco/indoteknik-addons into production
Diffstat (limited to 'indoteknik_custom/models/promotion')
-rw-r--r--indoteknik_custom/models/promotion/sale_order.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/indoteknik_custom/models/promotion/sale_order.py b/indoteknik_custom/models/promotion/sale_order.py
index be820c6f..1c31d060 100644
--- a/indoteknik_custom/models/promotion/sale_order.py
+++ b/indoteknik_custom/models/promotion/sale_order.py
@@ -10,11 +10,12 @@ class SaleOrder(models.Model):
for promotion in promotions:
program_line = self.env['promotion.program.line'].browse(promotion['program_line_id'])
for free_product in program_line.free_product_ids:
- self.env['sale.order.line'].create({
- 'order_id': self.id,
- 'name': "Free Product " + free_product.product_id.display_name,
- 'display_type': 'line_note'
- })
+ if free_product.product_id.merchandise_ok:
+ self.env['sale.order.line'].create({
+ 'order_id': self.id,
+ 'name': f"Free Product {free_product.product_id.display_name} Quantity ({free_product.qty})",
+ 'display_type': 'line_note'
+ })
def apply_promotion_program(self):
userdata = {