diff options
Diffstat (limited to 'indoteknik_custom/models/tukar_guling.py')
| -rw-r--r-- | indoteknik_custom/models/tukar_guling.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/indoteknik_custom/models/tukar_guling.py b/indoteknik_custom/models/tukar_guling.py index 601603d7..e1513c2e 100644 --- a/indoteknik_custom/models/tukar_guling.py +++ b/indoteknik_custom/models/tukar_guling.py @@ -243,8 +243,30 @@ class TukarGuling(models.Model): def action_submit(self): self.ensure_one() + picking = self.operations + if self.state != 'draft': raise UserError("Submit hanya bisa dilakukan dari Draft.") + + if not self.operations: + raise UserError("Operations harus diisi!") + + if not self.return_type: + raise UserError("Return Type harus diisi!") + + self._validate_product_lines() + + if picking.picking_type_id.sequence_code == 'OUT' or picking.picking_type_id.id == 29: + if picking.state != 'done': + raise UserError("BU/OUT Harus Sudah DONE") + + elif picking.picking_type_id.sequence_code == 'PICK' or picking.picking_type_id.id == 30: + linked_bu_out = picking.linked_manual_bu_out + if linked_bu_out.state == 'done': + raise UserError("BU/PICK yang bisa diretur ketika BU/OUT yang belum DONE") + else: + raise UserError("Picking Type harus BU/OUT atau BU/PICK") + self.state = 'approval_sales' def action_approve(self): |
