Odoo18-Base/addons/l10n_my_edi/data/my_ubl_templates.xml
2025-01-06 10:57:38 +07:00

51 lines
3.0 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<template id="ubl_21_InvoiceType_my" inherit_id="account_edi_ubl_cii.ubl_21_InvoiceType" primary="True">
<xpath expr="//*[local-name()='DocumentCurrencyCode']" position="after">
<!-- When applicable, the tax exchange rate MUST be provided. -->
<t xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"
xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">
<cac:TaxExchangeRate t-if="invoice.currency_id.name.upper() != 'MYR'">
<cbc:CalculationRate t-out="vals.get('tax_exchange_rate')"/>
<cbc:SourceCurrencyCode t-out="vals.get('document_currency_code')"/>
<cbc:TargetCurrencyCode>MYR</cbc:TargetCurrencyCode>
</cac:TaxExchangeRate>
<cac:AdditionalDocumentReference t-if="vals.get('invoice_incoterm_code')">
<cbc:ID t-out="vals['invoice_incoterm_code']"/>
</cac:AdditionalDocumentReference>
<cac:AdditionalDocumentReference t-if="vals.get('custom_form_reference')">
<cbc:ID t-out="vals['custom_form_reference']"/>
<cbc:DocumentType>CustomsImportForm</cbc:DocumentType>
</cac:AdditionalDocumentReference>
</t>
</xpath>
<!-- MyInvois does not support order references, having one will cause issues -->
<xpath expr="//*[local-name()='OrderReference']" position="replace"/>
</template>
<!-- They are not using the same template at all, so we make a new one. They basically want the same data as supplier/customer party -->
<template id="ubl_20_DeliveryType_my">
<t xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"
xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">
<cac:DeliveryParty>
<t t-set="accounting_delivery_vals" t-value="vals.get('accounting_delivery_party_vals', {})"/>
<t t-call="{{PartyType_template}}">
<t t-set="vals" t-value="accounting_delivery_vals"/>
</t>
</cac:DeliveryParty>
</t>
</template>
<template id="ubl_20_InvoiceLineType_my" inherit_id="account_edi_ubl_cii.ubl_20_InvoiceLineType" primary="True">
<xpath expr="//*[local-name()='Price']" position="after">
<t xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"
xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">
<cac:ItemPriceExtension>
<cbc:Amount t-att-currencyID="vals['currency'].name"
t-out="format_float(vals.get('item_price_extension_amount'), vals.get('currency_dp'))"/>
</cac:ItemPriceExtension>
</t>
</xpath>
</template>
</odoo>