From b3981d40d8cc8788bcec0aaa1444f5cf5328fa56 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Wed, 27 Mar 2024 13:05:18 +0700 Subject: add field for jasper reports --- indoteknik_custom/models/account_move.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/indoteknik_custom/models/account_move.py b/indoteknik_custom/models/account_move.py index e26e8266..4d0d6ae5 100644 --- a/indoteknik_custom/models/account_move.py +++ b/indoteknik_custom/models/account_move.py @@ -7,6 +7,7 @@ import base64 import PyPDF2 import os import re +from terbilang import Terbilang _logger = logging.getLogger(__name__) @@ -54,6 +55,15 @@ class AccountMove(models.Model): bills_invoice_document = fields.Binary(string="Invoice", required=False) is_invoice_uploaded = fields.Boolean(string="Is Invoice Uploaded", default=False) is_efaktur_uploaded = fields.Boolean(string="Is eFaktur Uploaded", default=False) + delivery_amt_text = fields.Char(string="Delivery Amt Terbilang", compute='compute_delivery_amt_text') + + def compute_delivery_amt_text(self): + tb = Terbilang() + + for record in self: + if record.sale_id.delivery_amt > 0: + tb.parse(int(record.sale_id.delivery_amt)) + record.delivery_amt_text = tb.getresult().title() @api.constrains('bills_efaktur_document') def _constrains_efaktur_document(self): -- cgit v1.2.3