From 4aa7c5af3bd15ca382fe72fbfea416c169d58ebf Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Wed, 15 Jan 2025 14:25:36 +0700 Subject: add nitku --- indoteknik_custom/models/coretax_fatur.py | 4 +++- indoteknik_custom/models/res_partner.py | 8 ++++++++ indoteknik_custom/views/res_partner.xml | 3 +++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/indoteknik_custom/models/coretax_fatur.py b/indoteknik_custom/models/coretax_fatur.py index ff8606b1..f0043884 100644 --- a/indoteknik_custom/models/coretax_fatur.py +++ b/indoteknik_custom/models/coretax_fatur.py @@ -49,7 +49,9 @@ class CoretaxFaktur(models.Model): for invoice in invoices: tax_invoice = ET.SubElement(list_of_tax_invoice, 'TaxInvoice') buyerTIN = self.validate_and_format_number(invoice.partner_id.npwp) - buyerIDTKU = buyerTIN.ljust(len(buyerTIN) + 6, '0') if sum(int(char) for char in buyerTIN) > 0 else '000000' + nitku = invoice.partner_id.nitku + formula = nitku if nitku else buyerTIN.ljust(len(buyerTIN) + 6, '0') + buyerIDTKU = formula if sum(int(char) for char in buyerTIN) > 0 else '000000' # Tambahkan elemen faktur ET.SubElement(tax_invoice, 'TaxInvoiceDate').text = invoice.invoice_date.strftime('%Y-%m-%d') if invoice.invoice_date else '' diff --git a/indoteknik_custom/models/res_partner.py b/indoteknik_custom/models/res_partner.py index 57fab403..f081e274 100644 --- a/indoteknik_custom/models/res_partner.py +++ b/indoteknik_custom/models/res_partner.py @@ -102,6 +102,7 @@ class ResPartner(models.Model): ]) sppkp = fields.Char(string="SPPKP", tracking=True) npwp = fields.Char(string="NPWP", tracking=True) + nitku = fields.Char(string="NITKU", tracking=True) counter = fields.Integer(string="Counter", default=0) leadtime = fields.Integer(string="Leadtime", default=0) digital_invoice_tax = fields.Boolean(string="Digital Invoice & Faktur Pajak") @@ -449,3 +450,10 @@ class ResPartner(models.Model): return partner.property_payment_term_id.name if partner.property_payment_term_id.id else 'Cash Before Delivery (C.B.D)' + @api.constrains('nitku') + def _onchange_nitku(self): + if self.nitku: + if not self.nitku.isdigit(): + raise UserError("NITKU harus berupa angka.") + if len(self.nitku) != 22: + raise UserError("NITKU harus memiliki tepat 22 angka.") \ No newline at end of file diff --git a/indoteknik_custom/views/res_partner.xml b/indoteknik_custom/views/res_partner.xml index 7e759e31..bd664890 100644 --- a/indoteknik_custom/views/res_partner.xml +++ b/indoteknik_custom/views/res_partner.xml @@ -56,6 +56,9 @@ + + + -- cgit v1.2.3