summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAzka Nathan <darizkyfaz@gmail.com>2025-01-15 16:20:11 +0700
committerAzka Nathan <darizkyfaz@gmail.com>2025-01-15 16:20:11 +0700
commit26688e4143d28f6a03eaf3f860ab25142ea7ca23 (patch)
treefaf83aa1301c3b2437874ea6020040f078a4535c
parentb764acbc595dd68fe1aeeda3f8f92977d0f6d4bc (diff)
parente4ec9406cd0903db59cfed34781da55a2dba4ca3 (diff)
Merge branch 'odoo-production' of bitbucket.org:altafixco/indoteknik-addons into odoo-production
-rw-r--r--indoteknik_custom/models/account_move.py2
-rw-r--r--indoteknik_custom/models/coretax_fatur.py6
-rw-r--r--indoteknik_custom/models/res_partner.py8
-rw-r--r--indoteknik_custom/views/res_partner.xml3
4 files changed, 16 insertions, 3 deletions
diff --git a/indoteknik_custom/models/account_move.py b/indoteknik_custom/models/account_move.py
index 2810c594..66726c8d 100644
--- a/indoteknik_custom/models/account_move.py
+++ b/indoteknik_custom/models/account_move.py
@@ -339,7 +339,7 @@ class AccountMove(models.Model):
invalid_invoices = self - invoices
if invalid_invoices:
invalid_ids = ", ".join(str(inv.id) for inv in invalid_invoices)
- raise UserError(_(
+ raise UserError((
"Faktur dengan ID berikut tidak valid untuk diekspor: {}.\n"
"Pastikan faktur dalam status 'posted', belum diekspor, dan merupakan 'out_invoice'.".format(invalid_ids)
))
diff --git a/indoteknik_custom/models/coretax_fatur.py b/indoteknik_custom/models/coretax_fatur.py
index ff8606b1..ae6dd2ae 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 ''
@@ -63,7 +65,7 @@ class CoretaxFaktur(models.Model):
ET.SubElement(tax_invoice, 'BuyerTin').text = buyerTIN
ET.SubElement(tax_invoice, 'BuyerDocument').text = 'TIN' if sum(int(char) for char in buyerTIN) > 0 else 'Other ID'
ET.SubElement(tax_invoice, 'BuyerCountry').text = 'IDN'
- ET.SubElement(tax_invoice, 'BuyerDocumentNumber').text = str(invoice.partner_id.id)
+ ET.SubElement(tax_invoice, 'BuyerDocumentNumber').text = '-' if sum(int(char) for char in buyerTIN) > 0 else str(invoice.partner_id.id)
ET.SubElement(tax_invoice, 'BuyerName').text = invoice.partner_id.nama_wajib_pajak or ''
ET.SubElement(tax_invoice, 'BuyerAdress').text = invoice.partner_id.alamat_lengkap_text or ''
ET.SubElement(tax_invoice, 'BuyerEmail').text = invoice.partner_id.email or ''
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 @@
<field name="npwp" position="before">
<field name="customer_type" required="1"/>
</field>
+ <field name="alamat_lengkap_text" position="after">
+ <field name="nitku" />
+ </field>
<field name="is_berikat" position="after">
<field name="pakta_integritas"/>
</field>