[REM] point_of_sale: removed closed cashbox report that is nearly the session resume report

bzr revid: sle@openerp.com-20140429114045-kaj86qq00dovj75o
This commit is contained in:
Simon Lejeune 2014-04-29 13:40:45 +02:00
parent fe90837cb2
commit 8db594758e
7 changed files with 0 additions and 237 deletions

View File

@ -72,7 +72,6 @@ Main Features
'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',

View File

@ -17,13 +17,5 @@
file="point_of_sale.report_usersproduct"
report_type="qweb-pdf"
/>
<report
id="action_report_closed_cashbox"
string="All Closed CashBox"
model="account.bank.statement"
name="point_of_sale.report_closedcashbox"
file="point_of_sale.report_closedcashbox"
report_type="qweb-pdf"
/>
</data>
</openerp>

View File

@ -21,7 +21,6 @@
import pos_users_product
import account_statement
import all_closed_cashbox_of_the_day
import pos_receipt
import pos_invoice
import pos_lines

View File

@ -1,147 +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
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):
super(all_closed_cashbox_of_the_day, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
'get_data':self._get_data,
'get_bal':self._get_bal,
'get_lines':self._get_lines,
'get_partner':self._get_partner,
'get_net_total':self._get_net_total,
'get_user':self._get_user,
'get_sub_total':self._get_sub_total,
'get_net_total_starting':self._get_net_total_starting,
})
def _get_user(self, line_ids):
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.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
LEFT JOIN res_users as ru ON ru.id = abs.user_id
LEFT JOIN res_company as rc ON rc.id = abs.company_id
WHERE to_char(date_trunc('day',abs.date),'YYYY-MM-DD')::date = current_date and abs.state IN ('confirm','open') and abs.user_id = %d"""%(user.id)
self.cr.execute(sql)
data = self.cr.dictfetchall()
return data
def _get_lines(self, statement):
data = {}
sql = """ select absl.* from account_bank_statement_line as absl, account_bank_statement as abs
where absl.statement_id = abs.id and abs.id = %d"""%(statement['id'])
self.cr.execute(sql)
data = self.cr.dictfetchall()
return data
def _get_bal(self, data):
res = {}
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:
return res[0]['bal']
else:
return 0
def _get_sub_total(self, user, data, date):
res={}
self.cr.execute(""" select sum(absl.amount) from account_bank_statement as abs
LEFT JOIN account_bank_statement_line as absl ON abs.id = absl.statement_id
WHERE abs.journal_id = %d
and abs.state IN ('confirm','open')
and abs.date = '%s'
and abs.user_id = %d
"""%(data,date,user.id))
res = self.cr.fetchall()
if res[0][0]:
return res[0][0]
else:
return False
def _get_partner(self, statement):
res = {}
if statement['pos_statement_id']:
sql =""" select rp.name from account_bank_statement_line as absl,res_partner as rp
where absl.partner_id = rp.id
and absl.pos_statement_id = %d"""%(statement['pos_statement_id'])
self.cr.execute(sql)
res = self.cr.dictfetchall() or {}
return res and res[0]['name']
else:
return 0.00
def _get_net_total_starting(self, user):
lst = []
res={}
total_ending_bal = 0.0
total_starting_bal = 0.0
sql = """ SELECT abs.id,abs.balance_end_real as net_total FROM account_bank_statement as abs
WHERE to_char(date_trunc('day',abs.date),'YYYY-MM-DD')::date = current_date
and abs.state IN ('confirm','open')
and abs.user_id = %d"""%(user.id)
self.cr.execute(sql)
res = self.cr.dictfetchall()
for r in res:
total_ending_bal += (r['net_total'] or 0.0)
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']:
total_starting_bal += data[0]['bal']
lst.append(total_ending_bal)
lst.append(total_starting_bal)
return lst
def _get_net_total(self, user):
res={}
sql = """select sum(absl.amount) as net_total from account_bank_statement as abs
LEFT JOIN account_bank_statement_line as absl ON abs.id = absl.statement_id
where abs.state IN ('confirm','open') and abs.user_id = %d
and to_char(date_trunc('day',abs.date),'YYYY-MM-DD')::date = current_date """%(user.id)
self.cr.execute(sql)
res = self.cr.dictfetchall()
return res[0]['net_total'] or 0.0
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

@ -20,7 +20,6 @@
##############################################################################
from openerp.osv import fields, osv
import time
from openerp import tools
class report_transaction_pos(osv.osv):

View File

@ -59,17 +59,6 @@
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
-

View File

@ -1,68 +0,0 @@
<?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>