From 04093dbd490ef94a19aa2df69793e8eeb48831c5 Mon Sep 17 00:00:00 2001 From: HafidBuroiroh Date: Mon, 2 Feb 2026 11:24:09 +0700 Subject: fix date order cashback start februari --- indoteknik_custom/models/refund_sale_order.py | 2 +- indoteknik_custom/models/sale_order_line.py | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/indoteknik_custom/models/refund_sale_order.py b/indoteknik_custom/models/refund_sale_order.py index 7a219130..7ce347a8 100644 --- a/indoteknik_custom/models/refund_sale_order.py +++ b/indoteknik_custom/models/refund_sale_order.py @@ -540,7 +540,7 @@ class RefundSaleOrder(models.Model): else: invoice_ids = rec.invoice_ids.ids - if invoice_ids and vals.get('refund_type', rec.refund_type) not in ['uang', 'barang_kosong_sebagian', 'barang_kosong', 'retur_half', 'retur']: + if invoice_ids and vals.get('refund_type', rec.refund_type) not in ['uang', 'barang_kosong_sebagian', 'barang_kosong', 'retur_half', 'retur', 'berita_acara']: raise UserError("Refund type Hanya Bisa Lebih Bayar, Barang Kosong Sebagian, atau Retur jika ada invoice") if not invoice_ids and vals.get('refund_type', rec.refund_type) in ['uang', 'barang_kosong_sebagian', 'retur_half']: diff --git a/indoteknik_custom/models/sale_order_line.py b/indoteknik_custom/models/sale_order_line.py index 270fc842..dd44f84a 100644 --- a/indoteknik_custom/models/sale_order_line.py +++ b/indoteknik_custom/models/sale_order_line.py @@ -261,17 +261,25 @@ class SaleOrderLine(models.Model): line.item_before_margin = margin_per_item def _compute_cashback_brand(self): + start_date = datetime(2026, 2, 1, 0, 0, 0) for line in self: line.amount_cashback = 0 if not line.product_id: continue + if line.order_id.date_order < start_date: + continue + + price, taxes, vendor_id = self._get_purchase_price(line.product_id) + cashback_percent = line.product_id.x_manufacture.cashback_percent or 0 if cashback_percent <= 0: continue - price, taxes, vendor = self._get_purchase_price(line.product_id) + + if line.vendor_id.id != 5571: + continue price_tax_excl = price -- cgit v1.2.3