| 1 |
<?xml version="1.0" encoding="UTF-8"?> |
| 2 |
<odoo> |
| 3 |
|
| 4 |
<template id="nilvera_party_details" |
| 5 |
xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" |
| 6 |
xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"> |
| 7 |
<cbc:WebsiteURI t-out="partner.website" /> |
| 8 |
<cac:PartyIdentification> |
| 9 |
<t t-if="partner.country_id.code != 'TR'"> |
| 10 |
<cbc:ID schemeID="TCKN" t-out="default_tckn"/> |
| 11 |
<t t-set="is_vkn" t-value="False"/> |
| 12 |
</t> |
| 13 |
<t t-else=""> |
| 14 |
<t t-set="is_vkn" t-value="len(partner.vat) == 10"/> |
| 15 |
<cbc:ID t-att-schemeID="is_vkn and 'VKN' or 'TCKN'" t-out="partner.vat"/> |
| 16 |
</t> |
| 17 |
</cac:PartyIdentification> |
| 18 |
<t t-if="is_vkn"> |
| 19 |
<cac:PartyName> |
| 20 |
<cbc:Name t-out="partner.name"/> |
| 21 |
</cac:PartyName> |
| 22 |
</t> |
| 23 |
<cac:PostalAddress> |
| 24 |
<cbc:StreetName t-out="' '.join(s for s in [partner.street, partner.street2] if s)"/> |
| 25 |
<cbc:CitySubdivisionName t-out="partner.city"/> |
| 26 |
<cbc:CityName t-out="partner.state_id.name"/> |
| 27 |
<cbc:PostalZone t-out="partner.country_id.code == 'TR' and partner.zip or partner.l10n_tr_nilvera_edispatch_customs_zip"/> |
| 28 |
<t t-set="tr_country" t-value="partner.country_id.with_context(lang='tr_TR')"/> |
| 29 |
<cac:Country> |
| 30 |
<cbc:IdentificationCode t-out="tr_country.code"/> |
| 31 |
<cbc:Name t-out="tr_country.name"/> |
| 32 |
</cac:Country> |
| 33 |
</cac:PostalAddress> |
| 34 |
<cac:Contact> |
| 35 |
<cbc:Telephone t-out="partner.phone"/> |
| 36 |
<cbc:ElectronicMail t-out="partner.email"/> |
| 37 |
</cac:Contact> |
| 38 |
<t t-if="not is_vkn"> |
| 39 |
<t t-set="partner_name" t-value="partner.name.split(' ', 1)"/> |
| 40 |
<cac:Person> |
| 41 |
<cbc:FirstName t-out="partner_name[0]"/> |
| 42 |
<cbc:FamilyName t-out="partner_name[1] if len(partner_name) > 1 else '\u200B'"/> |
| 43 |
</cac:Person> |
| 44 |
</t> |
| 45 |
</template> |
| 46 |
|
| 47 |
<template id="nilvera_party_template" |
| 48 |
xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"> |
| 49 |
<cac:Party> |
| 50 |
<t t-call="l10n_tr_nilvera_edispatch.nilvera_party_details"/> |
| 51 |
</cac:Party> |
| 52 |
</template> |
| 53 |
|
| 54 |
<template id="nilvera_dispatch_line" |
| 55 |
xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" |
| 56 |
xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"> |
| 57 |
<cac:DespatchLine> |
| 58 |
<cbc:ID t-out="line_id"/> |
| 59 |
<cbc:DeliveredQuantity t-att-unitCode="line.product_uom._get_unece_code()" t-out="line.quantity"/> |
| 60 |
<cac:OrderLineReference> |
| 61 |
<cbc:LineID t-out="line_id"/> |
| 62 |
</cac:OrderLineReference> |
| 63 |
<cac:Item> |
| 64 |
<cbc:Name t-out="line.product_id.display_name"/> |
| 65 |
</cac:Item> |
| 66 |
<cac:Shipment> |
| 67 |
<cbc:ID t-out="line_id"/> |
| 68 |
<cac:GoodsItem> |
| 69 |
<cac:InvoiceLine> |
| 70 |
<cbc:ID t-out="line_id"/> |
| 71 |
<cbc:InvoicedQuantity t-out="line.quantity"/> |
| 72 |
<cbc:LineExtensionAmount currencyID="TRY">0</cbc:LineExtensionAmount> |
| 73 |
<cac:Item> |
| 74 |
<cbc:Name t-out="line.product_id.display_name"/> |
| 75 |
</cac:Item> |
| 76 |
<cac:Price> |
| 77 |
<cbc:PriceAmount currencyID="TRY">0</cbc:PriceAmount> |
| 78 |
</cac:Price> |
| 79 |
</cac:InvoiceLine> |
| 80 |
</cac:GoodsItem> |
| 81 |
</cac:Shipment> |
| 82 |
</cac:DespatchLine> |
| 83 |
</template> |
| 84 |
|
| 85 |
<template id="l10n_tr_edispatch_format" name="Turkiye e-Dispatch XML"> |
| 86 |
<DespatchAdvice xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| 87 |
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" |
| 88 |
xmlns:ext="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2" |
| 89 |
xmlns:xades="http://uri.etsi.org/01903/v1.3.2#" |
| 90 |
xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" |
| 91 |
xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" |
| 92 |
xmlns="urn:oasis:names:specification:ubl:schema:xsd:DespatchAdvice-2"> |
| 93 |
<cbc:UBLVersionID t-out="ubl_version_id"/> |
| 94 |
<cbc:CustomizationID t-out="customization_id"/> |
| 95 |
<cbc:ProfileID t-out="dispatch_scenario"/> |
| 96 |
<cbc:ID t-out="picking.picking_type_id.sequence_code"/> |
| 97 |
<cbc:CopyIndicator t-out="copy_indicator"/> |
| 98 |
<cbc:UUID t-out="uuid"/> |
| 99 |
<cbc:IssueDate t-out="issue_date"/> |
| 100 |
<cbc:IssueTime t-out="issue_time"/> |
| 101 |
<cbc:DespatchAdviceTypeCode t-out="picking.l10n_tr_nilvera_dispatch_type"/> |
| 102 |
<cbc:Note t-if="picking.l10n_tr_nilvera_delivery_notes" t-out="picking.l10n_tr_nilvera_delivery_notes"/> |
| 103 |
<cbc:LineCountNumeric t-out="line_count"/> |
| 104 |
<cac:AdditionalDocumentReference t-if="picking.l10n_tr_nilvera_dispatch_type == 'MATBUDAN'"> |
| 105 |
<cbc:ID t-out="picking.l10n_tr_nilvera_delivery_printed_number"/> |
| 106 |
<cbc:IssueDate t-out="picking.l10n_tr_nilvera_delivery_date"/> |
| 107 |
<cbc:DocumentType>MATBU</cbc:DocumentType> |
| 108 |
</cac:AdditionalDocumentReference> |
| 109 |
<cac:DespatchSupplierParty> |
| 110 |
<t t-call="l10n_tr_nilvera_edispatch.nilvera_party_template"> |
| 111 |
<t t-set="partner" t-value="current_company"/> |
| 112 |
</t> |
| 113 |
</cac:DespatchSupplierParty> |
| 114 |
<cac:DeliveryCustomerParty> |
| 115 |
<t t-call="l10n_tr_nilvera_edispatch.nilvera_party_template"> |
| 116 |
<t t-set="partner" t-value="picking.partner_id.commercial_partner_id"/> |
| 117 |
</t> |
| 118 |
</cac:DeliveryCustomerParty> |
| 119 |
<cac:BuyerCustomerParty t-if="picking.l10n_tr_nilvera_buyer_id"> |
| 120 |
<t t-call="l10n_tr_nilvera_edispatch.nilvera_party_template"> |
| 121 |
<t t-set="partner" t-value="picking.l10n_tr_nilvera_buyer_id"/> |
| 122 |
</t> |
| 123 |
</cac:BuyerCustomerParty> |
| 124 |
<cac:SellerSupplierParty t-if="picking.l10n_tr_nilvera_seller_supplier_id"> |
| 125 |
<t t-call="l10n_tr_nilvera_edispatch.nilvera_party_template"> |
| 126 |
<t t-set="partner" t-value="picking.l10n_tr_nilvera_seller_supplier_id"/> |
| 127 |
</t> |
| 128 |
</cac:SellerSupplierParty> |
| 129 |
<cac:OriginatorCustomerParty t-if="picking.l10n_tr_nilvera_buyer_originator_id"> |
| 130 |
<t t-call="l10n_tr_nilvera_edispatch.nilvera_party_template"> |
| 131 |
<t t-set="partner" t-value="picking.l10n_tr_nilvera_buyer_originator_id"/> |
| 132 |
</t> |
| 133 |
</cac:OriginatorCustomerParty> |
| 134 |
<cac:Shipment> |
| 135 |
<cbc:ID t-out="picking.id"/> |
| 136 |
<cac:GoodsItem> |
| 137 |
<cbc:ValueAmount currencyID="TRY">0</cbc:ValueAmount> |
| 138 |
</cac:GoodsItem> |
| 139 |
<cac:ShipmentStage> |
| 140 |
<cac:TransportMeans> |
| 141 |
<cac:RoadTransport> |
| 142 |
<cbc:LicensePlateID schemeID="PLAKA" t-out="picking.l10n_tr_vehicle_plate.name"/> |
| 143 |
</cac:RoadTransport> |
| 144 |
</cac:TransportMeans> |
| 145 |
<t t-foreach="drivers" t-as="driver"> |
| 146 |
<cac:DriverPerson> |
| 147 |
<cbc:FirstName t-out="driver['name']"/> |
| 148 |
<cbc:FamilyName t-out="driver['fname']"/> |
| 149 |
<cbc:Title>Şoför</cbc:Title> |
| 150 |
<cbc:NationalityID schemeID="TCKN" t-out="driver['tckn']"/> |
| 151 |
</cac:DriverPerson> |
| 152 |
</t> |
| 153 |
</cac:ShipmentStage> |
| 154 |
<cac:Delivery> |
| 155 |
<cac:DeliveryAddress> |
| 156 |
<cbc:StreetName t-out="picking.partner_id.street"/> |
| 157 |
<cbc:CitySubdivisionName t-out="picking.partner_id.city"/> |
| 158 |
<cbc:CityName t-out="picking.partner_id.state_id.name"/> |
| 159 |
<cbc:PostalZone |
| 160 |
t-out="picking.partner_id.country_id.code == 'TR' and picking.partner_id.zip or picking.partner_id.l10n_tr_nilvera_edispatch_customs_zip" /> |
| 161 |
<t t-set="tr_country" t-value="picking.partner_id.country_id.with_context(lang='tr_TR')"/> |
| 162 |
<cac:Country> |
| 163 |
<cbc:IdentificationCode t-out="tr_country.code"/> |
| 164 |
<cbc:Name t-out="tr_country.name"/> |
| 165 |
</cac:Country> |
| 166 |
</cac:DeliveryAddress> |
| 167 |
<cac:CarrierParty t-if="picking.l10n_tr_nilvera_carrier_id"> |
| 168 |
<t t-call="l10n_tr_nilvera_edispatch.nilvera_party_details"> |
| 169 |
<t t-set="partner" t-value="picking.l10n_tr_nilvera_carrier_id"/> |
| 170 |
</t> |
| 171 |
</cac:CarrierParty> |
| 172 |
<cac:Despatch> |
| 173 |
<cbc:ActualDespatchDate t-out="actual_date"/> |
| 174 |
<cbc:ActualDespatchTime t-out="actual_time"/> |
| 175 |
</cac:Despatch> |
| 176 |
</cac:Delivery> |
| 177 |
<cac:TransportHandlingUnit> |
| 178 |
<t t-foreach="picking.l10n_tr_nilvera_trailer_plate_ids" t-as="trailer"> |
| 179 |
<cac:TransportEquipment> |
| 180 |
<cbc:ID schemeID="DORSEPLAKA" t-out="trailer.name"/> |
| 181 |
</cac:TransportEquipment> |
| 182 |
</t> |
| 183 |
</cac:TransportHandlingUnit> |
| 184 |
</cac:Shipment> |
| 185 |
<t t-set="line_id" t-value="1"/> |
| 186 |
<t t-foreach="picking.move_ids" t-as="line"> |
| 187 |
<t t-call="l10n_tr_nilvera_edispatch.nilvera_dispatch_line"/> |
| 188 |
<t t-set="line_id" t-value="line_id + 1"/> |
| 189 |
</t> |
| 190 |
</DespatchAdvice> |
| 191 |
</template> |
| 192 |
|
| 193 |
</odoo> |