Odoo18-Base/addons/l10n_id_efaktur/models/res_partner.py

42 lines
1.8 KiB
Python
Raw Permalink Normal View History

2025-03-10 11:12:23 +07:00
# -*- encoding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import fields, models, api
class ResPartner(models.Model):
"""Inherit res.partner object to add NPWP field and Kode Transaksi"""
_inherit = "res.partner"
l10n_id_pkp = fields.Boolean(string="ID PKP", compute='_compute_l10n_id_pkp', store=True, readonly=False)
l10n_id_nik = fields.Char(string='NIK')
l10n_id_tax_address = fields.Char('Tax Address')
l10n_id_tax_name = fields.Char('Tax Name')
l10n_id_kode_transaksi = fields.Selection([
('01', '01 To the Parties that is not VAT Collector (Regular Customers)'),
('02', '02 To the Treasurer'),
('03', '03 To other VAT Collectors other than the Treasurer'),
('04', '04 Other Value of VAT Imposition Base'),
('05', '05 Specified Amount (Article 9A Paragraph (1) VAT Law)'),
('06', '06 to individuals holding foreign passports'),
('07', '07 Deliveries that the VAT is not Collected'),
('08', '08 Deliveries that the VAT is Exempted'),
('09', '09 Deliveries of Assets (Article 16D of VAT Law)'),
],
string='Kode Transaksi',
help='Dua digit pertama nomor pajak',
default='01',
)
@api.depends('vat', 'country_code')
def _compute_l10n_id_pkp(self):
for record in self:
record.l10n_id_pkp = record.vat and record.country_code == 'ID'
class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings'
l10n_id_tax_address = fields.Char('Tax Address', related='company_id.partner_id.l10n_id_tax_address', readonly=False)
l10n_id_tax_name = fields.Char('Tax Name', related='company_id.partner_id.l10n_id_tax_address', readonly=False)