From a5e3fc915aace81b68c781d69042a2a8822dac85 Mon Sep 17 00:00:00 2001 From: Miqdad Date: Wed, 17 Sep 2025 05:29:23 +0700 Subject: fix group chat id tele --- indoteknik_custom/models/sj_tele.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indoteknik_custom/models/sj_tele.py b/indoteknik_custom/models/sj_tele.py index 029adcbe..d44aa338 100644 --- a/indoteknik_custom/models/sj_tele.py +++ b/indoteknik_custom/models/sj_tele.py @@ -47,7 +47,7 @@ class SjTele(models.Model): def woi(self): bot_mqdd = '8203414501:AAHy_XwiUAVrgRM2EJzW7sZx9npRLITZpb8' - chat_id_mqdd = '-4885333032' + chat_id_mqdd = '-1003087280519' api_base = f'https://api.telegram.org/bot{bot_mqdd}' data = self.search([], order='create_date asc', limit=15) -- cgit v1.2.3 From 1271bb23355f04eec5535d09844c86de0810c7ca Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Wed, 17 Sep 2025 09:06:20 +0700 Subject: balikin alamat --- indoteknik_custom/report/purchase_report.xml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/indoteknik_custom/report/purchase_report.xml b/indoteknik_custom/report/purchase_report.xml index 150b7af2..dd19340d 100644 --- a/indoteknik_custom/report/purchase_report.xml +++ b/indoteknik_custom/report/purchase_report.xml @@ -61,7 +61,9 @@ Alamat Pengiriman
PT. Indoteknik Dotcom Gemilang
- Jl. Bandengan Utara Raya No. 85A, 8-9 RT.3/RW.16, Penjaringan, Kecamatan Penjaringan, Jkt Utara
+ Jl. Bandengan Utara Komp A 8 B + RT. Penjaringan, Kec. Penjaringan, Jakarta + (BELAKANG INDOMARET)
Daerah Khusus Ibukota Jakarta 14440 -- cgit v1.2.3 From 1ff3a02196c74dd21573e84aba22cca8bd99a3bb Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Wed, 17 Sep 2025 09:27:58 +0700 Subject: push --- indoteknik_custom/models/purchase_order.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index e7e5c382..68180235 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -117,7 +117,8 @@ class PurchaseOrder(models.Model): ) show_description = fields.Boolean( - string='Show Description' + string='Show Description', + default=True ) @api.onchange('show_description') -- cgit v1.2.3 From 3f43b0bb62cc8524c05fa9ac7ee0be9408f73381 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 17 Sep 2025 10:42:00 +0700 Subject: (andri) buat func terpisah untuk handle due dan overdue --- indoteknik_custom/models/account_move.py | 105 ++++++++++++++++--------------- 1 file changed, 55 insertions(+), 50 deletions(-) diff --git a/indoteknik_custom/models/account_move.py b/indoteknik_custom/models/account_move.py index 70cd07e4..b20e07c8 100644 --- a/indoteknik_custom/models/account_move.py +++ b/indoteknik_custom/models/account_move.py @@ -192,49 +192,54 @@ class AccountMove(models.Model): def send_due_invoice_reminder(self): today = fields.Date.today() target_dates = [ - today - timedelta(days=7), - today - timedelta(days=3), - today, - today + timedelta(days=3), today + timedelta(days=7), + today + timedelta(days=3), + today, ] - - for days_after_due in range(14, 181, 7): - target_dates.append(today - timedelta(days=days_after_due)) - invoices = self.env['account.move'].search([ ('move_type', '=', 'out_invoice'), ('state', '=', 'posted'), ('payment_state', 'not in', ['paid', 'in_payment', 'reversed']), ('invoice_date_due', 'in', target_dates), - ('date_terima_tukar_faktur', '!=', False) - ]) - _logger.info(f"Invoices: {invoices}") + ('date_terima_tukar_faktur', '!=', False), + ('invoice_payment_term_id.name', 'ilike', 'tempo')]) + if not invoices: + _logger.info("Tidak ada invoice yang due") + return - invoices = invoices.filtered( - lambda inv: inv.invoice_payment_term_id and 'tempo' in (inv.invoice_payment_term_id.name or '').lower() - ) - # _logger.info(f"Invoices tahap 2: {invoices}") + self._send_invoice_reminders(invoices, mode='due') + def send_overdue_invoice_reminder(self): + today = fields.Date.today() + invoices = self.env['account.move'].search([ + ('move_type', '=', 'out_invoice'), + ('state', '=', 'posted'), + ('payment_state', 'not in', ['paid', 'in_payment', 'reversed']), + ('invoice_date_due', '<', today), + ('date_terima_tukar_faktur', '!=', False), + ('invoice_payment_term_id.name', 'ilike', 'tempo')]) if not invoices: - _logger.info("Tidak ada invoice yang due") + _logger.info("Tidak ada invoice yang overdue") return + self._send_invoice_reminders(invoices, mode='overdue') + + def _send_invoice_reminders(self, invoices, mode): + today = fields.Date.today() + template = self.env.ref('indoteknik_custom.mail_template_invoice_due_reminder') invoice_group = {} for inv in invoices: dtd = (inv.invoice_date_due - today).days if inv.invoice_date_due else 0 - key = (inv.partner_id, dtd) + key = (inv.partner_id, dtd if mode == 'due' else "overdue") if key not in invoice_group: invoice_group[key] = self.env['account.move'] # recordset kosong invoice_group[key] |= inv # gabung recordset - template = self.env.ref('indoteknik_custom.mail_template_invoice_due_reminder') - for (partner, dtd), invs in invoice_group.items(): if all(inv.reminder_sent_date == today for inv in invs): _logger.info(f"Reminder untuk {partner.name} sudah terkirim hari ini, skip.") continue - + promise_dates = [inv.customer_promise_date for inv in invs if inv.customer_promise_date] if promise_dates: earliest_promise = min(promise_dates) # ambil janji paling awal @@ -354,33 +359,33 @@ class AccountMove(models.Model): days_to_due_message = "" closing_message = "" - if dtd > 0: - days_to_due_message = ( - f"Kami ingin mengingatkan bahwa tagihan anda akan jatuh tempo dalam {dtd} hari ke depan, " - "dengan rincian sebagai berikut:" - ) - closing_message = ( - "Kami mengharapkan pembayaran dapat dilakukan tepat waktu untuk mendukung kelancaran " - "hubungan kerja sama yang baik antara kedua belah pihak.
" - "Mohon konfirmasi apabila pembayaran telah dijadwalkan. " - "Terima kasih atas perhatian dan kerja samanya." - ) - - if dtd == 0: - days_to_due_message = ( - "Kami ingin mengingatkan bahwa tagihan anda telah memasuki tanggal jatuh tempo pada hari ini, " - "dengan rincian sebagai berikut:" - ) - closing_message = ( - "Mohon kesediaannya untuk segera melakukan pembayaran tepat waktu guna menghindari status " - "keterlambatan dan menjaga kelancaran hubungan kerja sama yang telah terjalin dengan baik.
" - "Apabila pembayaran telah dijadwalkan atau diproses, mohon dapat dikonfirmasi kepada kami. " - "Terima kasih atas perhatian dan kerja samanya." - ) + if mode == "due": + if dtd > 0: + days_to_due_message = ( + f"Kami ingin mengingatkan bahwa tagihan anda akan jatuh tempo dalam {dtd} hari ke depan, " + "dengan rincian sebagai berikut:" + ) + closing_message = ( + "Kami mengharapkan pembayaran dapat dilakukan tepat waktu untuk mendukung kelancaran " + "hubungan kerja sama yang baik antara kedua belah pihak.
" + "Mohon konfirmasi apabila pembayaran telah dijadwalkan. " + "Terima kasih atas perhatian dan kerja samanya." + ) - if dtd < 0: + elif dtd == 0: + days_to_due_message = ( + "Kami ingin mengingatkan bahwa tagihan anda telah memasuki tanggal jatuh tempo pada hari ini, " + "dengan rincian sebagai berikut:" + ) + closing_message = ( + "Mohon kesediaannya untuk segera melakukan pembayaran tepat waktu guna menghindari status " + "keterlambatan dan menjaga kelancaran hubungan kerja sama yang telah terjalin dengan baik.
" + "Apabila pembayaran telah dijadwalkan atau diproses, mohon dapat dikonfirmasi kepada kami. " + "Terima kasih atas perhatian dan kerja samanya." + ) + else: # mode overdue days_to_due_message = ( - f"Kami ingin mengingatkan bahwa tagihan anda telah jatuh tempo selama {abs(dtd)} hari, " + f"Kami ingin mengingatkan bahwa beberapa tagihan anda telah jatuh tempo, " "dengan rincian sebagai berikut:" ) closing_message = ( @@ -413,13 +418,13 @@ class AccountMove(models.Model): # Siapkan email values values = { - 'subject': f"Reminder Invoice Due - {partner.name}", - # 'email_to': 'andrifebriyadiputra@gmail.com', - 'email_to': email_to, + 'subject': f"Reminder Invoice Due Test - {partner.name}", + 'email_to': 'andrifebriyadiputra@gmail.com', + # 'email_to': email_to, 'email_from': 'finance@indoteknik.co.id', - 'email_cc': ",".join(sorted(set(cc_list))), + # 'email_cc': ",".join(sorted(set(cc_list))), 'body_html': body_html, - 'reply_to': 'finance@indoteknik.co.id', + # 'reply_to': 'finance@indoteknik.co.id', } template.send_mail(invs[0].id, force_send=True, email_values=values) -- cgit v1.2.3 From 811e9dde8a027276b92a8dd594e11237b0b3b8c5 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Wed, 17 Sep 2025 10:45:52 +0700 Subject: push --- indoteknik_custom/views/purchase_order.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indoteknik_custom/views/purchase_order.xml b/indoteknik_custom/views/purchase_order.xml index a0ac9824..7feec934 100755 --- a/indoteknik_custom/views/purchase_order.xml +++ b/indoteknik_custom/views/purchase_order.xml @@ -99,7 +99,7 @@ - + -- cgit v1.2.3 From d37525b0dbdec49d2e812fc1945fb6a81a570e94 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 17 Sep 2025 11:09:35 +0700 Subject: (andri) add numbering + testing --- indoteknik_custom/models/account_move.py | 13 +++++++++---- indoteknik_custom/views/mail_template_invoice_reminder.xml | 1 + 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/indoteknik_custom/models/account_move.py b/indoteknik_custom/models/account_move.py index b20e07c8..f10ca23f 100644 --- a/indoteknik_custom/models/account_move.py +++ b/indoteknik_custom/models/account_move.py @@ -203,6 +203,7 @@ class AccountMove(models.Model): ('invoice_date_due', 'in', target_dates), ('date_terima_tukar_faktur', '!=', False), ('invoice_payment_term_id.name', 'ilike', 'tempo')]) + _logger.info(f"Found {len(invoices)} invoices due for reminder {invoices}.") if not invoices: _logger.info("Tidak ada invoice yang due") return @@ -217,7 +218,9 @@ class AccountMove(models.Model): ('payment_state', 'not in', ['paid', 'in_payment', 'reversed']), ('invoice_date_due', '<', today), ('date_terima_tukar_faktur', '!=', False), - ('invoice_payment_term_id.name', 'ilike', 'tempo')]) + ('invoice_payment_term_id.name', 'ilike', 'tempo'), + ('partner_id', 'in', [94603])]) + _logger.info(f"Found {len(invoices)} invoices overdue for reminder {invoices}.") if not invoices: _logger.info("Tidak ada invoice yang overdue") return @@ -281,11 +284,12 @@ class AccountMove(models.Model): invoice_table_rows = "" grand_total = 0 - for inv in invs: + for idx, inv in enumerate(invs, start=1): # numbering days_to_due = (inv.invoice_date_due - today).days if inv.invoice_date_due else 0 grand_total += inv.amount_total invoice_table_rows += f""" + {idx} {inv.partner_id.name} {inv.ref or '-'} {inv.name} @@ -296,6 +300,7 @@ class AccountMove(models.Model): {days_to_due} """ + invoice_table_footer = f""" @@ -428,10 +433,10 @@ class AccountMove(models.Model): } template.send_mail(invs[0].id, force_send=True, email_values=values) - _logger.info(f"Mengirim email ke: {values['email_to']} > email CC: {values['email_cc']}") + # _logger.info(f"Mengirim email ke: {values['email_to']} > email CC: {values['email_cc']}") _logger.info(f"Reminder terkirim ke {partner.name} ({values['email_to']}) → {len(invs)} invoice (dtd = {dtd})") # flag - invs.write({'reminder_sent_date': today}) + # invs.write({'reminder_sent_date': today}) # Post ke chatter user_system = self.env['res.users'].browse(25) system_id = user_system.partner_id.id if user_system else False diff --git a/indoteknik_custom/views/mail_template_invoice_reminder.xml b/indoteknik_custom/views/mail_template_invoice_reminder.xml index 13c02a08..3534f7f6 100644 --- a/indoteknik_custom/views/mail_template_invoice_reminder.xml +++ b/indoteknik_custom/views/mail_template_invoice_reminder.xml @@ -17,6 +17,7 @@ style="border-collapse:collapse; font-size:12px; border:1px solid #ddd;"> + No. Customer No. PO Invoice Number -- cgit v1.2.3 From 9e570f94949dad425e4bd9ce438240373460e4fc Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Wed, 17 Sep 2025 15:36:45 +0700 Subject: bf invoice dp, redundant qty invoice in sale order --- indoteknik_custom/models/sale_order.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index 484a9016..dd06f541 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -1848,7 +1848,8 @@ class SaleOrder(models.Model): # if term.days > 0: # raise UserError('Hanya dapat digunakan pada Cash Before Delivery') for line in self.order_line: - line.qty_to_invoice = line.product_uom_qty + if line.product_id.type == 'product': + line.qty_to_invoice = line.product_uom_qty # def _get_pickings(self): # state = ['assigned'] -- cgit v1.2.3 From 61b54c404d0c104a5751a17eed94c5934805a050 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Wed, 17 Sep 2025 15:52:33 +0700 Subject: delivery date --- indoteknik_custom/models/stock_picking.py | 1 + indoteknik_custom/views/stock_picking.xml | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py index 78a49ee4..35d408a1 100644 --- a/indoteknik_custom/models/stock_picking.py +++ b/indoteknik_custom/models/stock_picking.py @@ -307,6 +307,7 @@ class StockPicking(models.Model): ('delay', 'Delay By Vendor'), ('urgent', 'Urgent Delivery'), ], string='Reason Change Date Planned', tracking=True) + delivery_date = fields.Datetime(string='Delivery Date', copy=False) def _get_kgx_awb_number(self): """Menggabungkan name dan origin untuk membuat AWB Number""" diff --git a/indoteknik_custom/views/stock_picking.xml b/indoteknik_custom/views/stock_picking.xml index fc8be790..abaf347d 100644 --- a/indoteknik_custom/views/stock_picking.xml +++ b/indoteknik_custom/views/stock_picking.xml @@ -28,6 +28,10 @@ + + + + @@ -140,6 +144,9 @@ 1 + + + -- cgit v1.2.3