diff --git a/addons/event/__openerp__.py b/addons/event/__openerp__.py index 040df5ce987..1a7f3ba09c5 100644 --- a/addons/event/__openerp__.py +++ b/addons/event/__openerp__.py @@ -51,7 +51,7 @@ Note that: 'res_partner_view.xml', 'email_template.xml', ], - 'demo_xml': ['event_demo.xml'], + 'demo_xml': ['event_demo.yml'], 'test': ['test/process/event_draft2done.yml'], 'css': ['static/src/css/event.css'], 'installable': True, diff --git a/addons/event/event.py b/addons/event/event.py index 26fef61d2b5..6a8cf9f8a0b 100644 --- a/addons/event/event.py +++ b/addons/event/event.py @@ -55,22 +55,14 @@ class event_event(osv.osv): return [] res = [] for record in self.browse(cr, uid, ids, context=context): - date = record.date_begin.split(" ") - date = date[0] - registers='' - if record.register_max !=0: - register_max = str(record.register_max) - register_tot = record.register_current+record.register_prospect - register_tot = str(register_tot) - registers = register_tot+'/'+register_max - name = record.name+' ('+date+') '+registers - res.append((record['id'], name)) + date = record.date_begin.split(" ")[0] + date_end = record.date_end.split(" ")[0] + if date != date_end: + date += ' - ' + date_end + display_name = record.name + ' (' + date + ')' + res.append((record['id'], display_name)) return res - def _name_get_fnc(self, cr, uid, ids,prop,unknow, context=None): - res = self.name_get(cr, uid, ids, context=context) - return dict(res) - def create(self, cr, uid, vals, context=None): obj_id = super(event_event, self).create(cr, uid, vals, context) self.create_send_note(cr, uid, [obj_id], context=context) @@ -210,10 +202,12 @@ class event_event(osv.osv): help='If event is created, the state is \'Draft\'.If event is confirmed for the particular dates the state is set to \'Confirmed\'. If the event is over, the state is set to \'Done\'.If event is cancelled the state is set to \'Cancelled\'.'), 'email_registration_id' : fields.many2one('email.template','Registration Confirmation Email', help='This field contains the template of the mail that will be automatically sent each time a registration for this event is confirmed.'), 'email_confirmation_id' : fields.many2one('email.template','Event Confirmation Email', help="If you set an email template, each participant will receive this email announcing the confirmation of the event."), - 'full_name' : fields.function(_name_get_fnc, type="char", string='Name'), 'reply_to': fields.char('Reply-To Email', size=64, readonly=False, states={'done': [('readonly', True)]}, help="The email address of the organizer is likely to be put here, with the effect to be in the 'Reply-To' of the mails sent automatically at event or registrations confirmation. You can also put the email address of your mail gateway if you use one."), 'main_speaker_id': fields.many2one('res.partner','Main Speaker', readonly=False, states={'done': [('readonly', True)]}, help="Speaker who will be giving speech at the event."), 'address_id': fields.many2one('res.partner','Location Address', readonly=False, states={'done': [('readonly', True)]}), + 'street': fields.related('address_id','street',type='char',string='Street'), + 'zip': fields.related('address_id','zip',type='char',string='zip'), + 'city': fields.related('address_id','city',type='char',string='city'), 'speaker_confirmed': fields.boolean('Speaker Confirmed', readonly=False, states={'done': [('readonly', True)]}), 'country_id': fields.related('address_id', 'country_id', type='many2one', relation='res.country', string='Country', readonly=False, states={'done': [('readonly', True)]}), @@ -302,7 +296,7 @@ class event_registration(osv.osv): """Event Registration""" _name= 'event.registration' _description = __doc__ - _inherit = ['ir.needaction_mixin','mail.thread','res.partner'] + _inherit = ['ir.needaction_mixin','mail.thread'] _columns = { 'id': fields.integer('ID'), 'origin': fields.char('Source', size=124,readonly=True,help="Name of the sale order which create the registration"), @@ -316,13 +310,16 @@ class event_registration(osv.osv): 'log_ids': fields.one2many('mail.message', 'res_id', 'Logs', domain=[('email_from', '=', False),('model','=',_name)]), 'event_end_date': fields.related('event_id','date_end', type='datetime', string="Event End Date", readonly=True), 'event_begin_date': fields.related('event_id', 'date_begin', type='datetime', string="Event Start Date", readonly=True), - 'user_id': fields.many2one('res.users', 'Attendee', states={'done': [('readonly', True)]}), + 'user_id': fields.many2one('res.users', 'User', states={'done': [('readonly', True)]}), 'company_id': fields.related('event_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True, readonly=True, states={'draft':[('readonly',False)]}), 'state': fields.selection([('draft', 'Unconfirmed'), ('cancel', 'Cancelled'), ('open', 'Confirmed'), ('done', 'Attended')], 'Status', size=16, readonly=True), + 'email': fields.char('Email', size=64), + 'phone': fields.char('Phone', size=64), + 'name': fields.char('Name', size=128, select=True), } _defaults = { @@ -331,7 +328,6 @@ class event_registration(osv.osv): } _order = 'name, create_date desc' - def do_draft(self, cr, uid, ids, context=None): self.do_draft_send_note(cr, uid, ids, context=context) return self.write(cr, uid, ids, {'state': 'draft'}, context=context) @@ -400,18 +396,15 @@ class event_registration(osv.osv): return True def onchange_contact_id(self, cr, uid, ids, contact, partner, context=None): - data ={} if not contact: - return data + return {} addr_obj = self.pool.get('res.partner') contact_id = addr_obj.browse(cr, uid, contact, context=context) - data = { + return {'value': { 'email':contact_id.email, - 'contact_id':contact_id.id, 'name':contact_id.name, 'phone':contact_id.phone, - } - return {'value': data} + }} def onchange_event(self, cr, uid, ids, event_id, context=None): """This function returns value of Product Name, Unit Price based on Event. diff --git a/addons/event/event_demo.xml b/addons/event/event_demo.xml deleted file mode 100644 index 81dad07b5e4..00000000000 --- a/addons/event/event_demo.xml +++ /dev/null @@ -1,98 +0,0 @@ - - - - - - - - - - - Seminar - - - - Exhibition - - - - Conference - - - - Show - - - - Training - - - - - Concert of Bon Jovi - - - 500 - - - - - Opera of Verdi - - - - 50 - 350 - - - Conference on ERP Business - - - - 200 - - - - - - - Agrolait - s.l@agrolait.be - 003281588558 - - - 5 - - - - ASUStek - info@asustek.com - + 1 64 61 04 01 - - - 10 - - - - - Syleam - contact@syleam.fr - +33 (0) 2 33 31 22 10 - - - 6 - - - - - - Camptocamp - openerp@camptocamp.com - +41 21 619 10 04 - - - 5 - - - - diff --git a/addons/event/event_demo.yml b/addons/event/event_demo.yml new file mode 100644 index 00000000000..6f843fd0965 --- /dev/null +++ b/addons/event/event_demo.yml @@ -0,0 +1,73 @@ +- + from datetime import datetime, timedelta +- + !record {model: event.type, id: event_type_0}: + name: 'Seminar' +- + !record {model: event.type, id: event_type_1}: + name: 'Exhibition' +- + !record {model: event.type, id: event_type_2}: + name: 'Conference' +- + !record {model: event.type, id: event_type_3}: + name: 'Show' +- + !record {model: event.type, id: event_type_4}: + name: 'Training' +- + !record {model: event.event, id: event_0}: + name: 'Concert of Bon Jovi' + date_begin: !eval time.strftime('%Y-%m-01 19:05:15') + date_end: !eval time.strftime('%Y-%m-01 23:05:15') + register_max: 500 + type: event_type_1 +- + !record {model: event.event, id: event_1}: + name: 'Opera of Verdi' + date_begin: !eval (datetime.today()+ timedelta(days=1)).strftime('%Y-%m-%d 18:00:00') + date_end: !eval (datetime.today()+ timedelta(days=1)).strftime('%Y-%m-%d 21:00:00') + register_min: 50 + register_max: 350 + type: event_type_1 +- + !record {model: event.event, id: event_2}: + name: 'Conference on ERP Business' + date_begin: !eval (datetime.today()+ timedelta(days=20)).strftime('%Y-%m-%d 14:00:00') + date_end: !eval (datetime.today()+ timedelta(days=20)).strftime('%Y-%m-%d 16:30:00') + register_min: 50 + register_max: 350 + type: event_type_2 +- + !record {model: event.registration, id: reg_1_1}: + name: 'Agrolait' + email: 's.l@agrolait.be' + phone: '003281588558' + event_id: event_1 + partner_id: base.res_partner_asus + nb_register: 5 +- + !record {model: event.registration, id: reg_1_2}: + name: 'ASUStek' + email: 'info@asustek.com' + phone: '+ 1 64 61 04 01' + event_id: event_1 + partner_id: base.res_partner_asus + nb_register: 10 +- + !record {model: event.registration, id: reg_0_1}: + name: 'Syleam' + email: 'contact@syleam.fr' + phone: '+33 (0) 2 33 31 22 10' + event_id: event_0 + partner_id: base.res_partner_sednacom + nb_register: 6 +- + !record {model: event.registration, id: reg_0_2}: + name: 'Camptocamp' + email: 'openerp@camptocamp.com' + phone: '+41 21 619 10 04' + event_id: event_2 + partner_id: base.res_partner_c2c + nb_register: 5 + diff --git a/addons/event/event_view.xml b/addons/event/event_view.xml index ea2788594b7..142ba2bb2a4 100644 --- a/addons/event/event_view.xml +++ b/addons/event/event_view.xml @@ -1,7 +1,14 @@ - + @@ -17,10 +24,10 @@ - - + + @@ -89,88 +96,103 @@ event.event form - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + From to + + + + + + + + + + + + - - - - - - - - - - - - + + + + + + + Confirmed: , Unconfirmed: + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + @@ -351,15 +373,6 @@ Event is the low level object used by meeting and others documents that should be synchronized with mobile devices or calendar applications through caldav. Most of the users should work in the Calendar menu, and not in the list of events. - - form - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - + + + + + - - + + + + + - - - - - - - - +