summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAzka Nathan <darizkyfaz@gmail.com>2024-08-26 10:17:15 +0700
committerAzka Nathan <darizkyfaz@gmail.com>2024-08-26 10:17:15 +0700
commit8727296e3bd034d66a026557d7d8e242a3a153e9 (patch)
treeeaa247622569d753585c866cffcc2e21d9fe2a59
parentf023f87dad29ec752c387d8db9bd2db497ebe3ad (diff)
cr po
-rwxr-xr-xindoteknik_custom/models/purchase_order.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py
index c6512772..2517d72c 100755
--- a/indoteknik_custom/models/purchase_order.py
+++ b/indoteknik_custom/models/purchase_order.py
@@ -434,6 +434,8 @@ class PurchaseOrder(models.Model):
def button_confirm(self):
res = super(PurchaseOrder, self).button_confirm()
current_time = datetime.now()
+ self.check_ppn_mix()
+ self.check_data_vendor()
if self.total_percent_margin < self.total_so_percent_margin and not self.env.user.is_purchasing_manager and not self.env.user.is_leader:
raise UserError("Beda Margin dengan Sales, harus approval Manager")
@@ -477,9 +479,22 @@ class PurchaseOrder(models.Model):
self.date_planned = delta_time
self.date_deadline_ref_date_planned()
self.unlink_purchasing_job_state()
+
return res
+ def check_ppn_mix(self):
+ reference_taxes = self.order_line[0].taxes_id
+
+ for line in self.order_line:
+ if line.taxes_id != reference_taxes:
+ raise UserError("PPN harus sama untuk semua baris pada line.")
+
+ def check_data_vendor(self):
+ vendor = self.partner_id
+ if not vendor.email_finance and vendor.email_sales:
+ raise UserError("Email Finance dan Email Sales pada vendor harus diisi")
+
def unlink_purchasing_job_state(self):
for line in self.order_line:
purchasing_job_state = self.env['purchasing.job.state'].search([