diff options
5 files changed, 132 insertions, 4 deletions
diff --git a/addons/stock_picking_batch/__manifest__.py b/addons/stock_picking_batch/__manifest__.py index 50a2268fa2a..a44ab892d08 100644 --- a/addons/stock_picking_batch/__manifest__.py +++ b/addons/stock_picking_batch/__manifest__.py @@ -15,6 +15,8 @@ This module adds the batch picking option in warehouse management 'views/stock_picking_batch_views.xml', 'data/stock_picking_batch_data.xml', 'wizard/stock_picking_to_batch_views.xml', + 'report/stock_picking_batch_report_views.xml', + 'report/report_picking_batch.xml', ], 'demo': [ 'data/stock_picking_batch_demo.xml', diff --git a/addons/stock_picking_batch/data/stock_picking_batch_demo.xml b/addons/stock_picking_batch/data/stock_picking_batch_demo.xml index ddb333c02ac..d28aecad073 100644 --- a/addons/stock_picking_batch/data/stock_picking_batch_demo.xml +++ b/addons/stock_picking_batch/data/stock_picking_batch_demo.xml @@ -11,7 +11,6 @@ <!-- Add picking --> <record id="Picking_A" model="stock.picking"> - <field name="name">Picking #1</field> <field name="move_type">one</field> <field name="priority">2</field> <field name="picking_type_id" ref="stock.picking_type_internal"/> @@ -20,7 +19,6 @@ <field name="location_dest_id" ref="stock.stock_location_output"/> </record> <record id="Picking_B" model="stock.picking"> - <field name="name">Picking #2</field> <field name="move_type">one</field> <field name="state">assigned</field> <field name="priority">1</field> @@ -30,7 +28,6 @@ <field name="location_dest_id" ref="stock.stock_location_output"/> </record> <record id="Picking_C" model="stock.picking"> - <field name="name">Picking #3</field> <field name="move_type">one</field> <field name="state">assigned</field> <field name="priority">1</field> diff --git a/addons/stock_picking_batch/models/stock_picking_batch.py b/addons/stock_picking_batch/models/stock_picking_batch.py index bf799270b45..18a3e9cb4b2 100644 --- a/addons/stock_picking_batch/models/stock_picking_batch.py +++ b/addons/stock_picking_batch/models/stock_picking_batch.py @@ -50,7 +50,7 @@ class StockPickingBatch(models.Model): pickings = self.mapped('picking_ids') if not pickings: raise UserError(_('Nothing to print.')) - return self.env.ref('stock.action_report_picking').with_context(active_ids=pickings.ids, active_model='stock.picking').report_action([]) + return self.env.ref('stock_picking_batch.action_report_picking_batch').report_action(self) @api.multi def done(self): 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 00000000000..90d215e40cf --- /dev/null +++ b/addons/stock_picking_batch/report/report_picking_batch.xml @@ -0,0 +1,115 @@ +<?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')"/> + <t t-call="web.external_layout"> + <div class="page"> + <h3>Summary: <span t-field="o.name"/></h3> + <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>Picking Reference</th> + <th>Status</th> + <th>Commitment Date</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> + <span t-field="pick.state"/> + </td> + <td> + <span t-field="pick.date"/> + </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%">Destination</th> + <th width="23%">Picking</th> + <th t-if="has_serial_number" width="15%"> + <strong>Lot/Serial Number</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="any(move_operation.filtered(lambda l: l.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 and (move_operation.lot_id or move_operation.lot_name)" class="text-center h6" width="15%"> + <img t-att-src="'/report/barcode/?type=%s&value=%s&width=%s&height=%s&humanreadable=1' % ('Code128', move_operation.lot_id.name, 600, 100)" style="width:100%;height:35px;" alt="Barcode"/> + </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 00000000000..4c802ed466e --- /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> + <report + string="Batch Picking" + id="action_report_picking_batch" + model="stock.picking.batch" + report_type="qweb-pdf" + menu="False" + name="stock_picking_batch.report_picking_batch" + file="stock_picking_batch.report_picking_batch" + /> + </data> +</odoo> |
