summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMqdd <ahmadmiqdad27@gmail.com>2025-12-10 14:03:53 +0700
committerMqdd <ahmadmiqdad27@gmail.com>2025-12-10 14:03:53 +0700
commitda5617f49ec011c80d4ce6b04ce025f18151e575 (patch)
treefdc953e201a576931749f22d337907c7e9ce8468
parent50d5259f8af1c9bbaee5d6ceb75e70d8aaa29084 (diff)
<Miqdad> validate permission internal transfer
-rw-r--r--indoteknik_custom/models/stock_picking.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py
index 2f99a85a..28d082df 100644
--- a/indoteknik_custom/models/stock_picking.py
+++ b/indoteknik_custom/models/stock_picking.py
@@ -1453,6 +1453,24 @@ class StockPicking(models.Model):
raise UserError(
f"Tidak bisa validasi {picking.name} sebelum {prev_picking.name} divalidasi."
)
+
+ def internal_transfer_val(self):
+ for rec in self:
+ # Gudang service
+ if rec.location_dest_id.id == 98 and self.env.user.id not in [21, 17]:
+ raise UserError(f"Transfer ke gudang {rec.location_dest_id.name} harus di approve Rafly H. atau Denise")
+ # Gudang selisih
+ if rec.location_dest_id.id == 47 and self.env.user.id not in [21, 17]:
+ raise UserError(f"Transfer ke gudang {rec.location_dest_id.name} harus di approve Rafly H. atau Denise")
+
+ # Gudang Rusak
+ if rec.location_dest_id.id == 62 and self.env.user.id not in [21, 17]:
+ raise UserError(f"Transfer ke gudang {rec.location_dest_id.name} harus di approve Rafly H. atau Denise")
+
+ # Gudang Peminjaman
+ if rec.location_dest_id.id == 48 and self.env.user.id not in [21, 17]:
+ raise UserError(f"Transfer ke gudang {rec.location_dest_id.name} harus di approve Rafly H. atau Denise")
+
def button_validate(self):
self.check_invoice_date()
_logger.info("Kode Picking: %s", self.picking_type_id.code)
@@ -1463,6 +1481,8 @@ class StockPicking(models.Model):
group_id = self.env.ref('indoteknik_custom.group_role_merchandiser').id
users_in_group = self.env['res.users'].search([('groups_id', 'in', [group_id])])
active_model = self.env.context.get('active_model')
+ if self.picking_type_id.id in [26, 10, 20, 32, 53, 52]:
+ self.internal_transfer_val()
if self.tukar_guling_po_id and self.tukar_guling_po_id.return_type == 'tukar_guling':
self.validate_seq_vcm()
if self.is_so_fiktif == True: