summaryrefslogtreecommitdiff
path: root/addons/stock_picking_batch/report
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
committerstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
commit3751379f1e9a4c215fb6eb898b4ccc67659b9ace (patch)
treea44932296ef4a9b71d5f010906253d8c53727726 /addons/stock_picking_batch/report
parent0a15094050bfde69a06d6eff798e9a8ddf2b8c21 (diff)
initial commit 2
Diffstat (limited to 'addons/stock_picking_batch/report')
-rw-r--r--addons/stock_picking_batch/report/report_picking_batch.xml131
-rw-r--r--addons/stock_picking_batch/report/stock_picking_batch_report_views.xml14
2 files changed, 145 insertions, 0 deletions
diff --git a/addons/stock_picking_batch/report/report_picking_batch.xml b/addons/stock_picking_batch/report/report_picking_batch.xml
new file mode 100644
index 00000000..5e4415da
--- /dev/null
+++ b/addons/stock_picking_batch/report/report_picking_batch.xml
@@ -0,0 +1,131 @@
+<?xml version="1.0" encoding="utf-8"?>
+<odoo>
+ <data>
+ <template id="stock_picking_batch.report_picking_batch">
+ <t t-call="web.html_container">
+ <t t-foreach="docs" t-as="o">
+ <t t-set="move_line_ids" t-value="o.picking_ids.mapped('move_line_ids')"/>
+ <t t-set="has_package" t-value="move_line_ids.filtered('result_package_id')" groups="stock.group_tracking_lot"/>
+ <t t-set="has_serial_number" t-value="move_line_ids.filtered('lot_id')" groups="stock.group_production_lot"/>
+ <t t-set="has_barcode" t-value="move_line_ids.mapped('product_id').filtered('barcode')"/>
+ <t t-set="locations" t-value="move_line_ids.mapped('location_id').sorted(lambda location: location.complete_name)"/>
+ <t t-call="web.external_layout">
+ <div class="page">
+ <div class="d-flex">
+ <div><h3>Summary: <span t-field="o.name"/></h3></div>
+ <div class="mr-auto">
+ <img alt="Barcode" t-att-src="'/report/barcode/?type=%s&amp;value=%s&amp;width=%s&amp;height=%s' % ('Code128', quote_plus(o.name or ''), 600, 150)" style="width:300px;height:50px"/>
+ </div>
+ </div>
+ <div t-if="o.user_id">
+ <strong>Responsible:</strong>
+ <span t-field="o.user_id"/>
+ </div><br/>
+ <table class="table table-condensed">
+ <thead>
+ <tr>
+ <th>Transfer</th>
+ <th>Barcode</th>
+ <th>Status</th>
+ <th>Scheduled Date</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr t-foreach="o.picking_ids" t-as="pick">
+ <td>
+ <span t-field="pick.name"/>
+ </td>
+ <td>
+ <img t-att-src="'/report/barcode/?type=%s&amp;value=%s&amp;width=%s&amp;height=%s&amp;quiet=%s' % ('Code128', pick.name, 400, 100, 0)" style="width:200px;height:50px" alt="Barcode"/>
+ </td>
+ <td>
+ <span t-field="pick.state"/>
+ </td>
+ <td >
+ <span t-field="pick.scheduled_date"/>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ <p style="page-break-after: always;"/>
+ <t t-foreach="locations" t-as="location">
+ <t t-set="loc_move_line" t-value="move_line_ids.filtered(lambda x: x.location_id==location)"/>
+ <t t-set="products" t-value="loc_move_line.mapped('product_id')"/>
+ <h3><span t-field="o.name"/></h3>
+ <div t-if="o.user_id">
+ <strong>Responsible:</strong>
+ <span t-field="o.user_id"/>
+ </div><br/>
+ <h4><strong>To take from: <span t-field="location.display_name"/></strong></h4>
+ <table class="table table-condensed">
+ <thead>
+ <tr>
+ <th>Product</th>
+ <th>Quantity</th>
+ <th width="27%">To</th>
+ <th width="23%">Transfer</th>
+ <th t-if="has_serial_number" width="15%">
+ <strong>Lot/Serial Number</strong>
+ </th>
+ <th t-if="has_barcode" width="15%" class="text-center">
+ <strong>Product Barcode</strong>
+ </th>
+ <th t-if="has_package" width="15%">
+ <strong>Package</strong>
+ </th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr t-foreach="loc_move_line" t-as="move_operation">
+ <td>
+ <span t-field="move_operation.display_name"/>
+ </td>
+ <td>
+ <t t-if="not has_package">
+ <t t-if="move_operation.state == 'done'">
+ <span t-esc="sum(move_operation.mapped('qty_done'))"/>
+ </t>
+ <t t-else="">
+ <span t-esc="sum(move_operation.mapped('product_uom_qty'))"/>
+ </t>
+ </t>
+ <t t-if="has_package">
+ <span t-esc="sum(move_operation.mapped('qty_done'))"/>
+ </t>
+ <span t-field="move_operation.uom_id" groups="move_operation.group_uom"/>
+ </td>
+ <td>
+ <span t-esc="move_operation.mapped('location_dest_id').display_name"/>
+ </td>
+ <td>
+ <span t-esc="move_operation.mapped('picking_id').display_name"/>
+ </td>
+ <td t-if="has_serial_number" class="text-center h6" width="15%">
+ <img t-if="move_operation.lot_id or move_operation.lot_name" t-att-src="'/report/barcode/?type=%s&amp;value=%s&amp;width=%s&amp;height=%s&amp;humanreadable=1' % ('Code128', move_operation.lot_id.name, 600, 100)" style="width:100%;height:35px;" alt="Barcode"/>
+ </td>
+ <td width="15%" class="text-center" t-if="has_barcode">
+ <span t-if="move_operation.product_id and move_operation.product_id.barcode">
+ <img t-if="len(move_operation.product_id.barcode) == 13" t-att-src="'/report/barcode/?type=%s&amp;value=%s&amp;width=%s&amp;height=%s' % ('EAN13', move_operation.product_id.barcode, 600, 100)" style="width:100%;height:35px" alt="Barcode"/>
+ <img t-elif="len(move_operation.product_id.barcode) == 8" t-att-src="'/report/barcode/?type=%s&amp;value=%s&amp;width=%s&amp;height=%s' % ('EAN8', move_operation.product_id.barcode, 600, 100)" style="width:100%;height:35px" alt="Barcode"/>
+ <img t-else="" t-att-src="'/report/barcode/?type=%s&amp;value=%s&amp;width=%s&amp;height=%s' % ('Code128', move_operation.product_id.barcode, 600, 100)" style="width:100%;height:35px" alt="Barcode"/>
+
+ </span>
+ </td>
+ <td t-if="has_package" width="15%">
+ <span t-field="move_operation.package_id"/>
+ <t t-if="move_operation.result_package_id">
+ → <span t-field="move_operation.result_package_id"/>
+ </t>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ <p style="page-break-after: always;"/>
+ </t>
+ </div>
+ </t>
+ </t>
+ </t>
+ </template>
+ </data>
+</odoo>
diff --git a/addons/stock_picking_batch/report/stock_picking_batch_report_views.xml b/addons/stock_picking_batch/report/stock_picking_batch_report_views.xml
new file mode 100644
index 00000000..0565632b
--- /dev/null
+++ b/addons/stock_picking_batch/report/stock_picking_batch_report_views.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<odoo>
+ <data>
+ <record id="action_report_picking_batch" model="ir.actions.report">
+ <field name="name">Batch Transfer</field>
+ <field name="model">stock.picking.batch</field>
+ <field name="report_type">qweb-pdf</field>
+ <field name="report_name">stock_picking_batch.report_picking_batch</field>
+ <field name="report_file">stock_picking_batch.report_picking_batch</field>
+ <field name="binding_model_id" ref="model_stock_picking_batch"/>
+ <field name="binding_type">report</field>
+ </record>
+ </data>
+</odoo>