From f41e635755bb8092d9a85ccc0a0cb675afc7af00 Mon Sep 17 00:00:00 2001 From: Miqdad Date: Sun, 31 Aug 2025 12:17:35 +0700 Subject: oke --- indoteknik_custom/models/sale_order.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'indoteknik_custom') diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index ffb53dce..8cb169a6 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -1900,26 +1900,30 @@ class SaleOrder(models.Model): # raise UserError('Kelurahan Real Delivery Address harus diisi') def generate_payment_link_midtrans_sales_order(self): - # midtrans_url = 'https://app.sandbox.midtrans.com/snap/v1/transactions' # dev - sandbox - # midtrans_auth = 'Basic U0ItTWlkLXNlcnZlci1uLVY3ZDJjMlpCMFNWRUQyOU95Q1dWWXA6' # dev - sandbox - midtrans_url = 'https://app.midtrans.com/snap/v1/transactions' # production - midtrans_auth = 'Basic TWlkLXNlcnZlci1SbGMxZ2gzWGpSVW5scl9JblZzTV9OTnU6' # production + # midtrans_url = 'https://app.sandbox.midtrans.com/snap/v1/transactions' # dev - sandbox + # midtrans_auth = 'Basic U0ItTWlkLXNlcnZlci1uLVY3ZDJjMlpCMFNWRUQyOU95Q1dWWXA6' # dev - sandbox + midtrans_url = 'https://app.midtrans.com/snap/v1/transactions' # production + midtrans_auth = 'Basic TWlkLXNlcnZlci1SbGMxZ2gzWGpSVW5scl9JblZzTV9OTnU6' # production + so_number = self.name so_number = so_number.replace('/', '-') so_grandtotal = math.floor(self.grand_total) + headers = { 'Accept': 'application/json', 'Content-Type': 'application/json', 'Authorization': midtrans_auth, } - check_url = f'https://api.midtrans.com/v2/{so_number}/status' - check_response = requests.get(check_url, headers=headers) + # ==== ENV ==== + # check_url = f'https://api.sandbox.midtrans.com/v2/{so_number}/status' # dev - sandbox + check_url = f'https://api.midtrans.com/v2/{so_number}/status' # production + # ============================================= + check_response = requests.get(check_url, headers=headers) if check_response.status_code == 200: status_response = check_response.json() - if status_response.get('transaction_status') == 'expire' or status_response.get( - 'transaction_status') == 'cancel': + if status_response.get('transaction_status') in ('expire', 'cancel'): so_number = so_number + '-cpl' json_data = { @@ -1951,7 +1955,6 @@ class SaleOrder(models.Model): buffer = BytesIO() img.save(buffer, format="PNG") qr_code_img = base64.b64encode(buffer.getvalue()).decode() - self.payment_qr_code = qr_code_img @api.model -- cgit v1.2.3 From 77539c2e9ee720c7e731d1b5138041263394a978 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Tue, 2 Sep 2025 11:12:22 +0700 Subject: fix refund ongkir --- indoteknik_custom/models/refund_sale_order.py | 29 ++++++++------------------- 1 file changed, 8 insertions(+), 21 deletions(-) (limited to 'indoteknik_custom') diff --git a/indoteknik_custom/models/refund_sale_order.py b/indoteknik_custom/models/refund_sale_order.py index 6d0b5741..737419e7 100644 --- a/indoteknik_custom/models/refund_sale_order.py +++ b/indoteknik_custom/models/refund_sale_order.py @@ -392,6 +392,7 @@ class RefundSaleOrder(models.Model): total_invoice = sum(self.env['account.move'].browse(invoice_ids).mapped('amount_total_signed')) vals['total_invoice'] = total_invoice uang_masuk = rec.uang_masuk + amount_refund = vals.get('amount_refund', rec.amount_refund) if amount_refund <= 0: @@ -401,36 +402,22 @@ class RefundSaleOrder(models.Model): ('sale_order_ids', 'in', so_ids), ('id', '!=', rec.id) ]) - total_refunded = sum(existing_refunds.mapped('amount_refund')) + amount_refund - remaining = uang_masuk - total_refunded + total_refunded = sum(existing_refunds.mapped('amount_refund')) + if existing_refunds: + remaining = uang_masuk - total_refunded + else: + remaining = uang_masuk - amount_refund - if remaining < 0: - raise ValidationError("❌ Dana uang masuk telah sepenuhnya di refund tidak bisa Mengubah Nominal Refund") vals['remaining_refundable'] = remaining return super().write(vals) - @api.onchange('ongkir', 'amount_refund') + @api.onchange('amount_refund') def _onchange_refund_fields(self): for rec in self: refund_input = rec.amount_refund or 0.0 - - # ambil refund terakhir untuk SO - existing_refund = self.env['refund.sale.order'].search([ - ('sale_order_ids', 'in', rec.sale_order_ids.ids) - ], order='id desc', limit=1) - - if existing_refund: - sisa_uang_masuk = existing_refund.remaining_refundable - else: - sisa_uang_masuk = rec.uang_masuk or 0.0 - - # update field uang_masuk supaya form menampilkan sisa aktual - rec.uang_masuk = sisa_uang_masuk - - # hitung remaining setelah input refund - rec.remaining_refundable = sisa_uang_masuk - refund_input + rec.remaining_refundable = (rec.uang_masuk or 0.0) - refund_input @api.depends('status_payment', 'status') def _compute_is_locked(self): -- cgit v1.2.3 From ddaedc0eeaf53b47786a7747664fc99ae4dc1a7a Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Tue, 2 Sep 2025 14:46:57 +0700 Subject: fix refund validasi --- indoteknik_custom/models/refund_sale_order.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indoteknik_custom') diff --git a/indoteknik_custom/models/refund_sale_order.py b/indoteknik_custom/models/refund_sale_order.py index 737419e7..731d8e41 100644 --- a/indoteknik_custom/models/refund_sale_order.py +++ b/indoteknik_custom/models/refund_sale_order.py @@ -408,6 +408,8 @@ class RefundSaleOrder(models.Model): else: remaining = uang_masuk - amount_refund + if remaining < 0: + raise ValidationError("Semua dana sudah dikembalikan, tidak bisa mengajukan refund") vals['remaining_refundable'] = remaining -- cgit v1.2.3 From 461020919518ac0bde4024de482303734fd314dc Mon Sep 17 00:00:00 2001 From: Miqdad Date: Tue, 2 Sep 2025 14:51:29 +0700 Subject: Fix cancel invoice ccm --- indoteknik_custom/models/tukar_guling.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indoteknik_custom') diff --git a/indoteknik_custom/models/tukar_guling.py b/indoteknik_custom/models/tukar_guling.py index d2e00781..6e839bf0 100644 --- a/indoteknik_custom/models/tukar_guling.py +++ b/indoteknik_custom/models/tukar_guling.py @@ -134,7 +134,7 @@ class TukarGuling(models.Model): if not self.val_inv_opt and self.is_has_invoice == True: raise UserError("Kalau sudah ada invoice Return Invoice Option harus diisi!") for rec in self: - if rec.val_inv_opt == 'cancel_invoice' and self.is_has_invoice == True: + if rec.val_inv_opt == 'cancel_invoice' and self.is_has_invoice == True and rec.invoice_id.state != 'cancel': raise UserError("Tidak bisa mengubah Return karena sudah ada invoice dan belum di cancel.") elif rec.val_inv_opt == 'tanpa_cancel' and self.is_has_invoice == True: continue -- cgit v1.2.3 From f6537c3987112c351a2a099475b1e32a9e8de76e Mon Sep 17 00:00:00 2001 From: Miqdad Date: Thu, 4 Sep 2025 09:39:08 +0700 Subject: Fix singleton mathces SO --- indoteknik_custom/models/purchase_order_sales_match.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indoteknik_custom') diff --git a/indoteknik_custom/models/purchase_order_sales_match.py b/indoteknik_custom/models/purchase_order_sales_match.py index b18864f3..084b93f7 100644 --- a/indoteknik_custom/models/purchase_order_sales_match.py +++ b/indoteknik_custom/models/purchase_order_sales_match.py @@ -39,7 +39,7 @@ class PurchaseOrderSalesMatch(models.Model): ('sale_line_id', '=', rec.sale_line_id.id), ]) if stock_move: - rec.bu_pick = stock_move.picking_id.id + rec.bu_pick = stock_move[0].picking_id.id else: rec.bu_pick = None -- cgit v1.2.3 From 18df26a9a413261a63cf0531078b51f92f0594fc Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Thu, 4 Sep 2025 09:41:21 +0700 Subject: fix finance note open lock --- indoteknik_custom/views/refund_sale_order.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'indoteknik_custom') diff --git a/indoteknik_custom/views/refund_sale_order.xml b/indoteknik_custom/views/refund_sale_order.xml index ae0861e2..20a07aa3 100644 --- a/indoteknik_custom/views/refund_sale_order.xml +++ b/indoteknik_custom/views/refund_sale_order.xml @@ -214,12 +214,12 @@ - + - - - + + + -- cgit v1.2.3 From 14d3ad7bbb8a6bd9c1272685aed4b3712ab1f33d Mon Sep 17 00:00:00 2001 From: "Indoteknik ." Date: Thu, 4 Sep 2025 11:14:27 +0700 Subject: (andri) fix reminder --- indoteknik_custom/models/account_move.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'indoteknik_custom') diff --git a/indoteknik_custom/models/account_move.py b/indoteknik_custom/models/account_move.py index c44cad78..c93cfb76 100644 --- a/indoteknik_custom/models/account_move.py +++ b/indoteknik_custom/models/account_move.py @@ -179,9 +179,8 @@ class AccountMove(models.Model): ('state', '=', 'posted'), ('payment_state', 'not in', ['paid', 'in_payment', 'reversed']), ('invoice_date_due', 'in', target_dates), - ('date_terima_tukar_faktur', '!=', False), - ('partner_id', 'in' , [94603]) - ], limit=5) + ('date_terima_tukar_faktur', '!=', False) + ]) _logger.info(f"Invoices: {invoices}") invoices = invoices.filtered( -- cgit v1.2.3 From 31a7f35e3c179b7f7ed3dcf764c7e834af559283 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Thu, 4 Sep 2025 11:21:39 +0700 Subject: fix finance note open lock --- indoteknik_custom/views/refund_sale_order.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indoteknik_custom') diff --git a/indoteknik_custom/views/refund_sale_order.xml b/indoteknik_custom/views/refund_sale_order.xml index 20a07aa3..0c6cd371 100644 --- a/indoteknik_custom/views/refund_sale_order.xml +++ b/indoteknik_custom/views/refund_sale_order.xml @@ -218,8 +218,8 @@ - - + + -- cgit v1.2.3 From 0a1f22cac507ee7e9975f1a68f79bccdf179c9fd Mon Sep 17 00:00:00 2001 From: Miqdad Date: Fri, 5 Sep 2025 09:07:23 +0700 Subject: add image --- indoteknik_custom/models/stock_move.py | 1 + indoteknik_custom/views/stock_picking.xml | 100 ++++++++++++++++++------------ 2 files changed, 63 insertions(+), 38 deletions(-) (limited to 'indoteknik_custom') diff --git a/indoteknik_custom/models/stock_move.py b/indoteknik_custom/models/stock_move.py index 90ab30a4..d4106830 100644 --- a/indoteknik_custom/models/stock_move.py +++ b/indoteknik_custom/models/stock_move.py @@ -15,6 +15,7 @@ class StockMove(models.Model): barcode = fields.Char(string='Barcode', related='product_id.barcode') vendor_id = fields.Many2one('res.partner' ,string='Vendor') hold_outgoingg = fields.Boolean('Hold Outgoing', default=False) + product_image_128 = fields.Image('Product Image', related='product_id.image_1920') # @api.model_create_multi # def create(self, vals_list): diff --git a/indoteknik_custom/views/stock_picking.xml b/indoteknik_custom/views/stock_picking.xml index b3f0ce9f..e230bccc 100644 --- a/indoteknik_custom/views/stock_picking.xml +++ b/indoteknik_custom/views/stock_picking.xml @@ -8,7 +8,7 @@ final_seq asc - + @@ -20,9 +20,11 @@ - + - + @@ -50,11 +52,11 @@ type="object" attrs="{'invisible': ['|', ('state', 'in', ['done']), ('approval_receipt_status', '=', 'pengajuan1')]}" /> - - - - - + + + + + + + + @@ -105,7 +112,8 @@ - + @@ -133,7 +141,7 @@ 1 - + @@ -141,7 +149,8 @@ - + + - - + + - - + + - + - - + + - + @@ -220,7 +235,8 @@ - - -- cgit v1.2.3 From 4bd34e21d8d4dc3b2f688e181fb05c6359ac1f43 Mon Sep 17 00:00:00 2001 From: Miqdad Date: Sat, 6 Sep 2025 11:29:08 +0700 Subject: fix manufacture in stock move line & done --- indoteknik_custom/models/stock_move.py | 3 +-- indoteknik_custom/views/stock_move_line.xml | 9 +++++---- indoteknik_custom/views/stock_picking.xml | 7 ++++++- 3 files changed, 12 insertions(+), 7 deletions(-) (limited to 'indoteknik_custom') diff --git a/indoteknik_custom/models/stock_move.py b/indoteknik_custom/models/stock_move.py index 9ec36fcd..24d405a6 100644 --- a/indoteknik_custom/models/stock_move.py +++ b/indoteknik_custom/models/stock_move.py @@ -18,8 +18,7 @@ class StockMove(models.Model): barcode = fields.Char(string='Barcode', related='product_id.barcode') vendor_id = fields.Many2one('res.partner' ,string='Vendor') hold_outgoingg = fields.Boolean('Hold Outgoing', default=False) - product_image= fields.Image('Product Image', related='product_id.image_1920') - + product_image = fields.Binary(related="product_id.image_128", string="Product Image", readonly = True) # @api.model_create_multi # def create(self, vals_list): # moves = super(StockMove, self).create(vals_list) diff --git a/indoteknik_custom/views/stock_move_line.xml b/indoteknik_custom/views/stock_move_line.xml index 757d2522..94c0bf53 100644 --- a/indoteknik_custom/views/stock_move_line.xml +++ b/indoteknik_custom/views/stock_move_line.xml @@ -3,18 +3,19 @@ Stock Move Line stock.move.line - + + - + - + Stock Move Line stock.move.line - + diff --git a/indoteknik_custom/views/stock_picking.xml b/indoteknik_custom/views/stock_picking.xml index c8aa6454..50c5f261 100644 --- a/indoteknik_custom/views/stock_picking.xml +++ b/indoteknik_custom/views/stock_picking.xml @@ -99,7 +99,7 @@ attrs="{'invisible': [('state_approve_md', 'not in', ['waiting'])]}" /> - @@ -140,6 +140,11 @@ 1 + + + + -- cgit v1.2.3 From f2adf9ad9ed7491a6ad5422d1236761e7d42c82f Mon Sep 17 00:00:00 2001 From: Miqdad Date: Mon, 8 Sep 2025 12:30:59 +0700 Subject: remove image in tree view --- indoteknik_custom/views/stock_picking.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indoteknik_custom') diff --git a/indoteknik_custom/views/stock_picking.xml b/indoteknik_custom/views/stock_picking.xml index 50c5f261..fc8be790 100644 --- a/indoteknik_custom/views/stock_picking.xml +++ b/indoteknik_custom/views/stock_picking.xml @@ -99,11 +99,11 @@ attrs="{'invisible': [('state_approve_md', 'not in', ['waiting'])]}" /> - - + --> -- cgit v1.2.3 From 6188090965c5381fa120268a024a486e62056505 Mon Sep 17 00:00:00 2001 From: Miqdad Date: Mon, 8 Sep 2025 15:05:19 +0700 Subject: hilangin validasi sementara --- indoteknik_custom/models/tukar_guling_po.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indoteknik_custom') diff --git a/indoteknik_custom/models/tukar_guling_po.py b/indoteknik_custom/models/tukar_guling_po.py index f2f37606..c65ac286 100644 --- a/indoteknik_custom/models/tukar_guling_po.py +++ b/indoteknik_custom/models/tukar_guling_po.py @@ -441,8 +441,8 @@ class TukarGulingPO(models.Model): ('state', '!=', 'cancel'), ], limit=1) - if existing_tukar_guling: - raise UserError("BU ini sudah pernah diretur oleh dokumen %s." % existing_tukar_guling.name) + # if existing_tukar_guling: + # raise UserError("BU ini sudah pernah diretur oleh dokumen %s." % existing_tukar_guling.name) picking = self.operations pick_id = self.operations.picking_type_id.id -- cgit v1.2.3 From 7a34ad0965e08d1428c700f09a49f30f17c1996c Mon Sep 17 00:00:00 2001 From: Miqdad Date: Mon, 8 Sep 2025 15:08:54 +0700 Subject: Balikin --- indoteknik_custom/models/tukar_guling_po.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indoteknik_custom') diff --git a/indoteknik_custom/models/tukar_guling_po.py b/indoteknik_custom/models/tukar_guling_po.py index c65ac286..f2f37606 100644 --- a/indoteknik_custom/models/tukar_guling_po.py +++ b/indoteknik_custom/models/tukar_guling_po.py @@ -441,8 +441,8 @@ class TukarGulingPO(models.Model): ('state', '!=', 'cancel'), ], limit=1) - # if existing_tukar_guling: - # raise UserError("BU ini sudah pernah diretur oleh dokumen %s." % existing_tukar_guling.name) + if existing_tukar_guling: + raise UserError("BU ini sudah pernah diretur oleh dokumen %s." % existing_tukar_guling.name) picking = self.operations pick_id = self.operations.picking_type_id.id -- cgit v1.2.3 From 03db5f5bfd027fceeb0733bbb51e95e03c43d2cd Mon Sep 17 00:00:00 2001 From: Miqdad Date: Mon, 8 Sep 2025 16:20:28 +0700 Subject: copy false PO refund --- indoteknik_custom/models/purchase_order.py | 2 +- indoteknik_custom/models/refund_sale_order.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'indoteknik_custom') diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index 50913a80..18811b85 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -66,7 +66,7 @@ class PurchaseOrder(models.Model): sale_order = fields.Char(string='Sale Order') matches_so = fields.Many2many('sale.order', string='Matches SO', compute='_compute_matches_so') is_create_uangmuka = fields.Boolean(string='Uang Muka?') - move_id = fields.Many2one('account.move', string='Journal Entries Uang Muka', domain=[('move_type', '=', 'entry')]) + move_id = fields.Many2one('account.move', string='Journal Entries Uang Muka', domain=[('move_type', '=', 'entry')], copy=False) logbook_bill_id = fields.Many2one('report.logbook.bill', string='Logbook Bill') status_printed = fields.Selection([ ('not_printed', 'Belum Print'), diff --git a/indoteknik_custom/models/refund_sale_order.py b/indoteknik_custom/models/refund_sale_order.py index 731d8e41..9ab18f27 100644 --- a/indoteknik_custom/models/refund_sale_order.py +++ b/indoteknik_custom/models/refund_sale_order.py @@ -76,6 +76,7 @@ class RefundSaleOrder(models.Model): transfer_move_id = fields.Many2one( 'account.move', string="Journal Payment", + copy=False, help="Pilih transaksi salah transfer dari jurnal Uang Muka (journal_id=11) yang tidak terkait SO." ) -- cgit v1.2.3