summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/promotion
diff options
context:
space:
mode:
authorit-fixcomart <it@fixcomart.co.id>2024-11-29 10:05:58 +0700
committerit-fixcomart <it@fixcomart.co.id>2024-11-29 10:05:58 +0700
commit8906f678c23090d70d16191dc1fe76e518e8e9d9 (patch)
treea98cb41a39064f692d764338177b84fd14bed82a /indoteknik_custom/models/promotion
parentd0bd4a82c923789a931f9433085f4219c6d7346a (diff)
parent0080b6b1da5f181cee32fae7bb5166ce65165374 (diff)
Merge branch 'production' into CR/quotation-noPo
# Conflicts: # indoteknik_custom/models/user_company_request.py
Diffstat (limited to 'indoteknik_custom/models/promotion')
-rw-r--r--indoteknik_custom/models/promotion/sale_order.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/indoteknik_custom/models/promotion/sale_order.py b/indoteknik_custom/models/promotion/sale_order.py
index cb9a6f92..1c31d060 100644
--- a/indoteknik_custom/models/promotion/sale_order.py
+++ b/indoteknik_custom/models/promotion/sale_order.py
@@ -6,6 +6,17 @@ class SaleOrder(models.Model):
order_promotion_ids = fields.One2many('sale.order.promotion', 'order_id', 'Promotions')
+ def add_free_product(self, promotions):
+ 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:
+ 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 = {
'user_id': self.partner_id.user_id.id,