mirror of
https://github.com/OCA/stock-logistics-reporting.git
synced 2025-02-16 17:13:21 +02:00
[ADD] added print of delivery slip in stock_picking_webkit
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
#
|
||||
# Copyright (c) 2011-2013 Camptocamp SA (http://www.camptocamp.com)
|
||||
# @author Nicolas Bessi
|
||||
# Copyright (c) 2013 Agile Business Group (http://www.agilebg.com)
|
||||
# @author Lorenzo Battistini
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -20,11 +22,15 @@
|
||||
##############################################################################
|
||||
|
||||
{
|
||||
'name': 'Picking report using Webkit Library',
|
||||
'name': 'Picking reports using Webkit Library',
|
||||
'version': '1.0',
|
||||
'category': 'Reports/Webkit',
|
||||
'description': """
|
||||
Replaces the legacy rml picking Order report by a brand new webkit report.
|
||||
Replaces the legacy rml picking Order report by brand new webkit reports.
|
||||
Three reports are provided:
|
||||
- Aggregated pickings
|
||||
- Aggregated deliveries
|
||||
- Delivery Slip
|
||||
""",
|
||||
'author': 'Camptocamp',
|
||||
'website': 'http://www.openerp.com',
|
||||
|
||||
@@ -20,6 +20,15 @@
|
||||
report_type="webkit"
|
||||
header="False"
|
||||
webkit_header="base_headers_webkit.base_minimum_reports_portrait_header" />
|
||||
<report id="stock.report_picking_list_out"
|
||||
name="webkit.delivery_slip"
|
||||
auto="False"
|
||||
model="stock.picking.out"
|
||||
file="stock_picking_webkit/report/delivery_slip.mako"
|
||||
string="Delivery Slip"
|
||||
report_type="webkit"
|
||||
header="True"
|
||||
webkit_header="base_headers_webkit.base_reports_portrait_header" />
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
97
stock_picking_webkit/report/delivery_slip.mako
Normal file
97
stock_picking_webkit/report/delivery_slip.mako
Normal file
@@ -0,0 +1,97 @@
|
||||
<html>
|
||||
<head>
|
||||
<style type="text/css">
|
||||
${css}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<%page expression_filter="entity"/>
|
||||
<%
|
||||
def carriage_returns(text):
|
||||
return text.replace('\n', '<br />')
|
||||
%>
|
||||
%for picking in objects:
|
||||
<% setLang(picking.partner_id.lang) %>
|
||||
<div class="address">
|
||||
<table class="recipient">
|
||||
%if picking.partner_id.parent_id:
|
||||
<tr><td class="name">${picking.partner_id.parent_id.name or ''}</td></tr>
|
||||
<tr><td>${picking.partner_id.title and picking.partner_id.title.name or ''} ${picking.partner_id.name }</td></tr>
|
||||
<% address_lines = picking.partner_id.contact_address.split("\n")[1:] %>
|
||||
%else:
|
||||
<tr><td class="name">${picking.partner_id.title and picking.partner_id.title.name or ''} ${picking.partner_id.name }</td></tr>
|
||||
<% address_lines = picking.partner_id.contact_address.split("\n") %>
|
||||
%endif
|
||||
%for part in address_lines:
|
||||
%if part:
|
||||
<tr><td>${part}</td></tr>
|
||||
%endif
|
||||
%endfor
|
||||
</table>
|
||||
<%
|
||||
invoice_addr = invoice_address(picking)
|
||||
%>
|
||||
<table class="invoice">
|
||||
<tr><td class="address_title">${_("Invoice address:")}</td></tr>
|
||||
<tr><td>${invoice_addr.title and invoice_addr.title.name or ''} ${invoice_addr.name }</td></tr>
|
||||
%if invoice_addr.contact_address:
|
||||
<% address_lines = invoice_addr.contact_address.split("\n") %>
|
||||
%for part in address_lines:
|
||||
%if part:
|
||||
<tr><td>${part}</td></tr>
|
||||
%endif
|
||||
%endfor
|
||||
%endif
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<h1 style="clear:both;">${_(u'Delivery Order') } ${picking.name}</h1>
|
||||
|
||||
<table class="basic_table" width="100%">
|
||||
<tr>
|
||||
<td style="font-weight:bold;">${_("Contact")}</td>
|
||||
<td style="font-weight:bold;">${_("Origin")}</td>
|
||||
<td style="font-weight:bold;">${_("Scheduled Date")}</td>
|
||||
<td style="font-weight:bold;">${_('Weight')}</td>
|
||||
<td style="font-weight:bold;">${_('Delivery Method')}</td>
|
||||
<td style="font-weight:bold;">${_('Incoterm')}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>${user.name}</td>
|
||||
<td>${picking.origin or ''}</td>
|
||||
<td>${formatLang(picking.min_date, date=True)}</td>
|
||||
<td>${picking.weight}</td>
|
||||
<td>${picking.carrier_id and picking.carrier_id.name or ''}</td>
|
||||
<td>${picking.sale_id and picking.sale_id.incoterm and picking.sale_id.incoterm.name or ''}</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table class="list_sale_table" width="100%" style="margin-top: 20px;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="text-align:left; ">${_("Description")}</th>
|
||||
<th style="text-align:left; ">${_("Serial Number")}</th>
|
||||
<th class="amount">${_("Quantity")}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
%for line in picking.move_lines:
|
||||
<tr class="line">
|
||||
<td style="text-align:left; " >${ line.name }</td>
|
||||
<td style="text-align:left; " >${ line.prodlot_id and line.prodlot_id.name or ''}</td>
|
||||
<td class="amount" >${ formatLang(line.product_qty) } ${line.product_uom.name}</td>
|
||||
</tr>
|
||||
%endfor
|
||||
</table>
|
||||
|
||||
<br/>
|
||||
%if picking.note :
|
||||
<p class="std_text">${picking.note | carriage_returns}</p>
|
||||
%endif
|
||||
|
||||
<p style="page-break-after: always"/>
|
||||
<br/>
|
||||
%endfor
|
||||
</body>
|
||||
</html>
|
||||
@@ -3,6 +3,8 @@
|
||||
#
|
||||
# Copyright (c) 2011-2013 Camptocamp SA (http://www.camptocamp.com)
|
||||
# @author Nicolas Bessi
|
||||
# Copyright (c) 2013 Agile Business Group (http://www.agilebg.com)
|
||||
# @author Lorenzo Battistini
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -21,6 +23,7 @@
|
||||
import operator
|
||||
from report import report_sxw
|
||||
import pooler
|
||||
import time
|
||||
|
||||
class NullMove(object):
|
||||
"""helper class to generate empty lines in the delivery report"""
|
||||
@@ -114,6 +117,26 @@ class PrintPick(report_sxw.rml_parse):
|
||||
objects.append(PickingAgregation(agr[0], agr[1], agreg[agr]))
|
||||
return super(PrintPick, self).set_context(objects, data, ids, report_type=report_type)
|
||||
|
||||
|
||||
class DeliverySlip(report_sxw.rml_parse):
|
||||
|
||||
def _get_invoice_address(self, picking):
|
||||
if picking.sale_id:
|
||||
return picking.sale_id.partner_invoice_id
|
||||
partner_obj = self.pool.get('res.partner')
|
||||
invoice_address_id = picking.partner_id.address_get(
|
||||
adr_pref=['invoice']
|
||||
)['invoice']
|
||||
return partner_obj.browse(
|
||||
self.cr, self.uid, invoice_address_id)
|
||||
|
||||
def __init__(self, cr, uid, name, context):
|
||||
super(DeliverySlip, self).__init__(cr, uid, name, context=context)
|
||||
self.localcontext.update({
|
||||
'time': time,
|
||||
'invoice_address': self._get_invoice_address,
|
||||
})
|
||||
|
||||
report_sxw.report_sxw('report.webkit.aggregated_picking',
|
||||
'stock.picking',
|
||||
'addons/stock_picking_webkit/report/picking.html.mako',
|
||||
@@ -123,3 +146,8 @@ report_sxw.report_sxw('report.webkit.aggregated_delivery',
|
||||
'stock.picking',
|
||||
'addons/stock_picking_webkit/report/delivery.html.mako',
|
||||
parser=PrintPick)
|
||||
|
||||
report_sxw.report_sxw('report.webkit.delivery_slip',
|
||||
'stock.picking',
|
||||
'addons/stock_picking_webkit/report/delivery_slip.mako',
|
||||
parser=DeliverySlip)
|
||||
|
||||
Reference in New Issue
Block a user