Field mapping management for e-invoice file templates for Portugal
Manage field mapping for e-invoice file templates for Portugal, ensuring that the default mappings align with your business requirements and the Portugal implementation supported by Avalara.
Manage field mappings for e-invoice file templates used in Portugal's e-invoicing clearance process so that the generated payload contains the Portugal-specific business data required by Avalara. If the default field mapping does not align with your business requirements, you might need to customize the default template.
For the Portugal pre-integrated package, Zuora currently targets Avalara with the Clearance process and UBL as the supported outbound format. The supported download types currently identified for Portugal are XML, PDF, ZIP, and UBL_XML.
E-invoicing business regions configuration for Portugal
Configure the Portugal business region with the seller data required for Portugal e-invoicing.
Set Country to Portugal.
Select Avalara as the service provider.
Set the e-invoice process to Clearance.
Enable Invoice, Credit Memo, and Debit Memo as the supported billing document types.
Make sure the seller legal name, business identifiers, tax registration details, and address information are complete and consistent with the values configured in Avalara for the Portugal package. Use the same Portugal-specific seller data consistently across your business region configuration, service provider setup, and billing documents to help ensure successful e-invoice generation, submission, and validation.
E-invoicing profiles for accounts configuration in Portugal
Configure e-invoicing profiles for customer accounts involved in Portugal e-invoicing.
In the default templates, buyer profile data is sourced from Account.EInvoiceProfile. At a minimum, make sure the customer account is enabled for e-invoicing and that the buyer legal name and tax registration details are complete and consistent with the Portugal setup. This matches the pattern used in existing Avalara country topics, where buyer-side legal and tax data must be complete and aligned with the country package.
The following buyer-side mappings are used:
Buyer legal name maps to
cac:AccountingCustomerParty/cac:Party/cac:PartyName/cbc:Name.Buyer tax register number maps to
cac:PartyTaxScheme/cbc:CompanyIDwith tax schemeVAT.
Sold-to contact configuration for Portugal
Configure the sold-to contact with complete Portugal address information, including address line, city, postal code, and country. Use consistent buyer contact and address data because these values are part of the data set used in template generation, submission, and validation. This follows the same guidance used in existing Avalara country-specific field-mapping topics.
In the default templates, the buyer address is populated in the following order:
For invoice and debit memo templates, use
SoldToContactSnapshotif present.If no snapshot is available, use
SoldToContact.If neither is available, fall back to
Account.SoldTo.For the credit memo template, the address falls back from
SoldToContactSnapshottoAccount.SoldTo.The country code is emitted as
PTin all cases.
Invoice template field mapping for Portugal
The default Portugal invoice template uses the UBL Invoice structure and maps the following key fields:
InvoiceNumbertocbc:ID.InvoiceDatetocbc:IssueDate.CreatedDatetocbc:IssueTime.DueDatetocbc:DueDate.Fixed invoice type code
380.Currencytocbc:DocumentCurrencyCode.The invoice period start date from the earliest
ServiceStartDateacross invoice items.The invoice period end date from the latest
ServiceEndDateacross invoice items.
Credit memo template field mapping for Portugal
The default Portugal credit memo template uses the UBL CreditNote structure and maps the following key fields:
MemoNumbertocbc:ID.MemoDatetocbc:IssueDate.CreatedDatetocbc:IssueTime.Fixed credit note type code
381.Currencytocbc:DocumentCurrencyCode.The original invoice number to
cac:BillingReference/cac:CreditNoteDocumentReference/cbc:ID.Fixed document type code
01in the billing reference.TotalAmounttocac:LegalMonetaryTotal/cbc:PayableAmount.
Debit memo template field mapping for Portugal
The default Portugal debit memo template uses the UBL Invoice structure for debit memo output and maps the following key fields:
MemoNumbertocbc:ID.MemoDatetocbc:IssueDate.CreatedDatetocbc:IssueTime.DueDatetocbc:DueDate.Fixed invoice type code
383.Currencytocbc:DocumentCurrencyCode.The debit memo period start date from the earliest
ServiceStartDateacross debit memo items.The debit memo period end date from the latest
ServiceEndDateacross debit memo items.The original invoice number to
cac:BillingReference/cac:DebitNoteDocumentReference/cbc:ID.Fixed document type code
01in the billing reference.
Allowance and charge mapping for Portugal
In the invoice and debit memo templates, line items with ProcessingType = 1 are emitted as cac:AllowanceCharge entries.
The default mapping behavior is:
ChargeIndicatoris set totruefor positive values andfalsefor negative values.ChargeNamemaps tocbc:AllowanceChargeReason.The allowance or charge amount is emitted as an absolute positive value.
Tax category ID is mapped to
SwhenTaxRate > 0and toZwhen the tax rate is zero or when no taxation item is available.Tax scheme is emitted as
VAT.Tax percentage is emitted from
TaxRate * 100and rounded to two decimal places.
Tax mapping for Portugal
The default Portugal templates use VAT-based tax mapping.
The default tax behavior is:
TaxAmountmaps tocac:TaxTotal/cbc:TaxAmountfor invoice and debit memo templates.Invoice tax subtotals are grouped by
TaxCode.Debit memo tax subtotals are grouped by
TaxCodeName.For each tax subtotal, taxable amount and tax amount are calculated from the grouped line items.
Tax category ID is mapped to
SwhenTaxRate > 0and toZwhen the tax rate is zero or when no taxation item is available.Tax scheme is emitted as
VAT.Tax percentage is rounded to two decimal places.
Line-level item mapping for Portugal
For invoices and debit memos, line items with ProcessingType != 1 are emitted as document lines. For credit memos, CreditMemoItems with ProcessingType != 1 are emitted as credit note lines.
The default line-level mapping behavior is:
The line ID is generated sequentially.
ChargeNamemaps to the item name.The line item
Idmaps tocac:SellersItemIdentification/cbc:ID.Quantity is emitted with unit code
C62.When the source amount is negative, the quantity is multiplied by
-1so the generated quantity stays aligned with the document direction.Line extension amount is emitted from the source charge amount or memo amount without tax.
Price amount is emitted as the absolute line amount when quantity is zero.
Otherwise, price amount is calculated as the absolute line amount divided by quantity.
Line-level tax category uses the same
SorZlogic as the document-level tax mapping and emits tax schemeVAT.
Legal monetary total mapping for Portugal
For invoice and debit memo templates, the default legal monetary total section includes:
LineExtensionAmountfrom the sum of non-allowance lines.TaxExclusiveAmountfrom the total amount before tax.TaxInclusiveAmountfrom the total amount including tax.AllowanceTotalAmountfrom the absolute total of negative allowance values.ChargeTotalAmountfrom the total of positive allowance values.PayableAmountfrom the total payable amount.
For the credit memo template, the default legal monetary total currently emits PayableAmount only.