summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models
diff options
context:
space:
mode:
authorit-fixcomart <it@fixcomart.co.id>2025-02-12 15:02:14 +0700
committerit-fixcomart <it@fixcomart.co.id>2025-02-12 15:02:14 +0700
commit7f284e263de51242459ca780af32fe0e372f7ac4 (patch)
tree1f306c29deb6c4c9d3bb1287275e5b1a74ce12bd /indoteknik_custom/models
parentede74761c8556b18b4555af22738a76538682512 (diff)
update code
Diffstat (limited to 'indoteknik_custom/models')
-rwxr-xr-xindoteknik_custom/models/sale_order.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py
index b1039750..d0b72ed3 100755
--- a/indoteknik_custom/models/sale_order.py
+++ b/indoteknik_custom/models/sale_order.py
@@ -37,11 +37,16 @@ class CancelReasonOrder(models.TransientModel):
order = self.request_id
if order:
order.write({'reason_cancel': self.reason_cancel})
+ if not self.attachment_bukti:
+ raise UserError('Attachment bukti wajib disertakan')
order.write({'attachment_bukti': self.attachment_bukti})
order.message_post(body='Attachment Bukti Cancel',
attachment_ids=[self.attachment_bukti.id])
- if self.nomor_so_pengganti or self.reason_cancel == 'ganti_quotation':
- order.write({'nomor_so_pengganti': self.nomor_so_pengganti})
+ if self.reason_cancel == 'ganti_quotation':
+ if self.nomor_so_pengganti:
+ order.write({'nomor_so_pengganti': self.nomor_so_pengganti})
+ else:
+ raise UserError('Nomor SO pengganti wajib disertakan')
order.confirm_cancel_order()
return {'type': 'ir.actions.act_window_close'}