~ubuntu-branches/ubuntu/quantal/openerp6.1/quantal-proposed

« back to all changes in this revision

Viewing changes to openerp/addons/point_of_sale/report/report_cash_register.py

  • Committer: Package Import Robot
  • Author(s): Yolanda Robla
  • Date: 2012-09-20 15:29:00 UTC
  • Revision ID: package-import@ubuntu.com-20120920152900-woyy3yww8z6acmsk
Tags: upstream-6.1-1+dfsg
ImportĀ upstreamĀ versionĀ 6.1-1+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- coding: utf-8 -*-
 
2
##############################################################################
 
3
#
 
4
#    OpenERP, Open Source Management Solution
 
5
#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
 
6
#
 
7
#    This program is free software: you can redistribute it and/or modify
 
8
#    it under the terms of the GNU Affero General Public License as
 
9
#    published by the Free Software Foundation, either version 3 of the
 
10
#    License, or (at your option) any later version.
 
11
#
 
12
#    This program is distributed in the hope that it will be useful,
 
13
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
15
#    GNU Affero General Public License for more details.
 
16
#
 
17
#    You should have received a copy of the GNU Affero General Public License
 
18
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
19
#
 
20
##############################################################################
 
21
 
 
22
import tools
 
23
from osv import fields,osv
 
24
 
 
25
class report_cash_register(osv.osv):
 
26
    _name = "report.cash.register"
 
27
    _description = "Point of Sale Cash Register Analysis"
 
28
    _auto = False
 
29
    _columns = {
 
30
        'date': fields.date('Create Date', readonly=True),
 
31
        'year': fields.char('Year', size=4),
 
32
        'month':fields.selection([('01','January'), ('02','February'), ('03','March'), ('04','April'),
 
33
            ('05','May'), ('06','June'), ('07','July'), ('08','August'), ('09','September'),
 
34
            ('10','October'), ('11','November'), ('12','December')], 'Month',readonly=True),
 
35
        'day': fields.char('Day', size=128, readonly=True),
 
36
        'user_id':fields.many2one('res.users', 'User', readonly=True),
 
37
        'state': fields.selection([('draft', 'Quotation'),('open','Open'),('confirm', 'Confirmed')],'State'),
 
38
        'journal_id': fields.many2one('account.journal', 'Journal'),
 
39
        'balance_start': fields.float('Opening Balance'),
 
40
        'balance_end_real': fields.float('Closing Balance'),
 
41
    }
 
42
    _order = 'date desc'
 
43
 
 
44
    def init(self, cr):
 
45
        tools.drop_view_if_exists(cr, 'report_cash_register')
 
46
        cr.execute("""
 
47
            create or replace view report_cash_register as (
 
48
                select
 
49
                    min(s.id) as id,
 
50
                    to_date(to_char(s.create_date, 'dd-MM-YYYY'),'dd-MM-YYYY') as date,
 
51
                    s.user_id as user_id,
 
52
                    s.journal_id as journal_id,
 
53
                    s.state as state,
 
54
                    s.balance_start as balance_start,
 
55
                    s.balance_end_real as balance_end_real,
 
56
                    to_char(s.create_date, 'YYYY') as year,
 
57
                    to_char(s.create_date, 'MM') as month,
 
58
                    to_char(s.create_date, 'YYYY-MM-DD') as day
 
59
                from account_bank_statement as s
 
60
                group by
 
61
                        s.user_id,s.journal_id, s.balance_start, s.balance_end_real,s.state,to_char(s.create_date, 'dd-MM-YYYY'),
 
62
                        to_char(s.create_date, 'YYYY'),
 
63
                        to_char(s.create_date, 'MM'),
 
64
                        to_char(s.create_date, 'YYYY-MM-DD'))""")
 
65
 
 
66
report_cash_register()
 
67
 
 
68
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
 
 
b'\\ No newline at end of file'