<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<record id="paperformat_euro_landscape"
model="report.paperformat">
<field name="name">delivery_Paper</field>
<field name="default" eval="True" />
<field name="format">custom</field><!--一个预定义的格式如(A0-A9,B0-B10等)或自定义,默认是A4-->
<field name="page_height">140</field>
<field name="page_width">215</field>
<field name="orientation">Landscape</field><!--横向或纵向 Landscape , Portrait-->
<field name="margin_top">40</field>
<field name="margin_bottom">20</field>
<field name="margin_left">5</field>
<field name="margin_right">5</field>
<field name="header_line" eval="False" /><!--是否显示标题行-->
<field name="header_spacing">35</field><!--头部空白-->
<field name="dpi">90</field>
</record>
<template id="custom_report_delivery_document">
<t t-call="web.html_container">
<t t-if="o and 'company_id' in o">
<t t-set="company" t-value="o.company_id"></t>
</t>
<t t-if="not o or not 'company_id' in o">
<t t-set="company" t-value="res_company"></t>
</t>
<div class="header">
<div class="row mt16 mb16">
<div class="col-6" style="border-bottom:1px solid #000">
<img t-if="company.logo" t-att-src="'data:image/png;base64,%s' % to_text(company.logo)" style="max-height: 50px;" />
</div>
<div class="col-6 text-right" style="border-bottom:1px solid #000">
<span t-field="company.partner_id" />
<br/>
<span t-field="company.partner_id.country_id" />
<span t-field="company.partner_id.state_id" />
<span t-field="company.partner_id.city" />
<span t-field="company.partner_id.street" />
<span t-field="company.partner_id.street2" />
<span t-field="company.partner_id.vat" />
<br/>
</div>
</div>
<div class="row mt16 mb32">
<div class="col-6">
出库单号:<span t-field="o.name" />
<br/>
订 单 号:<span t-field="o.origin" />
</div>
<div t-if="o.state" class="col-6 text-right" name="div_sched_date">
<strong>发货日期:</strong>
<t t-if="o.state == 'done'">
<span t-field="o.date_done" t-options='{"widget": "date"}'/>
</t>
<t t-if="o.state != 'done'">
<span t-field="o.scheduled_date" t-options='{"widget": "date"}'/>
</t>
</div>
</div>
</div>
<div class="footer">
<div class="row mt32 mb32">
<div class="col-6" style="border-top:1px solid #000">
测试,左边
</div>
<div class="col-6 text-right" style="border-top:1px solid #000">
客户签收:
</div>
</div>
<div class="row mt16 mb16">
<div class="col-auto" style="border-top:1px solid #000">
制单人:<span t-field="o.write_uid" />
</div>
</div>
</div>
<t t-call="web.internal_layout"><!--external_layout头部和底部 internal_layout基本头部-->
<t t-set="o" t-value="o.with_context(lang=o.partner_id.lang)" />
<div class="page">
<div class="oe_structure"/>
<div class="row mt16 mb32">
<div t-if="o.move_lines and o.move_lines[0].partner_id and o.move_lines[0].partner_id.id != o.partner_id.id">
收货人及电话:<span t-field="o.partner_id"/>
<span>:
<span t-field="o.partner_id.mobile"/>/
<span t-field="o.partner_id.phone"/>
</span>
<br/>
收货地址:<span t-field="o.partner_id.country_id"/>
<span t-field="o.partner_id.state_id" />
<span t-field="o.partner_id.city" />
<span t-field="o.partner_id.street"/>
<span t-field="o.partner_id.street2" />
<span t-field="o.partner_id.zip" />
<br/>
<div t-field="o.partner_id.vat"/>
</div>
<div t-if="(o.move_lines and o.move_lines[0].partner_id and o.move_lines[0].partner_id.id == o.partner_id.id) or o.move_lines and not o.move_lines[0].partner_id">
收货人及电话:<span t-field="o.partner_id"/>
<span>:
<span t-field="o.partner_id.mobile"/>/
<span t-field="o.partner_id.phone"/>
</span>
<br/>
收货地址:<span t-field="o.partner_id.country_id"/>
<span t-field="o.partner_id.state_id" />
<span t-field="o.partner_id.city" />
<span t-field="o.partner_id.street"/>
<span t-field="o.partner_id.street2" />
<span t-field="o.partner_id.zip" />
<br/>
<div t-field="o.partner_id.vat"/>
</div>
</div>
<div class="row mt16 mb32">
<div class="col-auto" name="div_carrier_id">
<strong>承运方:</strong>
<p t-field="o.carrier_id"/>
</div>
<div class="col-auto" name="div_weight">
<strong>重量:</strong>
<p t-field="o.weight"/>
</div>
<div class="col-auto" name="div_volume">
<strong>体积:</strong>
<p t-field="o.volume"/>
</div>
</div>
<!--<table class="table table-sm" t-if="o.state!='done'" name="stock_move_table">-->
<table class="table table-sm" name="stock_move_table">
<thead>
<tr>
<th><strong>产品</strong></th>
<th><strong>数量</strong></th>
</tr>
</thead>
<tbody>
<t t-set="lines" t-value="o.move_lines.filtered(lambda x: x.product_uom_qty)"/>
<tr t-foreach="lines" t-as="move">
<td>
<span t-field="move.product_id"/>
<p t-if="o.picking_type_code == 'outgoing'">
<span t-field="move.product_id.sudo().description_pickingout"/>
</p>
<p t-if="o.picking_type_code == 'incoming'">
<span t-field="move.product_id.sudo().description_pickingin"/>
</p>
</td>
<td>
<span t-field="move.product_uom_qty"/>
<span t-field="move.product_uom"/>
</td>
</tr>
</tbody>
</table>
<p>
<t t-if="o.backorder_ids and o.backorder_ids.filtered(lambda x: x.state not in ('done', 'cancel'))">
All items couldn't be shipped, the remaining ones will be shipped as soon as they become available.
</t>
</p>
</div>
</t>
</t>
</template>
<template id="custom_report_deliveryslip">
<t t-foreach="docs" t-as="o">
<t t-call="mymodule.custom_report_delivery_document" t-lang="o.partner_id.lang"/>
</t>
</template>
<report
string="自定义出库单"
id="action_custom_report_delivery"
model="stock.picking"
report_type="qweb-pdf"
name="mymodule.custom_report_deliveryslip"
file="mymodule.custom_report_deliveryslip"
print_report_name="'delivery - %s - %s' % (object.partner_id.name or '', object.name)"
/>
</odoo>