From d0bcbd1b93719b2145a5cdc131f6fa6c9272a4e6 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Wed, 22 May 2024 14:48:58 +0700 Subject: count line on report logbook sj --- indoteknik_custom/models/report_logbook_sj.py | 7 +++++++ indoteknik_custom/views/report_logbook_sj.xml | 1 + 2 files changed, 8 insertions(+) diff --git a/indoteknik_custom/models/report_logbook_sj.py b/indoteknik_custom/models/report_logbook_sj.py index 093848b5..a1b6299c 100644 --- a/indoteknik_custom/models/report_logbook_sj.py +++ b/indoteknik_custom/models/report_logbook_sj.py @@ -30,6 +30,13 @@ class ReportLogbookSJ(models.Model): tracking=True, ) + count_line = fields.Char(string='Count Line', compute='_compute_count_line') + + @api.depends('report_logbook_sj_line') + def _compute_count_line(self): + for rec in self: + rec.count_line = len(rec.report_logbook_sj_line) + @api.model def create(self, vals): vals['name'] = self.env['ir.sequence'].next_by_code('report.logbook.sj') or '0' diff --git a/indoteknik_custom/views/report_logbook_sj.xml b/indoteknik_custom/views/report_logbook_sj.xml index 687464f0..147ae393 100644 --- a/indoteknik_custom/views/report_logbook_sj.xml +++ b/indoteknik_custom/views/report_logbook_sj.xml @@ -60,6 +60,7 @@ + -- cgit v1.2.3