{"en_US": "<t t-name=\"account_edi_ubl_cii.account_invoice_facturx_export_22\">\n            <t t-set=\"currency\" t-value=\"record.currency_id or record.company_currency_id\"/>\n            <rsm:CrossIndustryInvoice xmlns:ram=\"urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100\" xmlns:rsm=\"urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100\" xmlns:udt=\"urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100\" xmlns:qdt=\"urn:un:unece:uncefact:data:standard:QualifiedDataType:100\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n                <!-- Factur-x level:\n                    * minimum or basicwl:   urn:factur-x.eu:1p0...\n                    * basic:                urn:cen.eu:en16931:2017:compliant:factur-x.eu:1p0:basic\n                    * en16931:              urn:cen.eu:en16931:2017\n                -->\n                <rsm:ExchangedDocumentContext>\n                    <ram:GuidelineSpecifiedDocumentContextParameter>\n                        <ram:ID t-out=\"document_context_id\"/>\n                    </ram:GuidelineSpecifiedDocumentContextParameter>\n                </rsm:ExchangedDocumentContext>\n\n                <!-- Document Headers. -->\n                <rsm:ExchangedDocument>\n                    <ram:ID t-out=\"ExchangedDocument_vals.get('id')\"/>\n                    <ram:TypeCode t-out=\"ExchangedDocument_vals.get('type_code')\"/>\n                    <ram:IssueDateTime t-if=\"ExchangedDocument_vals.get('issue_date_time')\">\n                        <udt:DateTimeString format=\"102\" t-out=\"format_date(ExchangedDocument_vals.get('issue_date_time'))\"/>\n                    </ram:IssueDateTime>\n                    <ram:IncludedNote>\n                        <ram:Content t-out=\"ExchangedDocument_vals.get('included_note')\"/>\n                    </ram:IncludedNote>\n                </rsm:ExchangedDocument>\n\n                <rsm:SupplyChainTradeTransaction>\n                    <!-- Invoice lines. -->\n                    <t t-foreach=\"invoice_line_vals_list\" t-as=\"line_vals\">\n                        <t t-call=\"account_edi_ubl_cii.account_invoice_line_facturx_export_22\"/>\n                    </t>\n\n                    <!-- Partners. -->\n                    <ram:ApplicableHeaderTradeAgreement>\n                        <!-- \"Service Exécutant\" (Used by Chorus Pro) -->\n                        <ram:BuyerReference t-out=\"buyer_reference\"/>\n                        <!-- Seller. -->\n                        <ram:SellerTradeParty>\n                            <!-- Address. -->\n                            <t t-call=\"account_edi_ubl_cii.account_invoice_partner_facturx_export_22\">\n                                <t t-set=\"partner\" t-value=\"record.company_id.partner_id\"/>\n                                <t t-set=\"specified_legal_organization_val\" t-value=\"seller_specified_legal_organization\"/>\n                            </t>\n\n                            <!-- VAT. -->\n                            <ram:SpecifiedTaxRegistration t-if=\"record.fiscal_position_id.foreign_vat\">\n                                <ram:ID schemeID=\"VA\" t-out=\"record.fiscal_position_id.foreign_vat\"/>\n                            </ram:SpecifiedTaxRegistration>\n\n                            <ram:SpecifiedTaxRegistration t-elif=\"record.company_id.vat\">\n                                <ram:ID schemeID=\"VA\" t-out=\"record.company_id.vat\"/>\n                            </ram:SpecifiedTaxRegistration>\n                        </ram:SellerTradeParty>\n\n                        <!-- Customer. -->\n                        <ram:BuyerTradeParty>\n                            <!-- Address. -->\n                            <t t-call=\"account_edi_ubl_cii.account_invoice_partner_facturx_export_22\">\n                                <t t-set=\"partner\" t-value=\"record.partner_id\"/>\n                                <t t-set=\"specified_legal_organization_val\" t-value=\"buyer_specified_legal_organization\"/>\n                            </t>\n\n                            <!-- VAT. -->\n                            <ram:SpecifiedTaxRegistration t-if=\"record.commercial_partner_id.vat\">\n                                <ram:ID schemeID=\"VA\" t-out=\"record.commercial_partner_id.vat\"/>\n                            </ram:SpecifiedTaxRegistration>\n                        </ram:BuyerTradeParty>\n\n                        <!-- Reference. -->\n                        <ram:BuyerOrderReferencedDocument>\n                            <!-- \"Engagement Juridique\" (used by Chorus Pro) -->\n                            <ram:IssuerAssignedID t-out=\"purchase_order_reference\"/>\n                        </ram:BuyerOrderReferencedDocument>\n                        <ram:ContractReferencedDocument>\n                            <!-- \"Numéro de Marché\" (Used by Chorus Pro) -->\n                            <ram:IssuerAssignedID t-out=\"contract_reference\"/>\n                        </ram:ContractReferencedDocument>\n                    </ram:ApplicableHeaderTradeAgreement>\n\n                    <!-- Delivery -->\n                    <ram:ApplicableHeaderTradeDelivery>\n                        <ram:ShipToTradeParty>\n                            <t t-call=\"account_edi_ubl_cii.account_invoice_partner_facturx_export_22\">\n                                <t t-set=\"partner\" t-value=\"ship_to_trade_party\"/>\n                                <t t-set=\"hide_dtc\" t-value=\"document_context_id == 'urn:cen.eu:en16931:2017#compliant#urn:xoev-de:kosit:standard:xrechnung_2.2'\"/>\n                            </t>\n                        </ram:ShipToTradeParty>\n\n                        <ram:ActualDeliverySupplyChainEvent t-if=\"scheduled_delivery_time\">\n                            <ram:OccurrenceDateTime>\n                                <udt:DateTimeString t-att-format=\"102\" t-out=\"format_date(scheduled_delivery_time)\"/>\n                            </ram:OccurrenceDateTime>\n                        </ram:ActualDeliverySupplyChainEvent>\n                    </ram:ApplicableHeaderTradeDelivery>\n\n                    <!-- Taxes. -->\n                    <ram:ApplicableHeaderTradeSettlement>\n\n                        <ram:PaymentReference t-out=\"record.payment_reference\"/>\n                        <ram:InvoiceCurrencyCode t-out=\"currency.name\"/>\n\n                        <!-- Bank account. -->\n                        <ram:SpecifiedTradeSettlementPaymentMeans t-if=\"record.partner_bank_id.sanitized_acc_number\">\n                            <ram:TypeCode t-out=\"payment_means_code\"/>\n                            <ram:PayeePartyCreditorFinancialAccount>\n                                <ram:IBANID t-if=\"record.partner_bank_id.acc_type == 'iban'\" t-out=\"record.partner_bank_id.sanitized_acc_number\"/>\n                                <ram:ProprietaryID t-if=\"record.partner_bank_id.acc_type != 'iban'\" t-out=\"record.partner_bank_id.sanitized_acc_number\"/>\n                            </ram:PayeePartyCreditorFinancialAccount>\n                        </ram:SpecifiedTradeSettlementPaymentMeans>\n\n                        <!-- Tax Summary. -->\n                        <t t-foreach=\"tax_details.get('tax_details', {}).values()\" t-as=\"tax_detail_vals\">\n                            <ram:ApplicableTradeTax>\n                                <ram:CalculatedAmount t-out=\"format_monetary(tax_detail_vals.get('calculated_amount'), 2)\"/>\n                                <ram:TypeCode t-translation=\"off\">VAT</ram:TypeCode>\n                                <ram:ExemptionReason t-out=\"tax_detail_vals.get('tax_exemption_reason')\"/>\n                                <ram:BasisAmount t-out=\"format_monetary(tax_detail_vals['base_amount_currency'], 2)\"/>\n                                <ram:CategoryCode t-out=\"tax_detail_vals['tax_category_code']\"/>\n                                <ram:ExemptionReasonCode t-out=\"tax_detail_vals['tax_exemption_reason_code']\"/>\n                                <!-- 5 = Tax is exigible on the date on the invoice -->\n                                <ram:DueDateTypeCode>5</ram:DueDateTypeCode>\n                                <ram:RateApplicablePercent t-if=\"tax_detail_vals['amount_type'] == 'percent'\" t-out=\"tax_detail_vals['amount']\"/>\n                            </ram:ApplicableTradeTax>\n                        </t>\n\n                        <!-- Billing Period -->\n                        <ram:BillingSpecifiedPeriod t-if=\"billing_start and billing_end\">\n                            <ram:StartDateTime>\n                                <udt:DateTimeString format=\"102\" t-out=\"format_date(billing_start)\"/>\n                            </ram:StartDateTime>\n                            <ram:EndDateTime>\n                                <udt:DateTimeString format=\"102\" t-out=\"format_date(billing_end)\"/>\n                            </ram:EndDateTime>\n                        </ram:BillingSpecifiedPeriod>\n\n                        <!-- Payment Term. -->\n                        <ram:SpecifiedTradePaymentTerms>\n                            <ram:Description t-if=\"record.invoice_payment_term_id\" t-out=\"record.invoice_payment_term_id.name\"/>\n                            <ram:DueDateDateTime t-if=\"record.invoice_date_due\">\n                                <udt:DateTimeString format=\"102\" t-out=\"format_date(record.invoice_date_due)\"/>\n                            </ram:DueDateDateTime>\n                            <ram:ApplicableTradePaymentDiscountTerms t-if=\"record.invoice_payment_term_id.early_discount and record.invoice_payment_term_id.early_pay_discount_computation == 'mixed'\">\n                                <ram:BasisPeriodMeasure unitCode=\"DAY\" t-out=\"record.invoice_payment_term_id.discount_days\"/>\n                                <ram:CalculationPercent t-out=\"record.invoice_payment_term_id.discount_percentage\"/>\n                            </ram:ApplicableTradePaymentDiscountTerms>\n                        </ram:SpecifiedTradePaymentTerms>\n\n                        <!-- Summary. -->\n                        <ram:SpecifiedTradeSettlementHeaderMonetarySummation>\n                            <ram:LineTotalAmount t-esc=\"format_monetary(tax_basis_total_amount, 2)\"/>\n                            <ram:TaxBasisTotalAmount t-esc=\"format_monetary(tax_basis_total_amount, 2)\"/>\n                            <ram:TaxTotalAmount t-att-currencyID=\"currency.name\" t-esc=\"format_monetary(tax_total_amount, 2)\"/>\n                            <ram:GrandTotalAmount t-out=\"format_monetary(record.amount_total, 2)\"/>\n                            <ram:TotalPrepaidAmount t-out=\"format_monetary(record.amount_total - record.amount_residual, 2)\"/>\n                            <ram:DuePayableAmount t-out=\"format_monetary(record.amount_residual, 2)\"/>\n                        </ram:SpecifiedTradeSettlementHeaderMonetarySummation>\n                    </ram:ApplicableHeaderTradeSettlement>\n                </rsm:SupplyChainTradeTransaction>\n            </rsm:CrossIndustryInvoice>\n        </t>"}