summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models
diff options
context:
space:
mode:
authorMiqdad <ahmadmiqdad27@gmail.com>2025-09-30 08:09:02 +0700
committerMiqdad <ahmadmiqdad27@gmail.com>2025-09-30 08:09:02 +0700
commit1f58d7d4973edf04d6a3f3092115492585c1545b (patch)
treee72ede357b909ff1f4c8b3973bb9b42c1ec473c9 /indoteknik_custom/models
parentec21c4721f35028fc9b2a61bd0dbc6e4bf600e74 (diff)
<Miqdad> Need approval logistic when IU from BU/Stock
Diffstat (limited to 'indoteknik_custom/models')
-rw-r--r--indoteknik_custom/models/stock_picking.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py
index b27e6b5d..51f4cccd 100644
--- a/indoteknik_custom/models/stock_picking.py
+++ b/indoteknik_custom/models/stock_picking.py
@@ -97,6 +97,7 @@ class StockPicking(models.Model):
approval_status = fields.Selection([
('pengajuan1', 'Approval Accounting'),
+ ('pengajuan2', 'Approval Logistic'),
('approved', 'Approved'),
], string='Approval Status', readonly=True, copy=False, index=True, tracking=3,
help="Approval Status untuk Internal Use")
@@ -1082,6 +1083,10 @@ class StockPicking(models.Model):
def ask_approval(self):
if self.env.user.is_accounting:
raise UserError("Bisa langsung Validate")
+ if self.env.user.is_logistic_approver and self.location_id.id == 57 or self.location_id== 57:
+ raise UserError("Bisa langsung Validate")
+
+
# for calendar distribute only
# if self.is_internal_use:
@@ -1104,6 +1109,9 @@ class StockPicking(models.Model):
if line.qty_done <= 0:
raise UserError("Qty tidak boleh 0")
pick.approval_status = 'pengajuan1'
+ if pick.location_id.id == 57:
+ pick.approval_status = 'pengajuan2'
+ return
def ask_receipt_approval(self):
if self.env.user.is_logistic_approver:
@@ -1306,6 +1314,9 @@ class StockPicking(models.Model):
if self.picking_type_id.code == 'incoming' and self.group_id.id == False and self.is_internal_use == False:
raise UserError(_('Tidak bisa Validate jika tidak dari Document SO / PO'))
+ if self.is_internal_use and not self.env.user.is_logistic_approver and self.location_id.id == 57:
+ raise UserError("Harus di Approve oleh Logistik")
+
if self.is_internal_use and not self.env.user.is_accounting:
raise UserError("Harus di Approve oleh Accounting")
@@ -1348,6 +1359,9 @@ class StockPicking(models.Model):
)
self.validation_minus_onhand_quantity()
+ loc = self.location_id
+ if loc.id == 57 and not self.env.user.is_logistic_approver and self.approval_status in ['pengajuan2']:
+ raise UserError ("Harus Ask Approval Logistik")
self.responsible = self.env.user.id
# self.send_koli_to_so()
if self.picking_type_code == 'outgoing' and 'BU/OUT/' in self.name: