summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/promotion
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2024-11-29 11:04:28 +0700
committerstephanchrst <stephanchrst@gmail.com>2024-11-29 11:04:28 +0700
commitda323b9570817a90035f8347b4a9db367e193bc5 (patch)
tree69ae7f9c2a0ef11c2615b961b53abb9bea853070 /indoteknik_custom/models/promotion
parent8af6fd1991eb876777cd12f4c35cd0ba42b6a1b5 (diff)
parent301ad8d828e5ff43515b9f1ab467c9082fccd6f7 (diff)
Merge branch 'production' into cr/outgoing_incoming_bu_v2
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 = {