diff options
| author | Josse Colpaert <jco@openerp.com> | 2014-03-18 13:18:23 +0100 |
|---|---|---|
| committer | Josse Colpaert <jco@openerp.com> | 2014-03-18 13:18:23 +0100 |
| commit | 90b2be367640266285e06eb5bdfad4eac8d0a3f7 (patch) | |
| tree | f019010e17dd144dccd1cec612a7bc365a06c89f | |
| parent | 3f4f4fef4aec564bec76690f12a3510b448e3813 (diff) | |
[IMP] Delivery module report implementation in the existing picking report
bzr revid: jco@openerp.com-20140318121823-12d36hihg7yyfejl
| -rw-r--r-- | addons/delivery/__init__.py | 1 | ||||
| -rw-r--r-- | addons/delivery/__openerp__.py | 4 | ||||
| -rw-r--r-- | addons/delivery/delivery_report.xml | 14 | ||||
| -rw-r--r-- | addons/delivery/delivery_view.xml | 4 | ||||
| -rw-r--r-- | addons/delivery/report/__init__.py | 24 | ||||
| -rw-r--r-- | addons/delivery/report/shipping.py | 46 | ||||
| -rw-r--r-- | addons/delivery/report/shipping.rml | 212 | ||||
| -rw-r--r-- | addons/sale_stock/sale_stock.py | 15 | ||||
| -rw-r--r-- | addons/stock/views/report_stockpicking.xml | 10 |
9 files changed, 22 insertions, 308 deletions
diff --git a/addons/delivery/__init__.py b/addons/delivery/__init__.py index d277419434a..35705c10cb6 100644 --- a/addons/delivery/__init__.py +++ b/addons/delivery/__init__.py @@ -21,7 +21,6 @@ import delivery import partner -import report import sale import stock diff --git a/addons/delivery/__openerp__.py b/addons/delivery/__openerp__.py index 1ee6bf413ec..ab00fa9087e 100644 --- a/addons/delivery/__openerp__.py +++ b/addons/delivery/__openerp__.py @@ -35,10 +35,10 @@ invoices from picking, OpenERP is able to add and compute the shipping line. 'depends': ['sale_stock'], 'data': [ 'security/ir.model.access.csv', - 'delivery_report.xml', 'delivery_view.xml', 'partner_view.xml', - 'delivery_data.xml' + 'delivery_data.xml', + 'views/report_shipping.xml', ], 'demo': ['delivery_demo.xml'], 'test': ['test/delivery_cost.yml'], diff --git a/addons/delivery/delivery_report.xml b/addons/delivery/delivery_report.xml deleted file mode 100644 index 3cebbba4eac..00000000000 --- a/addons/delivery/delivery_report.xml +++ /dev/null @@ -1,14 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<openerp> - <data> - - <report - id="report_shipping" - model="stock.picking" - name="sale.shipping" - multi="True" - rml="delivery/report/shipping.rml" - string="Delivery order"/> - - </data> -</openerp> diff --git a/addons/delivery/delivery_view.xml b/addons/delivery/delivery_view.xml index 055ca985494..6df6cec3ef0 100644 --- a/addons/delivery/delivery_view.xml +++ b/addons/delivery/delivery_view.xml @@ -225,10 +225,6 @@ <field name="model">stock.picking</field> <field name="inherit_id" ref="stock.view_picking_form"/> <field name="arch" type="xml"> - <xpath expr="/form/header//button[@name='action_cancel']" position="after"> - <button name="%(report_shipping)d" string="Print Delivery Order" states="confirmed,assigned" type="action"/> - <button name="%(report_shipping)d" string="Print Delivery Order" states="done" type="action" class="oe_highlight"/> - </xpath> <xpath expr="//page[@string='Additional Info']/group[last()]" position="after"> <separator string="Carrier Informations"/> <group> diff --git a/addons/delivery/report/__init__.py b/addons/delivery/report/__init__.py deleted file mode 100644 index 085fa3a3cdc..00000000000 --- a/addons/delivery/report/__init__.py +++ /dev/null @@ -1,24 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. -# -############################################################################## - -import shipping - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/delivery/report/shipping.py b/addons/delivery/report/shipping.py deleted file mode 100644 index 6f313c14b11..00000000000 --- a/addons/delivery/report/shipping.py +++ /dev/null @@ -1,46 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. -# -############################################################################## - -import time - -from openerp.report import report_sxw - -class shipping(report_sxw.rml_parse): - def __init__(self, cr, uid, name, context): - super(shipping, self).__init__(cr, uid, name, context=context) - self.localcontext.update({ - 'time': time, - 'get_partner_invoice_info': self.get_partner_invoice_info, - }) - - def get_partner_invoice_info(self, origin): - """This method is used to get information of invoiced partner. - :param: origin: origin of picking - :return: tuple contaning partner name and address of invoiced partner - """ - sale_obj = self.pool.get('sale.order') - sale_id = sale_obj.search(self.cr, self.uid, [('name', '=', origin)])[0] - partner_invoice_id = sale_obj.browse(self.cr, self.uid, sale_id).partner_invoice_id - return partner_invoice_id.name, self.pool.get('res.partner')._display_address(self.cr, self.uid, partner_invoice_id) - -report_sxw.report_sxw('report.sale.shipping','stock.picking','addons/delivery/report/shipping.rml',parser=shipping) - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/delivery/report/shipping.rml b/addons/delivery/report/shipping.rml deleted file mode 100644 index d9d90c1b3bd..00000000000 --- a/addons/delivery/report/shipping.rml +++ /dev/null @@ -1,212 +0,0 @@ -<?xml version="1.0"?> -<document filename="Delivery Order.pdf"> - <template title="Delivery Order" author="OpenERP S.A.(sales@openerp.com)" allowSplitting="20"> - <pageTemplate id="first"> - <frame id="first" x1="30.0" y1="27.0" width="508" height="815"/> - </pageTemplate> - </template> - <stylesheet> - <blockTableStyle id="Standard_Outline"> - <blockAlignment value="LEFT"/> - <blockValign value="TOP"/> - </blockTableStyle> - <blockTableStyle id="Tableau1"> - <blockAlignment value="LEFT"/> - <blockValign value="TOP"/> - </blockTableStyle> - <blockTableStyle id="Table1"> - <blockAlignment value="LEFT"/> - <blockValign value="TOP"/> - <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="0,0" stop="0,-1"/> - <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="0,0" stop="0,0"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/> - <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="1,0" stop="1,-1"/> - <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="1,0" stop="1,0"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/> - <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="2,0" stop="2,-1"/> - <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="2,0" stop="2,0"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/> - <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="3,0" stop="3,-1"/> - <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="3,0" stop="3,0"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/> - <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="4,0" stop="4,-1"/> - <lineStyle kind="LINEAFTER" colorName="#e6e6e6" start="4,0" stop="4,-1"/> - <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="4,0" stop="4,0"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="4,-1" stop="4,-1"/> - </blockTableStyle> - <blockTableStyle id="Table2"> - <blockAlignment value="LEFT"/> - <blockValign value="TOP"/> - <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="0,0" stop="0,-1"/> - <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="0,0" stop="0,0"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/> - <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="1,0" stop="1,-1"/> - <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="1,0" stop="1,0"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/> - <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="2,0" stop="2,-1"/> - <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="2,0" stop="2,0"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/> - <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="3,0" stop="3,-1"/> - <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="3,0" stop="3,0"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/> - <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="4,0" stop="4,-1"/> - <lineStyle kind="LINEAFTER" colorName="#e6e6e6" start="4,0" stop="4,-1"/> - <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="4,0" stop="4,0"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="4,-1" stop="4,-1"/> - </blockTableStyle> - <blockTableStyle id="Table3"> - <blockAlignment value="LEFT"/> - <blockValign value="TOP"/> - <lineStyle kind="LINEBELOW" colorName="#666666" start="0,-1" stop="0,-1"/> - <lineStyle kind="LINEBELOW" colorName="#666666" start="1,-1" stop="1,-1"/> - <lineStyle kind="LINEBELOW" colorName="#666666" start="2,-1" stop="2,-1"/> - </blockTableStyle> - <blockTableStyle id="Table4"> - <blockAlignment value="LEFT"/> - <blockValign value="TOP"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/> - </blockTableStyle> - <initialize> - <paraStyle name="all" alignment="justify"/> - </initialize> - <paraStyle name="Standard" fontName="Helvetica"/> - <paraStyle name="Text body" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/> - <paraStyle name="Footer" fontName="Helvetica"/> - <paraStyle name="Table Contents" fontName="Helvetica"/> - <paraStyle name="Table Heading" fontName="Helvetica" alignment="CENTER"/> - <paraStyle name="Horizontal Line" fontName="Helvetica" fontSize="6.0" leading="8" spaceBefore="0.0" spaceAfter="14.0"/> - <paraStyle name="Heading" fontName="Helvetica" fontSize="15.0" leading="19" spaceBefore="12.0" spaceAfter="6.0"/> - <paraStyle name="List" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/> - <paraStyle name="Caption" fontName="Helvetica-Oblique" fontSize="9.0" leading="11" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="Index" fontName="Helvetica"/> - <paraStyle name="terp_header" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/> - <paraStyle name="Heading 9" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" spaceBefore="12.0" spaceAfter="6.0"/> - <paraStyle name="terp_tblheader_General" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="terp_tblheader_Details" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="terp_default_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_Bold_8" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_tblheader_General_Centre" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="terp_tblheader_General_Right" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="terp_tblheader_Details_Centre" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="terp_tblheader_Details_Right" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="terp_default_Right_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_Centre_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_header_Right" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/> - <paraStyle name="terp_header_Centre" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="CENTER" spaceBefore="12.0" spaceAfter="6.0"/> - <paraStyle name="terp_default_address" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_Bold_9" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_Centre_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_Right_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_1" fontName="Helvetica" fontSize="2.0" leading="3" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_Right_9_Bold" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/> - <images/> - </stylesheet> - <story> - <pto> - <pto_header> - <blockTable colWidths="455.0,82.0" repeatRows="1" style="Table3"> - <tr> - <td> - <para style="terp_tblheader_Details">Description</para> - </td> - <td> - <para style="terp_tblheader_Details_Right">Quantity</para> - </td> - </tr> - </blockTable> - </pto_header> - <para style="terp_default_9">[[repeatIn(objects,'o')]]</para> - <para style="terp_default_8"> - <font color="white"> </font> - </para> - - <blockTable colWidths="287.0,254.0" repeatRows="1" style="Tableau1"> - <tr> - <td> - <para style="terp_default_Bold_9">Invoiced to</para> - <para style="terp_default_9">[[ o.origin and get_partner_invoice_info(o.origin)[0] or '' ]]</para> - <para style="terp_default_9">[[ o.origin and get_partner_invoice_info(o.origin)[1] or '' ]]</para> - </td> - <td> - <para style="terp_default_9">[[ o.partner_id and o.partner_id.name or '' ]]</para> - <para style="terp_default_9">[[ o.partner_id and display_address(o.partner_id) ]]</para> - </td> - </tr> - </blockTable> - <para style="terp_header">Delivery Order : [[ o.name ]]</para> - <para style="terp_default_8"> - <font color="white"> </font> - </para> - <blockTable colWidths="126.0,103.0,103.0,103.0,103.0" style="Table1"> - <tr> - <td> - <para style="terp_tblheader_General_Centre">Order Ref.</para> - </td> - <td> - <para style="terp_tblheader_General_Centre">Order Date</para> - </td> - <td> - <para style="terp_tblheader_General_Centre">Shipping Date</para> - </td> - <td> - <para style="terp_tblheader_General_Centre">Carrier</para> - </td> - <td> - <para style="terp_tblheader_General_Centre">Weight</para> - </td> - </tr> - </blockTable> - <blockTable colWidths="126.0,103.0,103.0,103.0,103.0" style="Table2"> - <tr> - <td> - <para style="terp_default_Centre_8">[[ o.origin or '' ]]</para> - </td> - <td> - <para style="terp_default_Centre_8">[[ formatLang(o.date,date_time=True) ]]</para> - </td> - <td> - <para style="terp_default_Centre_8">[[ formatLang(o.min_date,date_time = True) ]]</para> - </td> - <td> - <para style="terp_default_Centre_8">[[ o.carrier_id and o.carrier_id.name or '' ]]</para> - </td> - <td> - <para style="terp_default_Centre_8">[[ formatLang(o.weight) ]]</para> - </td> - </tr> - </blockTable> - <para style="Standard"> - <font color="white"> </font> - </para> - <blockTable colWidths="455.0,82.0" repeatRows="1" style="Table3"> - <tr> - <td> - <para style="terp_tblheader_Details">Description</para> - </td> - <td> - <para style="terp_tblheader_Details_Right">Quantity</para> - </td> - </tr> - </blockTable> - <section> - <para style="terp_default_1">[[repeatIn(o.move_lines,'line')]]</para> - <blockTable colWidths="455.0,82.0" style="Table4"> - <tr> - <td> - <para style="terp_default_9">[[line.product_id.code ]] [[ line.product_id and line.product_id.name or '']]</para> - </td> - <td> - <para style="terp_default_Right_9">[[ formatLang(line.product_qty) ]] [[ line.product_uom and line.product_uom.name ]]</para> - </td> - </tr> - </blockTable> - <para style="terp_default_1"> - <font color="white"> </font> - </para> - </section> - </pto> - </story> -</document> diff --git a/addons/sale_stock/sale_stock.py b/addons/sale_stock/sale_stock.py index ed89fa49a92..0bcfa6a86a4 100644 --- a/addons/sale_stock/sale_stock.py +++ b/addons/sale_stock/sale_stock.py @@ -441,6 +441,21 @@ class stock_location_route(osv.osv): class stock_picking(osv.osv): _inherit = "stock.picking" + def _get_sale_id(self, cr, uid, ids, name, args, context=None): + sale_obj = self.pool.get("sale.order") + res = {} + for picking in self.browse(cr, uid, ids, context=context): + if picking.group_id: + res[picking.id] = False + sale_ids = sale_obj.search(cr, uid, [('procurement_group_id', '=', picking.group_id.id)], context=context) + if sale_ids: + res[picking.id] = sale_ids[0] + return res + + _columns = { + 'sale_id': fields.function(_get_sale_id, type="many2one", relation="sale.order", string="Sale Order"), + } + def _create_invoice_from_picking(self, cr, uid, picking, vals, context=None): sale_obj = self.pool.get('sale.order') sale_line_obj = self.pool.get('sale.order.line') diff --git a/addons/stock/views/report_stockpicking.xml b/addons/stock/views/report_stockpicking.xml index a5901cc6d5f..2b69cac0f3c 100644 --- a/addons/stock/views/report_stockpicking.xml +++ b/addons/stock/views/report_stockpicking.xml @@ -18,7 +18,7 @@ <div t-if="o.picking_type_id.code=='outgoing'"> <span><strong>Customer Address:</strong></span> </div> - <div t-if="o.partner_id"> + <div t-if="o.partner_id" name="partner_header"> <div t-field="o.partner_id" t-field-options='{"widget": "contact", "fields": ["address", "name", "phone", "fax"], "no_marker": true}'/> <p t-if="o.partner_id.vat">VAT: <span t-field="o.partner_id.vat"/></p> @@ -34,7 +34,7 @@ <th><strong>Order (Origin)</strong></th> <th><strong>State</strong></th> <th><strong>Commitment Date</strong></th> - <th><strong>Scheduled Date</strong></th> + <th name="td_sched_date_h"><strong>Scheduled Date</strong></th> </tr> </thead> <tbody> @@ -48,7 +48,7 @@ <td> <span t-field="o.date"/> </td> - <td> + <td name="td_sched_date"> <span t-field="o.min_date"/> </td> </tr> @@ -71,7 +71,8 @@ </table> <table class="table table-condensed" t-if="o.pack_operation_ids"> <tr t-foreach="o.pack_operation_ids" t-as="pack_operation"> - <td><span t-field="pack_operation.product_id"/></td> + <td><span t-field="pack_operation.product_id"/> + <t t-if="not pack_operation.product_id and pack_operation.package_id"><span t-field="pack_operation.package_id"/></t></td> <td><span t-field="pack_operation.product_qty"/> <span t-field="pack_operation.product_uom_id" groups="product.group_uom"/></td> <td><span t-field="pack_operation.location_id"/> <span t-if="pack_operation.package_id">:</span> @@ -87,7 +88,6 @@ <img t-att-src="'/report/barcode/EAN13/%s' % pack_operation.product_id.ean13"/> </span> <span t-if="pack_operation.package_id and not pack_operation.product_id"> - <span t-field = "pack_operation.package_id.name"/> <img t-att-src="'/report/barcode/Standard39/%s' % pack_operation.package_id.name"/> </span> </td> |
