summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/purchase_order.py
diff options
context:
space:
mode:
authorRafi Zadanly <zadanlyr@gmail.com>2024-02-02 14:07:43 +0700
committerRafi Zadanly <zadanlyr@gmail.com>2024-02-02 14:07:43 +0700
commitc26ea43e1d8c3c5bfffb94bc1432589a9f2815c9 (patch)
tree86b02e1b4d362617b168f4cb0a5777be483d07fb /indoteknik_custom/models/purchase_order.py
parent8bc43445f1d0b70d54d0a45830e04d0fcc406fbe (diff)
parentf5edc62d22c9a3973261ad289a11e189f0866f52 (diff)
Merge branch 'production' of bitbucket.org:altafixco/indoteknik-addons into production
Diffstat (limited to 'indoteknik_custom/models/purchase_order.py')
-rwxr-xr-xindoteknik_custom/models/purchase_order.py23
1 files changed, 21 insertions, 2 deletions
diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py
index ebadff06..dc654196 100755
--- a/indoteknik_custom/models/purchase_order.py
+++ b/indoteknik_custom/models/purchase_order.py
@@ -53,10 +53,29 @@ 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.delete_line)
+ lines_to_delete = self.order_line.filtered(lambda line: line.suggest == 'masih cukup')
if not lines_to_delete:
- raise UserError('Tidak ada item yang dipilih')
+ raise UserError('Tidak ada item yang masih cukup')
lines_to_delete.unlink()
def open_form_multi_confirm_po(self):