[REM]:sale:sale_prepare_allot
bzr revid: apa@tinyerp.com-20100928133244-l53x0zgup67u75h7
This commit is contained in:
parent
a70022cef2
commit
f2f92230be
|
@ -19,7 +19,6 @@
|
||||||
#
|
#
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
import sale_prepare_allot
|
|
||||||
import sale_order
|
import sale_order
|
||||||
import sale_report
|
import sale_report
|
||||||
|
|
||||||
|
|
|
@ -1,47 +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 report import report_sxw
|
|
||||||
|
|
||||||
class sale_prepare(report_sxw.rml_parse):
|
|
||||||
|
|
||||||
def __init__(self, cr, uid, name, context=None):
|
|
||||||
super(sale_prepare, self).__init__(cr, uid, name, context=context)
|
|
||||||
self.localcontext.update( {
|
|
||||||
'allotment': self._allotment,
|
|
||||||
})
|
|
||||||
|
|
||||||
def _allotment(self, object):
|
|
||||||
allotments = {}
|
|
||||||
for line in object.order_line:
|
|
||||||
if line.address_allotment_id:
|
|
||||||
allotments.setdefault(line.address_allotment_id.id, ([line.address_allotment_id],[]) )
|
|
||||||
else:
|
|
||||||
allotments.setdefault(line.address_allotment_id.id, ([],[]) )
|
|
||||||
allotments[line.address_allotment_id.id][1].append(line)
|
|
||||||
return allotments.values()
|
|
||||||
|
|
||||||
report_sxw.report_sxw('report.sale.order.prepare.allot', 'sale.order', 'addons/sale/report/sale_prepare_allot.rml',parser=sale_prepare)
|
|
||||||
|
|
||||||
|
|
||||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
|
@ -1,357 +0,0 @@
|
||||||
<?xml version="1.0"?>
|
|
||||||
<document filename="test.pdf">
|
|
||||||
<template pageSize="(595.0,842.0)" title="Prepare allot" author="OpenERP S.A. (sales@openerp.com)" allowSplitting="20">
|
|
||||||
<pageTemplate id="first">
|
|
||||||
<frame id="first" x1="57.0" y1="57.0" width="481" height="728"/>
|
|
||||||
</pageTemplate>
|
|
||||||
</template>
|
|
||||||
<stylesheet>
|
|
||||||
<blockTableStyle id="Standard_Outline">
|
|
||||||
<blockAlignment value="LEFT"/>
|
|
||||||
<blockValign value="TOP"/>
|
|
||||||
</blockTableStyle>
|
|
||||||
<blockTableStyle id="Table1">
|
|
||||||
<blockAlignment value="LEFT"/>
|
|
||||||
<blockValign value="TOP"/>
|
|
||||||
<lineStyle kind="GRID" colorName="black"/>
|
|
||||||
</blockTableStyle>
|
|
||||||
<blockTableStyle id="Table2">
|
|
||||||
<blockAlignment value="LEFT"/>
|
|
||||||
<blockValign value="TOP"/>
|
|
||||||
</blockTableStyle>
|
|
||||||
<blockTableStyle id="Table3">
|
|
||||||
<blockAlignment value="LEFT"/>
|
|
||||||
<blockValign value="TOP"/>
|
|
||||||
<lineStyle kind="GRID" colorName="black"/>
|
|
||||||
<blockBackground colorName="#808080" start="0,0" stop="0,0"/>
|
|
||||||
<blockBackground colorName="#808080" start="1,0" stop="1,0"/>
|
|
||||||
<blockBackground colorName="#808080" start="2,0" stop="2,0"/>
|
|
||||||
<blockBackground colorName="#808080" start="3,0" stop="3,0"/>
|
|
||||||
<blockBackground colorName="#808080" start="4,0" stop="4,0"/>
|
|
||||||
<blockBackground colorName="#808080" start="5,0" stop="5,0"/>
|
|
||||||
<blockBackground colorName="#808080" start="6,0" stop="6,0"/>
|
|
||||||
<blockBackground colorName="#808080" start="7,0" stop="7,0"/>
|
|
||||||
</blockTableStyle>
|
|
||||||
<blockTableStyle id="Table4">
|
|
||||||
<blockAlignment value="LEFT"/>
|
|
||||||
<blockValign value="TOP"/>
|
|
||||||
<lineStyle kind="GRID" colorName="black"/>
|
|
||||||
<blockBackground colorName="#cccccc" start="0,0" stop="0,0"/>
|
|
||||||
<blockBackground colorName="#cccccc" start="1,0" stop="1,0"/>
|
|
||||||
<blockBackground colorName="#cccccc" start="2,0" stop="2,0"/>
|
|
||||||
<blockBackground colorName="#cccccc" start="3,0" stop="3,0"/>
|
|
||||||
<blockBackground colorName="#cccccc" start="4,0" stop="4,0"/>
|
|
||||||
<blockBackground colorName="#cccccc" start="5,0" stop="5,0"/>
|
|
||||||
<blockBackground colorName="#cccccc" start="6,0" stop="6,0"/>
|
|
||||||
<blockBackground colorName="#cccccc" start="7,0" stop="7,0"/>
|
|
||||||
</blockTableStyle>
|
|
||||||
<blockTableStyle id="Table7">
|
|
||||||
<blockAlignment value="LEFT"/>
|
|
||||||
<blockValign value="TOP"/>
|
|
||||||
<lineStyle kind="GRID" colorName="black"/>
|
|
||||||
</blockTableStyle>
|
|
||||||
<blockTableStyle id="Table6">
|
|
||||||
<blockAlignment value="LEFT"/>
|
|
||||||
<blockValign value="TOP"/>
|
|
||||||
<lineStyle kind="GRID" colorName="black"/>
|
|
||||||
</blockTableStyle>
|
|
||||||
<initialize>
|
|
||||||
<paraStyle name="all" alignment="justify"/>
|
|
||||||
</initialize>
|
|
||||||
<paraStyle name="P1" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="CENTER"/>
|
|
||||||
<paraStyle name="P2" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="LEFT"/>
|
|
||||||
<paraStyle name="P3" fontName="Times-Roman" fontSize="12.0" leading="15" alignment="CENTER"/>
|
|
||||||
<paraStyle name="P4" fontName="Times-Roman" fontSize="25.0" leading="31" alignment="CENTER"/>
|
|
||||||
<paraStyle name="P5" fontName="Times-Roman"/>
|
|
||||||
<paraStyle name="P6" fontName="Times-Roman" fontSize="10.0" leading="13"/>
|
|
||||||
<paraStyle name="P7" fontName="Times-Roman" fontSize="10.0" leading="13"/>
|
|
||||||
<paraStyle name="P8" fontName="Times-Bold" fontSize="8.0" leading="10" alignment="CENTER"/>
|
|
||||||
<paraStyle name="P9" fontName="Times-Bold" fontSize="8.0" leading="10" alignment="CENTER"/>
|
|
||||||
<paraStyle name="P10" fontName="Times-Roman" fontSize="8.0" leading="10" alignment="CENTER"/>
|
|
||||||
<paraStyle name="P11" fontName="Times-Roman" fontSize="8.0" leading="10" alignment="CENTER"/>
|
|
||||||
<paraStyle name="P12" fontName="Times-Roman" fontSize="8.0" leading="10" alignment="CENTER"/>
|
|
||||||
<paraStyle name="P13" fontName="Times-Roman" fontSize="10.0" leading="13" alignment="LEFT"/>
|
|
||||||
<paraStyle name="P14" fontName="Times-Roman" fontSize="10.0" leading="13" alignment="CENTER"/>
|
|
||||||
<paraStyle name="P15" fontName="Times-Roman" fontSize="10.0" leading="13" alignment="RIGHT"/>
|
|
||||||
<paraStyle name="P16" fontName="Times-Roman" fontSize="10.0" leading="13" alignment="LEFT"/>
|
|
||||||
<paraStyle name="P17" fontName="Times-Roman" fontSize="10.0" leading="13" alignment="RIGHT"/>
|
|
||||||
<paraStyle name="P18" fontName="Times-Roman" fontSize="10.0" leading="13" alignment="LEFT"/>
|
|
||||||
<paraStyle name="P19" fontName="Times-Roman"/>
|
|
||||||
<paraStyle name="P20" fontName="Times-Roman" fontSize="9.0" leading="11"/>
|
|
||||||
<paraStyle name="P21" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="CENTER"/>
|
|
||||||
<paraStyle name="P22" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="RIGHT"/>
|
|
||||||
<paraStyle name="P23" fontName="Times-Roman" fontSize="10.0" leading="13"/>
|
|
||||||
<paraStyle name="Standard" fontName="Times-Roman"/>
|
|
||||||
<paraStyle name="Text body" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
|
|
||||||
<paraStyle name="Footer" fontName="Times-Roman"/>
|
|
||||||
<paraStyle name="Table Contents" fontName="Times-Roman"/>
|
|
||||||
<paraStyle name="Table Heading" fontName="Times-Roman" alignment="CENTER"/>
|
|
||||||
<paraStyle name="Horizontal Line" fontName="Times-Roman" fontSize="6.0" leading="8" spaceBefore="0.0" spaceAfter="14.0"/>
|
|
||||||
</stylesheet>
|
|
||||||
<story>
|
|
||||||
<para style="P1">[[ repeatIn(objects, 'o') ]]</para>
|
|
||||||
<para style="P2">
|
|
||||||
<font color="white"> </font>
|
|
||||||
</para>
|
|
||||||
<para style="P3">Sale Order [[ o.name ]]</para>
|
|
||||||
<para style="P4">[[ o.state!='done' and 'draft' or '' ]]</para>
|
|
||||||
<para style="P2">
|
|
||||||
<font color="white"> </font>
|
|
||||||
</para>
|
|
||||||
<blockTable colWidths="241.0,241.0" repeatRows="1" style="Table1">
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<para style="P5">Shipping to</para>
|
|
||||||
<para style="P6">[[ o.partner_shipping_id.partner_id.name ]]</para>
|
|
||||||
<para style="P7">[[ o.partner_shipping_id.street ]]</para>
|
|
||||||
<para style="P7">[[ o.partner_shipping_id.zip ]] [[ o.partner_shipping_id.city ]]</para>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<para style="P5">Ordered by</para>
|
|
||||||
<para style="P6">[[ o.partner_order_id.partner_id.name ]]</para>
|
|
||||||
<para style="P7">[[ o.partner_order_id.street ]]</para>
|
|
||||||
<para style="P7">[[ o.partner_order_id.zip ]] [[ o.partner_order_id.city ]]</para>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</blockTable>
|
|
||||||
<para style="Standard">
|
|
||||||
<font color="white"> </font>
|
|
||||||
</para>
|
|
||||||
<blockTable colWidths="98.0,88.0,90.0,101.0,106.0" repeatRows="1" style="Table2">
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<para style="P8">Order ref.</para>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<para style="P9">Order date</para>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<para style="P9">Shipping date </para>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<para style="P9">Delivery date 1</para>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<para style="P9">Delivery date 2</para>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<para style="P10">[[ o.name ]]</para>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<para style="P10">[[ o.date_order ]]</para>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<para style="P10">
|
|
||||||
<font color="white"> </font>
|
|
||||||
</para>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<para style="P11">
|
|
||||||
<font color="white"> </font>
|
|
||||||
</para>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<para style="P11">[[reduce(lambda x, line: line.date_planned>x and line.date_planned or x, o.order_line, '')]]</para>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</blockTable>
|
|
||||||
<blockTable colWidths="79.0,160.0,35.0,55.0,33.0,44.0,45.0,32.0" repeatRows="1" style="Table3">
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<para style="P12">Reference</para>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<para style="P12">Designation</para>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<para style="P12">Package</para>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<para style="P12">Quantity</para>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<para style="P12">S.U.</para>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<para style="P12">Prepared Package</para>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<para style="P12">Prepared quantity</para>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<para style="P12">Batch</para>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</blockTable>
|
|
||||||
<section>
|
|
||||||
<para style="Text body">[[ repeatIn(o.order_line, 'line') ]]</para>
|
|
||||||
<blockTable colWidths="78.0,160.0,36.0,54.0,34.0,44.0,45.0,31.0" style="Table4">
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<para style="P13">[[line.product_id.code]]</para>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<para style="P13">[[line.product_id.name]]</para>
|
|
||||||
<para style="P13">
|
|
||||||
<font color="white"> </font>
|
|
||||||
</para>
|
|
||||||
<para style="P14">
|
|
||||||
<font color="white"> </font>
|
|
||||||
</para>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<para style="P15">[[line.number_packages]]</para>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<para style="P15">[[line.product_uom_qty]]</para>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<para style="P13">[[line.product_uom.name]]</para>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<para style="P13">
|
|
||||||
<font color="white"> </font>
|
|
||||||
</para>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<para style="P13">
|
|
||||||
<font color="white"> </font>
|
|
||||||
</para>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<para style="P13">
|
|
||||||
<font color="white"> </font>
|
|
||||||
</para>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<para style="P16">[[line.product_id.ean13]]</para>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<para style="P16">Logistical unit : [[line.product_packaging.qty]]</para>
|
|
||||||
<para style="P16">[[line.number_packages and 'Packaging : %d package of %d P' % (line.number_packages, line.product_packaging.qty) or '']]</para>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<para style="P17">
|
|
||||||
<font color="white"> </font>
|
|
||||||
</para>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<para style="P17">[[line.product_uos_qty]]</para>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<para style="P18">[[line.product_uos and line.product_uos.name or '']]</para>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<para style="P16">
|
|
||||||
<font color="white"> </font>
|
|
||||||
</para>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<para style="P16">
|
|
||||||
<font color="white"> </font>
|
|
||||||
</para>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<para style="P16">
|
|
||||||
<font color="white"> </font>
|
|
||||||
</para>
|
|
||||||
<para style="P16">
|
|
||||||
<font color="white"> </font>
|
|
||||||
</para>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</blockTable>
|
|
||||||
</section>
|
|
||||||
<para style="P19">
|
|
||||||
<font color="white"> </font>
|
|
||||||
</para>
|
|
||||||
<blockTable colWidths="78.0,160.0,37.0,54.0,33.0,46.0,44.0,31.0" style="Table7">
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<para style="Table Contents">
|
|
||||||
<font color="white"> </font>
|
|
||||||
</para>
|
|
||||||
<para style="Table Contents">
|
|
||||||
<font color="white"> </font>
|
|
||||||
</para>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<para style="P20">Number of packages</para>
|
|
||||||
<para style="P20">
|
|
||||||
<font color="white"> </font>
|
|
||||||
</para>
|
|
||||||
<para style="P20">
|
|
||||||
<font color="white"> </font>
|
|
||||||
</para>
|
|
||||||
<para style="P20">
|
|
||||||
<font color="white"> </font>
|
|
||||||
</para>
|
|
||||||
<para style="P20">
|
|
||||||
<font color="white"> </font>
|
|
||||||
</para>
|
|
||||||
<para style="P20">
|
|
||||||
<font color="white"> </font>
|
|
||||||
</para>
|
|
||||||
<para style="P20">
|
|
||||||
<font color="white"> </font>
|
|
||||||
</para>
|
|
||||||
<para style="P20">
|
|
||||||
<font color="white"> </font>
|
|
||||||
</para>
|
|
||||||
<para style="P20">
|
|
||||||
<font color="white"> </font>
|
|
||||||
</para>
|
|
||||||
<para style="P21">
|
|
||||||
<font color="white"> </font>
|
|
||||||
</para>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<para style="P22">[[ reduce(lambda x, line: x+ len(line.move_lines), o.picking_ids, 0)]]</para>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<para style="Table Contents">
|
|
||||||
<font color="white"> </font>
|
|
||||||
</para>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<para style="Table Contents">
|
|
||||||
<font color="white"> </font>
|
|
||||||
</para>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<para style="Table Contents">
|
|
||||||
<font color="white"> </font>
|
|
||||||
</para>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<para style="Table Contents">
|
|
||||||
<font color="white"> </font>
|
|
||||||
</para>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<para style="Table Contents">
|
|
||||||
<font color="white"> </font>
|
|
||||||
</para>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</blockTable>
|
|
||||||
<para style="Standard">
|
|
||||||
<font color="white"> </font>
|
|
||||||
</para>
|
|
||||||
<blockTable colWidths="482.0" repeatRows="1" style="Table6">
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<para style="P19">Invoiced to : <font face="Times-Roman" size="10.0">[[ o.partner_invoice_id.partner_id.name ]]</font></para>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</blockTable>
|
|
||||||
<para style="P23">
|
|
||||||
<font color="white"> </font>
|
|
||||||
</para>
|
|
||||||
</story>
|
|
||||||
</document>
|
|
||||||
|
|
|
@ -1,16 +1,8 @@
|
||||||
-
|
-
|
||||||
In order to test the PDF reports defined on a sale order, we will print a sale order
|
In order to test the PDF reports defined on a sale order, we will print a sale order
|
||||||
-
|
-
|
||||||
!python {model: sale.order}: |
|
!python {model: sale.order}: |
|
||||||
import netsvc, tools, os
|
import netsvc, tools, os
|
||||||
(data, format) = netsvc.LocalService('report.sale.order').create(cr, uid, [ref('sale.order'),ref('sale.order2')], {}, {})
|
(data, format) = netsvc.LocalService('report.sale.order').create(cr, uid, [ref('sale.order'),ref('sale.order2')], {}, {})
|
||||||
if tools.config['test_report_directory']:
|
if tools.config['test_report_directory']:
|
||||||
file(os.path.join(tools.config['test_report_directory'], 'sale-sale_order.'+format), 'wb+').write(data)
|
file(os.path.join(tools.config['test_report_directory'], 'sale-sale_order.'+format), 'wb+').write(data)
|
||||||
-
|
|
||||||
In order to test the PDF reports defined on a sale order, we will print a report for sale prepare allot
|
|
||||||
-
|
|
||||||
!python {model: sale.order}: |
|
|
||||||
import netsvc, tools, os
|
|
||||||
(data, format) = netsvc.LocalService('report.sale.order.prepare.allot').create(cr, uid, [ref('sale.order'),ref('sale.order2'),ref('sale.order3')], {}, {})
|
|
||||||
if tools.config['test_report_directory']:
|
|
||||||
file(os.path.join(tools.config['test_report_directory'], 'sale-sale_prepare_allot.'+format), 'wb+').write(data)
|
|
Loading…
Reference in New Issue