[IMP] account_edi_ubl_cii: add Singapore Bis 3 format
Add a new edi_format "SG BIS Billing 3.0" available for SG companies. This format is based on BIS Billing 3.0. task-3180983 closes odoo/odoo#115147 Signed-off-by: Laurent Smet <las@odoo.com>
This commit is contained in:
@@ -9,6 +9,7 @@ from . import account_edi_xml_ubl_xrechnung
|
||||
from . import account_edi_xml_ubl_nlcius
|
||||
from . import account_edi_xml_ubl_efff
|
||||
from . import account_edi_xml_ubl_a_nz
|
||||
from . import account_edi_xml_ubl_sg
|
||||
from . import account_move_send
|
||||
from . import account_move
|
||||
from . import account_journal
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from odoo import models
|
||||
|
||||
|
||||
class AccountEdiXmlUBLSG(models.AbstractModel):
|
||||
_inherit = "account.edi.xml.ubl_bis3"
|
||||
_name = "account.edi.xml.ubl_sg"
|
||||
_description = "SG BIS Billing 3.0"
|
||||
|
||||
"""
|
||||
Documentation: https://www.peppolguide.sg/billing/bis/
|
||||
"""
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# EXPORT
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
def _export_invoice_filename(self, invoice):
|
||||
return f"{invoice.name.replace('/', '_')}_sg.xml"
|
||||
|
||||
def _export_invoice_ecosio_schematrons(self):
|
||||
return {
|
||||
'invoice': 'eu.peppol.bis3.sg.ubl:invoice:1.0.3',
|
||||
'credit_note': 'eu.peppol.bis3.sg.ubl:creditnote:1.0.3',
|
||||
}
|
||||
|
||||
def _get_partner_party_vals(self, partner, role):
|
||||
# EXTENDS account.edi.xml.ubl_bis3
|
||||
vals = super()._get_partner_party_vals(partner, role)
|
||||
|
||||
for party_tax_scheme in vals['party_tax_scheme_vals']:
|
||||
party_tax_scheme['tax_scheme_id'] = 'GST'
|
||||
|
||||
return vals
|
||||
|
||||
def _get_invoice_payment_means_vals_list(self, invoice):
|
||||
""" https://www.peppolguide.sg/billing/bis/#_payment_means_information
|
||||
"""
|
||||
vals_list = super()._get_invoice_payment_means_vals_list(invoice)
|
||||
for vals in vals_list:
|
||||
vals.update({
|
||||
'payment_means_code': 54,
|
||||
'payment_means_code_attrs': {'name': 'Credit Card'},
|
||||
})
|
||||
|
||||
return vals_list
|
||||
|
||||
def _get_tax_sg_codes(self, invoice, tax):
|
||||
""" https://www.peppolguide.sg/billing/bis/#_gst_category_codes
|
||||
"""
|
||||
tax_category_code = 'SR'
|
||||
if tax.amount == 0:
|
||||
tax_category_code = 'ZR'
|
||||
return tax_category_code
|
||||
|
||||
def _get_tax_category_list(self, invoice, taxes):
|
||||
# OVERRIDE
|
||||
res = []
|
||||
for tax in taxes:
|
||||
res.append({
|
||||
'id': self._get_tax_sg_codes(invoice, tax),
|
||||
'percent': tax.amount if tax.amount_type == 'percent' else False,
|
||||
'tax_scheme_id': 'GST',
|
||||
})
|
||||
return res
|
||||
|
||||
def _export_invoice_vals(self, invoice):
|
||||
# EXTENDS account.edi.xml.ubl_bis3
|
||||
vals = super()._export_invoice_vals(invoice)
|
||||
|
||||
vals['vals'].update({
|
||||
'customization_id': 'urn:cen.eu:en16931:2017#conformant#urn:fdc:peppol.eu:2017:poacc:billing:international:sg:3.0',
|
||||
})
|
||||
|
||||
return vals
|
||||
@@ -39,5 +39,7 @@ class AccountJournal(models.Model):
|
||||
return self.env['account.edi.xml.ubl_a_nz'], {}
|
||||
if self.country_code == 'NL':
|
||||
return self.env['account.edi.xml.ubl_nl'], {}
|
||||
if self.country_code == 'SG':
|
||||
return self.env['account.edi.xml.ubl_sg'], {}
|
||||
if self.country_code in COUNTRY_EAS:
|
||||
return self.env['account.edi.xml.ubl_bis3'], {}
|
||||
|
||||
Reference in New Issue
Block a user