diff options
| author | it-fixcomart <it@fixcomart.co.id> | 2024-12-04 11:24:24 +0700 |
|---|---|---|
| committer | it-fixcomart <it@fixcomart.co.id> | 2024-12-04 11:24:24 +0700 |
| commit | 1094670e6fc35e5150b612b32e1f497b36c022b3 (patch) | |
| tree | 4482491680db1554c28fb380480ada5282fac8f0 /indoteknik_custom/models/promotion | |
| parent | c631620706a24426faea6b43c2a0602eebf9a5e4 (diff) | |
| parent | dbe24b9cd600c7b5a9d0587f80a782ed93c9a761 (diff) | |
Merge branch 'production' into iman/telegram
# Conflicts:
# indoteknik_custom/models/__init__.py
# indoteknik_custom/models/stock_picking.py
Diffstat (limited to 'indoteknik_custom/models/promotion')
| -rw-r--r-- | indoteknik_custom/models/promotion/sale_order.py | 11 |
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, |
