From 8db594758ee67f49e67eeb9af18c11d0c7cfa93c Mon Sep 17 00:00:00 2001 From: Simon Lejeune Date: Tue, 29 Apr 2014 13:40:45 +0200 Subject: [PATCH] [REM] point_of_sale: removed closed cashbox report that is nearly the session resume report bzr revid: sle@openerp.com-20140429114045-kaj86qq00dovj75o --- addons/point_of_sale/__openerp__.py | 1 - .../account_statement_report.xml | 8 - addons/point_of_sale/report/__init__.py | 1 - .../report/all_closed_cashbox_of_the_day.py | 147 ------------------ addons/point_of_sale/report/pos_report.py | 1 - .../test/account_statement_reports.yml | 11 -- .../views/report_closedcashbox.xml | 68 -------- 7 files changed, 237 deletions(-) delete mode 100644 addons/point_of_sale/report/all_closed_cashbox_of_the_day.py delete mode 100644 addons/point_of_sale/views/report_closedcashbox.xml diff --git a/addons/point_of_sale/__openerp__.py b/addons/point_of_sale/__openerp__.py index ad82c7e05a6..8b97062f0c2 100644 --- a/addons/point_of_sale/__openerp__.py +++ b/addons/point_of_sale/__openerp__.py @@ -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', diff --git a/addons/point_of_sale/account_statement_report.xml b/addons/point_of_sale/account_statement_report.xml index 2f08ee7f6d8..61cc1b891f4 100644 --- a/addons/point_of_sale/account_statement_report.xml +++ b/addons/point_of_sale/account_statement_report.xml @@ -17,13 +17,5 @@ file="point_of_sale.report_usersproduct" report_type="qweb-pdf" /> - diff --git a/addons/point_of_sale/report/__init__.py b/addons/point_of_sale/report/__init__.py index aa8d4c080d8..ce424c84b1b 100644 --- a/addons/point_of_sale/report/__init__.py +++ b/addons/point_of_sale/report/__init__.py @@ -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 diff --git a/addons/point_of_sale/report/all_closed_cashbox_of_the_day.py b/addons/point_of_sale/report/all_closed_cashbox_of_the_day.py deleted file mode 100644 index 1bb51e82048..00000000000 --- a/addons/point_of_sale/report/all_closed_cashbox_of_the_day.py +++ /dev/null @@ -1,147 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2010 Tiny SPRL (). -# -# 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 . -# -############################################################################## - -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: diff --git a/addons/point_of_sale/report/pos_report.py b/addons/point_of_sale/report/pos_report.py index 96b056fb0fc..82c5ba3b7d2 100644 --- a/addons/point_of_sale/report/pos_report.py +++ b/addons/point_of_sale/report/pos_report.py @@ -20,7 +20,6 @@ ############################################################################## from openerp.osv import fields, osv -import time from openerp import tools class report_transaction_pos(osv.osv): diff --git a/addons/point_of_sale/test/account_statement_reports.yml b/addons/point_of_sale/test/account_statement_reports.yml index 30eb7d5741d..99a11a7b3e8 100644 --- a/addons/point_of_sale/test/account_statement_reports.yml +++ b/addons/point_of_sale/test/account_statement_reports.yml @@ -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 - diff --git a/addons/point_of_sale/views/report_closedcashbox.xml b/addons/point_of_sale/views/report_closedcashbox.xml deleted file mode 100644 index 4b936468341..00000000000 --- a/addons/point_of_sale/views/report_closedcashbox.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - - - -