From f0aaf4476c8b92cb68503e9760216ca20fe4e34d Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Tue, 17 Sep 2024 14:05:31 +0700 Subject: api check_tempo and add type promotion on sale order --- indoteknik_custom/models/sale_order.py | 11 +++++++++++ indoteknik_custom/views/sale_order.xml | 1 + 2 files changed, 12 insertions(+) (limited to 'indoteknik_custom') diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index 6348328e..43ee3ef9 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -115,6 +115,17 @@ class SaleOrder(models.Model): margin_after_delivery_purchase = fields.Float(string='Margin After Delivery Purchase', compute='_compute_margin_after_delivery_purchase') percent_margin_after_delivery_purchase = fields.Float(string='% Margin After Delivery Purchase', compute='_compute_margin_after_delivery_purchase') purchase_delivery_amt = fields.Float(string='Purchase Delivery Amount', compute='_compute_purchase_delivery_amount') + type_promotion = fields.Char(string='Type Promotion', compute='_compute_type_promotion') + + def _compute_type_promotion(self): + for rec in self: + promotion_types = [] + for promotion in rec.order_promotion_ids: + for line_program in promotion.program_line_id: + if line_program.promotion_type: + promotion_types.append(dict(line_program._fields['promotion_type'].selection).get(line_program.promotion_type)) + + rec.type_promotion = ', '.join(promotion_types) def _compute_purchase_delivery_amount(self): for order in self: diff --git a/indoteknik_custom/views/sale_order.xml b/indoteknik_custom/views/sale_order.xml index e772dcae..f2789254 100755 --- a/indoteknik_custom/views/sale_order.xml +++ b/indoteknik_custom/views/sale_order.xml @@ -32,6 +32,7 @@ +