summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAzka Nathan <darizkyfaz@gmail.com>2024-06-25 09:09:34 +0700
committerAzka Nathan <darizkyfaz@gmail.com>2024-06-25 09:09:34 +0700
commitac01fa257abf2f12588d240689c42f0d12da644f (patch)
tree5014114abc523d13a944e2ecdd0929d469f9e08c
parent6e256f5d35f48f75804829ddef08288905c33c68 (diff)
trying to fix ppn keluar on bill
-rw-r--r--indoteknik_custom/models/automatic_purchase.py12
-rwxr-xr-xindoteknik_custom/models/purchase_order.py22
-rwxr-xr-xindoteknik_custom/views/purchase_pricelist.xml4
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 @@
</group>
<group string="System">
<field name="system_price"/>
- <field name="taxes_system_id"/>
+ <field name="taxes_system_id" domain="[('type_tax_use','=','purchase')]"/>
<field name="system_last_update"/>
</group>
<group string="Human">
<field name="product_price"/>
- <field name="taxes_product_id"/>
+ <field name="taxes_product_id" domain="[('type_tax_use','=','purchase')]"/>
<field name="human_last_update"/>
</group>
</group>