From 43a8e9a7f2d6ba127de9bcd40925b838b1f5eaeb Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Thu, 29 Sep 2022 08:54:16 +0700 Subject: Update __manifest__.py, __init__.py, and 3 more files... --- indoteknik_custom/models/purchase_order.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'indoteknik_custom/models/purchase_order.py') 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' -- cgit v1.2.3