[FIX/IMP] point_of_sale : YML test for report added and corrected the reports

bzr revid: ach@tinyerp.com-20100917122936-n89nhvb9uor5cmo3
This commit is contained in:
Anup (OpenERP) 2010-09-17 17:59:36 +05:30
parent bcbdcde958
commit fc889e24dd
7 changed files with 105 additions and 30 deletions

View File

@ -75,8 +75,7 @@ Main features :
'demo_xml': ['pos_demo.xml','singer_statement_demo.xml','multi_company_stock_data.xml',],
'test':['test/pos_test.yml',
'test/pos_report.yml',
'test/pos_details.yml',
'test/pos_payment_report_date.yml'],
],
'installable': True,
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -61,5 +61,14 @@
<field name="notice">Discount Applied</field>
</record>
<record id="account_bank_statement_st0" model="account.bank.statement">
<field name="name">St. 05/19</field>
<field name="balance_end_real">0.0</field>
<field name="date">2010-05-19</field>
<field name="journal_id" ref="account.bank_journal"/>
<field name="period_id" ref="account.period_5"/>
<field name="state">draft</field>
</record>
</data>
</openerp>

View File

@ -40,13 +40,13 @@ class pos_payment_report_user(report_sxw.rml_parse):
"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 in ('paid','invoiced') and to_char(date_trunc('day',po.date_order),'YYYY-MM-DD')::date = current_date " \
"and po.user_id IN %s",(tuple(ids), )
self.cr.execute (sql)
"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):
def __pos_payment_user__total__(self, form):
res=[]
ids = form['user_id'][0][-1]
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 " \

View File

@ -42,7 +42,7 @@ class pos_user_product(report_sxw.rml_parse):
a_l=[]
for r in data:
a_l.append(r['id'])
if len(a):
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""",(tuple(a_l),)
self.cr.execute(sql2)
data = self.cr.dictfetchall()

View File

@ -1,8 +0,0 @@
-
In order to test the PDF reports defined on a Point Of Sale, we will print a POS Details report
-
!python {model: ir.ui.menu}: |
import netsvc, tools, os, time
(data, format) = netsvc.LocalService('report.pos.details').create(cr, uid, [], {'model':'ir.ui.menu', 'form':{'date_start': time.strftime('%Y-%m-%d'), 'date_end': time.strftime('%Y-%m-%d') }}, {})
if tools.config['test_report_directory']:
file(os.path.join(tools.config['test_report_directory'], 'point_of_sale- pos details report'+format), 'wb+').write(data)

View File

@ -1,8 +0,0 @@
-
In order to test the PDF reports defined on a Point Of Sale, we will print a POS Sales Lines report
-
!python {model: ir.ui.menu}: |
import netsvc, tools, os, time
(data, format) = netsvc.LocalService('report.pos.payment.report.date').create(cr, uid, [1], {'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')] }}, {})
if tools.config['test_report_directory']:
file(os.path.join(tools.config['test_report_directory'], 'point_of_sale- pos sales lines report'+format), 'wb+').write(data)

View File

@ -1,5 +1,5 @@
-
In order to test the PDF reports defined on a Point Of Sale, we will print a POS Detail Summary report
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 netsvc, tools, os
@ -8,7 +8,7 @@
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
In order to test the PDF reports defined on a Point Of Sale, we will print a POS Invoice Report
-
!python {model: pos.order}: |
import netsvc, tools, os
@ -17,7 +17,7 @@
file(os.path.join(tools.config['test_report_directory'], 'point_of_sale-invoice report'+format), 'wb+').write(data)
-
In order to test the PDF reports defined on a Point Of Sale, we will print a POS Lines report
In order to test the PDF reports defined on a Point Of Sale, we will print a POS Lines Report
-
!python {model: pos.order}: |
import netsvc, tools, os
@ -26,7 +26,7 @@
file(os.path.join(tools.config['test_report_directory'], 'point_of_sale-lines report'+format), 'wb+').write(data)
-
In order to test the PDF reports defined on a Point of Sale, we will print a POS Receipt report
In order to test the PDF reports defined on a Point of Sale, we will print a POS Receipt Report
-
!python {model: pos.order}: |
import netsvc, tools, os
@ -35,7 +35,7 @@
file(os.path.join(tools.config['test_report_directory'], 'point_of_sale-receipt report'+format), 'wb+').write(data)
-
In order to test the PDF reports defined on a Point of Sale, we will print a POS Receipt With Reimbursement report
In order to test the PDF reports defined on a Point of Sale, we will print a POS Receipt With Reimbursement Report
-
!python {model: pos.order}: |
import netsvc, tools, os
@ -44,10 +44,93 @@
file(os.path.join(tools.config['test_report_directory'], 'point_of_sale-receipt with reimbursement report'+format), 'wb+').write(data)
-
In order to test the PDF reports defined on a point of sale, we will print a POS Receipt Without Reimbursement report
In order to test the PDF reports defined on a point of sale, we will print a POS Receipt Without Reimbursement Report
-
!python {model: pos.order}: |
import netsvc, tools, os
(data, format) = netsvc.LocalService('report.pos.receipt.without.remboursment').create(cr, uid, [ref('point_of_sale.order_pos1'), ref('point_of_sale.order_pos2')], {}, {})
if tools.config['test_report_directory']:
file(os.path.join(tools.config['test_report_directory'], 'point_of_sale-receipt without reimbursement report'+format), 'wb+').write(data)
file(os.path.join(tools.config['test_report_directory'], 'point_of_sale-receipt without reimbursement 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 Report
-
!python {model: ir.ui.menu}: |
import netsvc, tools, os, time
(data, format) = netsvc.LocalService('report.pos.payment.report.date').create(cr, uid, [1], {'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')] }}, {})
if tools.config['test_report_directory']:
file(os.path.join(tools.config['test_report_directory'], 'point_of_sale- pos sales lines report'+format), 'wb+').write(data)
-
In order to test the PDF reports defined on a Point Of Sale, we will print a POS Details Report
-
!python {model: ir.ui.menu}: |
import netsvc, tools, os, time
(data, format) = netsvc.LocalService('report.pos.details').create(cr, uid, [], {'model':'ir.ui.menu', 'form':{'date_start': time.strftime('%Y-%m-%d'), 'date_end': time.strftime('%Y-%m-%d') }}, {})
if tools.config['test_report_directory']:
file(os.path.join(tools.config['test_report_directory'], 'point_of_sale- pos details report'+format), 'wb+').write(data)
-
In order to test the PDF reports defined on a Point Of Sale, we will print a Account Statement Report
-
!python {model: account.bank.statement}: |
import netsvc, tools, os, time
(data, format) = netsvc.LocalService('report.account.statement').create(cr, uid, [ref('point_of_sale.account_bank_statement_st0')], {}, {})
if tools.config['test_report_directory']:
file(os.path.join(tools.config['test_report_directory'], 'point_of_sale-account_statement_report'+format), 'wb+').write(data)
-
In order to test the PDF reports defined on a Point Of Sale, we will print a POS User Product Report
-
!python {model: account.bank.statement}: |
import netsvc, tools, os, time
(data, format) = netsvc.LocalService('report.pos.user.product').create(cr, uid, [ref('point_of_sale.account_bank_statement_st0')], {}, {})
if tools.config['test_report_directory']:
file(os.path.join(tools.config['test_report_directory'], 'point_of_sale-user_product_report'+format), 'wb+').write(data)
-
In order to test the PDF reports defined on a Point Of Sale, we will print a POS All Close Cashbox Of the Day Report
-
!python {model: account.bank.statement}: |
import netsvc, tools, os, time
(data, format) = netsvc.LocalService('report.all.closed.cashbox.of.the.day').create(cr, uid, [ref('point_of_sale.account_bank_statement_st0')], {}, {})
if tools.config['test_report_directory']:
file(os.path.join(tools.config['test_report_directory'], 'point_of_sale-all_closed_cash_box_of_the_day_report'+format), 'wb+').write(data)
-
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 netsvc, tools, os, time
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) = netsvc.LocalService('report.pos.sales.user').create(cr, uid, [ref('point_of_sale.order_pos1'), ref('point_of_sale.order_pos2')], 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 Sales User Today Report
-
!python {model: pos.order}: |
import netsvc, tools, os, time
data_dict = {'model':'ir.ui.menu', 'form':{'user_id':[ref('base.user_root')] }}
(data, format) = netsvc.LocalService('report.pos.sales.user.today').create(cr, uid, [ref('point_of_sale.order_pos1'), ref('point_of_sale.order_pos2')], data_dict, {})
if tools.config['test_report_directory']:
file(os.path.join(tools.config['test_report_directory'], 'point_of_sale-sales_user_today_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
-
!python {model: pos.order}: |
import netsvc, tools, os, time
(data, format) = netsvc.LocalService('report.pos.payment.report').create(cr, uid, [ref('point_of_sale.order_pos1'), ref('point_of_sale.order_pos2')], {}, {})
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 netsvc, tools, os, time
data_dict = {'model':'ir.ui.menu', 'form':{'user_id':[ref('base.user_root'),ref('base.user_demo')] }}
(data, format) = netsvc.LocalService('report.pos.payment.report.user').create(cr, uid, [ref('point_of_sale.order_pos1'), ref('point_of_sale.order_pos2')], 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)
-
In order to test the PDF reports defined on a Point of Sale, we will print a POS Today's Sales of Current User Report
-
!python {model: pos.order}: |
import netsvc, tools, os, time
(data, format) = netsvc.LocalService('report.pos.sales.user.today.current.user').create(cr, uid, [ref('point_of_sale.order_pos1'), ref('point_of_sale.order_pos2')], {}, {})
if tools.config['test_report_directory']:
file(os.path.join(tools.config['test_report_directory'], 'point_of_sale-sales_today_current_user_report'+format), 'wb+').write(data)