diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2025-09-16 17:11:14 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2025-09-16 17:11:14 +0700 |
| commit | dba361e5b7a44b9ad2c0c7fa54355707f63fd49a (patch) | |
| tree | 1a90a466ac6fe62364e73c82e0572fec09fb1f23 | |
| parent | 89f5ec71ff2de871e596967e82b5d49a433851ca (diff) | |
fix bug
| -rw-r--r-- | indoteknik_custom/models/report_logbook_sj.py | 40 | ||||
| -rwxr-xr-x | indoteknik_custom/security/ir.model.access.csv | 6 |
2 files changed, 5 insertions, 41 deletions
diff --git a/indoteknik_custom/models/report_logbook_sj.py b/indoteknik_custom/models/report_logbook_sj.py index b45eab03..3b07ff02 100644 --- a/indoteknik_custom/models/report_logbook_sj.py +++ b/indoteknik_custom/models/report_logbook_sj.py @@ -86,46 +86,6 @@ class ReportLogbookSJ(models.Model): def _onchange_report_logbook_sj_line(self): self._resequence_lines() -from odoo import models, fields, api - - - - def action_send_to_telegram(self): - - entries = [] - pickings = self.report_logbook_sj_line.mapped('picking_id') - for p in pickings: - if p: - entries.append((p.name, p.id)) - - fallback_names = [l.name for l in self.report_logbook_sj_line if not l.picking_id and l.name] - if fallback_names: - picks = self.env['stock.picking'].search([('name', 'in', list(set(fallback_names)))]) - name2id = {p.name: p.id for p in picks} - for n in fallback_names: - entries.append((n, name2id.get(n))) - - seen, unique_entries = set(), [] - for name, pid in entries: - key = pid or name - if key and key not in seen: - seen.add(key) - unique_entries.append((name, pid)) - - header = f"{self.env.user.name} sudah mengisi di Logbook SJ Report:\n" - body = "\n".join(f"{name} ({pid or '-'})" for name, pid in unique_entries) if unique_entries else "- (tidak ada)" - text = header + body - - bot_mqdd = '8203414501:AAHy_XwiUAVrgRM2EJzW7sZx9npRLITZpb8' - chat_id_mqdd = '-4885333032' - apiURL = f'https://api.telegram.org/bot{bot_mqdd}/sendMessage' - try: - hehe = requests.post(apiURL, json={'chat_id': chat_id_mqdd, 'text': text}) - _logger.info(hehe) - except Exception as e: - print(e) - - class ReportLogbookSJLine(models.Model): _name = 'report.logbook.sj.line' _order = 'sequence, id' # urut default di UI & ORM (drag pakai sequence) diff --git a/indoteknik_custom/security/ir.model.access.csv b/indoteknik_custom/security/ir.model.access.csv index 0d2789b3..423fe138 100755 --- a/indoteknik_custom/security/ir.model.access.csv +++ b/indoteknik_custom/security/ir.model.access.csv @@ -183,8 +183,13 @@ access_production_purchase_match,access.production.purchase.match,model_producti access_image_carousel,access.image.carousel,model_image_carousel,,1,1,1,1 access_v_sale_notin_matchpo,access.v.sale.notin.matchpo,model_v_sale_notin_matchpo,,1,1,1,1 access_approval_payment_term,access.approval.payment.term,model_approval_payment_term,,1,1,1,1 +access_purchase_order_update_date_wizard,access.purchase.order.update.date.wizard,model_purchase_order_update_date_wizard,,1,1,1,1 +access_change_date_planned_wizard,access.change.date.planned.wizard,model_change_date_planned_wizard,,1,1,1,1 access_refund_sale_order,access.refund.sale.order,model_refund_sale_order,base.group_user,1,1,1,1 access_refund_sale_order_line,access.refund.sale.order.line,model_refund_sale_order_line,base.group_user,1,1,1,1 +access_reimburse,access.reimburse,model_reimburse,,1,1,1,1 +access_reimburse_line,access.reimburse.line,model_reimburse_line,,1,1,1,1 + access_purchasing_job_seen,purchasing.job.seen,model_purchasing_job_seen,,1,1,1,1 access_tukar_guling_all_users,tukar.guling.all.users,model_tukar_guling,base.group_user,1,1,1,1 @@ -192,7 +197,6 @@ access_tukar_guling_line_all_users,tukar.guling.line.all.users,model_tukar_gulin access_tukar_guling_po_all_users,tukar.guling.po.all.users,model_tukar_guling_po,base.group_user,1,1,1,1 access_tukar_guling_line_po_all_users,tukar.guling.line.po.all.users,model_tukar_guling_line_po,base.group_user,1,1,1,1 access_tukar_guling_mapping_koli_all_users,tukar.guling.mapping.koli.all.users,model_tukar_guling_mapping_koli,base.group_user,1,1,1,1 -access_purchase_order_update_date_wizard,access.purchase.order.update.date.wizard,model_purchase_order_update_date_wizard,base.group_user,1,1,1,1 access_sync_promise_date_wizard,access.sync.promise.date.wizard,model_sync_promise_date_wizard,base.group_user,1,1,1,1 access_sync_promise_date_wizard_line,access.sync.promise.date.wizard.line,model_sync_promise_date_wizard_line,base.group_user,1,1,1,1 access_change_date_planned_wizard,access.change.date.planned.wizard,model_change_date_planned_wizard,,1,1,1,1 |
