From da5617f49ec011c80d4ce6b04ce025f18151e575 Mon Sep 17 00:00:00 2001 From: Mqdd Date: Wed, 10 Dec 2025 14:03:53 +0700 Subject: validate permission internal transfer --- indoteknik_custom/models/stock_picking.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) 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: -- cgit v1.2.3