Files
enterprise-addons/l10n_cl_edi_stock/views/report_delivery_guide.xml
T

301 lines
18 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<data>
<template id="custom_header">
<t t-set="report_number" t-value="int(o.l10n_latam_document_number)"/>
<t t-set="report_name" t-value="'GUÍA DE DESPACHO ELECTRÓNICA'"/>
<t t-set="header_address" t-value="o.company_id.partner_id"/>
<t t-set="custom_footer">
<t t-call="l10n_cl.custom_footer"/>
</t>
<div>
<div class="row">
<div name="left-upper-side" class="col-8">
<img t-if="o.company_id.logo" t-att-src="image_data_uri(o.company_id.logo)" style="max-height: 60px;" alt="Logo"/>
<br/>
<strong>
<span t-field="o.company_id.partner_id.name"/>
</strong>
<br/>
<span name="company_activity" class="fst-italic"
t-field="o.company_id.l10n_cl_activity_description"/>
<div/>
<t t-out="' - '.join([item for item in [', '.join([item for item in [header_address.street, header_address.street2] if item]), header_address.zip, header_address.country_id and header_address.country_id.name] if item])"/>
<span t-if="header_address.phone">
<br/>
</span>
<span t-if="header_address.phone" style="white-space: nowrap;"
t-out="'Tel: ' + header_address.phone"/>
<span t-if="header_address.website">
<span t-att-style="'color: %s;' % o.company_id.primary_color"
t-out="'- Web: %s' %' - '.join([item for item in [header_address.website.replace('https://', '').replace('http://', ''), header_address.email] if item])"/>
</span>
</div>
<div name="right-upper-side" class="col-4">
<div class="row">
<div name="right-upper-side" class="col-12">
<div class="row border border-dark">
<div class="col-12 text-center">
<h6 t-att-style="'color: %s;' % o.company_id.primary_color">
<strong t-att-style="'color: %s;' % o.company_id.primary_color">
<br/>
<span style="line-height: 180%;">RUT:</span>
<span t-field="o.company_id.partner_id.vat"/>
<br/>
<span class="text-uppercase" t-out="report_name"/>
<br/>
<span>Nº:</span>
<span style="line-height: 200%;" t-out="report_number"/>
<br/>
<br/>
</strong>
</h6>
</div>
</div>
<div class="row text-center">
<div class="col-12 text-center"
t-att-style="'color: %s;' % o.company_id.primary_color"
name="regional-office">
<span t-field="o.company_id.l10n_cl_sii_regional_office"/>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</template>
<template id="stock_informations">
<div id="informations" class="row mt8 mb8">
<div class="col-6">
<strong>
<span t-att-style="'color: %s;' % o.company_id.secondary_color">Date:</span>
</strong>
<span t-esc="o._get_effective_date()" t-options='{"widget": "date"}'/>
<br/>
<strong>Customer:</strong>
<span t-out="o.partner_id.commercial_partner_id.name or o.partner_id.name"/>
<br/>
<t t-if="o.partner_id.vat and o.partner_id.l10n_latam_identification_type_id">
<strong>
<t t-out="o.partner_id.l10n_latam_identification_type_id.name or o.company_id.country_id.vat_label"
id="inv_tax_id_label"/>:
</strong>
<span t-out="o.partner_id.vat"/>
<br/>
</t>
<strong>GIRO:</strong>
<span t-out="o.partner_id.commercial_partner_id.l10n_cl_activity_description or o.partner_id.l10n_cl_activity_description or ''"/>
<br/>
</div>
<div class="col-6">
<br/>
<strong>Address:</strong>
<span t-field="o.partner_id" t-options="{'widget': 'contact', 'fields': ['address'], 'no_marker': true, 'no_tag_br': True}"/>
<br/>
<strong>Order:</strong>
<span t-field="o.origin"/>
</div>
</div>
<div id="references" class="row">
<div class="col-12">
<t t-if="o.l10n_cl_reference_ids">
<t t-set="l10n_cl_reference_ids" t-value="o.l10n_cl_reference_ids"/>
<t t-call="l10n_cl_edi.template_references_table" />
</t>
</div>
</div>
</template>
<template id="barcode_stamp_footer">
<div name="stamp">
<t t-if="o.l10n_cl_sii_barcode" t-set="barcode_stamp"
t-value="o._pdf417_barcode(o.l10n_cl_sii_barcode)"/>
<t t-if="barcode_stamp">
<img class="img-fluid" t-attf-src="data:image/*;base64,{{barcode_stamp}}"/>
<p t-att-style="'color: %s;' % o.company_id.primary_color" class="text-center small">
Electronic Stamp SII
<br/>
Resolution Nº:
<span t-field="o.company_id.l10n_cl_dte_resolution_number"/>
from Date:
<span t-field="o.company_id.l10n_cl_dte_resolution_date" t-options='{"widget": "date"}'/>
<br/>
Verify the document on www.sii.cl
</p>
</t>
</div>
</template>
<template id="delivery_guide_document">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="o">
<t t-set="custom_header" t-value="'l10n_cl_edi_stock.custom_header'"/>
<t t-call="web.external_layout">
<div class="page">
<div class="row">
<div class="col-12">
<t t-call="l10n_cl_edi_stock.stock_informations"/>
</div>
</div>
<t t-set="prepared_amounts" t-value="o._prepare_pdf_values()"/>
<t t-set="has_unit_price" t-value="prepared_amounts['has_unit_price']"/>
<t t-set="has_discount" t-value="prepared_amounts['has_discount']"/>
<table class="o_has_total_table table table-borderless" t-if="o.move_ids">
<thead>
<tr>
<th name="th_code">
<strong>Code</strong>
</th>
<th name="th_product">
<strong>Product</strong>
</th>
<th class="text-end">
<strong>Quantity</strong>
</th>
<th groups="uom.group_uom">
<strong>Unit</strong>
</th>
<th name="unit_price" class="text-end" t-if="has_unit_price">
<strong>Unit Price</strong>
</th>
<th name="discount" class="text-end" t-if="has_discount">
<strong>Discount</strong>
</th>
<th name="subtotal" class="text-end" t-if="has_unit_price">
<strong>Value</strong>
</th>
</tr>
</thead>
<tbody>
<t t-set="total_line_amounts" t-value="prepared_amounts.get('total_line_amounts', {})"/>
<t t-set="float_repr" t-value="prepared_amounts['float_repr']"/>
<t t-foreach="o.move_ids.filtered(lambda x: x.quantity > 0)" t-as="line">
<t t-set="line_amounts" t-value="total_line_amounts.get(line, {})"/>
<tr>
<td>
<span t-field="line.product_id.default_code"/>
</td>
<td>
<span t-field="line.product_id.name"/>
<br/>
<span t-field="line.product_id.description_picking"/>
</td>
<td class="text-end">
<span t-field="line.quantity"/>
</td>
<td groups="uom.group_uom">
<span t-field="line.product_uom"/>
</td>
<td class="text-end" t-if="has_unit_price">
<span t-out="float_repr(line_amounts.get('price_unit', False), 2)"/>
</td>
<td class="text-end" t-if="has_discount">
<span t-out="line_amounts.get('total_discount_fl', 0.0)"
t-options="{'widget': 'monetary', 'display_currency': o.company_id.currency_id}"/>
</td>
<td class="text-end" t-if="has_unit_price">
<span t-out="line_amounts.get('total_amount', 0.0)"
t-options="{'widget': 'monetary', 'display_currency': o.company_id.currency_id}"/>
</td>
</tr>
</t>
</tbody>
</table>
<div class="clearfix">
<div id="total" class="row mt-n3">
<t t-set="amounts" t-value="prepared_amounts.get('amounts', {})"/>
<t t-set="withholdings" t-value="prepared_amounts.get('withholdings', {})"/>
<div t-attf-class="#{'col-6' if report_type != 'html' else 'col-sm-7 col-md-6'} ms-auto">
<table class="o_total_table table table-borderless" style="page-break-inside: avoid;">
<tr t-if="amounts.get('subtotal_amount_taxable', False)"
class="o_subtotal">
<td>
<strong>Subtotal Neto</strong>
</td>
<td class="text-end">
<span t-out="amounts.get('subtotal_amount_taxable', 0)"
t-options="{'widget': 'monetary', 'display_currency': o.company_id.currency_id}"/>
</td>
</tr>
<tr t-if="amounts.get('subtotal_amount_exempt', False)" class="o_subtotal">
<td>
<strong>Subtotal Exento</strong>
</td>
<td class="text-end">
<span t-out="amounts.get('subtotal_amount_exempt', 0)"
t-options="{'widget': 'monetary', 'display_currency': o.company_id.currency_id}"/>
</td>
</tr>
<tr t-if="amounts.get('vat_percent', False)"
class="o_subtotal">
<td>
<strong t-out="'IVA %s ' % amounts['vat_percent']"/>
<strong>%</strong>
</td>
<td class="text-end">
<span t-out="amounts.get('vat_amount')"
t-options="{'widget': 'monetary', 'display_currency': o.company_id.currency_id}"/>
</td>
</tr>
<t t-foreach="withholdings" t-as="tax">
<tr>
<td>
<span class="text-nowrap"
t-out="'%s %s' % (tax['tax_name'], tax['tax_percent'])"/>
<span>%</span>
</td>
<td class="text-end o_price_total">
<span class="text-nowrap" t-out="tax['tax_amount']"
t-options="{'widget': 'monetary', 'display_currency': o.company_id.currency_id}"/>
</td>
</tr>
</t>
<tr class="o_total">
<td>
<strong>Total</strong>
</td>
<td class="text-end">
<span class="text-nowrap" t-out="amounts.get('total_amount')"
t-options="{'widget': 'monetary', 'display_currency': o.company_id.currency_id}"/>
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="row">
<div class="col-5">
<t t-call="l10n_cl_edi_stock.barcode_stamp_footer"/>
</div>
<div class="col-7 text-justify">
<br/>
<p t-field="o.note"/>
</div>
</div>
</div>
</t>
</t>
</t>
</template>
<record id="action_delivery_guide_report_pdf" model="ir.actions.report">
<field name="name">Delivery Guide SII DTE 52 (CL)</field>
<field name="model">stock.picking</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">l10n_cl_edi_stock.delivery_guide_document</field>
<field name="report_file">l10n_cl_edi_stock.delivery_guide_document</field>
<field name="print_report_name">'GDE Guide SII - %s' % (object.name)</field>
<field name="binding_model_id" ref="model_stock_picking"/>
<field name="binding_type">report</field>
</record>
</data>
</odoo>