summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/stock_picking.py
diff options
context:
space:
mode:
authorFIN-IT_AndriFP <andrifebriyadiputra@gmail.com>2025-12-15 13:21:47 +0700
committerFIN-IT_AndriFP <andrifebriyadiputra@gmail.com>2025-12-15 13:21:47 +0700
commiteac7f6b944c0b9f434cd70a558c5aa184f83d8fa (patch)
tree3266263c634240b1696706510ebbfe4ec6aa84e4 /indoteknik_custom/models/stock_picking.py
parent8c0acd970dfdb463717ae6c4a2bc67a7b32238ab (diff)
parent52066bed7e68757247e17ec89d31959247991595 (diff)
Merge branch 'odoo-backup' of https://bitbucket.org/altafixco/indoteknik-addons into magento-solr-v1
Diffstat (limited to 'indoteknik_custom/models/stock_picking.py')
-rw-r--r--indoteknik_custom/models/stock_picking.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py
index 2f99a85a..2465fa96 100644
--- a/indoteknik_custom/models/stock_picking.py
+++ b/indoteknik_custom/models/stock_picking.py
@@ -202,6 +202,7 @@ class StockPicking(models.Model):
so_num = fields.Char('SO Number', compute='_get_so_num')
is_so_fiktif = fields.Boolean('SO Fiktif?', compute='_compute_is_so_fiktif', tracking=3)
payment_term = fields.Char('Payment Term', compute='_get_partner_payment_term')
+ is_rev_tg = fields.Boolean('Administrasi')
@api.depends('sale_id.payment_term_id')
def _get_partner_payment_term(self):
@@ -1453,6 +1454,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 +1482,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: