summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/purchase_order.py
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2022-09-29 08:54:16 +0700
committerstephanchrst <stephanchrst@gmail.com>2022-09-29 08:54:16 +0700
commit43a8e9a7f2d6ba127de9bcd40925b838b1f5eaeb (patch)
treea6531f8e798663efd442f42093d4549a52391d04 /indoteknik_custom/models/purchase_order.py
parentac37a854362dbaaf8a88431ea5ab077a37f3c5f9 (diff)
Update __manifest__.py, __init__.py, and 3 more files...
Diffstat (limited to 'indoteknik_custom/models/purchase_order.py')
-rwxr-xr-xindoteknik_custom/models/purchase_order.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py
index 2966eeed..a3226083 100755
--- a/indoteknik_custom/models/purchase_order.py
+++ b/indoteknik_custom/models/purchase_order.py
@@ -85,12 +85,12 @@ class PurchaseOrder(models.Model):
def button_confirm(self):
res = super(PurchaseOrder, self).button_confirm()
- test = self.env.user.id
- if self.total_percent_margin < self.total_so_percent_margin and self.env.user.id != 6:
+ test = self.env.user.is_leader
+ test2 = self.env.user.is_purchasing_manager
+ 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")
- if not self.sale_order_id:
- if self.env.user.id != 6 and self.env.user.id != 7:
- raise UserError("Tidak ada link dengan SO, harus approval Manager")
+ if not self.sale_order_id and not self.env.user.is_purchasing_manager and not self.env.user.is_leader:
+ raise UserError("Tidak ada link dengan SO, harus approval Manager")
self.approval_status = 'approved'
# for line in self.order_line:
@@ -120,7 +120,9 @@ class PurchaseOrder(models.Model):
return res
def po_approve(self):
- if (self.total_percent_margin == self.total_so_percent_margin) and (self.env.user.id == 6 or self.env.user.id == 7):
+ if self.env.user.is_leader or self.env.user.is_purchasing_manager:
+ raise UserError("Bisa langsung Confirm")
+ elif self.total_percent_margin == self.total_so_percent_margin and self.sale_order_id:
raise UserError("Bisa langsung Confirm")
else:
self.approval_status = 'pengajuan1'