[IMP]Improved reports of point_of_sale

bzr revid: azaz.201186@gmail.com-20101011074336-30gy3g8z1zec8mzy
This commit is contained in:
saz-OpenERP
2010-10-11 13:13:36 +05:30
parent e685ed93c4
commit 2c2b2941ab
7 changed files with 37 additions and 16 deletions
+2 -2
View File
@@ -275,7 +275,7 @@
<para style="terp_default_9">[[ p['name'] or removeParentNode('para') ]]</para>
</td>
<td>
<para style="terp_default_Right_9_Bold">[[ formatLang(p['amount']) or removeParentNode('font') ]] [[ company.currency_id.symbol ]]</para>
<para style="terp_default_Right_9_Bold">[[ formatLang(p['amount']) or removeParentNode('tr') ]] [[ company.currency_id.symbol ]]</para>
</td>
</tr>
</blockTable>
@@ -383,4 +383,4 @@
<font color="white"> </font>
</para>
</story>
</document>
</document>
@@ -38,7 +38,8 @@ class pos_details_summary(report_sxw.rml_parse):
'getsuminvoice': self._sum_invoice,
'gettaxamount': self._get_tax_amount,
'getsalestotal': self._get_sales_total,
'getperiod': self._get_period,
'getstartperiod': self._get_start_period,
'getendperiod': self._get_end_period,
'getcompany':self.get_company
})
@@ -119,15 +120,23 @@ class pos_details_summary(report_sxw.rml_parse):
def _get_sales_total(self, objects):
return reduce(lambda x, o: x + len(o.lines), objects, 0)
def _get_period(self, objects):
def _get_start_period(self, objects):
date_orders = [obj.date_order for obj in objects]
min_date = min(date_orders)
max_date = max(date_orders)
if min_date == max_date:
return '%s' % min_date
else:
return '%s - %s' % (min_date, max_date)
return '%s' % min_date
def _get_end_period(self, objects):
date_orders = [obj.date_order for obj in objects]
min_date = min(date_orders)
max_date = max(date_orders)
if min_date == max_date:
return '%s' % max_date
else:
return '%s' % max_date
report_sxw.report_sxw('report.pos.details_summary',
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<document filename="test.pdf">
<template pageSize="(595.0,842.0)" title="Detail of sales" author="OpenERP S.A. (sales@openerp.com)" allowSplitting="20">
<template pageSize="(595.0,842.0)" title="Details of Sales" author="OpenERP S.A. (sales@openerp.com)" allowSplitting="20">
<pageTemplate id="first">
<frame id="first" x1="27.0" y1="57.0" width="512" height="728"/>
</pageTemplate>
@@ -20,9 +20,12 @@
<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="LINEAFTER" 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="LINEAFTER" 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"/>
</blockTableStyle>
<blockTableStyle id="Table2">
<blockAlignment value="LEFT"/>
@@ -34,9 +37,12 @@
<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="LINEAFTER" 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="LINEAFTER" 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"/>
</blockTableStyle>
<blockTableStyle id="Table4">
<blockAlignment value="LEFT"/>
@@ -157,7 +163,7 @@
<para style="P4">
<font color="white"> </font>
</para>
<blockTable colWidths="170.0,170.0,170.0" style="Table1">
<blockTable colWidths="170.0,170.0,85.0,85.0" style="Table1">
<tr>
<td>
<para style="terp_tblheader_General_Centre">Company</para>
@@ -166,11 +172,14 @@
<para style="terp_tblheader_General_Centre">Print Date</para>
</td>
<td>
<para style="terp_tblheader_General_Centre">Period</para>
<para style="terp_tblheader_General_Centre">Start Period</para>
</td>
<td>
<para style="terp_tblheader_General_Centre">End Period</para>
</td>
</tr>
</blockTable>
<blockTable colWidths="170.0,170.0,170.0" style="Table2">
<blockTable colWidths="170.0,170.0,85.0,85.0" style="Table2">
<tr>
<td>
<para style="terp_default_Centre_8">[[ '%s' % getcompany(objects)]]</para>
@@ -179,7 +188,10 @@
<para style="terp_default_Centre_8">[[ formatLang(time.strftime('%Y-%m-%d'),date=True) ]]</para>
</td>
<td>
<para style="terp_default_Centre_8">[[ '%s' % getperiod(objects) ]]</para>
<para style="terp_default_Centre_8">[[ '%s' % getstartperiod(objects) ]]</para>
</td>
<td>
<para style="terp_default_Centre_8">[[ '%s' % getendperiod(objects) ]]</para>
</td>
</tr>
</blockTable>
@@ -184,7 +184,7 @@
<para style="terp_default_Right_9">[[ formatLang(line_ids['discount']) ]]</para>
</td>
<td>
<para style="terp_default_Right_9">[[ formatLang(line_ids['price_unit']) ]] [[ company.currency_id.symbol ]]</para>
<para style="terp_default_Right_9">[[ formatLang(line_ids['price_unit']) ]]</para>
</td>
<td>
<para style="terp_default_Right_9">[[ formatLang(line_ids['total']) ]] [[ company.currency_id.symbol ]]</para>
@@ -161,7 +161,7 @@
<para style="terp_default_Right_9">[[ formatLang(line_ids['discount']) ]]</para>
</td>
<td>
<para style="terp_default_Right_9">[[ formatLang(line_ids['price_unit']) ]] [[ company.currency_id.symbol ]]</para>
<para style="terp_default_Right_9">[[ formatLang(line_ids['price_unit']) ]] </para>
</td>
<td>
<para style="terp_default_Right_9">[[ formatLang(line_ids['total']) ]] [[ company.currency_id.symbol ]]</para>
@@ -25,7 +25,7 @@ from report import report_sxw
class pos_user_product(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(pos_user_product, self).__init__(cr, uid, name, context=context)
super(pos_user_product, self).__init__(cr, uid, name, context)
self.total = 0.0
self.localcontext.update({
'time': time,
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<document filename="test.pdf">
<template pageSize="(595.0,842.0)" title="User's Product" author="OpenERP S.A. (sales@openerp.com)" allowSplitting="20">
<template pageSize="(595.0,842.0)" title="Product by user" 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>