diff options
| author | stephanchrst <stephanchrst@gmail.com> | 2025-02-07 14:57:43 +0700 |
|---|---|---|
| committer | stephanchrst <stephanchrst@gmail.com> | 2025-02-07 14:57:43 +0700 |
| commit | ae66937628c5431274df26183674cad52f90c029 (patch) | |
| tree | 4329c9c9aded437bc48823e2b65fc3df996c59de | |
| parent | 3187466a66abb41931e346e7865dfa6432f3da9e (diff) | |
disallow some state while cancel sales order
| -rwxr-xr-x | indoteknik_custom/models/sale_order.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index 0d2e42cb..2f3871ad 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -1067,9 +1067,14 @@ class SaleOrder(models.Model): if self.have_outstanding_invoice: raise UserError("Invoice harus di Cancel dahulu") + + disallow_states = ['draft', 'waiting', 'confirmed', 'assigned'] + for picking in self.picking_ids: + if picking.state in disallow_states: + raise UserError("DO yang draft, waiting, confirmed, atau assigned harus di-cancel oleh Logistik") for line in self.order_line: if line.qty_delivered > 0: - raise UserError("DO harus di-cancel terlebih dahulu.") + raise UserError("DO yang done harus di-Return oleh Logistik") if not self.web_approval: self.web_approval = 'company' |
