summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/purchase_order.py
diff options
context:
space:
mode:
authorAzka Nathan <darizkyfaz@gmail.com>2024-02-02 13:32:55 +0700
committerAzka Nathan <darizkyfaz@gmail.com>2024-02-02 13:32:55 +0700
commit8978868864925683d02342112020e7fc047a4acf (patch)
tree1176a2d6f65e71a4bccde20c6dd4cbea79b4b8fa /indoteknik_custom/models/purchase_order.py
parentd6c7fad834f954f892cea0eb9e082db822bc8f2b (diff)
logbook sj and mark as cancel po
Diffstat (limited to 'indoteknik_custom/models/purchase_order.py')
-rwxr-xr-xindoteknik_custom/models/purchase_order.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py
index 67299d2c..dc654196 100755
--- a/indoteknik_custom/models/purchase_order.py
+++ b/indoteknik_custom/models/purchase_order.py
@@ -53,6 +53,25 @@ class PurchaseOrder(models.Model):
status_paid_cbd = fields.Boolean(string='Paid Status', tracking=3, help='Field ini diisi secara manual oleh Finance AP dan hanya untuk status PO CBD')
revisi_po = fields.Boolean(string='Revisi', tracking=3)
+ @api.model
+ def action_multi_cancel(self):
+ for purchase in self:
+ purchase.update({
+ 'state': 'cancel',
+ })
+
+ if purchase.state == 'cancel':
+ purchase.update({
+ 'approval_status': False,
+ })
+
+ def open_form_multi_cancel(self):
+ action = self.env['ir.actions.act_window']._for_xml_id('indoteknik_custom.action_po_multi_cancel')
+ action['context'] = {
+ 'purchase_ids': [x.id for x in self]
+ }
+ return action
+
def delete_line(self):
lines_to_delete = self.order_line.filtered(lambda line: line.suggest == 'masih cukup')
if not lines_to_delete: