summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indoteknik_custom/models/requisition.py4
-rw-r--r--indoteknik_custom/models/stock_picking.py3
-rw-r--r--indoteknik_custom/models/tukar_guling_po.py6
3 files changed, 7 insertions, 6 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([
diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py
index 155664cb..2f99a85a 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 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(
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