summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIT Fixcomart <it@fixcomart.co.id>2026-02-02 04:25:23 +0000
committerIT Fixcomart <it@fixcomart.co.id>2026-02-02 04:25:23 +0000
commit9f422af0b5503774e83917714a2b0f9778e0aa1a (patch)
tree0f9548a6a04a874c29530cf87d465619507d9f12
parent8c46283be0a6db7532574447fa49c212d0b0c328 (diff)
parent04093dbd490ef94a19aa2df69793e8eeb48831c5 (diff)
Merged in cashback_brand (pull request #484)
<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 82f5e1fd..627a6fdd 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