From 70a95da4b3ae6f5000ff0bedfe127955a5ba21fb Mon Sep 17 00:00:00 2001 From: "DBR (OpenERP)" Date: Thu, 8 Jul 2010 13:06:35 +0530 Subject: [PATCH] [ADD] point_of_sale : New Cash register report added bzr revid: dbr@tinyerp.com-20100708073635-187ijt0xf1gsw62q --- addons/point_of_sale/__openerp__.py | 1 + .../report/report_cash_register.py | 64 +++++++++++++ .../report/report_cash_register_view.xml | 89 +++++++++++++++++++ 3 files changed, 154 insertions(+) create mode 100644 addons/point_of_sale/report/report_cash_register.py create mode 100644 addons/point_of_sale/report/report_cash_register_view.xml diff --git a/addons/point_of_sale/__openerp__.py b/addons/point_of_sale/__openerp__.py index c9015d4be28..bbfa1677ea2 100644 --- a/addons/point_of_sale/__openerp__.py +++ b/addons/point_of_sale/__openerp__.py @@ -67,6 +67,7 @@ Main features : # 'pos_wizard.xml', 'pos_view.xml', 'report/report_pos_order_view.xml', + 'report/report_cash_register_view.xml', 'pos_sequence.xml', 'posrule_data.xml', 'pos_data.xml', diff --git a/addons/point_of_sale/report/report_cash_register.py b/addons/point_of_sale/report/report_cash_register.py new file mode 100644 index 00000000000..a7eb4af191c --- /dev/null +++ b/addons/point_of_sale/report/report_cash_register.py @@ -0,0 +1,64 @@ +# -*- 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 tools +from osv import fields,osv + +class report_cash_register(osv.osv): + _name = "report.cash.register" + _description = "Point of Sale Cash Register Analysis" + _auto = False + _columns ={ + 'date': fields.date('Create Date', readonly=True), + 'year': fields.char('Year', size=4), + 'month':fields.selection([('01','January'), ('02','February'), ('03','March'), ('04','April'), + ('05','May'), ('06','June'), ('07','July'), ('08','August'), ('09','September'), + ('10','October'), ('11','November'), ('12','December')], 'Month',readonly=True), + 'day': fields.char('Day', size=128, readonly=True), + 'user_id':fields.many2one('res.users', 'User', readonly=True), + 'state':fields.selection([('draft', 'Draft'),('confirm', 'Confirmed')],'State'), + 'journal_id': fields.many2one('account.journal', 'Journal'), + 'balance_start': fields.float('Opening Balance'), + 'balance_end_real': fields.float('Closing Balance'), + } + _order = 'date desc' + def init(self, cr): + tools.drop_view_if_exists(cr, 'report_cash_register') + cr.execute(""" + create or replace view report_cash_register as ( + select + min(s.id) as id, + to_date(to_char(s.create_date, 'dd-MM-YYYY'),'dd-MM-YYYY') as date, + s.user_id as user_id, + s.journal_id as journal_id, + s.state as state, + s.balance_start as balance_start, + s.balance_end_real as balance_end_real, + to_char(s.create_date, 'YYYY') as year, + to_char(s.create_date, 'MM') as month, + to_char(s.create_date, 'YYYY-MM-DD') as day + from account_bank_statement as s where s.user_id=1 + group by + s.user_id,s.journal_id, s.balance_start, s.balance_end_real,s.state,to_char(s.create_date, 'dd-MM-YYYY'), + to_char(s.create_date, 'YYYY'), + to_char(s.create_date, 'MM'), + to_char(s.create_date, 'YYYY-MM-DD'))""") + +report_cash_register() diff --git a/addons/point_of_sale/report/report_cash_register_view.xml b/addons/point_of_sale/report/report_cash_register_view.xml new file mode 100644 index 00000000000..c1af53d0abc --- /dev/null +++ b/addons/point_of_sale/report/report_cash_register_view.xml @@ -0,0 +1,89 @@ + + + + + report.cash.register.tree + report.cash.register + tree + + + + + + + + + + + + + + + + + report.cash.register.search + report.cash.register + search + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Cash Register Analysis + report.cash.register + form + tree,form + + {'search_default_today':1,'search_default_User':1,'group_by_no_leaf':1,'group_by':[]} + + + + +