~mga/openobject-addons/account_india

« back to all changes in this revision

Viewing changes to hotel_restaurant/wizard/hotel_restaurant_wizard.py

  • Committer: nel
  • Date: 2008-06-30 10:35:41 UTC
  • Revision ID: nel-03c45417b57316f5a70158417e86ae57f721f235
Hotel and dependencies

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
##############################################################################
 
2
#
 
3
# Copyright (c) 2005-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
 
4
#
 
5
# WARNING: This program as such is intended to be used by professional
 
6
# programmers who take the whole responsability of assessing all potential
 
7
# consequences resulting from its eventual inadequacies and bugs
 
8
# End users who are looking for a ready-to-use solution with commercial
 
9
# garantees and support are strongly adviced to contract a Free Software
 
10
# Service Company
 
11
#
 
12
# This program is Free Software; you can redistribute it and/or
 
13
# modify it under the terms of the GNU General Public License
 
14
# as published by the Free Software Foundation; either version 2
 
15
# of the License, or (at your option) any later version.
 
16
#
 
17
# This program is distributed in the hope that it will be useful,
 
18
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
19
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
20
# GNU General Public License for more details.
 
21
#
 
22
# You should have received a copy of the GNU General Public License
 
23
# along with this program; if not, write to the Free Software
 
24
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
25
#
 
26
##############################################################################
 
27
from osv import fields
 
28
from osv import osv
 
29
import time
 
30
import ir
 
31
from mx import DateTime
 
32
import datetime
 
33
import pooler
 
34
from tools import config
 
35
import wizard
 
36
import netsvc
 
37
import pooler
 
38
 
 
39
kot_form = """<?xml version="1.0"?>
 
40
<form string="Create Kot">
 
41
    <separator colspan="4" string="Do you really want to create the Kot?" />
 
42
    <field name="grouped" />
 
43
</form>
 
44
"""
 
45
kot_fields = {
 
46
    'grouped' : {'string':'Group the kots', 'type':'boolean', 'default': lambda x,y,z: False}
 
47
}
 
48
 
 
49
ack_form = """<?xml version="1.0"?>
 
50
<form string="Create Kots">
 
51
    <separator string="Kots created" />
 
52
</form>"""
 
53
 
 
54
ack_fields = {}
 
55
 
 
56
res_form= """<?xml version="1.0"?>
 
57
<form string="Reservation List">
 
58
     <field name="date_start" />
 
59
     <field name="date_end" />
 
60
</form>
 
61
"""
 
62
 
 
63
res_field= {
 
64
    'date_start': {'string':'Start Date','type':'datetime','required': True},
 
65
    'date_end': {'string':'End Date','type':'datetime','required': True},
 
66
 
 
67
}
 
68
 
 
69
result_form = """<?xml version="1.0"?>
 
70
<form string="Create Kots">
 
71
    <separator string="Reservation List" />
 
72
</form>"""
 
73
 
 
74
result_fields = {}
 
75
 
 
76
 
 
77
 
 
78
def _makeKot(self, cr, uid, data, context):
 
79
 
 
80
 
 
81
#    order_obj = pooler.get_pool(cr.dbname).get('hotel.reservation')
 
82
#    newinv = []
 
83
#    for o in order_obj.browse(cr, uid, data['ids'], context):
 
84
#        for i in o.folio_id:
 
85
#           newinv.append(i.id)
 
86
#    return {
 
87
#        'domain': "[('id','in', ["+','.join(map(str,newinv))+"])]",
 
88
#        'name': 'Folios',
 
89
#        'view_type': 'form',
 
90
#        'view_mode': 'tree,form',
 
91
#        'res_model': 'hotel_reservation.folio',
 
92
#        'view_id': False,
 
93
#        'type': 'ir.actions.act_window'
 
94
#
 
95
#    }
 
96
    return {}
 
97
 
 
98
class make_kot(wizard.interface):
 
99
    states = {
 
100
        'init' : {
 
101
            'actions' : [],
 
102
            'result' : {'type' : 'form',
 
103
                    'arch' : kot_form,
 
104
                    'fields' : kot_fields,
 
105
                    'state' : [('end', 'Cancel'),('kot', 'Create Kots') ]}
 
106
        },
 
107
        'kot' : {
 
108
            'actions' : [_makeKot],
 
109
            'result' : {'type' : 'action',
 
110
                    'action' : _makeKot,
 
111
                    'state' : 'end'}
 
112
        },
 
113
    }
 
114
make_kot("hotel.kot.make_kot")
 
115
 
 
116
class get_reservation_list(wizard.interface):
 
117
 
 
118
    states = {
 
119
        'init' : {
 
120
            'actions' : [],
 
121
            'result' : {'type' : 'form',
 
122
                    'arch' : res_form,
 
123
                    'fields' : res_field,
 
124
                    'state' : [('end', 'Cancel'),('print_report', 'Reservation List') ]}
 
125
        },
 
126
        'print_report' : {
 
127
            'actions' : [],
 
128
            'result' : {'type' : 'print',
 
129
                    'report':'hotel.table.res',
 
130
                    'state' : 'end'}
 
131
        },
 
132
    }
 
133
get_reservation_list("hotel.table.reservation")
 
 
b'\\ No newline at end of file'