From ac01fa257abf2f12588d240689c42f0d12da644f Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Tue, 25 Jun 2024 09:09:34 +0700 Subject: trying to fix ppn keluar on bill --- indoteknik_custom/models/automatic_purchase.py | 12 +++++++----- indoteknik_custom/models/purchase_order.py | 22 +++++++++++----------- indoteknik_custom/views/purchase_pricelist.xml | 4 ++-- 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/indoteknik_custom/models/automatic_purchase.py b/indoteknik_custom/models/automatic_purchase.py index 2c83c0ea..73416c48 100644 --- a/indoteknik_custom/models/automatic_purchase.py +++ b/indoteknik_custom/models/automatic_purchase.py @@ -506,13 +506,15 @@ class AutomaticPurchase(models.Model): taxes = '' human_last_update = purchase_price.human_last_update or datetime.min system_last_update = purchase_price.system_last_update or datetime.min - - price = purchase_price.product_price - taxes = purchase_price.taxes_product_id.id + + if purchase_price.taxes_product_id.type_tax_use == 'purchase': + price = purchase_price.product_price + taxes = purchase_price.taxes_product_id.id if system_last_update > human_last_update: - price = purchase_price.system_price - taxes = purchase_price.taxes_system_id.id + if purchase_price.taxes_system_id.type_tax_use == 'purchase': + price = purchase_price.system_price + taxes = purchase_price.taxes_system_id.id return price, taxes diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index c2a599ca..836df945 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -79,17 +79,17 @@ class PurchaseOrder(models.Model): day_extension = int(self.payment_term_id.line_ids.days) payment_schedule = date_done + timedelta(days=day_extension) - # Menyesuaikan tanggal sesuai aturan yang diberikan - if payment_schedule.weekday() == 0: # 0 adalah indeks untuk hari Senin - payment_schedule -= timedelta(days=4) # Mundur ke hari Kamis - elif payment_schedule.weekday() == 2: # 2 adalah indeks untuk hari Rabu - payment_schedule -= timedelta(days=1) # Mundur ke hari Selasa - elif payment_schedule.weekday() == 4: # 4 adalah indeks untuk hari Jumat - payment_schedule -= timedelta(days=1) # Mundur ke hari Kamis - elif payment_schedule.weekday() == 5: # 5 adalah indeks untuk hari Sabtu - payment_schedule -= timedelta(days=2) # Mundur ke hari Kamis - elif payment_schedule.weekday() == 6: # 6 adalah indeks untuk hari Minggu - payment_schedule -= timedelta(days=3) # Mundur ke hari Kamis + + if payment_schedule.weekday() == 0: + payment_schedule -= timedelta(days=4) + elif payment_schedule.weekday() == 2: + payment_schedule -= timedelta(days=1) + elif payment_schedule.weekday() == 4: + payment_schedule -= timedelta(days=1) + elif payment_schedule.weekday() == 5: + payment_schedule -= timedelta(days=2) + elif payment_schedule.weekday() == 6: + payment_schedule -= timedelta(days=3) partner_invoice_id = self.partner_id.address_get(['invoice'])['invoice'] invoice_vals = { diff --git a/indoteknik_custom/views/purchase_pricelist.xml b/indoteknik_custom/views/purchase_pricelist.xml index 05a6930b..1ede6854 100755 --- a/indoteknik_custom/views/purchase_pricelist.xml +++ b/indoteknik_custom/views/purchase_pricelist.xml @@ -41,12 +41,12 @@ - + - + -- cgit v1.2.3