[REF] stock: update picking operation and delivery slip report.

Updated report for stock refactoring.
This commit is contained in:
Kinjal Mehta
2017-10-02 09:32:35 +02:00
committed by amoyaux
parent ae190e8912
commit f6144fe1f3
3 changed files with 102 additions and 78 deletions
@@ -1,13 +1,13 @@
<odoo>
<template id="report_delivery_document_inherit_product_expiry" inherit_id="stock.report_delivery_document">
<xpath expr="//th[@name='lot_serial']" position="inside">
<t t-if="any([lot.lot_id.use_date for operation in o.move_line_ids for lot in operation.pack_lot_ids])">
<t t-if="any([move_lines.lot_id.use_date for move_lines in o.move_line_ids])">
<span class="pull-right">Expiry Date</span>
</t>
</xpath>
<xpath expr="//td[@name='lot_qty']" position="after">
<td>
<span class="pull-right" t-field="packlot.lot_id.use_date" t-field-options='{"widget": "date"}'/>
<span class="pull-right" t-field="move_line.lot_id.use_date" t-field-options='{"widget": "date"}'/>
</td>
</xpath>
</template>
+29 -28
View File
@@ -68,63 +68,64 @@
</table>
<t t-set="backorder" t-value="False"/>
<table class="table table-condensed mt48" t-if="o.move_line_ids">
<t t-set="has_serial_number" t-value="o.move_line_ids.filtered('pack_lot_ids')" groups="stock.group_production_lot"/>
<t t-set="has_serial_number" t-value="o.move_line_ids.mapped('lot_id')" groups="stock.group_production_lot"/>
<thead>
<tr>
<th><strong>Product</strong></th>
<th name="lot_serial" t-if="has_serial_number">
<span class="pull-left">Lot/Serial Number</span>
Lot/Serial Number
</th>
<th class="text-center"><strong>Ordered Quantity</strong></th>
<th t-if="any([pack_operation.state == 'done' for pack_operation in o.move_line_ids])" class="text-right">
<th t-if="any([move_line.state == 'done' for move_line in o.move_line_ids])" class="text-right">
<strong>Delivered Quantity</strong>
</th>
</tr>
</thead>
<tbody>
<tr t-foreach="o.move_line_ids" t-as="pack_operation">
<tr t-foreach="o.move_line_ids" t-as="move_line">
<td>
<span t-field="pack_operation.product_id"/>
<span t-field="move_line.product_id"/>
<p t-if="o.picking_type_code == 'outgoing'">
<span t-field="pack_operation.product_id.description_pickingout"/>
<span t-field="move_line.product_id.description_pickingout"/>
</p>
<p t-if="o.picking_type_code == 'incoming'">
<span t-field="pack_operation.product_id.description_pickingin"/>
<span t-field="move_line.product_id.description_pickingin"/>
</p>
<t t-if="not pack_operation.product_id and pack_operation.package_id">
<span t-field="pack_operation.package_id"/>
<t t-if="not move_line.product_id and move_line.package_id">
<span t-field="move_line.package_id"/>
</t>
</td>
<t t-if="has_serial_number">
<td t-if="pack_operation.pack_lot_ids">
<table class="table table-condensed" t-if="pack_operation.pack_lot_ids">
<tr t-foreach="pack_operation.pack_lot_ids" t-as="packlot">
<td>
<table width="100%">
<tr>
<td>
<span t-field="packlot.lot_id"/>
<t t-if="not packlot.lot_id">
<span t-field="packlot.lot_name"/>
<span t-field="move_line.lot_id"/>
<t t-if="not move_line.lot_id">
<span t-field="move_line.lot_name"/>
</t>
</td>
<td name="lot_qty">
<t t-if="move_line.product_qty">
<span t-field="move_line.product_qty"/>
</t>
</td>
<td name="lot_qty">
<span t-field="packlot.qty"/>
</td>
</tr>
</table>
</td>
<td t-if="not pack_operation.pack_lot_ids"/>
</td>
</t>
<td class="text-center">
<span t-if="pack_operation.package_id">:</span>
<span t-field="pack_operation.package_id"/>
<span t-field="pack_operation.ordered_qty"/>
<span t-field="pack_operation.product_uom_id"/>
<span t-field="move_line.package_id"/>
<span t-if="move_line.package_id">:</span>
<span t-field="move_line.ordered_qty"/>
<span t-field="move_line.product_uom_id"/>
</td>
<td class="text-right" t-if="pack_operation.state == 'done'">
<t t-if="pack_operation.ordered_qty != pack_operation.qty_done">
<td class="text-right" t-if="move_line.state == 'done'">
<t t-if="move_line.ordered_qty != move_line.qty_done">
<t t-set="backorder" t-value="True"/>
</t>
<span t-field="pack_operation.qty_done"/>
<span t-field="pack_operation.product_uom_id"/>
<span t-field="move_line.qty_done"/>
<span t-field="move_line.product_uom_id"/>
</td>
</tr>
</tbody>
@@ -22,7 +22,7 @@
</div>
<div class="col-xs-5 col-xs-offset-1">
<div t-if="o.picking_type_id.code=='incoming' and o.partner_id">
<span><strong>Vendor Address:</strong></span>
<span><strong>Partner Address:</strong></span>
</div>
<div t-if="o.picking_type_id.code=='internal' and o.partner_id">
<span><strong>Warehouse Address:</strong></span>
@@ -73,61 +73,84 @@
<br/>
<br/>
<table class="table table-condensed" t-if="o.move_line_ids">
<t t-set="has_barcode" t-value="any([pack_operation.product_id and pack_operation.product_id.sudo().barcode or pack_operation.package_id for pack_operation in o.move_line_ids])"/>
<t t-set="has_serial_number" t-value="o.move_line_ids.filtered('pack_lot_ids')" groups="stock.group_production_lot"/>
<t t-set="has_barcode" t-value="any([move_lines.product_id and move_lines.product_id.sudo().barcode or move_lines.package_id for move_lines in o.move_line_ids])"/>
<t t-set="has_serial_number" t-value="o.move_line_ids.filtered(lambda ml: ml.lot_id or ml.lot_name)" groups="stock.group_production_lot"/>
<thead>
<tr>
<th><strong>Product</strong></th>
<th class="text-right"><strong>Quantity</strong></th>
<t t-if="o.picking_type_id.code != 'incoming'"><th><strong>Source</strong></th></t>
<th t-if="has_barcode" class="text-center">
<strong>Barcode</strong>
<th width="15%">Product</th>
<th width="10%">Quantity</th>
<th width="20%" class="text-center">
<t t-if="has_barcode">Barcode</t>
</th>
<th t-if="has_serial_number">
<strong>Lot/Serial Number</strong>
<th width="15%">
<t t-if="o.picking_type_id.code != 'incoming'" align="left">Source</t>
</th>
<t t-if="o.picking_type_id.code != 'outgoing'"><th><strong>Destination</strong></th></t>
<th width="20%">
<t t-if="has_serial_number">Lot/Serial Number</t>
</th>
<th width="20%" class="text-right">Destination</th>
</tr>
</thead>
<tbody>
<tr t-foreach="o.move_line_ids" t-as="pack_operation">
<td><span t-field="pack_operation.product_id"/><br/>
<span t-field="pack_operation.product_id.description_picking"/>
<t t-if="not pack_operation.product_id and pack_operation.package_id"><span t-field="pack_operation.package_id"/></t></td>
<td class="text-right"><span t-field="pack_operation.product_qty"/> <span t-field="pack_operation.product_uom_id" groups="product.group_uom"/></td>
<t t-if="o.picking_type_id.code != 'incoming'"><td><span t-field="pack_operation.location_id"/>
<span t-if="pack_operation.package_id">:</span>
<span t-field="pack_operation.package_id"/>
<tr t-foreach="o.move_lines.sorted(key=lambda m: m.product_id.id)" t-as="move">
<td>
<span t-field="move.product_id.display_name"/><br/>
<span t-field="move.product_id.description_picking"/>
</td>
</t>
<td t-if="has_barcode">
<span t-if="pack_operation.product_id and pack_operation.product_id.barcode">
<img t-att-src="'/report/barcode/?type=%s&amp;value=%s&amp;width=%s&amp;height=%s' % ('Code128', pack_operation.product_id.barcode, 600, 100)" style="width:300px;height:50px"/>
</span>
<span t-if="pack_operation.package_id and not pack_operation.product_id">
<img t-att-src="'/report/barcode/?type=%s&amp;value=%s&amp;width=%s&amp;height=%s' % ('Code128', pack_operation.package_id.name, 600, 100)" style="width:300px;height:50px"/>
</span>
</td>
<td t-if="has_serial_number">
<table class="table table-condensed" t-if="pack_operation.pack_lot_ids">
<tr t-foreach="pack_operation.pack_lot_ids" t-as="packlot">
<td>
<span t-field="packlot.lot_id"/>
<t t-if="not packlot.lot_id">
<span t-field="packlot.lot_name"/>
</t>
</td>
<td>
<span t-field="packlot.qty"/> <t t-if="o.picking_type_id.use_existing_lots and o.state!='done'"> / <span t-field="packlot.qty_todo"/></t>
</td>
</tr>
</table>
</td>
<t t-if="o.picking_type_id.code != 'outgoing'"><td><span t-field="pack_operation.location_dest_id"/>
<span t-if="pack_operation.result_package_id">:</span>
<span t-field="pack_operation.result_package_id"/>
</td></t>
</tr>
<td>
<span t-if="move.product_qty" t-esc="move.product_qty"/>
<span t-if="not move.product_qty" t-esc="move.product_uom._compute_quantity(move.quantity_done, move.product_id.uom_id, rounding_method='HALF-UP')"/>
<span t-field="move.product_id.uom_id" groups="product.group_uom"/>
</td>
<td>
<t t-if="has_barcode">
<span t-if="move.product_id and move.product_id.barcode">
<img t-att-src="'/report/barcode/?type=%s&amp;value=%s&amp;width=%s&amp;height=%s' % ('Code128', move.product_id.barcode, 600, 100)" style="width:100%;height:50px"/>
</span>
</t>
</td>
<td colspan="3">
<t t-if="move.move_line_ids">
<table width="100%">
<tr t-foreach="move.move_line_ids.sorted(key=lambda ml: ml.location_id.id)" t-as="ml">
<td width="20%">
<t t-if="o.picking_type_id.code != 'incoming'">
<span t-esc="ml.location_id.display_name"/>
</t>
</td>
<td width="50%">
<t t-if="has_serial_number and ml.product_id.tracking != 'none'">
<div class="col-xs-4">
<span t-field="ml.lot_id"/>
<span t-if="not ml.lot_id" t-field="ml.lot_name"/>
</div>
<div class="col-xs-8">
<span t-field="ml.qty_done"/>
<t t-if="o.state!='done'">
/ <span t-field="ml.product_uom_qty"/>
</t>
</div>
</t>
</td>
<td width="30%" align="right">
<div>
<span t-field="ml.location_dest_id"/>
</div>
<div t-if="ml.result_package_id or ml.result_package_id">
<span t-field="ml.package_id"/>
<span t-if="ml.result_package_id and not ml.package_id" class="fa fa-dropbox"/>
<span t-if="ml.result_package_id and ml.package_id">&#8594;</span>
<span t-field="ml.result_package_id"/>
</div>
</td>
</tr>
</table>
</t>
<t t-else="">
<span>No reservation or quantity done yet.</span>
</t>
</td>
</tr>
</tbody>
</table>
<p t-if="o.state in ['draft', 'waiting', 'confirmed']">