summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHafidBuroiroh <hafidburoiroh09@gmail.com>2026-02-02 11:24:09 +0700
committerHafidBuroiroh <hafidburoiroh09@gmail.com>2026-02-02 11:24:09 +0700
commit04093dbd490ef94a19aa2df69793e8eeb48831c5 (patch)
tree2615cadae9d409e6d7940204caa31fdcf35dcf49
parent48e48a61a6fc0addcc1e0c3590ca8582abe66a6a (diff)
<hafid> fix date order cashback start februari
-rw-r--r--indoteknik_custom/models/refund_sale_order.py2
-rw-r--r--indoteknik_custom/models/sale_order_line.py10
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