summaryrefslogtreecommitdiff
path: root/fixco_custom/models/account_move.py
diff options
context:
space:
mode:
Diffstat (limited to 'fixco_custom/models/account_move.py')
-rw-r--r--fixco_custom/models/account_move.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/fixco_custom/models/account_move.py b/fixco_custom/models/account_move.py
index 58c94f7..e40e65f 100644
--- a/fixco_custom/models/account_move.py
+++ b/fixco_custom/models/account_move.py
@@ -48,6 +48,33 @@ class AccountMove(models.Model):
help="Flag otomatis kalau invoice sudah paid dan picking terkait di-return."
)
+ def queue_job_cancel_bill(self):
+ QueueJob = self.env['queue.job']
+ for move in self:
+ exists = QueueJob.search([
+ ('res_id', '=', move.id),
+ ('method_name', 'in', ['button_draft', 'button_cancel'])
+ ], limit=1)
+
+ if exists:
+ continue
+
+ QueueJob.create([
+ {
+ 'name': f'Reset To Draft {move.name}',
+ 'model_name': 'account.move',
+ 'method_name': 'button_draft',
+ 'res_id': move.id,
+ },
+ {
+ 'name': f'Cancel Bills {move.name}',
+ 'model_name': 'account.move',
+ 'method_name': 'button_cancel',
+ 'res_id': move.id,
+ }
+ ])
+
+
def _compute_need_refund(self):
for move in self:
flag = False