diff options
| author | IT Fixcomart <it@fixcomart.co.id> | 2026-01-08 04:39:33 +0000 |
|---|---|---|
| committer | IT Fixcomart <it@fixcomart.co.id> | 2026-01-08 04:39:33 +0000 |
| commit | f5e9a57a021902317297eba2441a00b8968ba38c (patch) | |
| tree | 1cc9916cab45f7afb00971fcb4c3dfde7e03dc14 | |
| parent | 6659dcfa24fb1a1923f47be4e0b697489dd0a3bf (diff) | |
| parent | 5c332365e81cda9a7bdb233a31880c3bec1d1e0e (diff) | |
Merged main into print_picking_list
| -rw-r--r-- | fixco_custom/models/account_move.py | 27 | ||||
| -rw-r--r-- | fixco_custom/models/purchase_order.py | 1 | ||||
| -rw-r--r-- | fixco_custom/models/purchase_order_multi_bills.py | 2 | ||||
| -rw-r--r-- | fixco_custom/models/uangmuka_pembelian.py | 2 | ||||
| -rw-r--r-- | fixco_custom/models/uangmuka_penjualan.py | 2 | ||||
| -rw-r--r-- | fixco_custom/models/upload_cancel_picking.py | 2 | ||||
| -rw-r--r-- | fixco_custom/models/upload_ginee.py | 2 | ||||
| -rw-r--r-- | fixco_custom/views/account_move.xml | 8 |
8 files changed, 41 insertions, 5 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 diff --git a/fixco_custom/models/purchase_order.py b/fixco_custom/models/purchase_order.py index ef80112..746ee89 100644 --- a/fixco_custom/models/purchase_order.py +++ b/fixco_custom/models/purchase_order.py @@ -73,6 +73,7 @@ class PurchaseOrder(models.Model): 'ref': self.partner_ref or '', 'move_type': move_type, 'invoice_date': datetime.utcnow(), + 'purchase_order_id': self.id, 'narration': self.notes, 'currency_id': self.currency_id.id, 'invoice_user_id': self.user_id and self.user_id.id or self.env.user.id, diff --git a/fixco_custom/models/purchase_order_multi_bills.py b/fixco_custom/models/purchase_order_multi_bills.py index d9e3c0d..2a5a54a 100644 --- a/fixco_custom/models/purchase_order_multi_bills.py +++ b/fixco_custom/models/purchase_order_multi_bills.py @@ -9,7 +9,7 @@ class PurchaeOrderMultiBills(models.TransientModel): po_ids = self._context.get('po_ids', []) purchase_orders = self.env['purchase.order'].browse(po_ids) for purchase in purchase_orders: - queue_job = self.env['queue.job'].search([('res_id', '=', purchase.id), ('method_name', '=', 'create_bills')], limit=1) + queue_job = self.env['queue.job'].search([('res_id', '=', purchase.id), ('method_name', '=', 'action_create_invoice'), ('state', '!=', 'error')], limit=1) if queue_job: continue self.env['queue.job'].create({ diff --git a/fixco_custom/models/uangmuka_pembelian.py b/fixco_custom/models/uangmuka_pembelian.py index 9374ba2..5a680a3 100644 --- a/fixco_custom/models/uangmuka_pembelian.py +++ b/fixco_custom/models/uangmuka_pembelian.py @@ -50,7 +50,7 @@ class UangmukaPembelian(models.TransientModel): param_header = { 'ref': ref_label, 'date': current_time, - 'journal_id': 23, + 'journal_id': 21, 'purchase_order_id': order.id } diff --git a/fixco_custom/models/uangmuka_penjualan.py b/fixco_custom/models/uangmuka_penjualan.py index a08b030..87327f7 100644 --- a/fixco_custom/models/uangmuka_penjualan.py +++ b/fixco_custom/models/uangmuka_penjualan.py @@ -62,7 +62,7 @@ class UangmukaPenjualan(models.TransientModel): param_header = { 'ref': ref_label, 'date': current_time, - 'journal_id': 24, + 'journal_id': 21, 'sale_id': order.id, 'uangmuka': True, } diff --git a/fixco_custom/models/upload_cancel_picking.py b/fixco_custom/models/upload_cancel_picking.py index 54a94d5..99a15a2 100644 --- a/fixco_custom/models/upload_cancel_picking.py +++ b/fixco_custom/models/upload_cancel_picking.py @@ -146,7 +146,7 @@ class UploadCancelPicking(models.Model): def action_cancel_picking(self): self.date_upload = datetime.utcnow() for line in self.picking_lines: - queue_job = self.env['queue.job'].search([('res_id', '=', line.id), ('method_name', '=', 'cancel_picking')], limit=1) + queue_job = self.env['queue.job'].search([('res_id', '=', line.id), ('method_name', '=', 'cancel_picking'), ('state', '!=', 'error')], limit=1) if queue_job: continue self.env['queue.job'].create({ diff --git a/fixco_custom/models/upload_ginee.py b/fixco_custom/models/upload_ginee.py index 282bf74..6806a28 100644 --- a/fixco_custom/models/upload_ginee.py +++ b/fixco_custom/models/upload_ginee.py @@ -169,7 +169,7 @@ class UploadGinee(models.Model): def action_get_order_id_and_create_detail_order(self): self.date_upload = datetime.utcnow() for line in self.ginee_lines: - queue_job = self.env['queue.job'].search([('res_id', '=', line.id), ('method_name', '=', 'get_order_id_and_create_detail_order')], limit=1) + queue_job = self.env['queue.job'].search([('res_id', '=', line.id), ('method_name', '=', 'get_order_id_and_create_detail_order'), ('state', '!=', 'error')], limit=1) if queue_job: continue self.env['queue.job'].create({ diff --git a/fixco_custom/views/account_move.xml b/fixco_custom/views/account_move.xml index 8eb7975..52dd64c 100644 --- a/fixco_custom/views/account_move.xml +++ b/fixco_custom/views/account_move.xml @@ -138,5 +138,13 @@ <field name="state">code</field> <field name="code">action = records.export_faktur_to_xml()</field> </record> + + <record id="action_cancel_bills" model="ir.actions.server"> + <field name="name">Cancel Bills</field> + <field name="model_id" ref="account.model_account_move" /> + <field name="binding_model_id" ref="account.model_account_move" /> + <field name="state">code</field> + <field name="code">action = records.queue_job_cancel_bill()</field> + </record> </data> </odoo>
\ No newline at end of file |
