summaryrefslogtreecommitdiff
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
parentede74761c8556b18b4555af22738a76538682512 (diff)
update code
-rwxr-xr-xindoteknik_custom/models/sale_order.py9
-rwxr-xr-xindoteknik_custom/views/sale_order.xml2
2 files changed, 8 insertions, 3 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'}
diff --git a/indoteknik_custom/views/sale_order.xml b/indoteknik_custom/views/sale_order.xml
index daa2b095..163330c5 100755
--- a/indoteknik_custom/views/sale_order.xml
+++ b/indoteknik_custom/views/sale_order.xml
@@ -291,7 +291,7 @@
<form string="Cancel Reason">
<group>
<field name="reason_cancel" widget="selection"/>
- <field name="attachment_bukti" widget="many2many_binary"/>
+ <field name="attachment_bukti" widget="many2many_binary" required="1"/>
<field name="nomor_so_pengganti" attrs="{'invisible': [('reason_cancel', '!=', 'ganti_quotation')]}"/>
</group>
<footer>