summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/promotion
diff options
context:
space:
mode:
authorit-fixcomart <it@fixcomart.co.id>2024-11-29 10:35:39 +0700
committerit-fixcomart <it@fixcomart.co.id>2024-11-29 10:35:39 +0700
commit75cad0da1476a2e605ef5d0f35cfb58944831934 (patch)
tree6cc7e014ef006e8d7794f2b6f50437bef61dd724 /indoteknik_custom/models/promotion
parentfd5617629243b879e020afbdb2f1957d2e419ae4 (diff)
parentfa3da08e5c0837e1492a3b00b17b7492c07ac676 (diff)
Merge branch 'production' into CR/website-improvment
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 = {