~openerp-commiter/openobject-addons/extra-6.0

« back to all changes in this revision

Viewing changes to hotel_housekeeping/hotel_housekeeping.py

  • Committer: Apa(Open ERP)
  • Date: 2009-04-27 13:38:52 UTC
  • Revision ID: apa@tinyerp.com-20090427133852-r2h309wkar0aobz2
Add hotel's module

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# -*- encoding: utf-8 -*-
2
1
##############################################################################
3
 
#
4
 
#    OpenERP, Open Source Management Solution   
5
 
#    Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved
6
 
#    $Id$
7
 
#
8
 
#    This program is free software: you can redistribute it and/or modify
9
 
#    it under the terms of the GNU General Public License as published by
10
 
#    the Free Software Foundation, either version 3 of the License, or
11
 
#    (at your option) any later version.
12
 
#
13
 
#    This program is distributed in the hope that it will be useful,
14
 
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 
#    GNU General Public License for more details.
17
 
#
18
 
#    You should have received a copy of the GNU General Public License
19
 
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
2
#Copyright (c) 2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
 
3
#                    Fabien Pinckaers <fp@tiny.Be>
 
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.
20
25
#
21
26
##############################################################################
22
27
 
30
35
from tools import config
31
36
import netsvc
32
37
 
 
38
class product_category(osv.osv):
 
39
    _inherit="product.category"
 
40
    _columns = {
 
41
        'isactivitytype':fields.boolean('Is Activity Type'),
 
42
    }
 
43
product_category()
 
44
 
 
45
class hotel_housekeeping_activity_type(osv.osv):
 
46
    _name='hotel.housekeeping.activity.type'
 
47
    _description='Activity Type'
 
48
    _inherits = {'product.category':'activity_id'}
 
49
    _columns = {
 
50
        'activity_id':fields.many2one('product.category','category',required=True),
 
51
       }
 
52
    _defaults = {
 
53
        'isactivitytype': lambda *a: 1,
 
54
 
 
55
    }
 
56
#end class
 
57
hotel_housekeeping_activity_type()
 
58
 
 
59
 
 
60
class product_product(osv.osv):
 
61
    _inherit="product.product"
 
62
    _columns = {
 
63
        'isact':fields.boolean('Is Activity'),
 
64
                
 
65
    }
 
66
product_product()
 
67
 
 
68
 
 
69
class h_activity(osv.osv):
 
70
  
 
71
    _name='h.activity'
 
72
    _inherits={'product.product':'h_id'}
 
73
   
 
74
    _description='Housekeeping Activity'
 
75
    _columns = {
 
76
        'h_id': fields.many2one('product.product','Product_id'),
 
77
       }
 
78
    _defaults = {
 
79
        'isact': lambda *a: 1,
 
80
       }
 
81
#end class
 
82
h_activity()
 
83
 
 
84
 
33
85
class hotel_housekeeping(osv.osv):
34
86
    _name = "hotel.housekeeping"
35
87
    _description = "Reservation"
39
91
        'room_no':fields.many2one('hotel.room','Room No',required=True),
40
92
        'activity_lines':fields.one2many('hotel.housekeeping.activities','a_list','Activities'),
41
93
        'room_no':fields.many2one('product.product','Room No',required=True),
42
 
        'activity_lines':fields.one2many('hotel.housekeeping.activities','a_list','Activities'),
43
94
        'inspector':fields.many2one('res.users','Inspector',required=True),
44
95
        'inspect_date_time':fields.datetime('Inspect Date Time',required=True),
45
96
        'quality':fields.selection([('good','Good'),('ok','Ok')],'Quality',required=True),
58
109
        return True
59
110
    
60
111
    def room_cancel(self, cr, uid, ids, *args):
61
 
 
 
112
        print "CANCEL"
62
113
        self.write(cr, uid, ids, {
63
114
            'state':'cancel'
64
115
        })
 
116
        
65
117
        return True
66
118
 
67
119
    def room_done(self, cr, uid, ids, *args):
68
 
 
 
120
        print "DONE"
69
121
        self.write(cr, uid, ids, {
70
122
            'state':'done'
71
123
        })
83
135
        self.write(cr, uid, ids, {
84
136
            'state':'clean'
85
137
        })
 
138
        
86
139
        return True
87
 
    
88
 
    
89
 
    
90
 
    
 
140
   
91
141
#end class
92
142
hotel_housekeeping()  
93
143
 
94
 
class product_category(osv.osv):
95
 
    _inherit="product.category"
96
 
    _columns = {
97
 
        'isactivitytype':fields.boolean('Is Activity Type'),
98
 
    }
99
 
product_category()
100
 
 
101
 
class hotel_housekeeping_activity_type(osv.osv):
102
 
    _name='hotel.housekeeping.activity.type'
103
 
    _description='Activity Type'
104
 
    _inherits = {'product.category':'activity_id'}
105
 
    _columns = {
106
 
        'activity_id':fields.many2one('product.category','category',required=True),
107
 
       }
108
 
    _defaults = {
109
 
        'isactivitytype': lambda *a: 1,
110
 
 
111
 
    }
112
 
#end class
113
 
hotel_housekeeping_activity_type()
 
144
 
114
145
  
115
 
class housekeeping_activity(osv.osv):
116
 
    _name = "housekeeping.activity"
117
 
    _description = "Housekeeping Activity List"
118
 
    _columns = {
119
 
        'name':fields.char('Activity Name',size=64,required=True),
120
 
        'categ_id':fields.many2one('product.category','Category', required=True, change_default=True),
121
 
        }
122
 
#end class
123
 
housekeeping_activity()
 
146
#class housekeeping_activity(osv.osv):
 
147
#    _name = "housekeeping.activity"
 
148
#    _description = "Housekeeping Activity List"
 
149
#    _columns = {
 
150
#        'name':fields.char('Activity Name',size=64,required=True),
 
151
#        'categ_id':fields.many2one('product.category','Category', required=True, change_default=True),
 
152
#        }
 
153
##end class
 
154
#housekeeping_activity()
124
155
 
125
156
class hotel_housekeeping_activities(osv.osv):
126
157
    _name = "hotel.housekeeping.activities"
127
158
    _description = "Housekeeping Activities "
128
159
    _columns = {
129
160
        'a_list':fields.many2one('hotel.housekeeping'),
130
 
        'activity_name':fields.many2one('housekeeping.activity','Housekeeping Activity'),
131
 
        'housekeeper':fields.many2one('res.users','Housekeeper'),
 
161
        'activity_name':fields.many2one('h.activity','Housekeeping Activity'),
 
162
        'housekeeper':fields.many2one('res.users','Housekeeper',required=True),
132
163
        'clean_start_time':fields.datetime('Clean Start Time',required=True),
133
164
        'clean_end_time':fields.datetime('Clean End Time',required=True),
134
165
        'dirty':fields.boolean('Dirty'),
138
169
#end class
139
170
hotel_housekeeping_activities()
140
171
 
141
 
class product_category(osv.osv):
142
 
    _inherit="product.category"
143
 
    _columns = {
144
 
        'isactivitytype':fields.boolean('Is Activity Type'),
145
 
    }
146
 
product_category()
147
 
 
148
 
class hotel_housekeeping_activity_type(osv.osv):
149
 
    _name='hotel.housekeeping.activity.type'
150
 
    _description='Activity Type'
151
 
    _inherits = {'product.category':'activity_id'}
152
 
    _columns = {
153
 
        'activity_id':fields.many2one('product.category','category',required=True),
154
 
       }
155
 
    _defaults = {
156
 
        'isactivitytype': lambda *a: 1,
157
 
 
158
 
    }
159
 
#end class
160
 
hotel_housekeeping_activity_type()
161
 
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
162
172