From f7c99e518ca9489e118f4c68f2d13ce91b0f1e84 Mon Sep 17 00:00:00 2001 From: Mqdd Date: Fri, 5 Dec 2025 16:51:17 +0700 Subject: cr requisition create po flow --- indoteknik_custom/models/requisition.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/indoteknik_custom/models/requisition.py b/indoteknik_custom/models/requisition.py index 64ef4fc8..748642eb 100644 --- a/indoteknik_custom/models/requisition.py +++ b/indoteknik_custom/models/requisition.py @@ -85,7 +85,7 @@ class Requisition(models.Model): ('product_id', '=', prod_line.product_id.id), ('order_id', '=', req.sale_order_id.id) ]) if match: - raise UserError ('Product sudah di SO tidak approve/create PO') + raise UserError ('Product sudah ada di SO tidak bisa approve/create PO') def button_approve(self): @@ -108,7 +108,7 @@ class Requisition(models.Model): raise UserError('Tidak ada Lines, belum bisa create PO') if self.is_po: raise UserError('Sudah pernah di create PO') - if not self.sale_order_id: + if not self.sale_order_id and (not self.sales_approve or not self.merchandise_approve): raise UserError('Tidak ada link dengan Sales Order, tidak bisa dihitung sebagai Plafon Qty di PO') vendor_ids = self.env['requisition.line'].read_group([ -- cgit v1.2.3 From 6c740b7fcc4137fa59cee04cfbe0003529b31cd4 Mon Sep 17 00:00:00 2001 From: Mqdd Date: Wed, 10 Dec 2025 09:40:00 +0700 Subject: hilangin validasi pernah di retur vcm --- indoteknik_custom/models/tukar_guling_po.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/indoteknik_custom/models/tukar_guling_po.py b/indoteknik_custom/models/tukar_guling_po.py index 739898a1..ae58d509 100644 --- a/indoteknik_custom/models/tukar_guling_po.py +++ b/indoteknik_custom/models/tukar_guling_po.py @@ -441,8 +441,8 @@ class TukarGulingPO(models.Model): ('state', '!=', 'cancel'), ], limit=1) - if existing_tukar_guling: - raise UserError("BU ini sudah pernah diretur oleh dokumen %s." % existing_tukar_guling.name) + # if existing_tukar_guling: + # raise UserError("BU ini sudah pernah diretur oleh dokumen %s." % existing_tukar_guling.name) picking = self.operations pick_id = self.operations.picking_type_id.id @@ -787,4 +787,4 @@ class StockPicking(models.Model): ) picking.tukar_guling_po_id.message_post(body=message) - return res \ No newline at end of file + return res -- cgit v1.2.3 From 93199aaed1ae3541fd9ecf5c0aa42b20140a7ad4 Mon Sep 17 00:00:00 2001 From: Mqdd Date: Wed, 10 Dec 2025 10:49:31 +0700 Subject: fix validate retur from vrt or prt manually --- indoteknik_custom/models/stock_picking.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py index 155664cb..cc6b69a3 100644 --- a/indoteknik_custom/models/stock_picking.py +++ b/indoteknik_custom/models/stock_picking.py @@ -1463,7 +1463,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') - self.validate_seq_vcm() + if self.tukar_guling_po_id: + self.validate_seq_vcm() if self.is_so_fiktif == True: raise UserError("SO Fiktif tidak bisa di validate") if self.location_id.id == 47 and self.env.user.id not in users_in_group.mapped( -- cgit v1.2.3 From 6f1b2a4337279a946ae999df38ba5682044a3bb2 Mon Sep 17 00:00:00 2001 From: Mqdd Date: Wed, 10 Dec 2025 11:11:01 +0700 Subject: fix sementara seq vcm --- indoteknik_custom/models/stock_picking.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py index cc6b69a3..7970793e 100644 --- a/indoteknik_custom/models/stock_picking.py +++ b/indoteknik_custom/models/stock_picking.py @@ -1435,8 +1435,8 @@ class StockPicking(models.Model): ordered_pickings = [] for prefix in picking_order: match = next((p for p in related_pickings if p.name.startswith(prefix)), None) - if not match: - raise UserError(f"Picking dengan prefix {prefix} belum ada.") + # if not match: + # raise UserError(f"Picking dengan prefix {prefix} belum ada.") ordered_pickings.append(match) current_index = -1 -- cgit v1.2.3 From 2c65cad93b296c059a7feb6b1d1fca3331981c89 Mon Sep 17 00:00:00 2001 From: Mqdd Date: Wed, 10 Dec 2025 11:15:26 +0700 Subject: fix smweentara --- indoteknik_custom/models/stock_picking.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py index 7970793e..6c498367 100644 --- a/indoteknik_custom/models/stock_picking.py +++ b/indoteknik_custom/models/stock_picking.py @@ -1435,8 +1435,8 @@ class StockPicking(models.Model): ordered_pickings = [] for prefix in picking_order: match = next((p for p in related_pickings if p.name.startswith(prefix)), None) - # if not match: - # raise UserError(f"Picking dengan prefix {prefix} belum ada.") + if not match: + raise UserError(f"Picking dengan prefix {prefix} belum ada.") ordered_pickings.append(match) current_index = -1 @@ -1463,8 +1463,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.tukar_guling_po_id: - self.validate_seq_vcm() + # if self.tukar_guling_po_id: + # self.validate_seq_vcm() if self.is_so_fiktif == True: raise UserError("SO Fiktif tidak bisa di validate") if self.location_id.id == 47 and self.env.user.id not in users_in_group.mapped( -- cgit v1.2.3 From d746dacecc64c2effb9166b54808f0e81ea8303f Mon Sep 17 00:00:00 2001 From: Mqdd Date: Wed, 10 Dec 2025 11:23:04 +0700 Subject: run validate seq vcm when return type tukar guling --- indoteknik_custom/models/stock_picking.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py index 6c498367..2f99a85a 100644 --- a/indoteknik_custom/models/stock_picking.py +++ b/indoteknik_custom/models/stock_picking.py @@ -1463,8 +1463,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.tukar_guling_po_id: - # self.validate_seq_vcm() + 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: raise UserError("SO Fiktif tidak bisa di validate") if self.location_id.id == 47 and self.env.user.id not in users_in_group.mapped( -- cgit v1.2.3