# The DebitNote dict defines the structure of a UBL 2.1 DebitNote, with all nodes in the correct order.
# It can be passed as the `template` argument to `dict_to_xml` to enforce the order of nodes.

import odoo.addons.account_edi_ubl_cii.tools.ubl_21_common as cac
import odoo.addons.account_edi_ubl_cii.tools.ubl_21_extensions as ext

DebitNoteLine = {
    'cbc:ID': {},
    'cbc:UUID': {},
    'cbc:Note': {},
    'cbc:DebitedQuantity': {},
    'cbc:LineExtensionAmount': {},
    'cbc:FreeOfChargeIndicator': {},
    'cac:InvoicePeriod': cac.Period,
    'cac:OrderLineReference': cac.OrderLineReference,
    'cac:BillingReference': cac.BillingReference,
    'cac:DocumentReference': cac.DocumentReference,
    'cac:PricingReference': cac.PricingReference,
    'cac:PaymentTerms': cac.PaymentTerms,
    'cac:TaxTotal': cac.TaxTotal,
    'cac:AllowanceCharge': cac.AllowanceCharge,
    'cac:Item': cac.Item,
    'cac:Price': cac.Price,
    'cac:ItemPriceExtension': cac.ItemPriceExtension,
}

DebitNote = {
    '_tag': 'DebitNote',
    'ext:UBLExtensions': ext.UBLExtensions,
    'cbc:UBLVersionID': {},
    'cbc:CustomizationID': {},
    'cbc:ProfileID': {},
    'cbc:ProfileExecutionID': {},
    'cbc:ID': {},
    'cbc:CopyIndicator': {},
    'cbc:UUID': {},
    'cbc:IssueDate': {},
    'cbc:IssueTime': {},
    'cbc:Note': {},
    'cbc:DocumentCurrencyCode': {},
    'cbc:TaxCurrencyCode': {},
    'cbc:PricingCurrencyCode': {},
    'cbc:LineCountNumeric': {},
    'cac:InvoicePeriod': cac.Period,
    'cac:DiscrepancyResponse': cac.DiscrepancyResponse,
    'cac:OrderReference': cac.OrderReference,
    'cac:BillingReference': cac.BillingReference,
    'cac:AdditionalDocumentReference': cac.DocumentReference,
    'cac:Signature': cac.Signature,
    'cac:AccountingSupplierParty': cac.SupplierParty,
    'cac:AccountingCustomerParty': cac.CustomerParty,
    'cac:SellerSupplierParty': cac.SupplierParty,
    'cac:PrepaidPayment': cac.PrepaidPayment,
    'cac:AllowanceCharge': cac.AllowanceCharge,
    'cac:Delivery': cac.Delivery,
    'cac:PaymentMeans': cac.PaymentMeans,
    'cac:PaymentTerms': cac.PaymentTerms,
    'cac:TaxExchangeRate': cac.ExchangeRate,
    'cac:PricingExchangeRate': cac.ExchangeRate,
    'cac:PaymentExchangeRate': cac.ExchangeRate,
    'cac:TaxTotal': cac.TaxTotal,
    'cac:RequestedMonetaryTotal': cac.MonetaryTotal,
    'cac:DebitNoteLine': DebitNoteLine,
}
