diff --git a/addons/event/__terp__.py b/addons/event/__terp__.py
index 654492e4ddf..bd61f486a05 100644
--- a/addons/event/__terp__.py
+++ b/addons/event/__terp__.py
@@ -42,12 +42,14 @@
'init_xml': ['event_data.xml'],
'update_xml': [
'event_wizard.xml',
+ 'wizard/event_confirm_registration_view.xml',
'event_view.xml',
'event_sequence.xml',
'security/event_security.xml',
'security/ir.model.access.csv',
'wizard/event_registration_view.xml',
'wizard/event_registrations_partner.xml',
+
],
'demo_xml': ['event_demo.xml'],
'installable': True,
diff --git a/addons/event/event.py b/addons/event/event.py
index e5485edc44e..ffdeb84d15d 100644
--- a/addons/event/event.py
+++ b/addons/event/event.py
@@ -151,6 +151,31 @@ event()
class event_registration(osv.osv):
+ def check_confirm(self, cr, uid, ids, context):
+ mod_obj = self.pool.get('ir.model.data')
+ current_registration = self.browse(cr, uid, [ids[0]])[0]
+ total_confirmed = current_registration.event_id.register_current + current_registration.nb_register
+ if total_confirmed <= current_registration.event_id.register_max or current_registration.event_id.register_max == 0:
+ self.write(cr, uid, [ids[0]], {'state':'open'}, context=context)
+ self._history(cr, uid, [ids[0]], 'Open', history=True)
+ self.mail_user(cr, uid, [ids[0]])
+ return True
+ else:
+ model_data_ids = mod_obj.search(cr,uid,[('model','=','ir.ui.view'),('name','=','view_event_confirm_registration')], context=context)
+ resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id']
+ context.update({'reg_id': ids[0]})
+ return {
+ 'name': _('Confirm Registration'),
+ 'context': context,
+ 'view_type': 'form',
+ 'view_mode': 'tree,form',
+ 'res_model': 'event.confirm.registration',
+ 'views': [(resource_id,'form')],
+ 'type': 'ir.actions.act_window',
+ 'target': 'new',
+ 'nodestroy': True
+ }
+
def _history(self, cr, uid,ids,keyword, history=False, email=False, context={}):
for case in self.browse(cr, uid, ids):
if not case.case_id:
@@ -244,14 +269,14 @@ class event_registration(osv.osv):
"invoice_id":fields.many2one("account.invoice","Invoice"),
'date_closed': fields.datetime('Closed', readonly=True),
'ref' : fields.reference('Reference', selection=crm._links_get, size=128),
- 'ref2' : fields.reference('Reference 2', selection=crm._links_get, size=128),
+ 'ref2' : fields.reference('Reference 2', selection=crm._links_get, size=128),
'categ_id': fields.many2one('crm.case.categ','Category', domain="[('section_id','=',section_id)]"),
'canal_id': fields.many2one('res.partner.canal', 'Channel',help="The channels represent the different communication modes available with the customer." \
" With each commercial opportunity, you can indicate the canall which is this opportunity source."),
'som': fields.many2one('res.partner.som', 'State of Mind', help="The minds states allow to define a value scale which represents" \
"the partner mentality in relation to our services.The scale has" \
"to be created with a factor for each level from 0 (Very dissatisfied) to 10 (Extremely satisfied)."),
-
+
}
_defaults = {
'nb_register': lambda *a: 1,
diff --git a/addons/event/event_view.xml b/addons/event/event_view.xml
index cd904657acd..3655e73afe6 100644
--- a/addons/event/event_view.xml
+++ b/addons/event/event_view.xml
@@ -203,7 +203,7 @@
-
+
diff --git a/addons/event/event_wizard.xml b/addons/event/event_wizard.xml
index 2888bd8587f..7042b4e67b5 100644
--- a/addons/event/event_wizard.xml
+++ b/addons/event/event_wizard.xml
@@ -2,31 +2,12 @@
-
-
-
-
-
-
-
diff --git a/addons/event/wizard/__init__.py b/addons/event/wizard/__init__.py
index f197adebe0a..b151b760d9f 100644
--- a/addons/event/wizard/__init__.py
+++ b/addons/event/wizard/__init__.py
@@ -22,5 +22,5 @@
import event_registration
import make_invoice
import event_registrations_partner
-import confirm_registration
+import event_confirm_registration
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/addons/event/wizard/confirm_registration.py b/addons/event/wizard/confirm_registration.py
deleted file mode 100644
index 3c0cdac180d..00000000000
--- a/addons/event/wizard/confirm_registration.py
+++ /dev/null
@@ -1,80 +0,0 @@
-# -*- 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 time
-import wizard
-import ir
-import pooler
-from osv.osv import except_osv
-from osv import fields,osv
-import netsvc
-
-ARCH = '''
-'''
-
-ARCH_fields={}
-
-def _confirm(self, cr, uid, data, context):
- registration_obj = pooler.get_pool(cr.dbname).get('event.registration')
- current_registration = registration_obj.browse(cr, uid, [data['id']])[0]
-
- total_confirmed = current_registration.event_id.register_current + current_registration.nb_register
- if total_confirmed <= current_registration.event_id.register_max or current_registration.event_id.register_max == 0:
- return 'confirm'
- return 'split'
-
-
-def _check_confirm(self, cr, uid, data, context):
- registration_obj = pooler.get_pool(cr.dbname).get('event.registration')
- registration_obj.write(cr, uid, [data['id']], {'state':'open',})
- registration_obj._history(cr, uid, [data['id']], 'Open', history=True)
- registration_obj.mail_user(cr,uid,[data['id']])
- return {}
-
-
-class confirm_registration(wizard.interface):
- states = {
- 'init' : {
- 'actions' : [],
- 'result' : {'type' : 'choice', 'next_state' : _confirm}
- },
-
- 'split' : {
- 'actions' : [],
- 'result' : {'type' : 'form',
- 'arch' : ARCH,'fields':ARCH_fields,
- 'state' : [('end', 'Cancel'),('confirm', 'Confirm Anyway') ]}
- },
-
- 'confirm' : {
- 'actions' : [],
- 'result' : {'type' : 'action', 'action': _check_confirm, 'state' : 'end'}
- },
- 'end' : {
- 'actions' : [],
- 'result': {'type': 'state', 'state': 'end'},
- },
- }
-
-confirm_registration('event.confirm_registration')
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/event/wizard/event_confirm_registration.py b/addons/event/wizard/event_confirm_registration.py
new file mode 100644
index 00000000000..f8a9d02de7d
--- /dev/null
+++ b/addons/event/wizard/event_confirm_registration.py
@@ -0,0 +1,47 @@
+# -*- 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 .
+#
+##############################################################################
+
+from osv import fields, osv
+
+class event_confirm_registration(osv.osv_memory):
+ """
+ Confirm Event Registration
+ """
+ _name = "event.confirm.registration"
+ _description = "Event Registraion"
+ _columns = {
+ 'msg': fields.text('Message', readonly=True),
+ }
+ _defaults={
+ 'msg':lambda *a:'The event limit is reached. What do you want to do?'
+ }
+
+ def confirm(self, cr, uid, ids, context):
+ registration_obj = self.pool.get('event.registration')
+ reg_id = context.get('reg_id', False) or context.get('active_id', False)
+ if reg_id:
+ registration_obj.write(cr, uid, [reg_id], {'state':'open',})
+ registration_obj._history(cr, uid, [reg_id], 'Open', history=True)
+ registration_obj.mail_user(cr,uid,[reg_id])
+ return {}
+
+event_confirm_registration()
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/addons/event/wizard/event_confirm_registration_view.xml b/addons/event/wizard/event_confirm_registration_view.xml
new file mode 100644
index 00000000000..03733d2045d
--- /dev/null
+++ b/addons/event/wizard/event_confirm_registration_view.xml
@@ -0,0 +1,33 @@
+
+
+
+
+
+ Registration Confirmation
+ event.confirm.registration
+ form
+
+
+
+
+
+
+ Registrations
+ ir.actions.act_window
+ event.confirm.registration
+ form
+ form
+
+ {'record_id' : active_id}
+ new
+
+
+
+
\ No newline at end of file