# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
-from datetime import timedelta
+import datetime
import pytz
from openerp import models, fields, api, _
from openerp.exceptions import Warning
+
class event_type(models.Model):
""" Event Type """
_name = 'event.type'
readonly=False, states={'done': [('readonly', True)]})
type = fields.Many2one('event.type', string='Type of Event',
readonly=False, states={'done': [('readonly', True)]})
+ color = fields.Integer('Kanban Color Index')
seats_max = fields.Integer(string='Maximum Available Seats', oldname='register_max',
readonly=True, states={'draft': [('readonly', False)]},
help="You can for each event define a maximum registration level. If you have too much registrations you are not able to confirm your event. (put 0 to ignore this rule )")
regs = regs.sudo().create({
'event_id': self.id,
'email': user.email,
- 'name':user.name,
+ 'name': user.name,
'user_id': user.id,
'nb_register': num_of_seats,
})
self.seats_min = self.type.default_registration_min
self.seats_max = self.type.default_registration_max
- @api.onchange('date_begin')
- def _onchange_date_begin(self):
- if self.date_begin and not self.date_end:
- date_begin = fields.Datetime.from_string(self.date_begin)
- self.date_end = fields.Datetime.to_string(date_begin + timedelta(hours=1))
+ @api.multi
+ def action_event_registration_report(self):
+ res = self.env['ir.actions.act_window'].for_xml_id('event', 'action_report_event_registration')
+ res['context'] = {
+ "search_default_event_id": self.id,
+ "group_by": ['event_date:day'],
+ }
+ return res
class event_registration(models.Model):