[REM] removed details_summary, sales_user, sales_user_today, payment_user reports, wizards and rml

[REM] dead code:  pos_box_entries.py/xml, pos_box_out.py/xml, pos_return_view.py/xml
[ADD] lines, invoice, cashbox of the day, payment, receipt, users product reports converted to QWeb. Added YML tests for the bank statement reports.
[FIX] closed cashbox of the day sql using old fields in its queries, yml test not correctly generating an invoice from a pos order

bzr revid: sle@openerp.com-20140414104954-xj10wi640tyr3ufe
This commit is contained in:
Simon Lejeune 2014-04-14 12:49:54 +02:00
parent e82fbf7d91
commit afd490c984
69 changed files with 978 additions and 4519 deletions

View File

@ -19,14 +19,12 @@
#
##############################################################################
import point_of_sale
import account_bank_statement
import controllers
import point_of_sale
import report
import res_users
import res_partner
import wizard
import report
import controllers
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -19,7 +19,6 @@
#
##############################################################################
{
'name': 'Point of Sale',
'version': '1.0.1',
@ -51,19 +50,15 @@ Main Features
'images': ['images/pos_touch_screen.jpeg', 'images/pos_session.jpeg', 'images/pos_analysis.jpeg','images/sale_order_pos.jpeg','images/product_pos.jpeg'],
'depends': ['sale_stock'],
'data': [
'data/report_paperformat.xml',
'security/point_of_sale_security.xml',
'security/ir.model.access.csv',
'wizard/pos_details.xml',
'wizard/pos_box.xml',
'wizard/pos_confirm.xml',
'wizard/pos_details.xml',
'wizard/pos_discount.xml',
'wizard/pos_open_statement.xml',
'wizard/pos_payment_report_user_view.xml',
'wizard/pos_sales_user.xml',
'wizard/pos_receipt_view.xml',
'wizard/pos_payment_report_user.xml',
'wizard/pos_payment_report.xml',
'wizard/pos_payment.xml',
'wizard/pos_box.xml',
'wizard/pos_session_opening.xml',
'point_of_sale_report.xml',
'point_of_sale_view.xml',
@ -75,16 +70,24 @@ Main Features
'account_statement_report.xml',
'res_users_view.xml',
'res_partner_view.xml',
'views/report_statement.xml',
'views/report_usersproduct.xml',
'views/report_closedcashbox.xml',
'views/report_receipt.xml',
'views/report_saleslines.xml',
'views/report_detailsofsales.xml',
'views/report_payment.xml',
],
'demo': [
'point_of_sale_demo.xml',
'account_statement_demo.xml',
'test/00_register_open.yml'
],
'test': [
'test/00_register_open.yml',
'test/01_order_to_payment.yml',
'test/02_order_to_invoice.yml',
'test/point_of_sale_report.yml'
'test/point_of_sale_report.yml',
'test/account_statement_reports.yml',
],
'installable': True,
'application': True,

View File

@ -1,60 +1,29 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<openerp>
<data>
<report
id="pos_users_product_re"
id="action_report_account_statement"
model="account.bank.statement"
string="Statement"
name="point_of_sale.report_statement"
file="point_of_sale.report_statement"
report_type="qweb-pdf"
/>
<report
id="action_report_pos_users_product"
string="User's Product"
model="account.bank.statement"
name="pos.user.product"
auto="False"
multi="True"
rml="point_of_sale/report/pos_users_product.rml"
/>
name="point_of_sale.report_usersproduct"
file="point_of_sale.report_usersproduct"
report_type="qweb-pdf"
/>
<report
id="account_statement"
string="Statement"
model="account.bank.statement"
name="account.statement"
auto="False"
multi="True"
rml="point_of_sale/report/account_statement.rml"
/>
<report
id="all_closed_cashbox_of_the_day"
id="action_report_closed_cashbox"
string="All Closed CashBox"
model="account.bank.statement"
name="all.closed.cashbox.of.the.day"
auto="False"
multi="True"
menu = 'False'
rml="point_of_sale/report/all_closed_cashbox_of_the_day.rml"
/>
<report
id="pos_users_product_re"
string="User's Product"
model="account.bank.statement"
name="pos.user.product"
auto="False"
multi="True"
rml="point_of_sale/report/pos_users_product.rml"
/>
<report
id="account_statement"
string="Statement"
model="account.bank.statement"
name="account.statement"
auto="False"
multi="True"
rml="point_of_sale/report/account_statement.rml"
/>
name="point_of_sale.report_closedcashbox"
file="point_of_sale.report_closedcashbox"
report_type="qweb-pdf"
/>
</data>
</openerp>

View File

@ -1,3 +1,2 @@
import main
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="paperformat_posreceipt" model="report.paperformat">
<field name="name">Point Of Sale Receipt</field>
<field name="default" eval="True"/>
<field name="format">custom</field>
<field name="page_height">150</field>
<field name="page_width">60</field>
<field name="orientation">Portrait</field>
<field name="margin_top">3</field>
<field name="margin_bottom">3</field>
<field name="margin_left">3</field>
<field name="margin_right">3</field>
<field name="header_line" eval="False" />
<field name="header_spacing">3</field>
<field name="dpi">130</field>
</record>
</data>
</openerp>

View File

@ -605,7 +605,6 @@ class pos_order(osv.osv):
return {'value': {'pricelist_id': pricelist}}
def _amount_all(self, cr, uid, ids, name, args, context=None):
tax_obj = self.pool.get('account.tax')
cur_obj = self.pool.get('res.currency')
res = {}
for order in self.browse(cr, uid, ids, context=context):
@ -858,9 +857,7 @@ class pos_order(osv.osv):
'qty': -order_line.qty
}, context=context)
new_order = ','.join(map(str,clone_list))
abs = {
#'domain': "[('id', 'in', ["+new_order+"])]",
'name': _('Return Products'),
'view_type': 'form',
'view_mode': 'form',

View File

@ -1,8 +1,6 @@
<?xml version="1.0" ?>
<openerp>
<data noupdate="1">
<data>
<!-- After installation of the module, open the related menu -->
<record id="action_client_pos_menu" model="ir.actions.client">
<field name="name">Open POS Menu</field>
@ -27,7 +25,6 @@
<field name="body"><![CDATA[<p>Record sale orders, register payments, compute change to return, create invoices, and manage refunds through a specific web touch-screen interface.</p>
<p>If you install the PoS proxy you will be able to interface OpenERP with retail hardware: barcode scanners, printers, cash registers, weighing machines, credit card payment terminals.</p>]]></field>
</record>
</data>
</openerp>

View File

@ -1,86 +1,62 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<openerp>
<data>
<report id="report_user_label"
model="res.users"
name="point_of_sale.user.label"
string="User Labels"
xml="point_of_sale/report/user_label.xml"
xsl="point_of_sale/report/user_label.xsl"
/>
<report
id="pos_invoice_report"
string="Invoice"
model="pos.order"
name="pos.invoice"
report_type="qweb-pdf"
name="point_of_sale.report_invoice"
file="point_of_sale.report_invoice"
/>
<report
id="action_report_pos_receipt"
string="Receipt"
model="pos.order"
report_type="qweb-pdf"
name="point_of_sale.report_receipt"
file="point_of_sale.report_receipt"
/>
<record id="action_report_pos_receipt" model="ir.actions.report.xml">
<field name="paperformat_id" ref="point_of_sale.paperformat_posreceipt"/>
</record>
<report
id="pos_lines_report"
string="Sales Lines"
model="pos.order"
report_type="qweb-pdf"
name="point_of_sale.report_saleslines"
file="point_of_sale.report_saleslines"
auto="False"
multi="True"
rml="account/report/account_print_invoice.rml"
/>
/>
<report
id="pos_lines_detail"
string="Details of Sales"
model="pos.order"
name="pos.details"
auto="False"
multi="True"
report_type="qweb-pdf"
name="point_of_sale.report_detailsofsales"
file="point_of_sale.report_detailsofsales"
menu="False"
rml="point_of_sale/report/pos_details.rml"
/>
/>
<report
id="pos_details_summary"
string="Sales (summary)"
id="pos_payment_report"
string="Today's Payment"
model="pos.order"
name="pos.details_summary"
auto="False"
multi="True"
rml="point_of_sale/report/pos_details_summary.rml"
/>
<report
id="pos_lines_report"
string="Pos Lines"
model="pos.order"
name="pos.lines"
auto="False"
multi="True"
rml="point_of_sale/report/pos_lines.rml"
/>
<report
id="pos_sales_user"
string="Sales Report"
model="pos.order"
name="pos.sales.user"
auto="False"
multi="True"
menu="False"
rml="point_of_sale/report/pos_sales_user.rml"
/>
<report
id="pos_sales_user_today"
string="Today's Sales"
model="pos.order"
name="pos.sales.user.today"
auto="False"
multi="True"
menu="False"
rml="point_of_sale/report/pos_sales_user_today.rml"
/>
<report
id="pos_payment_report_user"
string="Today's Payment By User"
model="pos.order"
name="pos.payment.report.user"
auto="False"
multi="True"
menu="False"
rml="point_of_sale/report/pos_payment_report_user.rml"
/>
<report id="report_user_label"
model="res.users"
name="point_of_sale.user.label"
string="User Labels"
xml="point_of_sale/report/user_label.xml"
xsl="point_of_sale/report/user_label.xsl"/>
report_type="qweb-pdf"
name="point_of_sale.report_payment"
file="point_of_sale.report_payment"
/>
</data>
</openerp>

View File

@ -26,11 +26,7 @@ import pos_receipt
import pos_invoice
import pos_lines
import pos_details
import pos_details_summary
import pos_payment_report
import pos_sales_user
import pos_sales_user_today
import pos_payment_report_user
import pos_report
import pos_order_report

View File

@ -20,8 +20,10 @@
##############################################################################
import time
from openerp.osv import osv
from openerp.report import report_sxw
class account_statement(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
@ -46,6 +48,11 @@ class account_statement(report_sxw.rml_parse):
total += line.amount
return total
report_sxw.report_sxw('report.account.statement', 'account.bank.statement', 'addons/statement/report/account_statement.rml', parser=account_statement,header='internal')
class report_account_statement(osv.AbstractModel):
_name = 'report.point_of_sale.report_statement'
_inherit = 'report.abstract_report'
_template = 'point_of_sale.report_statement'
_wrapped_report_class = account_statement
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,285 +0,0 @@
<?xml version="1.0"?>
<document filename="test.pdf">
<template title="Statement" author="OpenERP S.A. (sales@openerp.com)" allowSplitting="20">
<pageTemplate id="first">
<frame id="first" x1="36.0" y1="57.0" width="520" 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="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="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"/>
<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="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="Table3">
<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="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"/>
<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="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="Table9">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/>
</blockTableStyle>
<blockTableStyle id="Table5">
<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>
<blockTableStyle id="Table7">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="1,0" stop="1,0"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="2,0" stop="2,0"/>
</blockTableStyle>
<initialize>
<paraStyle name="all" alignment="justify"/>
</initialize>
<paraStyle name="Standard" fontName="Helvetica"/>
<paraStyle name="Heading" fontName="Helvetica" fontSize="14.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="Text body" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="List" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Caption" fontName="Helvetica" fontSize="12.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="Index" fontName="Helvetica"/>
<paraStyle name="Table Contents" fontName="Helvetica"/>
<paraStyle name="Table Heading" fontName="Helvetica" alignment="CENTER"/>
<paraStyle name="terp_header" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.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_default_Bold_9" fontName="Helvetica-Bold" fontSize="9.0" leading="11" 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_tblheader_General" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.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_default_Centre_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_tblheader_Details" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="Footer" fontName="Helvetica"/>
<paraStyle name="Horizontal Line" fontName="Helvetica" fontSize="6.0" leading="8" spaceBefore="0.0" spaceAfter="14.0"/>
<paraStyle name="Heading 9" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" spaceBefore="12.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_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="15.0" leading="19" 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_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"/>
<paraStyle name="terp_default_8_Italic" fontName="Helvetica-Oblique" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<images/>
</stylesheet>
<story>
<pto>
<pto_header>
<blockTable colWidths="131.0,292.0,97.0" style="Table9">
<tr>
<td>
<para style="terp_tblheader_Details">Name</para>
</td>
<td>
<para style="terp_tblheader_Details">Partner</para>
</td>
<td>
<para style="terp_tblheader_Details_Right">Amount </para>
</td>
</tr>
</blockTable>
</pto_header>
<para style="terp_default_8">[[ repeatIn(objects,'statement') ]]</para>
<para style="terp_header_Centre">Statement</para>
<blockTable colWidths="130.0,130.0,130.0,130.0" style="Table1">
<tr>
<td>
<para style="terp_tblheader_General_Centre">Statement Name</para>
</td>
<td>
<para style="terp_tblheader_General_Centre">Journal</para>
</td>
<td>
<para style="terp_tblheader_General_Centre">Company</para>
</td>
<td>
<para style="terp_tblheader_General_Centre">User</para>
</td>
</tr>
</blockTable>
<blockTable colWidths="130.0,130.0,130.0,130.0" style="Table2">
<tr>
<td>
<para style="terp_default_Centre_8">[[ statement.name ]]</para>
</td>
<td>
<para style="terp_default_Centre_8">[[ statement.journal_id.name ]]</para>
</td>
<td>
<para style="terp_default_Centre_8">[[ statement.company_id.name ]]</para>
</td>
<td>
<para style="terp_default_Centre_8">[[ statement.user_id.name ]]</para>
</td>
</tr>
</blockTable>
<para style="terp_default_8">
<font color="white"> </font>
</para>
<blockTable colWidths="130.0,130.0,130.0,130.0" style="Table3">
<tr>
<td>
<para style="terp_tblheader_General_Centre">Opening Date</para>
</td>
<td>
<para style="terp_tblheader_General_Centre">Closing Date</para>
</td>
<td>
<para style="terp_tblheader_General_Centre">Starting Balance</para>
</td>
<td>
<para style="terp_tblheader_General_Centre">Ending Balance</para>
</td>
</tr>
</blockTable>
<blockTable colWidths="130.0,130.0,130.0,130.0" style="Table4">
<tr>
<td>
<para style="terp_default_Centre_8">[[ formatLang(statement.date,date=True) ]]</para>
</td>
<td>
<para style="terp_default_Centre_8">[[ formatLang(statement.closing_date,date_time=True)]]</para>
</td>
<td>
<para style="terp_default_Centre_8">[[ formatLang(statement.balance_start, dp='Account', currency_obj = company.currency_id) ]]</para>
</td>
<td>
<para style="terp_default_Centre_8">[[ formatLang(statement.balance_end_real, dp='Account', currency_obj = company.currency_id) ]]</para>
</td>
</tr>
</blockTable>
<para style="terp_default_8">
<font color="white"> </font>
</para>
<blockTable colWidths="131.0,292.0,97.0" style="Table9">
<tr>
<td>
<para style="terp_tblheader_Details">Name</para>
</td>
<td>
<para style="terp_tblheader_Details">Partner</para>
</td>
<td>
<para style="terp_tblheader_Details_Right">Amount </para>
</td>
</tr>
</blockTable>
<section>
<para style="terp_default_1">[[ repeatIn(statement.line_ids,'line_ids') and ' ' or removeParentNode('blockTable') ]]</para>
<section>
<para style="terp_default_1">[[ repeatIn(get_data(statement), 'line_ids')]]</para>
<blockTable colWidths="131.0,292.0,97.0" style="Table5">
<tr>
<td>
<para style="terp_default_9">[[ line_ids.name ]]</para>
</td>
<td>
<para style="terp_default_9">[[ line_ids.partner_id.name ]]</para>
</td>
<td>
<para style="terp_default_Right_9">[[ formatLang(line_ids.amount, dp='Account', currency_obj=company.currency_id) ]]</para>
</td>
</tr>
</blockTable>
</section>
</section>
<blockTable colWidths="374.0,49.0,97.0" style="Table7">
<tr>
<td>
<para style="terp_default_8">
<font color="white"> </font>
</para>
</td>
<td>
<para style="terp_tblheader_Details">Total :</para>
</td>
<td>
<para style="terp_default_Right_9_Bold">[[ formatLang(get_total(statement.line_ids), dp='Account', currency_obj = company.currency_id) ]]</para>
</td>
</tr>
</blockTable>
<para style="terp_default_8">
<font color="white"> </font>
</para>
<para style="terp_default_8">
<font color="white"> </font>
</para>
<para style="terp_default_8">
<font color="white"> </font>
</para>
</pto>
</story>
</document>

View File

@ -20,8 +20,10 @@
##############################################################################
import time
from openerp.osv import osv
from openerp.report import report_sxw
class all_closed_cashbox_of_the_day(report_sxw.rml_parse):
#TOFIX: sql injection problem: SQL Request must be pass from sql injection...
def __init__(self, cr, uid, name, context):
@ -39,14 +41,14 @@ class all_closed_cashbox_of_the_day(report_sxw.rml_parse):
})
def _get_user(self, line_ids):
sql = "select name from res_users where id = %d"%(line_ids['create_uid'])
sql = "select login from res_users where id = %d"%(line_ids['create_uid'])
self.cr.execute(sql)
user = self.cr.fetchone()
return user[0]
def _get_data(self, user):
data = {}
sql = """ SELECT abs.journal_id,abs.id,abs.date,abs.closing_date,abs.name as statement,aj.name as journal,ap.name as period,ru.name as user,rc.name as company,
sql = """ SELECT abs.journal_id,abs.id,abs.date,abs.closing_date,abs.name as statement,aj.name as journal,ap.name as period,ru.partner_id as user,rc.name as company,
abs.state,abs.balance_end_real FROM account_bank_statement as abs
LEFT JOIN account_journal as aj ON aj.id = abs.journal_id
LEFT JOIN account_period as ap ON ap.id = abs.period_id
@ -67,7 +69,7 @@ class all_closed_cashbox_of_the_day(report_sxw.rml_parse):
def _get_bal(self, data):
res = {}
sql =""" select sum(pieces*number) as bal from account_cashbox_line where starting_id = %d """%(data['id'])
sql =""" select sum(pieces*number_closing) as bal from account_cashbox_line where bank_statement_id = %d """%(data['id'])
self.cr.execute(sql)
res = self.cr.dictfetchall()
if res:
@ -115,7 +117,7 @@ class all_closed_cashbox_of_the_day(report_sxw.rml_parse):
res = self.cr.dictfetchall()
for r in res:
total_ending_bal += (r['net_total'] or 0.0)
sql1 =""" select sum(pieces*number) as bal from account_cashbox_line where starting_id = %d"""%(r['id'])
sql1 =""" select sum(pieces*number_closing) as bal from account_cashbox_line where bank_statement_id = %d"""%(r['id'])
self.cr.execute(sql1)
data = self.cr.dictfetchall()
if data[0]['bal']:
@ -135,6 +137,11 @@ class all_closed_cashbox_of_the_day(report_sxw.rml_parse):
res = self.cr.dictfetchall()
return res[0]['net_total'] or 0.0
report_sxw.report_sxw('report.all.closed.cashbox.of.the.day', 'account.bank.statement', 'addons/point_of_sale/report/all_closed_cashbox_of_the_day.rml', parser=all_closed_cashbox_of_the_day,header='internal')
class report_closed_cashbox(osv.AbstractModel):
_name = 'report.point_of_sale.report_closedcashbox'
_inherit = 'report.abstract_report'
_template = 'point_of_sale.report_closedcashbox'
_wrapped_report_class = all_closed_cashbox_of_the_day
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,249 +0,0 @@
<?xml version="1.0"?>
<document filename="test.pdf">
<template title="Cashbox of the day" 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>
</template>
<stylesheet>
<blockTableStyle id="Standard_Outline">
<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="LINEAFTER" 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"/>
</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="LINEAFTER" 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"/>
</blockTableStyle>
<blockTableStyle id="Table3">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="3,-1" stop="3,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="4,-1" stop="4,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="5,-1" stop="5,-1"/>
</blockTableStyle>
<blockTableStyle id="Table4">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="3,-1" stop="3,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="4,-1" stop="4,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="5,-1" stop="5,-1"/>
</blockTableStyle>
<blockTableStyle id="Table7">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
</blockTableStyle>
<blockTableStyle id="Table5">
<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"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="4,-1" stop="4,-1"/>
</blockTableStyle>
<initialize>
<paraStyle name="all" alignment="justify"/>
</initialize>
<paraStyle name="P1" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="Standard" fontName="Helvetica"/>
<paraStyle name="Heading" fontName="Helvetica" fontSize="14.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="Text body" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="List" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Caption" fontName="Helvetica" fontSize="12.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="Index" fontName="Helvetica"/>
<paraStyle name="Table Contents" fontName="Helvetica"/>
<paraStyle name="Table Heading" fontName="Helvetica" alignment="CENTER"/>
<paraStyle name="terp_header" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.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_default_Bold_9" fontName="Helvetica-Bold" fontSize="9.0" leading="11" 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_tblheader_General" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.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_default_Centre_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_tblheader_Details" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="Footer" fontName="Helvetica"/>
<paraStyle name="Horizontal Line" fontName="Helvetica" fontSize="6.0" leading="8" spaceBefore="0.0" spaceAfter="14.0"/>
<paraStyle name="Heading 9" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" spaceBefore="12.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_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="15.0" leading="19" 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_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"/>
<paraStyle name="terp_default_8_Italic" fontName="Helvetica-Oblique" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<images/>
</stylesheet>
<story>
<para style="terp_default_8">[[ repeatIn(objects,'statement') ]]</para>
<para style="terp_default_8">
<font color="white"> </font>
</para>
<para style="terp_default_8">
<font color="white"> </font>
</para>
<para style="terp_header_Centre">Today's Closed Cashbox</para>
<para style="terp_default_Right_9">
<font color="white"> </font>
</para>
<blockTable colWidths="256.0,256.0" style="Table1">
<tr>
<td>
<para style="terp_tblheader_General_Centre">Company</para>
</td>
<td>
<para style="terp_tblheader_General_Centre">User</para>
</td>
</tr>
</blockTable>
<blockTable colWidths="256.0,256.0" style="Table2">
<tr>
<td>
<para style="terp_default_Centre_8">[[ company.name ]]</para>
</td>
<td>
<para style="terp_default_Centre_8">[[ user.name ]]</para>
</td>
</tr>
</blockTable>
<para style="Standard">
<font color="white"> </font>
</para>
<blockTable colWidths="59.0,101.0,75.0,78.0,104.0,95.0" style="Table3">
<tr>
<td>
<para style="terp_tblheader_General">St.Name</para>
</td>
<td>
<para style="terp_tblheader_General_Centre">Journal</para>
</td>
<td>
<para style="terp_tblheader_General_Centre">Opening Date</para>
</td>
<td>
<para style="terp_tblheader_General_Centre">Closing Date</para>
</td>
<td>
<para style="terp_tblheader_General_Right">Starting Balance</para>
</td>
<td>
<para style="terp_tblheader_General_Right">Ending Balance</para>
</td>
</tr>
</blockTable>
<blockTable colWidths="59.0,101.0,75.0,78.0,104.0,95.0" style="Table4">
<tr>
<td>
<para style="terp_tblheader_General">Total:</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="terp_tblheader_General_Right"><u>[[ formatLang(get_net_total_starting(user)[1], currency_obj = company.currency_id)]]</u></para>
</td>
<td>
<para style="terp_tblheader_General_Right"><u>[[ formatLang(get_net_total(user), currency_obj = company.currency_id)]]</u></para>
</td>
</tr>
</blockTable>
<section>
<para style="terp_default_1">[[ repeatIn(get_data(user),'statement') ]]</para>
<blockTable colWidths="60.0,99.0,75.0,79.0,103.0,96.0" style="Table7">
<tr>
<td>
<para style="terp_default_Bold_8">[[ statement['statement'] ]]</para>
</td>
<td>
<para style="terp_default_Bold_8">[[ statement['journal'] ]]</para>
</td>
<td>
<para style="terp_default_Bold_8">[[ statement['date'] ]]</para>
</td>
<td>
<para style="terp_default_Bold_8">[[ statement['closing_date'] ]]</para>
</td>
<td>
<para style="P1"><u>[[ formatLang(get_bal(statement), currency_obj = company.currency_id)]]</u></para>
</td>
<td>
<para style="P1"><u>[[ formatLang(get_sub_total(user,statement['journal_id'],statement['date']), currency_obj = company.currency_id )]]</u></para>
</td>
</tr>
</blockTable>
<section>
<para style="terp_default_1">[[ repeatIn(get_lines(statement),'line_ids') ]]</para>
<blockTable colWidths="99.0,134.0,129.0,3.0,147.0" style="Table5">
<tr>
<td>
<para style="terp_default_9">[[ line_ids['name'] ]]</para>
<para style="terp_default_9">
<font color="white"> </font>
</para>
</td>
<td>
<para style="terp_default_9">[[ get_partner(line_ids) or removeParentNode('font') ]]</para>
</td>
<td>
<para style="terp_default_Right_9">[[ get_user(line_ids) or removeParentNode('font') ]]</para>
</td>
<td>
<para style="Table Contents">
<font color="white"> </font>
</para>
</td>
<td>
<para style="terp_default_Right_9">[[ formatLang(line_ids['amount'], currency_obj = company.currency_id)]]</para>
</td>
</tr>
</blockTable>
<para style="terp_default_1">
<font color="white"> </font>
</para>
</section>
</section>
</story>
</document>

View File

@ -20,8 +20,10 @@
##############################################################################
import time
from openerp.osv import osv
from openerp.report import report_sxw
class pos_details(report_sxw.rml_parse):
def _get_invoice(self, inv_id):
@ -180,7 +182,7 @@ class pos_details(report_sxw.rml_parse):
'strip_name': self._strip_name,
'getpayments': self._get_payments,
'getsumdisc': self._get_sum_discount,
'gettotalofthaday': self._total_of_the_day,
'gettotaloftheday': self._total_of_the_day,
'gettaxamount': self._get_tax_amount,
'pos_sales_details':self._pos_sales_details,
'getqtytotal2': self._get_qty_total_2,
@ -191,6 +193,11 @@ class pos_details(report_sxw.rml_parse):
'get_user_names': self._get_user_names,
})
report_sxw.report_sxw('report.pos.details', 'pos.order', 'addons/point_of_sale_singer/report/pos_details.rml', parser=pos_details, header='internal')
class report_pos_details(osv.AbstractModel):
_name = 'report.point_of_sale.report_detailsofsales'
_inherit = 'report.abstract_report'
_template = 'point_of_sale.report_detailsofsales'
_wrapped_report_class = pos_details
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,400 +0,0 @@
<?xml version="1.0"?>
<document filename="test.pdf">
<template title="Details of Sales" author="OpenERP S.A. (sales@openerp.com)" allowSplitting="20">
<pageTemplate id="first">
<frame id="first" x1="28.0" y1="57.0" width="511" 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="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="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"/>
<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="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"/>
<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="Table4">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="3,-1" stop="3,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="4,-1" stop="4,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="5,-1" stop="5,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="6,-1" stop="6,-1"/>
</blockTableStyle>
<blockTableStyle id="Table6">
<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"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="4,-1" stop="4,-1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="5,-1" stop="5,-1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="6,-1" stop="6,-1"/>
</blockTableStyle>
<blockTableStyle id="Table3">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
</blockTableStyle>
<blockTableStyle id="Table5">
<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"/>
</blockTableStyle>
<blockTableStyle id="Table9">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
</blockTableStyle>
<blockTableStyle id="Table11">
<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"/>
</blockTableStyle>
<blockTableStyle id="Table8">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Table7">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="0,0" stop="0,0"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="1,0" stop="1,0"/>
<lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="0,1" stop="0,1"/>
<lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="1,1" stop="1,1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="0,2" stop="0,2"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="1,2" stop="1,2"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="0,3" stop="0,3"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="1,3" stop="1,3"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="0,4" stop="0,4"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="1,4" stop="1,4"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="0,5" stop="0,5"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="1,5" stop="1,5"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/>
</blockTableStyle>
<initialize>
<paraStyle name="all" alignment="justify"/>
</initialize>
<paraStyle name="Standard" fontName="Helvetica"/>
<paraStyle name="Heading" fontName="Helvetica" fontSize="14.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="Text body" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="List" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Caption" fontName="Helvetica" fontSize="12.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="Index" fontName="Helvetica"/>
<paraStyle name="terp_header" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.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="Table Contents" fontName="Helvetica"/>
<paraStyle name="Table Heading" fontName="Helvetica" alignment="CENTER"/>
<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_default_Bold_9" fontName="Helvetica-Bold" fontSize="9.0" leading="11" 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_tblheader_General" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.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_default_Centre_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_tblheader_Details" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="Footer" fontName="Helvetica"/>
<paraStyle name="Horizontal Line" fontName="Helvetica" fontSize="6.0" leading="8" spaceBefore="0.0" spaceAfter="14.0"/>
<paraStyle name="Heading 9" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" spaceBefore="12.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_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="15.0" leading="19" 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_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"/>
<paraStyle name="terp_default_8_Italic" fontName="Helvetica-Oblique" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<images/>
</stylesheet>
<story>
<para style="terp_default_8">
<font color="white"> </font>
</para>
<para style="terp_header_Centre">Details of Sales</para>
<para style="terp_default_8">
<font color="white"> </font>
</para>
<blockTable colWidths="104.0,104.0,133.0,85.0,86.0" style="Table1">
<tr>
<td>
<para style="terp_tblheader_General_Centre">Company</para>
</td>
<td>
<para style="terp_tblheader_General_Centre">Users</para>
</td>
<td>
<para style="terp_tblheader_General_Centre">Print Date</para>
</td>
<td>
<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="104.0,104.0,133.0,85.0,85.0" style="Table2">
<tr>
<td>
<para style="terp_default_Centre_8">[[ company.name ]]</para>
</td>
<td>
<para style="terp_default_Centre_8">[[ get_user_names(data['form']['user_ids']) or 'All' ]]</para>
</td>
<td>
<para style="terp_default_Centre_8">[[ formatLang(time.strftime('%Y-%m-%d'),date=True) ]]</para>
</td>
<td>
<para style="terp_default_Centre_8">[[ formatLang(data['form']['date_start'],date=True) ]] </para>
</td>
<td>
<para style="terp_default_Centre_8">[[ formatLang(data['form']['date_end'],date=True) ]] </para>
</td>
</tr>
</blockTable>
<para style="terp_default_8">
<font color="white"> </font>
</para>
<blockTable colWidths="108.0,54.0,159.0,54.0,75.0,30.0,69.0" style="Table4">
<tr>
<td>
<para style="terp_tblheader_Details">Date</para>
</td>
<td>
<para style="terp_tblheader_Details">Order</para>
</td>
<td>
<para style="terp_tblheader_Details">Product</para>
</td>
<td>
<para style="terp_tblheader_Details_Right">Price </para>
</td>
<td>
<para style="terp_tblheader_Details_Centre">Qty</para>
</td>
<td>
<para style="terp_tblheader_Details_Right">Disc(%) </para>
</td>
<td>
<para style="terp_tblheader_Details_Centre">Invoiced </para>
</td>
</tr>
</blockTable>
<section>
<para style="terp_default_1">[[ repeatIn(pos_sales_details(data['form']), 'line_ids') ]]</para>
<blockTable colWidths="108.0,54.0,159.0,54.0,75.0,30.0,69.0" style="Table6">
<tr>
<td>
<para style="terp_default_9">[[ formatLang(line_ids['date_order'],date_time = True) ]]</para>
</td>
<td>
<para style="terp_default_9">[[ line_ids['pos_name'] ]]</para>
</td>
<td>
<para style="terp_default_9">[ [[ line_ids['code'] ]] ] [[ line_ids['name'] ]]</para>
</td>
<td>
<para style="terp_default_Right_9">[[ formatLang(line_ids['price_unit'], dp='Sale Price', currency_obj = company.currency_id) ]]</para>
</td>
<td>
<para style="terp_default_Centre_9">[[ formatLang(line_ids['qty']) ]] [[ line_ids['uom'] ]]</para>
</td>
<td>
<para style="terp_default_Centre_9">[[ formatLang(line_ids['discount'], dp='Sale Price') ]]</para>
</td>
<td>
<para style="terp_default_Centre_9">[[ getinvoice(line_ids['invoice_id']) or removeParentNode('font') ]]</para>
</td>
</tr>
</blockTable>
</section>
<para style="terp_default_8">
<font color="white"> </font>
</para>
<blockTable colWidths="256.0,256.0" style="Table3">
<tr>
<td>
<para style="terp_tblheader_Details">Taxes</para>
</td>
<td>
<para style="terp_default_8">
<font color="white"> </font>
</para>
</td>
</tr>
</blockTable>
<section>
<para style="terp_default_1">[[ repeatIn(gettaxamount(data['form']), 'p')]]</para>
<blockTable colWidths="256.0,256.0" style="Table5">
<tr>
<td>
<para style="terp_default_9">[[ p['name'] or removeParentNode('para') ]]</para>
</td>
<td>
<para style="terp_default_Right_9_Bold">[[ formatLang(p['amount'], currency_obj = company.currency_id) or removeParentNode('tr') ]]</para>
</td>
</tr>
</blockTable>
<para style="terp_default_1">
<font color="white"> </font>
</para>
</section>
<para style="terp_default_8">
<font color="white"> </font>
</para>
<blockTable colWidths="257.0,255.0" style="Table9">
<tr>
<td>
<para style="terp_tblheader_Details">Payment</para>
</td>
<td>
<para style="terp_default_8">
<font color="white"> </font>
</para>
</td>
</tr>
</blockTable>
<section>
<para style="terp_default_1">[[ repeatIn(getpayments(data['form']), 'p') ]]</para>
<blockTable colWidths="255.0,255.0" style="Table11">
<tr>
<td>
<para style="terp_default_9">[[ p['name'] or removeParentNode('para') ]]</para>
</td>
<td>
<para style="terp_default_Right_9_Bold">[[ formatLang(p['sum'], dp='Account', currency_obj = company.currency_id) or removeParentNode('tr') ]]</para>
</td>
</tr>
</blockTable>
<para style="terp_default_1">
<font color="white"> </font>
</para>
</section>
<para style="terp_default_8">
<font color="white"> </font>
</para>
<blockTable colWidths="257.0,255.0" style="Table8">
<tr>
<td>
<para style="terp_tblheader_Details">Summary</para>
</td>
<td>
<para style="terp_default_9">
<font color="white"> </font>
</para>
</td>
</tr>
</blockTable>
<blockTable colWidths="257.0,254.0" style="Table7">
<tr>
<td>
<para style="terp_default_Bold_9">Sales total(Revenue)</para>
</td>
<td>
<para style="terp_default_Right_9_Bold">[[ formatLang(getsalestotal2(), dp='Sale Price', currency_obj = company.currency_id) ]]</para>
</td>
</tr>
<tr>
<td>
<para style="terp_default_Bold_9">Qty of product</para>
</td>
<td>
<para style="terp_default_Right_9_Bold">[[ formatLang(getqtytotal2()) ]]</para>
</td>
</tr>
<tr>
<td>
<para style="terp_default_Bold_9">Total invoiced</para>
</td>
<td>
<para style="terp_default_Right_9_Bold">[[ formatLang(getsuminvoice2(data['form']), dp='Sale Price', currency_obj = company.currency_id) ]]</para>
</td>
</tr>
<tr>
<td>
<para style="terp_default_Bold_9">Total discount</para>
</td>
<td>
<para style="terp_default_Right_9_Bold">[[ formatLang(getsumdisc(data['form']), dp='Sale Price', currency_obj = company.currency_id) ]]</para>
</td>
</tr>
<tr>
<td>
<para style="terp_default_Bold_9">Total paid</para>
</td>
<td>
<para style="terp_default_Right_9_Bold">[[ formatLang(getpaidtotal2(), dp='Sale Price', currency_obj = company.currency_id) ]]</para>
</td>
</tr>
<tr>
<td>
<para style="terp_default_Bold_9">Total of the day</para>
</td>
<td>
<para style="terp_default_Right_9_Bold">[[ formatLang(gettotalofthaday(data['form']), dp='Sale Price', currency_obj = company.currency_id) ]]</para>
</td>
</tr>
</blockTable>
<para style="terp_default_8">
<font color="white"> </font>
</para>
</story>
</document>

View File

@ -1,129 +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 pos_details_summary(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(pos_details_summary, self).__init__(cr, uid, name, context=context)
self.total = 0.0
self.localcontext.update({
'time': time,
'strip_name': self._strip_name,
'getpayments': self._get_payments,
'getqtytotal': self._get_qty_total,
'getsumdisc': self._get_sum_discount,
'getpaidtotal': self._paid_total,
'gettotalofthaday': self._total_of_the_day,
'getsuminvoice': self._sum_invoice,
'gettaxamount': self._get_tax_amount,
'getsalestotal': self._get_sales_total,
'getstartperiod': self._get_start_period,
'getendperiod': self._get_end_period,
'getcompany':self.get_company
})
def get_company(self, objects):
comp=[obj.company_id.name for obj in objects]
return '%s' % (comp[0])
def _get_qty_total(self, objects):
#code for the sum of qty_total
return reduce(lambda acc, object:
acc + reduce(
lambda sum_qty, line:
sum_qty + line.qty,
object.lines,
0 ),
objects,
0)
def _get_sum_discount(self, objects):
#code for the sum of discount value
return reduce(lambda acc, object:
acc + reduce(
lambda sum_dis, line:
sum_dis + ((line.price_unit * line.qty ) * (line.discount / 100)),
object.lines,
0.0),
objects,
0.0 )
def _get_payments(self, objects):
result = {}
for obj in objects:
for statement in obj.statement_ids:
if statement.journal_id:
result[statement.journal_id] = result.get(statement.journal_id, 0.0) + statement.amount
return result
def _paid_total(self, objects):
return sum(self._get_payments(objects).values(), 0.0)
def _total_of_the_day(self, objects):
total_paid = self._paid_total(objects)
total_invoiced = self._sum_invoice(objects)
return total_paid - total_invoiced
def _sum_invoice(self, objects):
return reduce(lambda acc, obj:
acc + obj.invoice_id.amount_total,
[o for o in objects if o.invoice_id and o.invoice_id.number],
0.0)
def _ellipsis(self, string, maxlen=100, ellipsis = '...'):
ellipsis = ellipsis or ''
return string[:maxlen - len(ellipsis) ] + (ellipsis, '')[len(string) < maxlen]
def _strip_name(self, name, maxlen=50):
return self._ellipsis(name, maxlen, ' ...')
def _get_tax_amount(self, objects):
res = {}
for order in objects:
for line in order.lines:
for tax in line.product_id.taxes_id:
res[tax.name] = res.setdefault(tax.name, 0.0) + (line.price_subtotal_incl - line.price_subtotal)
return res
def _get_sales_total(self, objects):
return reduce(lambda x, o: x + len(o.lines), objects, 0)
def _get_start_period(self, objects):
date_orders = sorted([obj.date_order for obj in objects])
min_date = date_orders[0]
return '%s' % min_date
def _get_end_period(self, objects):
date_orders = sorted([obj.date_order for obj in objects])
max_date = date_orders[-1]
return '%s' % max_date
report_sxw.report_sxw('report.pos.details_summary',
'pos.order',
'addons/point_of_sale/report/pos_details_summary.rml',
parser=pos_details_summary,
header='internal')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,315 +0,0 @@
<?xml version="1.0"?>
<document filename="test.pdf">
<template title="Details of Sales" author="OpenERP S.A. (sales@openerp.com)" allowSplitting="20">
<pageTemplate id="first">
<frame id="first" x1="28.0" y1="57.0" width="511" 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="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="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"/>
<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="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="Table3">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
</blockTableStyle>
<blockTableStyle id="Table5">
<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"/>
</blockTableStyle>
<blockTableStyle id="Table9">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
</blockTableStyle>
<blockTableStyle id="Table11">
<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"/>
</blockTableStyle>
<blockTableStyle id="Table8">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Table7">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="0,0" stop="0,0"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="1,0" stop="1,0"/>
<lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="0,1" stop="0,1"/>
<lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="1,1" stop="1,1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="0,2" stop="0,2"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="1,2" stop="1,2"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="0,3" stop="0,3"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="1,3" stop="1,3"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="0,4" stop="0,4"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="1,4" stop="1,4"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="0,5" stop="0,5"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="1,5" stop="1,5"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/>
</blockTableStyle>
<initialize>
<paraStyle name="all" alignment="justify"/>
</initialize>
<paraStyle name="P1" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P2" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="Standard" fontName="Helvetica"/>
<paraStyle name="Heading" fontName="Helvetica" fontSize="14.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="Text body" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="List" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Caption" fontName="Helvetica" fontSize="12.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="Index" fontName="Helvetica"/>
<paraStyle name="terp_header" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.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="Table Contents" fontName="Helvetica"/>
<paraStyle name="Table Heading" fontName="Helvetica" alignment="CENTER"/>
<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_default_Bold_9" fontName="Helvetica-Bold" fontSize="9.0" leading="11" 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_tblheader_General" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.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_default_Centre_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_tblheader_Details" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="Footer" fontName="Helvetica"/>
<paraStyle name="Horizontal Line" fontName="Helvetica" fontSize="6.0" leading="8" spaceBefore="0.0" spaceAfter="14.0"/>
<paraStyle name="Heading 9" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" spaceBefore="12.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_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="15.0" leading="19" 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_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"/>
<paraStyle name="terp_default_8_Italic" fontName="Helvetica-Oblique" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<images/>
</stylesheet>
<story>
<para style="terp_default_8">
<font color="white"> </font>
</para>
<para style="terp_header_Centre">Details of Sales</para>
<para style="terp_default_8">
<font color="white"> </font>
</para>
<blockTable colWidths="149.0,124.0,119.0,120.0" style="Table1">
<tr>
<td>
<para style="terp_tblheader_General_Centre">Company</para>
</td>
<td>
<para style="terp_tblheader_General_Centre">Print Date</para>
</td>
<td>
<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="148.0,124.0,119.0,119.0" style="Table2">
<tr>
<td>
<para style="terp_default_Centre_8">[[ company.name ]]</para>
</td>
<td>
<para style="terp_default_Centre_8">[[ formatLang(time.strftime('%Y-%m-%d'),date=True) ]]</para>
</td>
<td>
<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>
<para style="terp_default_8">
<font color="white"> </font>
</para>
<section>
<para style="Standard">
<font color="white"> </font>
</para>
</section>
<blockTable colWidths="256.0,256.0" style="Table3">
<tr>
<td>
<para style="terp_tblheader_Details">Mode of Taxes</para>
</td>
<td>
<para style="terp_default_8">
<font color="white"> </font>
</para>
</td>
</tr>
</blockTable>
<section>
<para style="terp_default_1">[[ repeatIn(gettaxamount(objects).items(),'p') ]]</para>
<blockTable colWidths="256.0,256.0" style="Table5">
<tr>
<td>
<para style="P1">[[ p[0] ]]</para>
</td>
<td>
<para style="terp_default_Right_9_Bold">[[ formatLang(p[1], currency_obj=company.currency_id) ]]</para>
</td>
</tr>
</blockTable>
<para style="terp_default_1">
<font color="white"> </font>
</para>
</section>
<para style="terp_default_8">
<font color="white"> </font>
</para>
<blockTable colWidths="257.0,255.0" style="Table9">
<tr>
<td>
<para style="terp_tblheader_Details">Mode of Payment</para>
</td>
<td>
<para style="terp_default_8">
<font color="white"> </font>
</para>
</td>
</tr>
</blockTable>
<section>
<para style="terp_default_1">[[ repeatIn(getpayments(objects).items(),'t') ]]</para>
<blockTable colWidths="255.0,255.0" style="Table11">
<tr>
<td>
<para style="P2">[[ t[0].name ]]</para>
</td>
<td>
<para style="terp_default_Right_9_Bold">[[ formatLang(t[1], currency_obj=company.currency_id) ]]</para>
</td>
</tr>
</blockTable>
<para style="terp_default_1">
<font color="white"> </font>
</para>
</section>
<para style="terp_default_8">
<font color="white"> </font>
</para>
<blockTable colWidths="257.0,255.0" style="Table8">
<tr>
<td>
<para style="terp_tblheader_Details">Summary</para>
</td>
<td>
<para style="terp_default_9">
<font color="white"> </font>
</para>
</td>
</tr>
</blockTable>
<blockTable colWidths="257.0,254.0" style="Table7">
<tr>
<td>
<para style="terp_default_Bold_9">Sales total</para>
</td>
<td>
<para style="terp_default_Right_9_Bold">[[ '%d' % getsalestotal(objects) ]]</para>
</td>
</tr>
<tr>
<td>
<para style="terp_default_Bold_9">Qty of product</para>
</td>
<td>
<para style="terp_default_Right_9_Bold">[[ '%d' % getqtytotal(objects) ]]</para>
</td>
</tr>
<tr>
<td>
<para style="terp_default_Bold_9">Total invoiced</para>
</td>
<td>
<para style="terp_default_Right_9_Bold">[[ formatLang(getsuminvoice(objects), currency_obj=company.currency_id) ]]</para>
</td>
</tr>
<tr>
<td>
<para style="terp_default_Bold_9">Total discount</para>
</td>
<td>
<para style="terp_default_Right_9_Bold">[[ formatLang(getsumdisc(objects), currency_obj=company.currency_id) ]]</para>
</td>
</tr>
<tr>
<td>
<para style="terp_default_Bold_9">Total paid</para>
</td>
<td>
<para style="terp_default_Right_9_Bold">[[ formatLang(getpaidtotal(objects), currency_obj=company.currency_id) ]]</para>
</td>
</tr>
<tr>
<td>
<para style="terp_default_Bold_9">Total of the day</para>
</td>
<td>
<para style="terp_default_Right_9_Bold">[[ formatLang(gettotalofthaday(objects), currency_obj=company.currency_id) ]]</para>
</td>
</tr>
</blockTable>
<para style="terp_default_8">
<font color="white"> </font>
</para>
</story>
</document>

View File

@ -2,7 +2,7 @@
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
# Copyright (C) 2014-Today OpenERP SA (<http://www.openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
@ -19,40 +19,36 @@
#
##############################################################################
import time
from openerp.report import report_sxw
from openerp.osv import osv
from openerp.tools.translate import _
class pos_invoice(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(pos_invoice, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
})
class PosInvoiceReport(osv.AbstractModel):
_name = 'report.point_of_sale.report_invoice'
def set_context(self, objects, data, ids, report_type=None):
super(pos_invoice, self).set_context(objects, data, ids, report_type)
iids = []
nids = []
def render_html(self, cr, uid, ids, data=None, context=None):
if context is None:
context = {}
for order in objects:
order.write({'nb_print': order.nb_print + 1})
report_obj = self.pool['report']
report = report_obj._get_report_from_name(cr, uid, 'account.report_invoice')
selected_posorders = self.pool['pos.order'].browse(cr, uid, ids, context=context)
if order.invoice_id and order.invoice_id not in iids:
if not order.invoice_id:
raise osv.except_osv(_('Error!'), _('Please create an invoice for this sale.'))
iids.append(order.invoice_id)
nids.append(order.invoice_id.id)
data['ids'] = nids
self.datas = data
self.ids = nids
self.objects = iids
self.localcontext['data'] = data
self.localcontext['objects'] = iids
invoiced_posorders = []
invoiced_posorders_ids = []
for order in selected_posorders:
if order.invoice_id:
invoiced_posorders.append(order)
invoiced_posorders_ids.append(order.id)
report_sxw.report_sxw('report.pos.invoice', 'pos.order', 'addons/account/report/account_print_invoice.rml', parser= pos_invoice)
if not invoiced_posorders:
raise osv.except_osv(_('Error!'), _('Please create an invoice for this sale.'))
docargs = {
'doc_ids': invoiced_posorders_ids,
'doc_model': report.model,
'docs': invoiced_posorders,
}
return report_obj.render(cr, uid, invoiced_posorders_ids, 'account.report_invoice', docargs, context=context)
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -20,8 +20,10 @@
##############################################################################
import time
from openerp.osv import osv
from openerp.report import report_sxw
class pos_lines(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
@ -50,6 +52,11 @@ class pos_lines(report_sxw.rml_parse):
res=self.cr.fetchone()[0]
return res
report_sxw.report_sxw('report.pos.lines', 'pos.order', 'addons/point_of_sale/report/pos_lines.rml', parser=pos_lines,header='internal')
class report_pos_lines(osv.AbstractModel):
_name = 'report.point_of_sale.report_saleslines'
_inherit = 'report.abstract_report'
_template = 'point_of_sale.report_saleslines'
_wrapped_report_class = pos_lines
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,239 +0,0 @@
<?xml version="1.0"?>
<document filename="Sale Lines.pdf">
<template title="Sale Lines" 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>
</template>
<stylesheet>
<blockTableStyle id="Standard_Outline">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Table3">
<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="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"/>
</blockTableStyle>
<blockTableStyle id="Table4">
<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="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"/>
</blockTableStyle>
<blockTableStyle id="Tableau6">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="3,-1" stop="3,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="4,-1" stop="4,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="5,-1" stop="5,-1"/>
</blockTableStyle>
<blockTableStyle id="Tableau7">
<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"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="4,-1" stop="4,-1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="5,-1" stop="5,-1"/>
</blockTableStyle>
<blockTableStyle id="Table1">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEABOVE" colorName="#ffffff" start="0,0" stop="0,0"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="1,0" stop="1,0"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="2,0" stop="2,0"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="1,2" stop="1,2"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="2,2" stop="2,2"/>
</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="Heading" fontName="Helvetica" fontSize="14.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="List" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Table Contents" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Table Heading" fontName="Helvetica" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Caption" fontName="Helvetica-Oblique" fontSize="12.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="Index" fontName="Helvetica"/>
<paraStyle name="terp_header" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.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_default_Bold_9" fontName="Helvetica-Bold" fontSize="9.0" leading="11" 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_tblheader_General" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.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_default_Centre_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_tblheader_Details" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="Footer" fontName="Helvetica"/>
<paraStyle name="Horizontal Line" fontName="Helvetica" fontSize="6.0" leading="8" spaceBefore="0.0" spaceAfter="14.0"/>
<paraStyle name="Heading 9" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" spaceBefore="12.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_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="15.0" leading="19" 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_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"/>
<paraStyle name="terp_default_8_Italic" fontName="Helvetica-Oblique" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="Heading 3" fontName="Helvetica-Bold" fontSize="14.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/>
<images/>
</stylesheet>
<story>
<para style="terp_default_8">[[repeatIn(objects,'o')]]</para>
<para style="terp_default_8">[[ setLang(o.partner_id.lang) ]]</para>
<para style="terp_header_Centre">Sales lines</para>
<para style="terp_default_8">
<font color="white"> </font>
</para>
<blockTable colWidths="171.0,170.0,170.0" style="Table3">
<tr>
<td>
<para style="terp_tblheader_General_Centre">Company</para>
</td>
<td>
<para style="terp_tblheader_General_Centre">Print Date</para>
</td>
<td>
<para style="terp_tblheader_General_Centre">No. Of Articles</para>
</td>
</tr>
</blockTable>
<blockTable colWidths="170.0,170.0,170.0" style="Table4">
<tr>
<td>
<para style="terp_default_Centre_8">[[ company.name ]]</para>
</td>
<td>
<para style="terp_default_Centre_8">[[ formatLang(time.strftime('%Y-%m-%d'),date = True) ]]</para>
</td>
<td>
<para style="terp_default_Centre_8">[[ formatLang(total_quantity(o)) ]]</para>
</td>
</tr>
</blockTable>
<para style="Standard">
<font color="white"> </font>
</para>
<para style="terp_default_9">
<font color="white"> </font>
</para>
<blockTable colWidths="186.0,71.0,71.0,57.0,57.0,71.0" style="Tableau6">
<tr>
<td>
<para style="terp_tblheader_Details">Description</para>
</td>
<td>
<para style="terp_tblheader_Details_Centre">Tax</para>
</td>
<td>
<para style="terp_tblheader_Details_Right">Quantity</para>
</td>
<td>
<para style="terp_tblheader_Details_Right">Unit Price</para>
</td>
<td>
<para style="terp_tblheader_Details_Centre">Disc. (%)</para>
</td>
<td>
<para style="terp_tblheader_Details_Right">Price</para>
</td>
</tr>
</blockTable>
<section>
<para style="terp_default_1">[[repeatIn(o.lines,'l')]]</para>
<blockTable colWidths="186.0,71.0,71.0,57.0,57.0,71.0" style="Tableau7">
<tr>
<td>
<para style="terp_default_9">[ [[l.product_id.code]] ] [[l.product_id.name]]</para>
</td>
<td>
<para style="terp_default_Centre_9">[[taxes(l)]]</para>
</td>
<td>
<para style="terp_default_Right_9">[[ formatLang(l.qty) ]] [[l.product_id.uom_id.name]]</para>
</td>
<td>
<para style="terp_default_Right_9">[[ formatLang(l.price_unit) ]] </para>
</td>
<td>
<para style="terp_default_Centre_9">[[ formatLang(l.discount) ]]</para>
</td>
<td>
<para style="terp_default_Right_9">[[ formatLang(l.price_subtotal, currency_obj=o.pricelist_id.currency_id) ]]</para>
</td>
</tr>
</blockTable>
</section>
<blockTable colWidths="356.0,71.0,85.0" style="Table1">
<tr>
<td>
<para style="terp_default_9">
<font color="white"> </font>
</para>
</td>
<td>
<para style="terp_default_9">Net Total :</para>
</td>
<td>
<para style="terp_default_Right_9">[[ formatLang(o.amount_total, currency_obj=o.pricelist_id.currency_id) ]]</para>
</td>
</tr>
<tr>
<td>
<para style="terp_default_9">
<font color="white"> </font>
</para>
</td>
<td>
<para style="terp_default_9">Taxes :</para>
</td>
<td>
<para style="terp_default_Right_9">[[ formatLang(o.amount_tax, currency_obj=o.pricelist_id.currency_id) ]]</para>
</td>
</tr>
<tr>
<td>
<para style="terp_default_9">
<font color="white"> </font>
</para>
</td>
<td>
<para style="terp_default_Bold_9">Total:</para>
</td>
<td>
<para style="terp_default_Right_9_Bold">[[ formatLang(o.amount_total + o.amount_tax, currency_obj=o.pricelist_id.currency_id) ]]</para>
</td>
</tr>
</blockTable>
<para style="terp_default_9">
<font color="white"> </font>
</para>
</story>
</document>

View File

@ -20,8 +20,10 @@
##############################################################################
import time
from openerp.osv import osv
from openerp.report import report_sxw
class pos_payment_report(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
@ -59,6 +61,11 @@ class pos_payment_report(report_sxw.rml_parse):
def _pos_payment_total(self, o):
return self.total
report_sxw.report_sxw('report.pos.payment.report', 'pos.order', 'addons/point_of_sale/report/pos_payment_report.rml', parser=pos_payment_report,header='internal')
class report_pos_payment(osv.AbstractModel):
_name = 'report.point_of_sale.report_payment'
_inherit = 'report.abstract_report'
_template = 'point_of_sale.report_payment'
_wrapped_report_class = pos_payment_report
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,209 +0,0 @@
<?xml version="1.0"?>
<document filename="test.pdf">
<template title="Payment" author="OpenERP S.A. (sales@openerp.com)" allowSplitting="20">
<pageTemplate id="first">
<frame id="first" x1="2.0" y1="57.0" width="537" height="728"/>
</pageTemplate>
</template>
<stylesheet>
<blockTableStyle id="Standard_Outline">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Table3">
<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="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"/>
</blockTableStyle>
<blockTableStyle id="Table4">
<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="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"/>
</blockTableStyle>
<blockTableStyle id="Tableau6">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="3,-1" stop="3,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="4,-1" stop="4,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="5,-1" stop="5,-1"/>
</blockTableStyle>
<blockTableStyle id="Tableau7">
<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"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="4,-1" stop="4,-1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="5,-1" stop="5,-1"/>
</blockTableStyle>
<blockTableStyle id="Table1">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEABOVE" colorName="#ffffff" start="0,0" stop="0,0"/>
<lineStyle kind="LINEABOVE" colorName="#ffffff" start="1,0" stop="1,0"/>
<lineStyle kind="LINEABOVE" colorName="#ffffff" start="2,0" stop="2,0"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="1,0" stop="-1,-1"/>
</blockTableStyle>
<initialize>
<paraStyle name="all" alignment="justify"/>
</initialize>
<paraStyle name="Standard" fontName="Times-Roman"/>
<paraStyle name="Text body" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Heading" fontName="Helvetica" fontSize="14.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="List" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Table Contents" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Table Heading" fontName="Times-Roman" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Caption" fontName="Times-Italic" fontSize="12.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="Index" fontName="Times-Roman"/>
<paraStyle name="terp_header" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="terp_header_center" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.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_default_Bold_9" fontName="Helvetica-Bold" fontSize="9.0" leading="11" 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_tblheader_General" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.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_default_Centre_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_tblheader_Details" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="Footer" fontName="Times-Roman"/>
<paraStyle name="Horizontal Line" fontName="Times-Roman" fontSize="6.0" leading="8" spaceBefore="0.0" spaceAfter="14.0"/>
<paraStyle name="Heading 9" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" spaceBefore="12.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_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="15.0" leading="19" 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_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"/>
<paraStyle name="terp_default_8_Italic" fontName="Helvetica-Oblique" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="Heading 3" fontName="Helvetica-Bold" fontSize="14.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/>
</stylesheet>
<images/>
<story>
<para style="terp_default_9">
<font color="white"> </font>
</para>
<para style="terp_default_9">
<font color="white"> </font>
</para>
<para style="terp_header_center">Payment For Sale</para>
<para style="terp_default_9">
<font color="white"> </font>
</para>
<para style="terp_default_9">
<font color="white"> </font>
</para>
<blockTable colWidths="268.0,268.0" style="Table3">
<tr>
<td>
<para style="terp_tblheader_General_Centre">Company</para>
</td>
<td>
<para style="terp_tblheader_General_Centre">Print Date</para>
</td>
</tr>
</blockTable>
<blockTable colWidths="268.0,268.0" style="Table4">
<tr>
<td>
<para style="terp_default_Centre_8">[[ company.name ]]</para>
</td>
<td>
<para style="terp_default_Centre_8">[[ formatLang(time.strftime('%Y-%m-%d'),date = True) ]]</para>
</td>
</tr>
</blockTable>
<para style="Standard">
<font color="white"> </font>
</para>
<para style="terp_default_9">
<font color="white"> </font>
</para>
<blockTable colWidths="257.0,71.0,57.0,57.0,71.0" style="Tableau6">
<tr>
<td>
<para style="terp_tblheader_Details">Product</para>
</td>
<td>
<para style="terp_tblheader_Details_Centre">Qty</para>
</td>
<td>
<para style="terp_tblheader_Details_Centre">Disc.(%)</para>
</td>
<td>
<para style="terp_tblheader_Details_Right">Unit Price</para>
</td>
<td>
<para style="terp_tblheader_Details_Right">Total</para>
</td>
</tr>
</blockTable>
<section>
<para style="terp_default_8">[[ repeatIn(objects,'o') ]]</para>
<section>
<para style="terp_default_8">[[ repeatIn(pos_payment(o), 'line_ids') ]]</para>
<blockTable colWidths="257.0,71.0,57.0,57.0,71.0" style="Tableau7">
<tr>
<td>
<para style="terp_default_9">[ [[ line_ids['code'] ]] ] [[ line_ids['name'] ]]</para>
</td>
<td>
<para style="terp_default_Right_9">[[ formatLang(line_ids['qty']) ]] [[line_ids['uom'] ]]</para>
</td>
<td>
<para style="terp_default_Right_9">[[ formatLang(line_ids['discount']) ]]</para>
</td>
<td>
<para style="terp_default_Right_9">[[ formatLang(line_ids['price_unit']) ]]</para>
</td>
<td>
<para style="terp_default_Right_9">[[ formatLang(line_ids['total'], currency_obj = company.currency_id) ]]</para>
</td>
</tr>
</blockTable>
</section>
</section>
<blockTable colWidths="356.0,71.0,85.0" style="Table1">
<tr>
<td>
<para style="terp_default_9">
<font color="white"> </font>
</para>
</td>
<td>
<para style="terp_tblheader_Details">Net Total:</para>
</td>
<td>
<para style="terp_default_Right_9_Bold">[[ formatLang(pos_payment_total(o), currency_obj = company.currency_id) or removeParentNode('blockTable')]]</para>
</td>
</tr>
</blockTable>
</story>
</document>

View File

@ -1,64 +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 pos_payment_report_user(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(pos_payment_report_user, self).__init__(cr, uid, name, context=context)
self.total = 0.0
self.localcontext.update({
'time': time,
'pos_payment_user': self.__pos_payment_user__,
'pos_payment_user_total':self.__pos_payment_user__total__,
})
def __pos_payment_user__(self, form):
data={}
ids = form['user_id']
sql = "select pt.name,pp.default_code as code,pol.qty,pu.name as uom,pol.discount,pol.price_unit, " \
"(pol.price_unit * pol.qty * (1 - (pol.discount) / 100.0)) as total " \
"from pos_order as po,pos_order_line as pol,product_product as pp,product_template as pt,product_uom as pu " \
"where pt.id=pp.product_tmpl_id and pp.id=pol.product_id and po.id = pol.order_id and pu.id=pt.uom_id " \
"and po.state in ('paid','invoiced') and to_char(date_trunc('day',po.date_order),'YYYY-MM-DD')::date = current_date " \
"and po.user_id IN %s"
self.cr.execute (sql, (tuple(ids), ))
data=self.cr.dictfetchall()
return data
def __pos_payment_user__total__(self, form):
res=[]
ids = form['user_id']
self.cr.execute ("select sum(pol.price_unit * pol.qty * (1 - (pol.discount) / 100.0)) " \
"from pos_order as po,pos_order_line as pol,product_product as pp,product_template as pt " \
"where pt.id=pp.product_tmpl_id and pp.id=pol.product_id and po.id = pol.order_id " \
"and po.state='paid' and to_char(date_trunc('day',po.date_order),'YYYY-MM-DD')::date = current_date " \
"and po.user_id IN %s",(tuple(ids),))
res=self.cr.fetchone()
res = res and res[0] or 0.0
return res
report_sxw.report_sxw('report.pos.payment.report.user', 'pos.order', 'addons/point_of_sale/report/pos_payment_report_user.rml', parser=pos_payment_report_user,header='internal')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,205 +0,0 @@
<?xml version="1.0"?>
<document filename="test.pdf">
<template title="Payment 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>
</template>
<stylesheet>
<blockTableStyle id="Standard_Outline">
<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="LINEAFTER" 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"/>
</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="LINEAFTER" 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"/>
</blockTableStyle>
<blockTableStyle id="Table3">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="3,-1" stop="3,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="4,-1" stop="4,-1"/>
</blockTableStyle>
<blockTableStyle id="Table6">
<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"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="4,-1" stop="4,-1"/>
</blockTableStyle>
<blockTableStyle id="Table5">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="3,0" stop="3,0"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="4,0" stop="4,0"/>
</blockTableStyle>
<initialize>
<paraStyle name="all" alignment="justify"/>
</initialize>
<paraStyle name="P1" fontName="Helvetica-Bold" fontSize="16.0" leading="20" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="Standard" fontName="Helvetica"/>
<paraStyle name="Heading" fontName="Helvetica" fontSize="14.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="Text body" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="List" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Caption" fontName="Helvetica" fontSize="12.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="Index" fontName="Helvetica"/>
<paraStyle name="Table Contents" fontName="Helvetica"/>
<paraStyle name="Table Heading" fontName="Helvetica" alignment="CENTER"/>
<paraStyle name="terp_header" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.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_default_Bold_9" fontName="Helvetica-Bold" fontSize="9.0" leading="11" 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_tblheader_General" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.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_default_Centre_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_tblheader_Details" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="Footer" fontName="Helvetica"/>
<paraStyle name="Horizontal Line" fontName="Helvetica" fontSize="6.0" leading="8" spaceBefore="0.0" spaceAfter="14.0"/>
<paraStyle name="Heading 9" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" spaceBefore="12.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_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="15.0" leading="19" 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_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"/>
<paraStyle name="terp_default_8_Italic" fontName="Helvetica-Oblique" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<images/>
</stylesheet>
<story>
<para style="terp_default_8">[[ repeatIn(objects,'order') ]]</para>
<para style="terp_default_8">
<font color="white"> </font>
</para>
<para style="Standard">
<font color="white"> </font>
</para>
<para style="P1">Payment By User </para>
<para style="P1">
<font color="white"> </font>
</para>
<blockTable colWidths="241.0,241.0" style="Table1">
<tr>
<td>
<para style="terp_tblheader_General_Centre">Company</para>
</td>
<td>
<para style="terp_tblheader_General_Centre">Print Date</para>
</td>
</tr>
</blockTable>
<blockTable colWidths="241.0,241.0" style="Table2">
<tr>
<td>
<para style="terp_default_Centre_8">[[ company.name ]]</para>
</td>
<td>
<para style="terp_default_Centre_8">[[ formatLang(time.strftime('%Y-%m-%d'),date = True) ]]</para>
</td>
</tr>
</blockTable>
<para style="Standard">
<font color="white"> </font>
</para>
<para style="Standard">
<font color="white"> </font>
</para>
<blockTable colWidths="241.0,55.0,61.0,61.0,64.0" style="Table3">
<tr>
<td>
<para style="terp_tblheader_Details">Product</para>
</td>
<td>
<para style="terp_tblheader_General_Right">Qty</para>
</td>
<td>
<para style="terp_tblheader_General_Right">Disc(%)</para>
</td>
<td>
<para style="terp_tblheader_General_Right">Unit Price</para>
</td>
<td>
<para style="terp_tblheader_General_Right">Total</para>
</td>
</tr>
</blockTable>
<section>
<para style="terp_default_1">[[ repeatIn(pos_payment_user(data['form']), 'line_ids') ]]</para>
<blockTable colWidths="241.0,55.0,61.0,61.0,64.0" style="Table6">
<tr>
<td>
<para style="terp_default_9">[ [[ line_ids['code'] ]] ] [[ line_ids['name'] ]]</para>
</td>
<td>
<para style="terp_default_Right_9">[[ formatLang(line_ids['qty']) ]] [[line_ids['uom'] ]]</para>
</td>
<td>
<para style="terp_default_Right_9">[[ formatLang(line_ids['discount']) ]]</para>
</td>
<td>
<para style="terp_default_Right_9">[[ formatLang(line_ids['price_unit']) ]]</para>
</td>
<td>
<para style="terp_default_Right_9">[[ formatLang(line_ids['total'], currency_obj = company.currency_id)]]</para>
</td>
</tr>
</blockTable>
</section>
<blockTable colWidths="241.0,56.0,61.0,61.0,64.0" style="Table5">
<tr>
<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="terp_tblheader_General_Right">Total:</para>
</td>
<td>
<para style="terp_default_Right_9">[[ formatLang(pos_payment_user_total(data['form']), currency_obj = company.currency_id) or removeParentNode('blockTable')]]</para>
</td>
</tr>
</blockTable>
<para style="Standard">
<font color="white"> </font>
</para>
</story>
</document>

View File

@ -20,14 +20,17 @@
##############################################################################
import time
from openerp.osv import osv
from openerp.report import report_sxw
def titlize(journal_name):
words = journal_name.split()
while words.pop() != 'journal':
continue
return ' '.join(words)
class order(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
@ -71,6 +74,11 @@ class order(report_sxw.rml_parse):
data = self.cr.dictfetchall()
return data
report_sxw.report_sxw('report.pos.receipt', 'pos.order', 'addons/point_of_sale/report/pos_receipt.rml', parser=order, header=False)
class report_order_receipt(osv.AbstractModel):
_name = 'report.point_of_sale.report_receipt'
_inherit = 'report.abstract_report'
_template = 'point_of_sale.report_receipt'
_wrapped_report_class = order
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,171 +0,0 @@
<?xml version="1.0"?>
<document filename="test.pdf">
<template pageSize="(204.0,842.0)" title="Receipt" author="OpenERP S.A. (sales@openerp.com)" allowSplitting="20">
<pageTemplate id="first">
<frame id="first" x1="0.0" y1="0.0" width="204" height="800"/>
</pageTemplate>
</template>
<stylesheet>
<blockTableStyle id="Standard_Outline">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Table3">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="0,1" stop="0,1"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="1,1" stop="1,1"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="2,1" stop="2,1"/>
</blockTableStyle>
<blockTableStyle id="Table2">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="1,0" stop="1,0"/>
</blockTableStyle>
<blockTableStyle id="Table4">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Table10">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="0,1" stop="0,1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="1,1" stop="1,1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="2,1" stop="2,1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/>
</blockTableStyle>
<initialize>
<paraStyle name="all" alignment="justify"/>
</initialize>
<paraStyle name="P1" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT"/>
<paraStyle name="P2" fontName="Helvetica" fontSize="8.0" leading="10"/>
<paraStyle name="P3" fontName="Helvetica" fontSize="7.0" leading="9" alignment="LEFT"/>
<paraStyle name="P8" fontName="Helvetica" fontSize="9.0" leading="11" alignment="RIGHT"/>
<paraStyle name="Standard" fontName="Helvetica"/>
<paraStyle name="Text body" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Heading" fontName="Helvetica" fontSize="14.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="List" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Table Contents" fontName="Helvetica"/>
<paraStyle name="Table Heading" fontName="Helvetica" alignment="CENTER"/>
<paraStyle name="Caption" fontName="Helvetica" fontSize="12.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="Index" fontName="Helvetica"/>
<paraStyle name="Frame contents" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="terp_default_Centre_9" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="9.0" leading="11" alignment="CENTER"/>
<paraStyle name="terp_default_8" rightIndent="0.0" leftIndent="0.0" fontName="Courier" fontSize="10.0" leading="13" alignment="LEFT"/>
<paraStyle name="terp_header_Centre" fontName="Courier-Bold" fontSize="12.0" leading="15" alignment="CENTER"/>
<paraStyle name="terp_default_9b" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT"/>
<paraStyle name="terp_default_Right_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="RIGHT"/>
<paraStyle name="terp_default_Bold_9_Right1" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT"/>
<paraStyle name="terp_default_Bold_9_Right2" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT"/>
<paraStyle name="P4" fontName="Courier-Bold" fontSize="10.0" leading="13" alignment="CENTER"/>
<paraStyle name="P5" fontName="Courier-Bold" fontSize="10.0" leading="13" alignment="LEFT"/>
<paraStyle name="P7" fontName="Courier-Bold" fontSize="10.0" leading="13" alignment="RIGHT"/>
<paraStyle name="P6a" fontName="Helvetica" fontSize="10.0" leading="13" alignment="RIGHT"/>
<paraStyle name="P7a" fontName="Courier" fontSize="10.0" leading="13" alignment="RIGHT"/>
<paraStyle name="P6" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica-Bold" fontSize="10.0" leading="13" alignment="RIGHT"/>
<paraStyle name="P13" fontName="Courier-Bold" fontSize="10.0" leading="13" alignment="RIGHT"/>
<paraStyle name="Table" fontName="Helvetica" fontSize="12.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/>
<images/>
</stylesheet>
<story>
<para style="terp_default_8">[[ repeatIn(objects,'o') ]]</para>
<para style="terp_header_Centre">[[o.user_id.company_id.name]]</para>
<para style="terp_default_Centre_9">[[ address and display_address(address)]]</para>
<para style="terp_default_Centre_9">Tel : [[ address and address.phone ]]</para>
<para style="terp_default_Centre_9">User : [[ o.user_id.name ]]</para>
<para style="terp_default_Centre_9">Warehouse : [[ o.warehouse_id.name ]]</para>
<para style="terp_default_Centre_9">Date : [[ o.date_order ]]</para>
<para style="P4">
<font color="white"> </font>
</para>
<para style="P4">
<font color="white"> </font>
</para>
<para style="P4">
<font color="white"> </font>
</para>
<para style="P4">N° : [[ o.name ]]</para>
<blockTable colWidths="68.0,68.0,68.0" style="Table3">
<tr>
<td>
<para style="P5">Description</para>
</td>
<td>
<para style="P7">Qty</para>
</td>
<td>
<para style="P7">Price</para>
</td>
</tr>
<tr>
<td>
<para style="P1">[[ repeatIn(o.lines,'line') ]]</para>
<para style="terp_default_9b">[[ line.product_id.name ]]</para>
<para style="terp_default_Right_9">
<font face="Helvetica">With a [[ line and line.discount == 0.0 and removeParentNode('font') ]] ([[ '%.2f' % line.discount ]]) % discount.</font>
</para>
<para style="terp_default_9b">
<font color="white"> </font>
</para>
</td>
<td>
<para style="terp_default_Right_9">[[o.state=='cancel' and o.statement_ids and '-' or '']][['%.f' % line.qty ]]</para>
</td>
<td>
<para style="terp_default_Right_9">[[o.state=='cancel' and o.statement_ids and '-' or '']][[ formatLang(net(line.id), currency_obj=company.currency_id) ]] <font face="Helvetica">[[ line and line.discount == 0.0 and removeParentNode('font') ]] ([[ formatLang(line.discount, currency_obj=company.currency_id) ]])</font></para>
</td>
</tr>
</blockTable>
<blockTable colWidths="136.0,68.0" style="Table2">
<tr>
<td>
<para style="P6a">Taxes :</para>
</td>
<td>
<para style="terp_default_Right_9">[[o.state=='cancel' and o.statement_ids and '-' or '']][[formatLang(o.amount_tax, currency_obj=company.currency_id)]]</para>
</td>
</tr>
</blockTable>
<blockTable colWidths="136.0,68.0" style="Table4">
<tr>
<td>
<para style="P6">Total :</para>
</td>
<td>
<para style="terp_default_Bold_9_Right2">[[o.state=='cancel' and o.statement_ids and '-' or '']][[formatLang(o.amount_total, currency_obj=company.currency_id)]]</para>
</td>
</tr>
</blockTable>
<blockTable colWidths="102.0,34.0,68.0" style="Table10">
<tr>
<td>
<para style="P5">Payment Mode</para>
</td>
<td>
<para style="P1">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P13">Amount</para>
</td>
</tr>
<tr>
<td>
<para style="P1">[[ repeatIn(get_journal_amt(o),'d') ]]</para>
<para style="P2">[[ d['name'] ]]</para>
</td>
<td>
<para style="P1">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P8">[[ formatLang(d['amt'] or 0, currency_obj=company.currency_id) ]]</para>
</td>
</tr>
</blockTable>
</story>
</document>

View File

@ -1,50 +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 pos_sales_user(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(pos_sales_user, self).__init__(cr, uid, name, context=context)
self.total = 0.0
self.localcontext.update({
'time': time,
'get_data':self._get_data,
})
def _get_data(self, form):
dt1 = form['date_start'] + ' 00:00:00'
dt2 = form['date_end'] + ' 23:59:59'
data={}
self.cr.execute("select po.name as pos,po.date_order,rp.name as user,po.state,rc.name " \
"from pos_order as po,res_users as ru,res_company as rc, res_partner as rp " \
"where po.date_order >= %s and po.date_order <= %s " \
"and po.company_id=rc.id and po.user_id=ru.id and po.user_id IN %s and ru.partner_id = rp.id" \
,(dt1,dt2,tuple(form['user_id'])))
return self.cr.dictfetchall()
report_sxw.report_sxw('report.pos.sales.user', 'pos.order', 'addons/point_of_sale/report/pos_sales_user.rml', parser=pos_sales_user,header='internal')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,175 +0,0 @@
<?xml version="1.0"?>
<document filename="test.pdf">
<template title="Sales Report" 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>
</template>
<stylesheet>
<blockTableStyle id="Standard_Outline">
<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="LINEAFTER" 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"/>
</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="LINEAFTER" 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"/>
</blockTableStyle>
<blockTableStyle id="Table3">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="3,-1" stop="3,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="4,-1" stop="4,-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"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="4,-1" stop="4,-1"/>
</blockTableStyle>
<initialize>
<paraStyle name="all" alignment="justify"/>
</initialize>
<paraStyle name="P1" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="P2" fontName="Helvetica-Bold" fontSize="16.0" leading="20" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="Standard" fontName="Helvetica"/>
<paraStyle name="Heading" fontName="Helvetica" fontSize="14.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="Text body" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="List" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Caption" fontName="Helvetica" fontSize="12.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="Index" fontName="Helvetica"/>
<paraStyle name="Table Contents" fontName="Helvetica"/>
<paraStyle name="Table Heading" fontName="Helvetica" alignment="CENTER"/>
<paraStyle name="terp_header" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.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_default_Bold_9" fontName="Helvetica-Bold" fontSize="9.0" leading="11" 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_tblheader_General" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.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_default_Centre_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_tblheader_Details" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="Footer" fontName="Helvetica"/>
<paraStyle name="Horizontal Line" fontName="Helvetica" fontSize="6.0" leading="8" spaceBefore="0.0" spaceAfter="14.0"/>
<paraStyle name="Heading 9" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" spaceBefore="12.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_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="15.0" leading="19" 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_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"/>
<paraStyle name="terp_default_8_Italic" fontName="Helvetica-Oblique" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<images/>
</stylesheet>
<story>
<para style="terp_default_8">[[ repeatIn(objects,'order') ]]</para>
<para style="terp_default_8">
<font color="white"> </font>
</para>
<para style="Standard">
<font color="white"> </font>
</para>
<para style="P2">Sales Report</para>
<para style="P2">
<font color="white"> </font>
</para>
<blockTable colWidths="256.0,256.0" style="Table1">
<tr>
<td>
<para style="terp_tblheader_General_Centre">Company</para>
</td>
<td>
<para style="terp_tblheader_General_Centre">Print Date</para>
</td>
</tr>
</blockTable>
<blockTable colWidths="256.0,256.0" style="Table2">
<tr>
<td>
<para style="terp_default_Centre_8">[[ company.name ]]</para>
</td>
<td>
<para style="terp_default_Centre_8">[[ formatLang(time.strftime('%Y-%m-%d'),date = True) ]]</para>
</td>
</tr>
</blockTable>
<para style="Standard">
<font color="white"> </font>
</para>
<para style="Standard">
<font color="white"> </font>
</para>
<blockTable colWidths="150.0,118.0,97.0,64.0,82.0" style="Table3">
<tr>
<td>
<para style="terp_tblheader_Details">Name</para>
</td>
<td>
<para style="terp_tblheader_Details_Centre">Date Order</para>
</td>
<td>
<para style="P1">User</para>
</td>
<td>
<para style="terp_tblheader_General_Right">Status</para>
</td>
<td>
<para style="terp_tblheader_Details_Centre">Company</para>
</td>
</tr>
</blockTable>
<section>
<para style="terp_default_1">[[ repeatIn(get_data(data['form']), 'line_ids')]]</para>
<blockTable colWidths="150.0,118.0,97.0,64.0,82.0" style="Table4">
<tr>
<td>
<para style="terp_default_8">[[ line_ids['pos'] ]]</para>
</td>
<td>
<para style="terp_default_Right_9">[[ formatLang(line_ids['date_order'],date_time = True) ]]</para>
</td>
<td>
<para style="terp_default_Right_9">[[ line_ids['user'] ]]</para>
</td>
<td>
<para style="terp_default_Right_9">[[ line_ids['state'] ]]</para>
</td>
<td>
<para style="terp_default_Right_9">[[ line_ids['name'] ]]</para>
</td>
</tr>
</blockTable>
<para style="terp_default_1">
<font color="white"> </font>
</para>
</section>
</story>
</document>

View File

@ -1,50 +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 pos_sales_user_today(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(pos_sales_user_today, self).__init__(cr, uid, name, context=context)
self.total = 0.0
self.localcontext.update({
'time': time,
'get_data':self._get_data,
})
def _get_data(self, form):
data={}
ids = form['user_id']
self.cr.execute("select po.name as pos,po.date_order,ru.name as user,po.state,rc.name " \
"from pos_order as po,res_users as ru,res_company as rc " \
"where to_char(date_trunc('day',po.date_order),'YYYY-MM-DD')::date = current_date " \
"and po.company_id=rc.id and po.user_id=ru.id and po.user_id IN %s", (tuple(ids), ))
data = self.cr.dictfetchall()
return data
report_sxw.report_sxw('report.pos.sales.user.today', 'pos.order', 'addons/point_of_sale/report/pos_sales_user_today.rml', parser=pos_sales_user_today,header='internal')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,175 +0,0 @@
<?xml version="1.0"?>
<document filename="test.pdf">
<template title="Todays Sales By User" 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>
</template>
<stylesheet>
<blockTableStyle id="Standard_Outline">
<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="LINEAFTER" 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"/>
</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="LINEAFTER" 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"/>
</blockTableStyle>
<blockTableStyle id="Table3">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="3,-1" stop="3,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="4,-1" stop="4,-1"/>
</blockTableStyle>
<blockTableStyle id="Table5">
<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"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="4,-1" stop="4,-1"/>
</blockTableStyle>
<initialize>
<paraStyle name="all" alignment="justify"/>
</initialize>
<paraStyle name="P1" fontName="Helvetica-Bold" fontSize="16.0" leading="20" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P2" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="Standard" fontName="Helvetica"/>
<paraStyle name="Heading" fontName="Helvetica" fontSize="14.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="Text body" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="List" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Caption" fontName="Helvetica" fontSize="12.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="Index" fontName="Helvetica"/>
<paraStyle name="Table Contents" fontName="Helvetica"/>
<paraStyle name="Table Heading" fontName="Helvetica" alignment="CENTER"/>
<paraStyle name="terp_header" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.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_default_Bold_9" fontName="Helvetica-Bold" fontSize="9.0" leading="11" 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_tblheader_General" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.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_default_Centre_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_tblheader_Details" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="Footer" fontName="Helvetica"/>
<paraStyle name="Horizontal Line" fontName="Helvetica" fontSize="6.0" leading="8" spaceBefore="0.0" spaceAfter="14.0"/>
<paraStyle name="Heading 9" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" spaceBefore="12.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_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="15.0" leading="19" 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_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"/>
<paraStyle name="terp_default_8_Italic" fontName="Helvetica-Oblique" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<images/>
</stylesheet>
<story>
<para style="terp_default_8">[[ repeatIn(objects,'order') ]]</para>
<para style="terp_default_8">
<font color="white"> </font>
</para>
<para style="Standard">
<font color="white"> </font>
</para>
<para style="P1">Today's Sales By User</para>
<para style="P1">
<font color="white"> </font>
</para>
<blockTable colWidths="256.0,256.0" style="Table1">
<tr>
<td>
<para style="terp_tblheader_General_Centre">Company</para>
</td>
<td>
<para style="terp_tblheader_General_Centre">Print Date</para>
</td>
</tr>
</blockTable>
<blockTable colWidths="256.0,256.0" style="Table2">
<tr>
<td>
<para style="terp_default_Centre_8">[[ company.name ]]</para>
</td>
<td>
<para style="terp_default_Centre_8">[[ formatLang(time.strftime('%Y-%m-%d'),date = True) ]]</para>
</td>
</tr>
</blockTable>
<para style="Standard">
<font color="white"> </font>
</para>
<para style="Standard">
<font color="white"> </font>
</para>
<blockTable colWidths="150.0,118.0,97.0,64.0,82.0" style="Table3">
<tr>
<td>
<para style="terp_tblheader_Details">Name</para>
</td>
<td>
<para style="terp_tblheader_Details_Centre">Date Order</para>
</td>
<td>
<para style="P2">User</para>
</td>
<td>
<para style="terp_tblheader_General_Right">Status</para>
</td>
<td>
<para style="terp_tblheader_Details_Centre">Company</para>
</td>
</tr>
</blockTable>
<section>
<para style="terp_default_1">[[ repeatIn(get_data(data['form']), 'line_ids')]]</para>
<blockTable colWidths="150.0,118.0,97.0,64.0,83.0" style="Table5">
<tr>
<td>
<para style="terp_default_8">[[ line_ids['pos'] ]]</para>
</td>
<td>
<para style="terp_default_Right_9">[[ formatLang(line_ids['date_order'],date_time = True) ]]</para>
</td>
<td>
<para style="terp_default_Right_9">[[ line_ids['user'] ]]</para>
</td>
<td>
<para style="terp_default_Right_9">[[ line_ids['state'] ]]</para>
</td>
<td>
<para style="terp_default_Right_9">[[ line_ids['name'] ]]</para>
</td>
</tr>
</blockTable>
<para style="terp_default_1">
<font color="white"> </font>
</para>
</section>
</story>
</document>

View File

@ -20,8 +20,10 @@
##############################################################################
import time
from openerp.osv import osv
from openerp.report import report_sxw
class pos_user_product(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
@ -52,17 +54,27 @@ class pos_user_product(report_sxw.rml_parse):
return data
def _get_user(self, object):
names = []
users_obj = self.pool['res.users']
for o in object:
sql = """select ru.name from account_bank_statement as abs,res_users ru
sql = """select ru.id from account_bank_statement as abs,res_users ru
where abs.user_id = ru.id
and abs.id = %d"""%(o.id)
self.cr.execute(sql)
data = self.cr.fetchone()
return data[0]
if data:
user = users_obj.browse(self.cr, self.uid, data[0])
names.append(user.partner_id.name)
return list(set(names))
def _get_total(self, o):
return self.total
report_sxw.report_sxw('report.pos.user.product', 'account.bank.statement', 'addons/statement/report/pos_users_product.rml', parser=pos_user_product,header='internal')
class report_pos_user_product(osv.AbstractModel):
_name = 'report.point_of_sale.report_usersproduct'
_inherit = 'report.abstract_report'
_template = 'point_of_sale.report_usersproduct'
_wrapped_report_class = pos_user_product
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,68 +0,0 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$
#
# 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
# 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import time
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)
self.total = 0.0
self.localcontext.update({
'time': time,
'get_data':self._get_data,
'get_user':self._get_user,
'get_total':self._get_total,
})
def _get_data(self,object):
data={}
for o in object :
sql1=""" SELECT distinct(o.id) from account_bank_statement s, account_bank_statement_line l,pos_order o,pos_order_line i where i.order_id=o.id and o.state in ('paid','invoiced') and l.statement_id=s.id and l.pos_statement_id=o.id and s.id=%d"""%(o.id)
self.cr.execute(sql1)
data = self.cr.dictfetchall()
a_l=[]
for r in data:
if r['id']:
a_l.append(r['id'])
a = ','.join(map(str,a_l))
if len(a_l):
sql2="""SELECT sum(qty) as qty,l.price_unit*sum(l.qty) as amt,t.name as name from product_product p, product_template t, pos_order_line l where order_id in (%s) and p.product_tmpl_id=t.id and l.product_id=p.id group by t.name, l.price_unit"""%(a)
self.cr.execute(sql2)
data = self.cr.dictfetchall()
for d in data:
self.total += d['amt']
return data
def _get_user(self,object):
for o in object :
sql = """select ru.name from account_bank_statement as abs,res_users ru
where abs.user_id = ru.id
and abs.id = %d"""%(o.id)
self.cr.execute(sql)
data = self.cr.fetchone()
return data[0]
def _get_total(self):
return self.total
report_sxw.report_sxw('report.pos.user.product', 'account.bank.statement', 'addons/statement/report/pos_users_product.rml', parser=pos_user_product)

View File

@ -1,219 +0,0 @@
<?xml version="1.0"?>
<document filename="test.pdf">
<template title="User's Product'" author="OpenERP S.A. (sales@openerp.com)" allowSplitting="20">
<pageTemplate id="first">
<frame id="first" x1="36.0" y1="57.0" width="520" 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="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="#000000" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/>
</blockTableStyle>
<blockTableStyle id="Table6">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="2,-1" stop="2,-1"/>
</blockTableStyle>
<blockTableStyle id="Table5">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="1,0" stop="1,0"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="2,0" stop="2,0"/>
</blockTableStyle>
<initialize>
<paraStyle name="all" alignment="justify"/>
</initialize>
<paraStyle name="P1" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT"/>
<paraStyle name="P2" fontName="Helvetica-Bold" fontSize="14.0" leading="17" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="Standard" fontName="Helvetica"/>
<paraStyle name="Heading" fontName="Helvetica" fontSize="14.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="Text body" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="List" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Caption" fontName="Helvetica" fontSize="12.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="Index" fontName="Helvetica"/>
<paraStyle name="Table Contents" fontName="Helvetica"/>
<paraStyle name="Table Heading" fontName="Helvetica" alignment="CENTER"/>
<paraStyle name="terp_header" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.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_default_Bold_9" fontName="Helvetica-Bold" fontSize="9.0" leading="11" 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_tblheader_General" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.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_default_Centre_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_tblheader_Details" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="Footer" fontName="Helvetica"/>
<paraStyle name="Horizontal Line" fontName="Helvetica" fontSize="6.0" leading="8" spaceBefore="0.0" spaceAfter="14.0"/>
<paraStyle name="Heading 9" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" spaceBefore="12.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_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="15.0" leading="19" 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_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"/>
<paraStyle name="terp_default_8_Italic" fontName="Helvetica-Oblique" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<images/>
</stylesheet>
<story>
<para style="terp_default_8">[[ repeatIn(objects,'statement') ]]</para>
<para style="terp_default_8">
<font color="white"> </font>
</para>
<para style="terp_default_8">
<font color="white"> </font>
</para>
<para style="P2">User's Product</para>
<para style="terp_default_8">
<font color="white"> </font>
</para>
<para style="terp_default_8">
<font color="white"> </font>
</para>
<blockTable colWidths="104.0,104.0,104.0,104.0,104.0" style="Table1">
<tr>
<td>
<para style="terp_tblheader_General_Centre">User</para>
</td>
<td>
<para style="terp_tblheader_General_Centre">Company</para>
</td>
<td>
<para style="terp_tblheader_General_Centre">Print Date</para>
</td>
<td>
<para style="terp_tblheader_General_Centre">Starting Date</para>
</td>
<td>
<para style="terp_tblheader_General_Centre">Ending Date</para>
</td>
</tr>
</blockTable>
<blockTable colWidths="104.0,104.0,104.0,104.0,104.0" style="Table2">
<tr>
<td>
<para style="terp_default_Centre_8">[[ get_user(objects) ]]</para>
</td>
<td>
<para style="terp_default_Centre_8">[[ company.name ]]</para>
</td>
<td>
<para style="terp_default_Centre_8">[[ formatLang(time.strftime('%Y-%m-%d'),date = True) ]]</para>
</td>
<td>
<para style="terp_default_Centre_8">[[ formatLang(statement.date,date = True) ]]</para>
</td>
<td>
<para style="terp_default_Centre_8">[[ formatLang(statement.closing_date,date_time = True) ]]</para>
</td>
</tr>
</blockTable>
<para style="terp_default_8">
<font color="white"> </font>
</para>
<blockTable colWidths="356.0,68.0,95.0" style="Table3">
<tr>
<td>
<para style="terp_tblheader_General">Product</para>
</td>
<td>
<para style="terp_tblheader_General_Right">Qty</para>
</td>
<td>
<para style="terp_tblheader_General_Right">Amount</para>
</td>
</tr>
</blockTable>
<section>
<para style="terp_default_1">[[ repeatIn(get_data(statement), 'line_ids') and ' ' or removeParentNode('blockTable') ]]</para>
<section>
<para style="terp_default_1">[[ repeatIn(get_data(statement), 'line_ids')]]</para>
<blockTable colWidths="356.0,69.0,95.0" style="Table6">
<tr>
<td>
<para style="terp_default_9">[ [[line_ids['code'] ]] ] [[ line_ids['name'] ]]</para>
</td>
<td>
<para style="terp_default_Right_9">[[ formatLang(line_ids['qty']) ]] [[line_ids['uom'] ]]</para>
</td>
<td>
<para style="terp_default_Right_9">[[ formatLang(line_ids['amt'], currency_obj = company.currency_id) ]]</para>
</td>
</tr>
</blockTable>
</section>
</section>
<blockTable colWidths="357.0,69.0,94.0" style="Table5">
<tr>
<td>
<para style="P1">
<font color="white"> </font>
</para>
</td>
<td>
<para style="terp_tblheader_General_Right">Total :</para>
</td>
<td>
<para style="terp_default_Right_9_Bold">[[ formatLang(get_total(statement), currency_obj = company.currency_id) ]]</para>
</td>
</tr>
</blockTable>
<para style="terp_default_8">
<font color="white"> </font>
</para>
</story>
</document>

View File

@ -36,11 +36,16 @@
- state == 'paid'
- not invoice_id
-
I generate the invoice by pressing the Invoice button that calls the workflow
I set the order as invoiced
-
!workflow {model: pos.order, action: invoice, ref: pos_order_pos1}
-
I generate an invoice from the order
-
!python {model: pos.order}: |
invoice = self.action_invoice(cr, uid, [ref('pos_order_pos1')])
-
I test that the total of the attached invoice is correct
-
!assert {model: pos.order, id: pos_order_pos1, string: Invoice not correct}:
- amount_total == (450*2 + 300*3*1.05)*0.95
!assert {model: pos.order, id: pos_order_pos1, string: Invoice inconsistent with its origin order}:
- invoice_id.amount_total == 1795.5

View File

@ -0,0 +1,83 @@
-
In order to test Bank Statement feature of account I create a bank statement line and confirm it and check it's move created
-
I select the period and journal for the bank statement
-
!python {model: account.bank.statement}: |
import time
journal = self._default_journal_id(cr, uid, {'lang': u'en_US', 'tz': False, 'active_model': 'ir.ui.menu',
'journal_type': 'bank', 'period_id': time.strftime('%m'), 'active_ids': [ref('account.menu_bank_statement_tree')], 'active_id': ref('account.menu_bank_statement_tree')})
assert journal, 'Journal has not been selected'
-
I create a bank statement with Opening and Closing balance 0.
-
!record {model: account.bank.statement, id: account_bank_statement_0}:
balance_end_real: 0.0
balance_start: 0.0
date: !eval time.strftime('%Y-%m-%d')
journal_id: account.bank_journal
-
I create bank statement line
-
!python {model: account.bank.statement.line}: |
partner = self.onchange_partner_id(cr, uid, [], ref('base.res_partner_4'), context=None)
vals = {
'account_id': partner['value']['account_id'],
'amount': 1000.0,
'partner_id': ref('base.res_partner_4'),
'statement_id': ref('account_bank_statement_0'),
'name': 'EXT001'
}
vals.update(partner.get('value',{}))
line_id = self.create(cr, uid, vals)
assert line_id, "Account bank statement line has not been created"
-
I compute bank statement using Compute button
-
!python {model: account.bank.statement}: |
self.button_dummy(cr, uid, [ref("account_bank_statement_0")])
-
I modify the bank statement and set the Closing Balance.
-
!record {model: account.bank.statement, id: account_bank_statement_0}:
balance_end_real: 1000.0
-
I confirm the bank statement using Confirm button
-
!python {model: account.bank.statement}: |
self.button_confirm_bank(cr, uid, [ref("account_bank_statement_0")])
-
Print the account statement report
-
!python {model: account.bank.statement}: |
import os
import openerp.report
from openerp import tools
data, format = openerp.report.render_report(cr, uid, [ref('account_bank_statement_0')], 'point_of_sale.report_statement', {}, {})
if tools.config['test_report_directory']:
file(os.path.join(tools.config['test_report_directory'], 'point_of_sale-statement.'+format), 'wb+').write(data)
-
Print the closed cashbox of the day report
-
!python {model: account.bank.statement}: |
import os
import openerp.report
from openerp import tools
data, format = openerp.report.render_report(cr, uid, [ref('account_bank_statement_0')], 'point_of_sale.report_closedcashbox', {}, {})
if tools.config['test_report_directory']:
file(os.path.join(tools.config['test_report_directory'], 'point_of_sale-closedcashbox.'+format), 'wb+').write(data)
-
Printing the user s product report
-
!python {model: account.bank.statement}: |
import os
import openerp.report
from openerp import tools
data, format = openerp.report.render_report(cr, uid, [ref('account_bank_statement_0')], 'point_of_sale.report_usersproduct', {}, {})
if tools.config['test_report_directory']:
file(os.path.join(tools.config['test_report_directory'], 'point_of_sale-usersproduct.'+format), 'wb+').write(data)

View File

@ -1,14 +1,3 @@
-
In order to test the PDF reports defined on a Point Of Sale,we will print a POS Detail Summary Report
-
!python {model: pos.order}: |
import os
import openerp.report
from openerp import tools
data, format = openerp.report.render_report(cr, uid, [ref('point_of_sale.pos_order_pos1')], 'pos.details_summary', {}, {})
if tools.config['test_report_directory']:
file(os.path.join(tools.config['test_report_directory'], 'point_of_sale-details_summary report'+format), 'wb+').write(data)
-
In order to test the PDF reports defined on a Point Of Sale, we will print a POS Invoice Report
-
@ -16,7 +5,7 @@
import os
import openerp.report
from openerp import tools
data, format = openerp.report.render_report(cr, uid, [ref('point_of_sale.pos_order_pos1')], 'pos.invoice', {}, {})
data, format = openerp.report.render_report(cr, uid, [ref('pos_order_pos1')], 'point_of_sale.report_invoice', {}, {})
if tools.config['test_report_directory']:
file(os.path.join(tools.config['test_report_directory'], 'point_of_sale-invoice report'+format), 'wb+').write(data)
@ -27,7 +16,7 @@
import os
import openerp.report
from openerp import tools
data, format = openerp.report.render_report(cr, uid, [ref('point_of_sale.pos_order_pos1')], 'pos.lines', {}, {})
data, format = openerp.report.render_report(cr, uid, [ref('pos_order_pos1')], 'point_of_sale.report_saleslines', {}, {})
if tools.config['test_report_directory']:
file(os.path.join(tools.config['test_report_directory'], 'point_of_sale-lines report'+format), 'wb+').write(data)
@ -38,7 +27,7 @@
import os
import openerp.report
from openerp import tools
data, format = openerp.report.render_report(cr, uid, [ref('point_of_sale.pos_order_pos1')], 'pos.receipt', {}, {})
data, format = openerp.report.render_report(cr, uid, [ref('pos_order_pos1')], 'point_of_sale.report_receipt', {}, {})
if tools.config['test_report_directory']:
file(os.path.join(tools.config['test_report_directory'], 'point_of_sale-receipt report'+format), 'wb+').write(data)
@ -53,17 +42,6 @@
from openerp.tools import test_reports
test_reports.try_report_action(cr, uid, 'action_report_pos_details',wiz_data=data_dict, context=ctx, our_module='point_of_sale')
-
In order to test the PDF reports defined on a Point of Sale, we will print a POS Sales User Report
-
!python {model: pos.order}: |
import os, time
import openerp.report
from openerp import tools
data_dict = {'model':'ir.ui.menu', 'form':{'date_start': time.strftime('%Y-%m-%d'), 'date_end': time.strftime('%Y-%m-%d'),'user_id':[ref('base.user_root')] }}
data, format = openerp.report.render_report(cr, uid, [ref('point_of_sale.pos_order_pos1')], 'pos.sales.user', data_dict, {})
if tools.config['test_report_directory']:
file(os.path.join(tools.config['test_report_directory'], 'point_of_sale-sales_user_report'+format), 'wb+').write(data)
-
In order to test the PDF reports defined on a Point of Sale, we will print a POS Payment Report
-
@ -71,17 +49,6 @@
import os, time
import openerp.report
from openerp import tools
data, format = openerp.report.render_report(cr, uid, [ref('point_of_sale.pos_order_pos0')], 'pos.payment.report', {}, {})
data, format = openerp.report.render_report(cr, uid, [ref('pos_order_pos0')], 'point_of_sale.report_payment', {}, {})
if tools.config['test_report_directory']:
file(os.path.join(tools.config['test_report_directory'], 'point_of_sale-payment_report'+format), 'wb+').write(data)
-
In order to test the PDF reports defined on a Point of Sale, we will print a POS Payment User Report
-
!python {model: pos.order}: |
import os, time
import openerp.report
from openerp import tools
data_dict = {'model':'ir.ui.menu', 'form':{'user_id':[ref('base.user_root'),ref('base.user_demo')] }}
data, format = openerp.report.render_report(cr, uid, [ref('point_of_sale.pos_order_pos1')], 'pos.payment.report.user', data_dict, {})
if tools.config['test_report_directory']:
file(os.path.join(tools.config['test_report_directory'], 'point_of_sale-payment_user_report'+format), 'wb+').write(data)

View File

@ -0,0 +1,68 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<template id="report_closedcashbox">
<t t-call="report.html_container">
<t t-foreach="docs" t-as="o">
<t t-call="report.internal_layout">
<div class="page">
<h2>Today's Closed Cashbox</h2>
<p>User: <span t-esc="user.partner_id.name"/></p>
<table class="table table-condensed">
<thead>
<tr>
<th>St.Name</th>
<th>Journal</th>
<th>Opening Date</th>
<th>Closing Date</th>
<th>Starting Balance</th>
<th>Ending Balance</th>
</tr>
<tr>
<th>Total:</th>
<th colspan="3"></th>
<th class="text-right">
<u t-esc="formatLang(get_net_total_starting(user)[1], currency_obj=res_company.currency_id)"/>
</th>
<th class="text-right">
<u t-esc="formatLang(get_net_total(user), currency_obj=res_company.currency_id)"/>
</th>
</tr>
</thead>
<tbody>
<t t-foreach="get_data(user)" t-as="statement">
<tr>
<td><strong><t t-esc="statement['statement']"/></strong></td>
<td><strong><t t-esc="statement['journal']"/></strong></td>
<td><strong><t t-esc="statement['date']"/></strong></td>
<td><strong><t t-esc="statement['closing_date']"/></strong></td>
<td class="text-right">
<strong t-if="get_bal(statement)">
<span t-esc="formatLang(get_bal(statement), currency_obj=res_company.currency_id)"/>
</strong>
</td>
<td class="text-right">
<strong>
<span t-esc="formatLang(get_sub_total(user,statement['journal_id'], statement['date']), currency_obj=res_company.currency_id)"/>
</strong>
</td>
</tr>
<tr t-foreach="get_lines(statement)" t-as="line_ids">
<td colspan="2"><span t-esc="line_ids['name']"/></td>
<td><span t-esc="get_partner(line_ids)"/></td>
<td><t t-esc="get_user(line_ids)"/></td>
<td colspan="2" class="text-right">
<span t-esc="formatLang(line_ids['amount'], currency_obj=res_company.currency_id)"/>
</td>
</tr>
</t>
</tbody>
</table>
</div>
</t>
</t>
</t>
</template>
</data>
</openerp>

View File

@ -0,0 +1,140 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<template id="report_detailsofsales">
<t t-call="report.html_container">
<t t-call="report.internal_layout">
<div class="page">
<h2>Details of Sales</h2>
<div class="row mt32">
<div class="col-xs-3">
<strong>Company</strong>:<br/>
<span t-esc="res_company.name"/>
</div>
<div class="col-xs-3">
<strong>Users</strong>:<br/>
<span t-esc="get_user_names(data['form']['user_ids']) or 'All'"/>
</div>
<div class="col-xs-3">
<strong>Print Date</strong>:<br/>
<span t-esc="formatLang(time.strftime('%Y-%m-%d'),date=True)"/>
</div>
</div>
<div class="row mb32">
<div class="col-xs-3">
<strong>Start Period</strong>:<br/>
<span t-esc="formatLang(data['form']['date_start'],date=True)"/>
</div>
<div class="col-xs-3">
<strong>End Period</strong>:<br/>
<span t-esc="formatLang(data['form']['date_end'],date=True)"/>
</div>
</div>
<table class="table table-condensed">
<thead>
<th><strong>Date</strong></th>
<th><strong>Order</strong></th>
<th><strong>Product</strong></th>
<th class="text-right"><strong>Price</strong></th>
<th class="text-center"><strong>Qty</strong></th>
<th class="text-center"><strong>Disc(%)</strong></th>
<th class="text-center"><strong>Invoiced</strong></th>
</thead>
<tbody>
<tr t-foreach="pos_sales_details(data['form'])" t-as="line_ids">
<td>
<span t-esc="formatLang(line_ids['date_order'], date_time=True)"/>
</td>
<td>
<span t-esc="line_ids['pos_name']"/>
</td>
<td>
[<t t-if="line_ids['code']">
<span t-esc="line_ids['code']"/>
</t>]
<span t-esc="line_ids['name']"/>
</td>
<td class="text-right">
<span t-esc="formatLang(line_ids['price_unit'], dp='Sale Price', currency_obj=res_company.currency_id)"/>
</td>
<td class="text-center">
<span t-esc="formatLang(line_ids['qty'])"/>
<span t-esc="line_ids['uom']"/>
</td>
<td class="text-center">
<span t-esc="formatLang(line_ids['discount'], dp='Sale Price')"/>
</td>
<td class="text-center">
<t t-if="line_ids['invoice_id']">
<span t-esc="getinvoice(line_ids['invoice_id'])"/>
</t>
</td>
</tr>
</tbody>
</table>
<table class="table table-condensed">
<tr t-if="gettaxamount(data['form'])"><td colspan="2"><strong>Taxes</strong></td></tr>
<tr t-foreach="gettaxamount(data['form'])" t-as="tax">
<td><span t-esc="tax['name']"/></td>
<td class="text_right">
<strong t-esc="formatLang(tax['amount'], currency_obj = res_company.currency_id)"/>
</td>
</tr>
<tr>
<td colspan="2"><strong>Payment</strong></td>
</tr>
<tr t-foreach="getpayments(data['form'])" t-as="payment">
<td><span t-esc="payment['name']"/></td>
<td class="text-right">
<strong t-esc="formatLang(payment['sum'], dp='Account', currency_obj=res_company.currency_id)"/>
</td>
</tr>
<tr>
<td colspan="2"><strong>Summary</strong></td>
</tr>
<tr>
<td><strong>Sales total(Revenue)</strong></td>
<td class="text-right">
<strong t-esc="formatLang(getsalestotal2(), dp='Sale Price', currency_obj=res_company.currency_id)"/>
</td>
</tr>
<tr>
<td><strong>Qty of product</strong></td>
<td class="text-right">
<strong t-esc="formatLang(getqtytotal2())"/>
</td>
</tr>
<tr>
<td><strong>Total invoiced</strong></td>
<td class="text-right">
<strong t-esc="formatLang(getsuminvoice2(data['form']), dp='Sale Price', currency_obj=res_company.currency_id)"/>
</td>
</tr>
<tr>
<td><strong>Total discount</strong></td>
<td class="text-right">
<strong t-esc="formatLang(getsumdisc(data['form']), dp='Sale Price', currency_obj=res_company.currency_id)"/>
</td>
</tr>
<tr>
<td><strong>Total paid</strong></td>
<td class="text-right">
<strong t-esc="formatLang(getpaidtotal2(), dp='Sale Price', currency_obj=res_company.currency_id)"/>
</td>
</tr>
<tr>
<td><strong>Total of the day</strong></td>
<td class="text-right">
<strong t-esc="formatLang(gettotaloftheday(data['form']), dp='Sale Price', currency_obj = res_company.currency_id)"/>
</td>
</tr>
</table>
</div>
</t>
</t>
</template>
</data>
</openerp>

View File

@ -0,0 +1,90 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<template id="report_payment">
<t t-call="report.html_container">
<t t-call="report.internal_layout">
<div class="page">
<h2>Today's Payments</h2>
<div class="row mt32 mb32">
<div class="col-xs-3">
<strong>Company</strong>:<br/>
<span t-field="res_company.name"/>
</div>
<div class="col-xs-3">
<strong>Print date</strong>:<br/>
<t t-esc="formatLang(time.strftime('%Y-%m-%d'), date='True')"/>
</div>
</div>
<t t-foreach="docs" t-as="o">
<table class="table table-condensed" t-if="pos_payment_total(o)">
<thead>
<tr>
<td>
<strong>Product</strong>
</td>
<td class="text-center">
<strong>Qty</strong>
</td>
<td class="text-center">
<strong>Disc.(%)</strong>
</td>
<td class="text-right">
<strong>Unit Price</strong>
</td>
<td class="text-right">
<strong>Total</strong>
</td>
</tr>
</thead>
<tbody>
<tr t-foreach="pos_payment(o)" t-as="line_ids">
<td>
<t t-if="line_ids['code']">
<span t-esc="line_ids['code']"/>
</t>
<t t-if="line_ids['name']">
<span t-esc="line_ids['name']"/>
</t>
</td>
<td class="text-right">
<span t-esc="formatLang(line_ids['qty'])"/>
<t t-if="line_ids['uom']">
<span t-esc="line_ids['uom']"/>
</t>
</td>
<td class="text-right">
<span t-esc="formatLang(line_ids['discount'])"/>
</td>
<td class="text-right">
<span t-esc="formatLang(line_ids['price_unit'])"/>
</td>
<td class="text-right">
<span t-esc="formatLang(line_ids['total'], currency_obj=res_company.currency_id)"/>
</td>
</tr>
</tbody>
</table>
<div class="row" t-if="pos_payment_total(o)">
<div class="col-xs-4 pull-right">
<table class="table table-condensed">
<tr>
<td>
<strong>Net Total:</strong>
</td>
<td>
<strong t-esc="formatLang(pos_payment_total(o), currency_obj = res_company.currency_id)"/>
</td>
</tr>
</table>
</div>
</div>
</t>
</div>
</t>
</t>
</template>
</data>
</openerp>

View File

@ -0,0 +1,92 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<template id="report_receipt">
<t t-call="report.html_container">
<t t-foreach="docs" t-as="o">
<div class="page">
<div class="row">
<div class="col-xs-12 text-center">
<h2 t-esc="o.user_id.company_id.name"/>
<div t-field="o.partner_id"
t-field-options='{"widget": "contact", "fields": ["address", "name", "phone", "fax"], "no_marker": true}'/>
User: <span t-field="o.user_id"/><br/>
Warehouse: <span t-field="o.warehouse_id"/><br/>
Date: <span t-field="o.date_order"/><br/>
</div>
</div>
<div class="row">
</div>
<table class="table table-condensed">
<thead>
<tr>
<th>Description</th>
<th class="text-right">Quantity</th>
<th class="text-right">Price</th>
</tr>
</thead>
<tbody>
<tr t-foreach="o.lines" t-as="line">
<td><span t-field="line.product_id"/></td>
<td class="text-right">
<t t-if="o.state != 'cancel' and o.statement_ids">
<span t-esc="'%.f' % line.qty"/>
</t>
</td>
<td class="text-right">
<t t-if="o.state != 'cancel' and o.statement_ids">
<span t-esc="formatLang(net(line.id), currency_obj=res_company.currency_id)"/>
</t>
<t t-if="line.discount != 0.0">
<span t-esc="formatLang(line.discount, currency_obj=res_company.currency_id)"/>
</t>
</td>
</tr>
</tbody>
</table>
<div class="row">
<div class="col-xs-6 pull-right">
<table class="table table-condensed">
<tr class="border-black">
<td><strong>Taxes</strong></td>
<td class="text-right">
<strong t-esc="formatLang(o.amount_tax, currency_obj=res_company.currency_id)"/>
</td>
</tr>
<tr>
<td><strong>Total</strong></td>
<td class="text-right">
<strong t-esc="formatLang(o.amount_total, currency_obj=res_company.currency_id)"/>
</td>
</tr>
</table>
</div>
</div>
<table class="table table-condensed">
<thead>
<tr>
<th>Payment Mode</th>
<th>Amount</th>
</tr>
</thead>
<tbody>
<tr t-foreach="get_journal_amt(o)" t-as="d">
<td>
<span t-esc="d['name']"/>
</td>
<td>
<span t-esc="formatLang(d['amt'], currency_obj=res_company.currency_id)"/>
</td>
</tr>
</tbody>
</table>
</div>
</t>
</t>
</template>
</data>
</openerp>

View File

@ -0,0 +1,98 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<template id="report_saleslines">
<t t-call="report.html_container">
<t t-foreach="docs" t-as="o">
<t t-call="report.internal_layout">
<div class="page">
<h2>POS Lines</h2>
<div class="row mt32 mb32">
<div class="col-xs-3">
<strong>Company</strong>:<br/>
<span t-field="res_company.name"/>
</div>
<div class="col-xs-3">
<strong>Print date</strong>:<br/>
<t t-esc="formatLang(time.strftime('%Y-%m-%d'), date=True)"/>
</div>
<div class="col-xs-3">
<strong>No. Of Articles</strong>:<br/>
<t t-esc="total_quantity(o)"/>
</div>
</div>
<table class="table table-condensed">
<thead>
<tr>
<th><strong>Description</strong></th>
<th><strong>Tax</strong></th>
<th class="text-right"><strong>Quantity</strong></th>
<th class="text-right"><strong>Unit Price</strong></th>
<th class="text-right" groups="sale.group_discount_per_so_line"><strong>Disc. (%)</strong></th>
<th class="text-right"><strong>Price</strong></th>
</tr>
</thead>
<tbody>
<tr t-foreach="o.lines" t-as="l">
<td>
<t t-if="l.product_id and l.product_id.code">
[<span t-field="l.product_id.code"/>]
</t>
<span t-field="l.product_id.name"/>
</td>
<td>
<t t-esc="taxes(l)"/>
</td>
<td class="text-right">
<span t-field="l.qty"/>
<span t-field="l.product_id.uom_id.name" groups="product.group_uom"/>
</td>
<td class="text-right">
<span t-field="l.price_unit"/>
</td>
<td class="text-right" groups="sale.group_discount_per_so_line">
<span t-field="l.discount"/>
</td>
<td class="text-right">
<span t-field="l.price_subtotal" t-field-options='{"widget": "monetary", "display_currency": "o.pricelist_id.currency_id"}'/>
</td>
</tr>
</tbody>
</table>
<div class="row">
<div class="col-xs-4 pull-right">
<table class="table table-condensed">
<tr class="border-black">
<td><strong>Total Without Taxes</strong></td>
<td class="text-right">
<span t-field="o.amount_total"
t-field-options='{"widget": "monetary", "display_currency": "o.pricelist_id.currency_id"}'/>
</td>
</tr>
<tr>
<td>Taxes</td>
<td class="text-right">
<span t-field="o.amount_tax"
t-field-options='{"widget": "monetary", "display_currency": "o.pricelist_id.currency_id"}'/>
</td>
</tr>
<tr class="border-black">
<td><strong>Total</strong></td>
<td class="text-right">
<span t-esc="(o.amount_total + o.amount_tax)"
t-esc-options='{"widget": "monetary", "display_currency": "o.pricelist_id.currency_id"}'/>
</td>
</tr>
</table>
</div>
</div>
</div>
</t>
</t>
</t>
</template>
</data>
</openerp>

View File

@ -0,0 +1,85 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<template id="report_statement">
<t t-call="report.html_container">
<t t-foreach="docs" t-as="o">
<t t-call="report.internal_layout">
<div class="page">
<h2>Statement</h2>
<div class="row">
<div class="col-xs-3">
<strong>Statement Name</strong>:<br/>
<span t-field="o.name"/>
</div>
<div class="col-xs-3">
<strong>Journal</strong>:<br/>
<span t-field="o.journal_id"/>
</div>
<div class="col-xs-3">
<strong>Company</strong>:<br/>
<span t-field="o.company_id"/>
</div>
<div class="col-xs-3">
<strong>User</strong>:<br/>
<span t-field="o.user_id"/>
</div>
</div>
<div class="row mb32">
<div class="col-xs-3">
<strong>Opening Date</strong>:<br/>
<span t-field="o.date"/>
</div>
<div class="col-xs-3">
<strong>Closing Date</strong>:<br/>
<span t-field="o.closing_date"/>
</div>
<div class="col-xs-3">
<strong>Starting Balance</strong>:<br/>
<span t-field="o.balance_start" t-field-options='{"widget": "monetary", "display_currency": "res_company.currency_id"}'/>
</div>
<div class="col-xs-3">
<strong>Ending Balance</strong>:<br/>
<span t-field="o.balance_end_real" t-field-options='{"widget": "monetary", "display_currency": "res_company.currency_id"}'/>
</div>
</div>
<table class="table table-condensed">
<thead>
<tr>
<th>Name</th>
<th>Partner</th>
<th class="text-right">Amount</th>
</tr>
</thead>
<tbody>
<tr t-foreach="o.line_ids" t-as="line">
<td><span t-field="line.name"/></td>
<td><span t-esc="line.partner_id.name"/></td>
<td class="text-right">
<span t-field="line.amount"
t-field-options='{"widget": "monetary", "display_currency": "res_company.currency_id"}'/>
</td>
</tr>
</tbody>
</table>
<div class="row">
<div class="col-xs-4 pull-right">
<table class="table table-condensed">
<tr class="border-black">
<td><strong>Total</strong></td>
<td class="text-right"><span t-esc="formatLang(get_total(o.line_ids), currency_obj=res_company.currency_id)"/></td>
</tr>
</table>
</div>
</div>
</div>
</t>
</t>
</t>
</template>
</data>
</openerp>

View File

@ -0,0 +1,79 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<template id="report_usersproduct">
<t t-call="report.html_container">
<t t-foreach="docs" t-as="o">
<t t-call="report.internal_layout">
<div class="page">
<h2>User's Product</h2>
<div class="row mb32">
<div class="col-xs-3">
<strong>User</strong>:<br/>
<span t-esc="', '.join(get_user(docs))"/>
</div>
<div class="col-xs-3">
<strong>Company</strong>:<br/>
<span t-field="res_company.name"/>
</div>
<div class="col-xs-3">
<strong>Print Date</strong>:<br/>
<span t-esc="formatLang(time.strftime('%Y-%m-%d'), date=True)"/>
</div>
<div class="col-xs-3">
<strong>Starting Date</strong>:<br/>
<span t-esc="formatLang(o.date, date=True)"/>
</div>
</div>
<div class="row mb32" t-if="o.closing_date">
<div class="col-xs-3">
<strong>Ending Date</strong>:<br/>
<span t-esc="formatLang(o.closing_date, date=True)"/>
</div>
</div>
<table class="table table-condensed">
<thead>
<tr>
<th>Product</th>
<th class="text-right">Qty</th>
<th class="text-right">Amount</th>
</tr>
</thead>
<tbody>
<tr t-foreach="get_data(o)" t-as="line_ids">
<td><t t-if="line_ids['code']">
[<t t-esc="line_ids['code']" />]
</t>
<t t-esc="line_ids['name']" />
</td>
<td class="text-right">
<span t-esc="formatLang(line_ids['qty'])" />
<span t-esc="line_ids['uom']"/>
</td>
<td class="text-right">
<t t-esc="formatLang(line_ids['amt'], currency_obj=res_company.currency_id)"/>
</td>
</tr>
</tbody>
</table>
<div class="row">
<div class="col-xs-4 pull-right">
<table class="table table-condensed">
<tr class="border-black">
<td><strong>Total</strong></td>
<td class="text-right"><span t-esc="formatLang(get_total(o), currency_obj=res_company.currency_id)"/></td>
</tr>
</table>
</div>
</div>
</div>
</t>
</t>
</t>
</template>
</data>
</openerp>

View File

@ -19,18 +19,12 @@
#
##############################################################################
import pos_box
import pos_confirm
import pos_details
import pos_discount
import pos_open_statement
import pos_details
import pos_sales_user
import pos_sales_user_today
import pos_receipt
import pos_payment_report_user
import pos_payment_report
import pos_payment
import pos_session_opening
import pos_box
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,5 +1,5 @@
from openerp.osv import osv, fields
from openerp.osv import osv
from openerp.tools.translate import _
from openerp.addons.account.wizard.pos_box import CashBox

View File

@ -1,146 +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.osv import osv, fields
from openerp.tools.translate import _
def get_journal(self, cr, uid, context=None):
"""
Make the selection list of Cash Journal .
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param context: A standard dictionary
@return :Return the list of journal
"""
journal_obj = self.pool.get('account.journal')
statement_obj = self.pool.get('account.bank.statement')
j_ids = journal_obj.search(cr, uid, [('journal_user','=',1)], context=context)
obj_ids = statement_obj.search(cr, uid, [('state', '=', 'open'), ('user_id', '=', uid), ('journal_id', 'in', j_ids)], context=context)
res = statement_obj.read(cr, uid, obj_ids, ['journal_id'], context=context)
res = [(r['journal_id']) for r in res]
if not len(res) and context:
raise osv.except_osv(_('Error!'), _('You do not have any open cash register. You must create a payment method or open a cash register.'))
return res
class pos_box_entries(osv.osv_memory):
_name = 'pos.box.entries'
_description = 'Pos Box Entries'
def _get_income_product(self, cr, uid, context=None):
"""
Make the selection list of purchasing products.
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param context: A standard dictionary
@return :Return of operation of product
"""
product_obj = self.pool.get('product.product')
ids = product_obj.search(cr, uid, [('income_pdt', '=', True)], context=context)
res = product_obj.read(cr, uid, ids, ['id', 'name'], context=context)
res = [(r['id'], r['name']) for r in res]
res.insert(0, ('', ''))
return res
_columns = {
'name': fields.char('Reason', size=32, required=True),
'journal_id': fields.many2one('account.journal', 'Cash Register', required=True, domain="[('journal_id.type', '=', 'cash')]"),
'product_id': fields.selection(_get_income_product, "Operation", required=True, size=-1),
'amount': fields.float('Amount', digits=(16, 2), required=True),
'ref': fields.char('Ref', size=32),
'session_id' : fields.many2one('pos.session', 'Session'),
'user_id' : fields.many2one('res.users', 'User'),
}
def _default_session_id(self, cr, uid, context=None):
return context and context.get('active_id', False) or False
def _default_cash_register(self, cr, uid, context=None):
#import pdb
#pdb.set_trace()
if not context:
context = {}
result = context.get('active_id', False) or False
return result
_defaults = {
#'session_id' : _default_session_id,
#'journal_id': _default_cash_register,
#'product_id': 1,
'user_id' : lambda obj, cr, uid, context: uid,
}
def get_in(self, cr, uid, ids, context=None):
"""
Create the entry of statement in journal.
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param context: A standard dictionary
@return :Return of operation of product
"""
statement_obj = self.pool.get('account.bank.statement')
res_obj = self.pool.get('res.users')
product_obj = self.pool.get('product.product')
bank_statement = self.pool.get('account.bank.statement.line')
for data in self.read(cr, uid, ids, context=context):
vals = {}
curr_company = res_obj.browse(cr, uid, uid, context=context).company_id.id
statement_id = statement_obj.search(cr, uid, [('journal_id', '=', int(data['journal_id'])), ('company_id', '=', curr_company), ('user_id', '=', uid), ('state', '=', 'open')], context=context)
if not statement_id:
raise osv.except_osv(_('Error!'), _('You have to open at least one cashbox.'))
product = product_obj.browse(cr, uid, int(data['product_id']))
acc_id = product.property_account_income or product.categ_id.property_account_income_categ
if not acc_id:
raise osv.except_osv(_('Error!'), _('Please check that income account is set to %s.')%(product_obj.browse(cr, uid, data['product_id']).name))
if statement_id:
statement_id = statement_id[0]
if not statement_id:
statement_id = statement_obj.create(cr, uid, {
'date': time.strftime('%Y-%m-%d 00:00:00'),
'journal_id': data['journal_id'],
'company_id': curr_company,
'user_id': uid,
}, context=context)
vals['statement_id'] = statement_id
vals['journal_id'] = data['journal_id']
if acc_id:
vals['account_id'] = acc_id.id
vals['amount'] = data['amount'] or 0.0
vals['ref'] = "%s" % (data['ref'] or '')
vals['name'] = "%s: %s " % (product_obj.browse(cr, uid, data['product_id'], context=context).name, data['name'].decode('utf8'))
bank_statement.create(cr, uid, vals, context=context)
return {}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,50 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!-- Box Entries -->
<record id="view_box_entries" model="ir.ui.view">
<field name="name">Box Entries</field>
<field name="model">pos.box.entries</field>
<field name="arch" type="xml">
<form string="Put Money" version="7.0">
<separator string="Fill in this form if you put money in the cash register:"/>
<group col="4">
<field name="journal_id"/>
<field name="product_id"/>
<field name="amount"/>
<field name="session_id"/>
<field name="name"/>
<field name="user_id" invisible="1"/>
</group>
<footer>
<button name="get_in" string="Put Money" class="oe_highlight"
type="object"/>
or
<button class="oe_link" special="cancel"
string="Cancel"/>
</footer>
</form>
</field>
</record>
<act_window name="Put Money In"
res_model="pos.box.entries"
src_model="account.bank.statement"
view_mode="form"
target="new"
key2="client_action_multi"
id="action_box_entries"/>
<act_window name="Put Money In"
res_model="pos.box.entries"
src_model="pos.session"
view_mode="form"
target="new"
key2="client_action_multi"
id="action_pos_session_box_entries"/>
</data>
</openerp>

View File

@ -1,105 +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 datetime import datetime
from dateutil.relativedelta import relativedelta
from openerp.osv import fields, osv
from openerp.tools.translate import _
import pos_box_entries
class pos_box_out(osv.osv_memory):
_name = 'pos.box.out'
_description = 'Pos Box Out'
def _get_expense_product(self, cr, uid, context=None):
"""
Make the selection list of expense product.
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param context: A standard dictionary
@return :Return of operation of product
"""
product_obj = self.pool.get('product.product')
company_id = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.id
ids = product_obj.search(cr, uid, ['&', ('expense_pdt', '=', True), '|', ('company_id', '=', company_id), ('company_id', '=', None)], context=context)
res = product_obj.read(cr, uid, ids, ['id', 'name'], context=context)
res = [(r['id'], r['name']) for r in res]
return res
_columns = {
'name': fields.char('Description / Reason', size=32, required=True),
'journal_id': fields.selection(pos_box_entries.get_journal, "Cash Register", required=True, size=-1),
'product_id': fields.selection(_get_expense_product, "Operation", required=True, size=-1),
'amount': fields.float('Amount', digits=(16, 2), required=True),
'session_id' : fields.many2one('pos.session', 'Session'),
'user_id' : fields.many2one('res.users', 'User'),
}
_defaults = {
'journal_id': 1,
'product_id': 1,
'user_id' : lambda obj, cr, uid, context: uid,
}
def get_out(self, cr, uid, ids, context=None):
"""
Create the entries in the CashBox .
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param context: A standard dictionary
@return :Return of operation of product
"""
vals = {}
statement_obj = self.pool.get('account.bank.statement')
statement_line_obj = self.pool.get('account.bank.statement.line')
product_obj = self.pool.get('product.product')
res_obj = self.pool.get('res.users')
for data in self.read(cr, uid, ids, context=context):
curr_company = res_obj.browse(cr, uid, uid, context=context).company_id.id
statement_ids = statement_obj.search(cr, uid, [('journal_id', '=', data['journal_id']), ('company_id', '=', curr_company), ('user_id', '=', uid), ('state', '=', 'open')], context=context)
monday = (datetime.today() + relativedelta(weekday=0)).strftime('%Y-%m-%d')
sunday = (datetime.today() + relativedelta(weekday=6)).strftime('%Y-%m-%d')
done_statmt = statement_obj.search(cr, uid, [('date', '>=', monday+' 00:00:00'), ('date', '<=', sunday+' 23:59:59'), ('journal_id', '=', data['journal_id']), ('company_id', '=', curr_company), ('user_id', '=', uid)], context=context)
stat_done = statement_obj.browse(cr, uid, done_statmt, context=context)
am = 0.0
product = product_obj.browse(cr, uid, data['product_id'], context=context)
acc_id = product.property_account_expense or product.categ_id.property_account_expense_categ
if not acc_id:
raise osv.except_osv(_('Error!'), _('please check that account is set to %s.')%(product.name))
if not statement_ids:
raise osv.except_osv(_('Error!'), _('You have to open at least one cashbox.'))
vals['statement_id'] = statement_ids[0]
vals['journal_id'] = data['journal_id']
vals['account_id'] = acc_id.id
amount = data['amount'] or 0.0
if data['amount'] > 0:
amount = -data['amount']
vals['amount'] = amount
vals['name'] = "%s: %s " % (product.name, data['name'])
statement_line_obj.create(cr, uid, vals, context=context)
return {}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,48 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!-- Box Entries -->
<record id="view_pos_box_out" model="ir.ui.view">
<field name="name">Box Out</field>
<field name="model">pos.box.out</field>
<field name="arch" type="xml">
<form string="Output Operation" version="7.0">
<separator string="Describe why you take money from the cash register:"/>
<group colspan="4">
<field name="journal_id"/>
<field name="product_id"/>
<field name="amount"/>
<field name="session_id" />
<field name="name"/>
<field name="user_id" invisible="1" />
</group>
<footer>
<button name="get_out" string="Take Money"
type="object" class="oe_highlight"/> or
<button icon="gtk-stop" special="cancel"
string="Cancel" class="oe_link"/>
</footer>
</form>
</field>
</record>
<act_window name="Take Money Out"
res_model="pos.box.out"
src_model="account.bank.statement"
view_mode="form"
target="new"
key2="client_action_multi"
id="action_box_out" />
<act_window name="Take Money Out"
res_model="pos.box.out"
src_model="pos.session"
view_mode="form"
target="new"
key2="client_action_multi"
id="action_pos_session_box_out" />
</data>
</openerp>

View File

@ -50,4 +50,3 @@ class pos_confirm(osv.osv_memory):
return {}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -17,16 +17,5 @@
</form>
</field>
</record>
<!--
<record id="action_pos_confirm" model="ir.actions.act_window">
<field name="name">Post Sale Entries</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">pos.confirm</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
-->
</data>
</openerp>

View File

@ -20,9 +20,9 @@
##############################################################################
import time
from openerp.osv import osv, fields
class pos_details(osv.osv_memory):
_name = 'pos.details'
_description = 'Sales Details'
@ -54,12 +54,6 @@ class pos_details(osv.osv_memory):
datas['form'] = res
if res.get('id',False):
datas['ids']=[res['id']]
return {
'type': 'ir.actions.report.xml',
'report_name': 'pos.details',
'datas': datas,
}
return self.pool['report'].get_action(cr, uid, [], 'point_of_sale.report_detailsofsales', data=datas, context=context)
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -21,6 +21,7 @@
from openerp.osv import osv, fields
class pos_discount(osv.osv_memory):
_name = 'pos.discount'
_description = 'Add a Global Discount'
@ -31,21 +32,6 @@ class pos_discount(osv.osv_memory):
'discount': 5,
}
# def view_init(self, cr, uid, fields_list, context=None):
# """
# Creates view dynamically and adding fields at runtime.
# @param self: The object pointer.
# @param cr: A database cursor
# @param uid: ID of the user currently logged in
# @param context: A standard dictionary
# @return: New arch of view with new columns.
# """
# if context is None:
# context = {}
# super(pos_discount, self).view_init(cr, uid, fields_list, context=context)
# record_id = context and context.get('active_id', False) or False
# True
def apply_discount(self, cr, uid, ids, context=None):
"""
To give the discount of product and check the.
@ -68,5 +54,4 @@ class pos_discount(osv.osv_memory):
order_line_ref.write(cr, uid, [x.id for x in order.lines], {'discount':this.discount}, context=context)
return {}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -21,11 +21,10 @@
import time
import pos_box_entries
from openerp.osv import osv, fields
from openerp.tools.translate import _
class account_journal(osv.osv):
_inherit = 'account.journal'
@ -43,6 +42,7 @@ class account_journal(osv.osv):
return super(account_journal, self).search(cr, uid, args, offset=offset, limit=limit, order=order, context=context, count=count)
class pos_make_payment(osv.osv_memory):
_name = 'pos.make.payment'
_description = 'Point of Sale Payment'
@ -53,7 +53,6 @@ class pos_make_payment(osv.osv_memory):
"""
context = context or {}
order_obj = self.pool.get('pos.order')
obj_partner = self.pool.get('res.partner')
active_id = context and context.get('active_id', False)
order = order_obj.browse(cr, uid, active_id, context=context)
@ -128,6 +127,4 @@ class pos_make_payment(osv.osv_memory):
'amount': _default_amount,
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,48 +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/>.
#
##############################################################################
from openerp.osv import osv
class pos_payment_report(osv.osv_memory):
_name = 'pos.payment.report'
_description = 'Payment Report'
def print_report(self, cr, uid, ids, context=None):
"""
To get the date and print the report
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param context: A standard dictionary
@return : retrun report
"""
if context is None:
context = {}
datas = {'ids': context.get('active_ids', [])}
return {
'type': 'ir.actions.report.xml',
'report_name': 'pos.payment.report',
'datas': datas,
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,31 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!-- pos.details -->
<record id="view_pos_payment_report" model="ir.ui.view">
<field name="name">Payment Report</field>
<field name="model">pos.payment.report</field>
<field name="arch" type="xml">
<form string="Payment Report" version="7.0">
<header>
<button name="print_report" string="Print Report" type="object" class="oe_highlight" />
or
<button string="Cancel" class="oe_link" special="cancel" />
</header>
</form>
</field>
</record>
<record id="action_pos_payment_report" model="ir.actions.act_window">
<field name="name">Payment Report</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">pos.payment.report</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
</data>
</openerp>

View File

@ -1,54 +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/>.
#
##############################################################################
from openerp.osv import osv, fields
class pos_payment_report_user(osv.osv_memory):
_name = 'pos.payment.report.user'
_description = 'Sales lines by Users'
def print_report(self, cr, uid, ids, context=None):
"""
To get the date and print the report
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param context: A standard dictionary
@return : retrun report
"""
if context is None:
context = {}
datas = {'ids': context.get('active_ids', [])}
res = self.read(cr, uid, ids, ['user_id'], context=context)
res = res and res[0] or {}
datas['form'] = res
return {
'type': 'ir.actions.report.xml',
'report_name': 'pos.payment.report.user',
'datas': datas,
}
_columns = {
'user_id': fields.many2many('res.users', 'res_user_sale', 'user_id', 'sale_id', 'Salesperson')
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,31 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!-- pos.details -->
<record id="view_pos_payment_report" model="ir.ui.view">
<field name="name">Payment Report</field>
<field name="model">pos.payment.report</field>
<field name="arch" type="xml">
<form string="Pyament Report " version="7.0">
<header>
<button name="print_report" string="Print Report" type="object" class="oe_highlight" />
or
<button string="Cancel" class="oe_link" special="cancel" />
</header>
</form>
</field>
</record>
<record id="action_report_pos_payment" model="ir.actions.act_window">
<field name="name">Pyament Report</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">pos.payment.report</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
</data>
</openerp>

View File

@ -1,29 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="pos_payment_report_user_form" model="ir.ui.view">
<field name="name">pos.payment.report.user.form</field>
<field name="model">pos.payment.report.user</field>
<field name="arch" type="xml">
<form string="Sale by User" version="7.0">
<group>
<field name="user_id"/>
</group>
<footer>
<button name="print_report" string="Print Report" type="object" icon="gtk-print" class="oe_highlight"/>
or
<button string="Cancel" special="cancel" class="oe_link"/>
</footer>
</form>
</field>
</record>
<record id="action_report_pos_payment_report_user" model="ir.actions.act_window">
<field name="name">Sales lines by Users</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">pos.payment.report.user</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
</data>
</openerp>

View File

@ -1,59 +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/>.
#
##############################################################################
from openerp.osv import osv
from openerp.tools.translate import _
class pos_receipt(osv.osv_memory):
_name = 'pos.receipt'
_description = 'Point of sale receipt'
def view_init(self, cr, uid, fields_list, context=None):
"""
Creates view dynamically and adding fields at runtime.
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param context: A standard dictionary
@return: New arch of view with new columns.
"""
order_lst = self. pool.get('pos.order').browse(cr, uid, context['active_id'], context=context)
def print_report(self, cr, uid, ids, context=None):
"""
To get the date and print the report
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param context: A standard dictionary
@return : retrun report
"""
if context is None:
context = {}
datas = {'ids': context.get('active_ids', [])}
return {
'type': 'ir.actions.report.xml',
'report_name': 'pos.receipt',
'datas': datas,
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,30 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!-- Pos Receipt -->
<record id="view_pos_receipt" model="ir.ui.view">
<field name="name">Receipt</field>
<field name="model">pos.receipt</field>
<field name="arch" type="xml">
<form string="Receipt :" version="7.0">
<group>
<label string="Print the Receipt of the Sale"/>
</group>
<footer>
<button name="print_report" string="Print Receipt" type="object" class="oe_highlight" />
or
<button string="Cancel" class="oe_link" special="cancel" />
</footer>
</form>
</field>
</record>
<record id="action_report_pos_receipt" model="ir.actions.act_window">
<field name="name">Receipt</field>
<field name="res_model">pos.receipt</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
</data>
</openerp>

View File

@ -1,323 +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/>.
#
##############################################################################
from openerp.osv import osv,fields
from openerp.tools.translate import _
import time
class pos_return(osv.osv_memory):
_name = 'pos.return'
_description = 'Point of sale return'
_columns = {
'pos_moves_ids' : fields.one2many('pos.return.memory', 'pos_moves_id', 'Moves'),
}
def default_get(self, cr, uid, fields, context=None):
"""
To get default values for the object.
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param fields: List of fields for which we want default values
@param context: A standard dictionary
@return: A dictionary which of fields with values.
"""
res = super(pos_return, self).default_get(cr, uid, fields, context=context)
order_obj = self.pool.get('pos.order')
if context is None:
context={}
active_ids = context.get('active_ids')
result=[]
for order in order_obj.browse(cr, uid, active_ids, context=context):
for line in order.lines:
result.append({
'product_id' : line.product_id.id,
'quantity' : line.qty,
'line_id':line.id
})
res.update({'pos_moves_ids': result})
return res
def create_returns(self, cr, uid, data, context=None):
"""
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param context: A standard dictionary
@return: Return the add product form again for adding more product
"""
if context is None:
context = {}
current_rec = self.browse(cr, uid, data, context=context)[0]
order_obj =self.pool.get('pos.order')
line_obj = self.pool.get('pos.order.line')
pos_current = order_obj.browse(cr, uid, context.get('active_id'), context=context)
for pos_line in pos_current.lines:
for record in current_rec.pos_moves_ids:
if pos_line.id == record.line_id:
less_qty = record.quantity
line_obj.write(cr, uid, pos_line.id, {'qty':pos_line.qty - less_qty}, context=context)
return {
'name': _('Add Product'),
'view_type': 'form',
'view_mode': 'form',
'res_model': 'pos.add.product',
'view_id': False,
'target':'new',
'views': False,
'context': context,
'type': 'ir.actions.act_window',
}
def create_returns2(self, cr, uid, ids, context=None):
if context is None:
context = {}
active_id = context.get('active_id', False)
order_obj =self.pool.get('pos.order')
line_obj = self.pool.get('pos.order.line')
picking_obj = self.pool.get('stock.picking')
stock_move_obj = self.pool.get('stock.move')
property_obj= self.pool.get("ir.property")
uom_obj =self. pool.get('product.uom')
statementl_obj = self.pool.get('account.bank.statement.line')
#Todo :Need to clean the code
if active_id:
data = self.browse(cr, uid, ids, context=context)[0]
date_cur = time.strftime('%Y-%m-%d %H:%M:%S')
for order_id in order_obj.browse(cr, uid, [active_id], context=context):
source_stock_id = property_obj.get(cr, uid, 'property_stock_customer', 'res.partner', context=context).id
cr.execute("SELECT s.id FROM stock_location s, stock_warehouse w "
"WHERE w.lot_stock_id=s.id AND w.id=%s ",
(order_id.warehouse_id.id,))
res = cr.fetchone()
location_id = res and res[0] or None
new_picking = picking_obj.copy(cr, uid, order_id.picking_id.id, {'name':'%s (return)' % order_id.name,
'move_lines': [],
'state':'draft',
'type': 'in',
'partner_id': order_id.partner_id.id,
'date': date_cur })
new_order = order_obj.copy(cr, uid, order_id.id, {'name': 'Refund %s'%order_id.name,
'lines':[],
'statement_ids':[],
'picking_id':[]})
account_def = property_obj.get(cr, uid, 'property_account_payable', 'res.partner', context=context)
amount = 0.0
for line in order_id.lines:
for record in data.pos_moves_ids:
if line.id == record.line_id:
qty = record.quantity
amount += qty * line.price_unit
stock_move_obj.create(cr, uid, {
'product_qty': qty ,
'product_uos_qty': uom_obj._compute_qty(cr, uid, qty ,line.product_id.uom_id.id),
'picking_id': new_picking,
'product_uom': line.product_id.uom_id.id,
'location_id': source_stock_id,
'product_id': line.product_id.id,
'location_dest_id': location_id,
'name': '%s (return)' %order_id.name,
'date': date_cur
})
if qty != 0.0:
line_obj.copy(cr, uid, line.id, {'qty': -qty, 'order_id': new_order})
statementl_obj.create(cr, uid, {
'name': 'Refund %s'%order_id.name,
'statement_id': order_id.statement_ids[0].statement_id.id,
'pos_statement_id': new_order,
'date': fields.date.context_today(self, cr, uid, context=context),
'account_id': order_id.partner_id and order_id.partner_id.property_account_payable \
and order_id.partner_id.property_account_payable.id or account_def.id,
'amount': -amount,
})
order_obj.write(cr,uid, [active_id,new_order], {'state': 'done'})
picking_obj.signal_button_confirm(cr, uid, [new_picking])
picking_obj.force_assign(cr, uid, [new_picking], context)
act = {
'domain': "[('id', 'in', ["+str(new_order)+"])]",
'name': 'Refunded Orders',
'view_type': 'form',
'view_mode': 'tree,form',
'res_model': 'pos.order',
'auto_refresh':0,
'res_id':new_order,
'view_id': False,
'context':context,
'type': 'ir.actions.act_window'
}
return act
class add_product(osv.osv_memory):
_inherit = 'pos.add.product'
def select_product(self, cr, uid, ids, context=None):
"""
To get the product and quantity and add in order .
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param context: A standard dictionary
@return : Retrun the add product form again for adding more product
"""
if context is None:
context = {}
active_id=context.get('active_id', False)
data = self.read(cr, uid, ids)
data = data and data[0] or False
if active_id:
order_obj = self.pool.get('pos.order')
picking_obj = self.pool.get('stock.picking')
stock_move_obj = self.pool.get('stock.move')
property_obj= self.pool.get("ir.property")
date_cur=time.strftime('%Y-%m-%d')
uom_obj = self.pool.get('product.uom')
prod_obj=self.pool.get('product.product')
order_obj.add_product(cr, uid, active_id, data['product_id'], data['quantity'], context=context)
for order_id in order_obj.browse(cr, uid, [active_id], context=context):
prod=data['product_id']
qty=data['quantity']
stock_dest_id = property_obj.get(cr, uid, 'property_stock_customer', 'res.partner', context=context).id
cr.execute("SELECT s.id FROM stock_location s, stock_warehouse w "
"WHERE w.lot_stock_id=s.id AND w.id=%s ",
(order_id.warehouse_id.id,))
res=cr.fetchone()
location_id=res and res[0] or None
prod_id=prod_obj.browse(cr, uid, prod, context=context)
new_picking=picking_obj.create(cr, uid, {
'name':'%s (Added)' %order_id.name,
'move_lines':[],
'state':'draft',
'type':'out',
'date':date_cur
})
stock_move_obj.create(cr, uid, {
'product_qty': qty,
'product_uos_qty': uom_obj._compute_qty(cr, uid, prod_id.uom_id.id, qty, prod_id.uom_id.id),
'picking_id':new_picking,
'product_uom':prod_id.uom_id.id,
'location_id':location_id,
'product_id':prod_id.id,
'location_dest_id':stock_dest_id,
'name':'%s (return)' %order_id.name,
'date':date_cur
})
picking_obj.signal_button_confirm(cr, uid, [new_picking])
picking_obj.force_assign(cr, uid, [new_picking], context)
order_obj.write(cr,uid,active_id,{'picking_id':new_picking})
return {
'name': _('Add Product'),
'view_type': 'form',
'view_mode': 'form',
'res_model': 'pos.add.product',
'view_id': False,
'target':'new',
'context':context,
'views': False,
'type': 'ir.actions.act_window',
}
def close_action(self, cr, uid, ids, context=None):
if context is None: context = {}
active_ids=context.get('active_ids', False)
order_obj = self.pool.get('pos.order')
lines_obj = self.pool.get('pos.order.line')
picking_obj = self.pool.get('stock.picking')
stock_move_obj = self.pool.get('stock.move')
property_obj= self.pool.get("ir.property")
invoice_obj=self.pool.get('account.invoice')
date_cur=time.strftime('%Y-%m-%d %H:%M:%S')
uom_obj = self.pool.get('product.uom')
return_boj=self.pool.get('pos.return')
return_id = return_boj.search(cr,uid,[])
data = {}
if return_id:
data = return_boj.read(cr,uid,return_id,[])[0]
self_data = self.browse(cr, uid, ids, context=context)[0]
order_obj.add_product(cr, uid, active_ids[0], self_data.product_id.id, self_data.quantity, context=context)
for order_id in order_obj.browse(cr, uid, active_ids, context=context):
stock_dest_id = property_obj.get(cr, uid, 'property_stock_customer', 'res.partner', context=context).id
cr.execute("SELECT s.id FROM stock_location s, stock_warehouse w "
" WHERE w.lot_stock_id=s.id AND w.id=%s ",
(order_id.warehouse_id.id,))
res=cr.fetchone()
location_id=res and res[0] or None
if order_id.invoice_id:
invoice_obj.refund(cr, uid, [order_id.invoice_id.id], time.strftime('%Y-%m-%d'), False, order_id.name, context=context)
new_picking=picking_obj.create(cr, uid, {
'name':'%s (return)' %order_id.name,
'move_lines':[], 'state':'draft',
'type':'in',
'date':date_cur
})
for line in order_id.lines:
key= 'return%s' % line.id
if line.id:
if data.has_key(key):
qty = data[key]
lines_obj.write(cr,uid,[line.id], {
'qty':line.qty-(data[key] or 0.0)
})
else:
qty = line.qty
stock_move_obj.create(cr, uid, {
'product_qty': qty,
'product_uos_qty': uom_obj._compute_qty(cr, uid, qty, line.product_id.uom_id.id),
'picking_id':new_picking,
'product_uom':line.product_id.uom_id.id,
'location_id':location_id,
'product_id':line.product_id.id,
'location_dest_id':stock_dest_id,
'name':'%s (return)' % order_id.name,
'date':date_cur,
})
picking_obj.signal_button_confirm(cr, uid, [new_picking])
picking_obj.force_assign(cr, uid, [new_picking], context)
obj=order_obj.browse(cr,uid, active_ids[0])
context.update({'return':'return'})
if obj.amount_total != obj.amount_paid:
return {
'name': _('Make Payment'),
'context ':context,
'view_type': 'form',
'view_mode': 'form',
'res_model': 'pos.make.payment',
'view_id': False,
'target': 'new',
'views': False,
'type': 'ir.actions.act_window',
}
return True
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,53 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="pos_return_form" model="ir.ui.view">
<field name="name">pos.return</field>
<field name="model">pos.return</field>
<field name="arch" type="xml">
<form string="Return lines" version="7.0">
<footer>
<button name= "create_returns" string="Return Products" type="object" class="oe_highlight" />
or
<button string="Cancel" class="oe_link" special="cancel" />
</footer>
</form>
</field>
</record>
<record id="action_view_pos_return" model="ir.actions.act_window">
<field name="name">Return lines</field>
<field name="res_model">pos.return</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
<record id="pos_return_tree_in" model="ir.ui.view">
<field name="name">pos.return.memory</field>
<field name="model">pos.return.memory</field>
<field name="arch" type="xml">
<tree editable="bottom" string="Return Product">
<field name="product_id" />
<field name="quantity" />
<field name="line_id" invisible="1"/>
</tree>
</field>
</record>
<record id="pos_return_form_in" model="ir.ui.view">
<field name="name">pos.return.memory</field>
<field name="model">pos.return.memory</field>
<field name="arch" type="xml">
<form version="7.0">
<group col="4">
<field name="product_id" />
<field name="quantity" />
<field name="line_id" invisible="1"/>
</group>
</form>
</field>
</record>
</data>
</openerp>

View File

@ -1,60 +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/>.
#
##############################################################################
from openerp.osv import osv, fields
from openerp.tools.translate import _
class pos_sale_user(osv.osv_memory):
_name = 'pos.sale.user'
_description = 'Sale by User'
_columns = {
'date_start': fields.date('Date Start', required=True),
'date_end': fields.date('Date End', required=True),
'user_id': fields.many2many('res.users', 'sale_user_rel', 'user_id', 'uid', 'Salesperson'),
}
def print_report(self, cr, uid, ids, context=None):
"""
To get the date and print the report
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param context: A standard dictionary
@return : return report
"""
if context is None:
context = {}
datas = {'ids': context.get('active_ids', [])}
res = self.read(cr, uid, ids, ['date_start', 'date_end', 'user_id'], context=context)
res = res and res[0] or {}
datas['form'] = res
return {
'type': 'ir.actions.report.xml',
'report_name': 'pos.sales.user',
'datas': datas,
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,36 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!-- pos sales user -->
<record id="view_pos_sale_user" model="ir.ui.view">
<field name="name">Sale By User</field>
<field name="model">pos.sale.user</field>
<field name="arch" type="xml">
<form string="Sale By User" version="7.0">
<group col="4">
<field name="date_start"/>
<field name="date_end"/>
<field name="user_id"/>
</group>
<footer>
<button name="print_report" type="object" string="Print Report" class="oe_highlight"/>
or
<button string="Cancel" special="cancel" class="oe_link"/>
</footer>
</form>
</field>
</record>
<record id="action_report_pos_sale_user" model="ir.actions.act_window">
<field name="name">Sale by User</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">pos.sale.user</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
</data>
</openerp>

View File

@ -1,58 +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/>.
#
##############################################################################
from openerp.osv import osv
from openerp.tools.translate import _
class pos_sales_user_today_current_user(osv.osv_memory):
_name = 'pos.sales.user.today.current_user'
_description = 'Sales Details'
_columns = {
}
def print_report(self, cr, uid, ids, context=None):
"""
To get the date and print the report
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param context: A standard dictionary
@return : retrun report
"""
if context is None:
context = {}
datas = {'ids': context.get('active_ids', [])}
res = self.read(cr, uid, ids, [], context=context)
res = res and res[0] or {}
datas['form'] = res
return {
'type': 'ir.actions.report.xml',
'report_name': 'pos.sales.user.today.current.user',
'datas': datas,
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,57 +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/>.
#
##############################################################################
from openerp.osv import osv, fields
class pos_sales_user_today(osv.osv_memory):
_name = 'pos.sales.user.today'
_description = 'Sales User Today'
_columns = {
'user_id': fields.many2many('res.users', 'sale_user_rel_today', 'user_id', 'uid', 'Salesperson'),
}
def print_report(self, cr, uid, ids, context=None):
"""
To get the date and print the report
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param context: A standard dictionary
@return : retrun report
"""
if context is None:
context = {}
datas = {'ids': context.get('active_ids', [])}
res = self.read(cr, uid, ids, ['user_id'], context=context)
res = res and res[0] or {}
datas['form'] = res
return {
'type': 'ir.actions.report.xml',
'report_name': 'pos.sales.user.today',
'datas': datas,
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -20,6 +20,8 @@
##############################################################################
from openerp.addons.web.http import Controller, route, request
from openerp.addons.web.controllers.main import _serialize_exception
from openerp.osv import osv
import simplejson
from werkzeug import exceptions, url_decode
@ -97,32 +99,40 @@ class ReportController(Controller):
"""
requestcontent = simplejson.loads(data)
url, type = requestcontent[0], requestcontent[1]
try:
if type == 'qweb-pdf':
reportname = url.split('/report/pdf/')[1].split('?')[0]
if type == 'qweb-pdf':
reportname = url.split('/report/pdf/')[1].split('?')[0]
docids = None
if '/' in reportname:
reportname, docids = reportname.split('/')
docids = None
if '/' in reportname:
reportname, docids = reportname.split('/')
if docids:
# Generic report:
response = self.report_routes(reportname, docids=docids, converter='pdf')
else:
# Particular report:
data = url_decode(url.split('?')[1]).items() # decoding the args represented in JSON
response = self.report_routes(reportname, converter='pdf', **dict(data))
if docids:
# Generic report:
response = self.report_routes(reportname, docids=docids, converter='pdf')
response.headers.add('Content-Disposition', 'attachment; filename=%s.pdf;' % reportname)
response.set_cookie('fileToken', token)
return response
elif type =='controller':
reqheaders = Headers(request.httprequest.headers)
response = Client(request.httprequest.app, BaseResponse).get(url, headers=reqheaders, follow_redirects=True)
response.set_cookie('fileToken', token)
return response
else:
# Particular report:
data = url_decode(url.split('?')[1]).items() # decoding the args represented in JSON
response = self.report_routes(reportname, converter='pdf', **dict(data))
response.headers.add('Content-Disposition', 'attachment; filename=%s.pdf;' % reportname)
response.set_cookie('fileToken', token)
return response
elif type =='controller':
reqheaders = Headers(request.httprequest.headers)
response = Client(request.httprequest.app, BaseResponse).get(url, headers=reqheaders, follow_redirects=True)
response.set_cookie('fileToken', token)
return response
else:
return
return
except osv.except_osv, e:
se = _serialize_exception(e)
error = {
'code': 200,
'message': "OpenERP Server Error",
'data': se
}
return request.make_response(simplejson.dumps(error))
@route(['/report/check_wkhtmltopdf'], type='json', auth="user")
def check_wkhtmltopdf(self):

View File

@ -78,8 +78,7 @@ openerp.report = function(instance) {
}
return trigger_download(self.session, response, c);
});
}
else if (action.report_type == 'controller') {
} else if (action.report_type == 'controller') {
return trigger_download(self.session, response, c);
}
}