[MERGE] merge with event module

bzr revid: mva@openerp.com-20120207094125-t3ze0w9pxh2af7a7
This commit is contained in:
MVA 2012-02-07 10:41:25 +01:00
parent 4ea4e8ad59
commit db2cdc75ab
5 changed files with 141 additions and 479 deletions

View File

@ -56,7 +56,6 @@ Note that:
'test': [],
'installable': True,
'active': False,
'certificate': '0083059161581',
'images': ['images/1_event_type_list.jpeg','images/2_events.jpeg','images/3_registrations.jpeg'],
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -45,12 +45,9 @@ class event_event(osv.osv):
_name = 'event.event'
_description = __doc__
_order = 'date_begin'
def copy(self, cr, uid, id, default=None, context=None):
""" Copy record of Given id
@param id: Id of Event record.
@param context: A standard dictionary for contextual values
""" Reset the state and the registrations while copying an event
"""
if not default:
default = {}
@ -60,20 +57,6 @@ class event_event(osv.osv):
})
return super(event_event, self).copy(cr, uid, id, default=default, context=context)
def onchange_product(self, cr, uid, ids, product_id=False):
"""This function returns value of product's unit price based on product id.
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of Event IDs
@param product_id: Product's id
"""
if not product_id:
return {'value': {'unit_price': False}}
else:
unit_price=self.pool.get('product.product').price_get(cr, uid, [product_id])[product_id]
return {'value': {'unit_price': unit_price}}
def button_draft(self, cr, uid, ids, context=None):
return self.write(cr, uid, ids, {'state': 'draft'}, context=context)
@ -81,61 +64,27 @@ class event_event(osv.osv):
return self.write(cr, uid, ids, {'state': 'cancel'}, context=context)
def button_done(self, cr, uid, ids, context=None):
if type(ids) in (int, long,):
ids = [ids]
return self.write(cr, uid, ids, {'state': 'done'}, context=context)
def do_confirm(self, cr, uid, ids, context=None):
def button_confirm(self, cr, uid, ids, context=None):
""" Confirm Event and send confirmation email to all register peoples
"""
if isinstance(ids, (int, long)):
ids = [ids]
#renforcing method : create a list of ids
register_pool = self.pool.get('event.registration')
for event in self.browse(cr, uid, ids, context=context):
# if event.mail_auto_confirm:
total_confirmed = event.register_current
if total_confirmed < event.register_min or total_confirmed > event.register_max:
raise osv.except_osv(_('Error!'),_("The total of confirmed registration for the event '%s' does not meet the expected minimum/maximum. You should maybe reconsider those limits before going further") % (even.name))
if event.email_confirmation_id:
#send reminder that will confirm the event for all the people that were already confirmed
reg_ids = register_pool.search(cr, uid, [
('event_id', '=', event.id),
('state', 'not in', ['draft', 'cancel'])], context=context)
register_pool.mail_user_confirm(cr, uid, reg_ids)
return self.write(cr, uid, ids, {'state': 'confirm'}, context=context)
def button_confirm(self, cr, uid, ids, context=None):
"""This Function Confirm Event.
@param ids: List of Event IDs
@param context: A standard dictionary for contextual values
@return: True
"""
if context is None:
context = {}
res = False
if type(ids) in (int, long,):
ids = [ids]
data_pool = self.pool.get('ir.model.data')
unconfirmed_ids = []
for event in self.browse(cr, uid, ids, context=context):
total_confirmed = event.register_current
if total_confirmed >= event.register_min or event.register_max == 0:
res = self.do_confirm(cr, uid, [event.id], context=context)
else:
unconfirmed_ids.append(event.id)
if unconfirmed_ids:
view_id = data_pool.get_object_reference(cr, uid, 'event', 'view_event_confirm')
view_id = view_id and view_id[1] or False
context['event_ids'] = unconfirmed_ids
return {
'name': _('Confirm Event'),
'context': context,
'view_type': 'form',
'view_mode': 'tree,form',
'res_model': 'event.confirm',
'views': [(view_id, 'form')],
'type': 'ir.actions.act_window',
'target': 'new',
'context': context,
'nodestroy': True
}
return res
def _get_register(self, cr, uid, ids, fields, args, context=None):
"""Get Confirm or uncofirm register value.
@param ids: List of Event registration type's id
@ -170,38 +119,10 @@ class event_event(osv.osv):
res[event.id]['register_prospect'] = number and number[0] or 0.0
return res
def write(self, cr, uid, ids, vals, context=None):
"""
Writes values in one or several fields.
@param ids: List of Event registration type's IDs
@param vals: dictionary with values to update.
@return: True
"""
register_pool = self.pool.get('event.registration')
res = super(event_event, self).write(cr, uid, ids, vals, context=context)
if vals.get('date_begin', False) or vals.get('mail_confirm', False):
for event in self.browse(cr, uid, ids, context=context):
#change the deadlines of the registration linked to this event
register_values = {}
if vals.get('date_begin', False):
register_values['date_deadline'] = vals['date_begin']
#change the description of the registration linked to this event
if 'mail_confirm' in vals:
register_values['description'] = vals['mail_confirm']
if register_values:
reg_ids = register_pool.search(cr, uid, [('event_id', '=', event.id)], context=context)
register_pool.write(cr, uid, reg_ids, register_values, context=context)
return res
_columns = {
'name': fields.char('Name', size=64, required=True, translate=True, readonly=False, states={'done': [('readonly', True)]}),
'user_id': fields.many2one('res.users', 'Responsible User', readonly=False, states={'done': [('readonly', True)]}),
'parent_id': fields.many2one('event.event', 'Parent Event', readonly=False, states={'done': [('readonly', True)]}),
'section_id': fields.many2one('crm.case.section', 'Sale Team', readonly=False, states={'done': [('readonly', True)]}),
'child_ids': fields.one2many('event.event', 'parent_id', 'Child Events', readonly=False, states={'done': [('readonly', True)]}),
'type': fields.many2one('event.type', 'Type', help="Type of Event like Seminar, Exhibition, Conference, Training.", readonly=False, states={'done': [('readonly', True)]}),
'register_max': fields.integer('Maximum Registrations', help="Provide Maximum Number of Registrations", readonly=True, states={'draft': [('readonly', False)]}),
'register_min': fields.integer('Minimum Registrations', help="Provide Minimum Number of Registrations", readonly=True, states={'draft': [('readonly', False)]}),
@ -219,23 +140,18 @@ class event_event(osv.osv):
('cancel', 'Cancelled')],
'State', readonly=True, required=True,
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','Email registration'),
'email_confirmation_id' : fields.many2one('email.template','Email confirmation'),
'reply_to': fields.char('Reply-To', size=64, readonly=False, states={'done': [('readonly', True)]}, help="The email address put in the 'Reply-To' of all emails sent by OpenERP"),
'note': fields.text('Notes', help="Description or Summary of Event", readonly=False, states={'done': [('readonly', True)]}),
'pricelist_id': fields.many2one('product.pricelist', 'Pricelist', readonly=True, states={'draft': [('readonly', False)]}, help="Pricelist version for current event."),
'unit_price': fields.related('product_id', 'list_price', type='float', string='Registration Cost', readonly=True, states={'draft':[('readonly',False)]}, help="This will be the default price used as registration cost when invoicing this event. Note that you can specify a specific amount for each registration.", digits_compute=dp.get_precision('Sale Price')),
'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."),
'speaker_ids': fields.many2many('res.partner', 'event_speaker_rel', 'speaker_id', 'partner_id', 'Other Speakers', readonly=False, states={'done': [('readonly', True)]}),
'address_id': fields.many2one('res.partner.address','Location Address', readonly=False, states={'done': [('readonly', True)]}),
'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)]}),
'language': fields.char('Language',size=64, readonly=False, states={'done': [('readonly', True)]}),
'note': fields.text('Description', readonly=False, states={'done': [('readonly', True)]}),
'company_id': fields.many2one('res.company', 'Company', required=False, change_default=True, readonly=False, states={'done': [('readonly', True)]}),
'product_id': fields.many2one('product.product', 'Product', readonly=True, states={'draft': [('readonly', False)]}, help="The product is optional and only serves informative purposes. It will be used for analysis mainly."),
}
_defaults = {
@ -244,9 +160,6 @@ class event_event(osv.osv):
'user_id': lambda obj, cr, uid, context: uid,
}
def _check_recursion(self, cr, uid, ids, context=None):
return super(event_event, self)._check_recursion(cr, uid, ids, context=context)
def _check_closing_date(self, cr, uid, ids, context=None):
for event in self.browse(cr, uid, ids, context=context):
if event.date_end < event.date_begin:
@ -254,10 +167,9 @@ class event_event(osv.osv):
return True
_constraints = [
(_check_recursion, 'Error ! You cannot create recursive event.', ['parent_id']),
(_check_closing_date, 'Error ! Closing Date cannot be set before Beginning Date.', ['date_end']),
]
#TODO: display sale_team in event form view and use this onchange
def do_team_change(self, cr, uid, ids, team_id, context=None):
"""
On Change Callback: when team change, this is call.
@ -280,48 +192,24 @@ class event_registration(osv.osv):
_description = __doc__
_inherit = ['mail.thread','res.partner.address']
def _amount_line(self, cr, uid, ids, field_name, arg, context=None):
cur_obj = self.pool.get('res.currency')
res = {}
for line in self.browse(cr, uid, ids, context=context):
price = line.unit_price * line.nb_register
pricelist = line.event_id.pricelist_id or line.partner_invoice_id.property_product_pricelist
cur = pricelist and pricelist.currency_id or False
res[line.id] = cur and cur_obj.round(cr, uid, cur, price) or price
return res
_columns = {
'id': fields.integer('ID'),
'origin': fields.char('Origin', size=124, readonly=True, states={'draft': [('readonly', False)]}),
'email_cc': fields.text('CC', size=252, readonly=False, states={'done': [('readonly', True)]}, help="These email addresses will be added to the CC field of all inbound and outbound emails for this record before being sent. Separate multiple email addresses with a comma"),
'nb_register': fields.integer('Quantity', required=True, readonly=True, states={'draft': [('readonly', False)]}, help="Number of Registrations or Tickets"),
'event_id': fields.many2one('event.event', 'Event', required=True, readonly=True, states={'draft': [('readonly', False)]}),
'partner_id': fields.many2one('res.partner', 'Partner', states={'done': [('readonly', True)]}),
'partner_id_address': fields.many2one('res.partner.address', 'Partner', states={'done': [('readonly', True)]}),
"partner_invoice_id": fields.many2one('res.partner', 'Partner Invoiced', readonly=True, states={'draft': [('readonly', False)]}),
"contact_id": fields.many2one('res.partner.address', 'Partner Contact', readonly=False, states={'done': [('readonly', True)]}), #TODO: filter only the contacts that have a function into the selected partner_id
"unit_price": fields.float('Unit Price', required=True, digits_compute=dp.get_precision('Sale Price'), readonly=True, states={'draft': [('readonly', False)]}),
'price_subtotal': fields.function(_amount_line, string='Subtotal', digits_compute=dp.get_precision('Sale Price'), store=True),
"event_product": fields.char("Invoice Name", size=128, readonly=True, states={'draft': [('readonly', False)]}),
"invoice_id": fields.many2one("account.invoice", "Invoice", readonly=True),
'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),
'email_from': fields.char('Email', size=128, states={'done': [('readonly', True)]}, help="These people will receive email."),
'create_date': fields.datetime('Creation Date', readonly=True),
'write_date': fields.datetime('Write Date', readonly=True),
'description': fields.text('Description', states={'done': [('readonly', True)]}),
'message_ids': fields.one2many('mail.message', 'res_id', 'Messages', domain=[('model','=',_name)]),
'date_closed': fields.datetime('Closure Date', readonly=True),
'email_from': fields.related('event_id','reply_to',string='Reply-to Email', type='char', size=128, readonly=True,),
'log_ids': fields.one2many('mail.message', 'res_id', 'Logs', domain=[('email_from', '=', False),('model','=',_name)]),
'date_deadline': fields.related('event_id','date_end', type='datetime', string="End Date", readonly=True),
'date': fields.related('event_id', 'date_begin', type='datetime', string="Start Date", readonly=True),
'date_deadline': fields.related('event_id','date_end', type='datetime', string="Event End Date", readonly=True),
'date': fields.related('event_id', 'date_begin', type='datetime', string="Event Start Date", readonly=True),
'user_id': fields.many2one('res.users', 'Responsible', states={'done': [('readonly', True)]}),
'active': fields.boolean('Active'),
'section_id': fields.related('event_id', 'section_id', type='many2one', relation='crm.case.section', string='Sale Team', store=True, 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([('open', 'Confirmed'),
('draft', 'Unconfirmed'),
'state': fields.selection([('draft', 'Unconfirmed'),
('open', 'Confirmed'),
('cancel', 'Cancelled'),
('done', 'Done')], 'State', \
size=16, readonly=True)
@ -329,25 +217,8 @@ class event_registration(osv.osv):
_defaults = {
'nb_register': 1,
'state': 'draft',
'active': 1,
'user_id': lambda self, cr, uid, ctx: uid,
}
def copy(self, cr, uid, id, default=None, context=None):
""" Copy record of Given id
@param id: Id of Registration record.
@param context: A standard dictionary for contextual values
"""
if not default:
default = {}
default.update({
'invoice_id': False,
})
return super(event_registration, self).copy(cr, uid, id, default=default, context=context)
def do_open(self, cr, uid, ids, context=None):
""" Open Registration
@ -362,78 +233,40 @@ class event_registration(osv.osv):
"""
if context is None:
context = {}
invoice_id = context.get('invoice_id', False)
values = {'state': 'done', 'date_closed': time.strftime('%Y-%m-%d %H:%M:%S')}
msg = _('Done')
if invoice_id:
values['invoice_id'] = invoice_id
res = self.write(cr, uid, ids, values)
self.message_append(cr, uid, ids, msg)
return res
# event uses add_note wizard from crm, which expects case_* methods
def case_open(self, cr, uid, ids, context=None):
self.do_open(cr, uid, ids, context)
# event uses add_note wizard from crm, which expects case_* methods
def case_close(self, cr, uid, ids, context=None):
self.do_close(cr, uid, ids, context)
return self.write(cr, uid, ids, {'state': 'done'})
#def case_close(self, cr, uid, ids, context=None):
# self.do_close(cr, uid, ids, context)
# return self.write(cr, uid, ids, {'state': 'done'})
# event uses add_note wizard from crm, which expects case_* methods
def case_cancel(self, cr, uid, ids, context=None):
""" Cancel Registration
"""
self.message_append(cr, uid, ids, _('Cancel'))
return self.write(cr, uid, ids, {'state': 'cancel'})
# event uses add_note wizard from crm, which expects case_* methods
def case_reset(self, cr, uid, ids, context=None):
pass
# event uses add_note wizard from crm, which expects case_* methods
def case_pending(self, cr, uid, ids, context=None):
pass
def check_confirm(self, cr, uid, ids, context=None):
"""This Function Open Event Registration and send email to user.
@param ids: List of Event registration's IDs
@param context: A standard dictionary for contextual values
@return: True
"""
if type(ids) in (int, long,):
ids = [ids]
data_pool = self.pool.get('ir.model.data')
unconfirmed_ids = []
if context is None:
context = {}
for registration in self.browse(cr, uid, ids, context=context):
total_confirmed = registration.event_id.register_current + registration.nb_register
if total_confirmed <= registration.event_id.register_max or registration.event_id.register_max == 0:
self.do_open(cr, uid, [registration.id], context=context)
else:
unconfirmed_ids.append(registration.id)
if unconfirmed_ids:
view_id = data_pool.get_object_reference(cr, uid, 'event', 'view_event_confirm_registration')
view_id = view_id and view_id[1] or False
context['registration_ids'] = unconfirmed_ids
return {
'name': _('Confirm Registration'),
'context': context,
'view_type': 'form',
'view_mode': 'tree,form',
'res_model': 'event.confirm.registration',
'views': [(view_id, 'form')],
'type': 'ir.actions.act_window',
'target': 'new',
'context': context,
'nodestroy': True
}
return True
def button_reg_close(self, cr, uid, ids, context=None):
"""This Function Close Event Registration.
"""
return self.case_close(cr, uid, ids)
#def button_reg_close(self, cr, uid, ids, context=None):
# """This Function Close Event Registration.
# """
# return self.case_close(cr, uid, ids)
def button_reg_cancel(self, cr, uid, ids, context=None, *args):
return self.case_cancel(cr, uid, ids)
@ -441,7 +274,7 @@ class event_registration(osv.osv):
def mail_user(self, cr, uid, ids, confirm=False, context=None):
"""
Send email to user with email_template when registration is done
"""
"""
for registration in self.browse(cr, uid, ids, context=context):
template_id = registration.event_id.email_registration_id.id
if template_id:
@ -458,94 +291,42 @@ class event_registration(osv.osv):
mail_message = self.pool.get('email.template').send_mail(cr,uid,template_id,registration.id)
return True
def onchange_contact_id(self, cr, uid, ids, contact, partner):
"""This function returns value of Badge Name, Badge Title based on Partner contact.
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of Registration IDs
@param contact: Patner Contact IDS
@param partner: Partner IDS
"""
def onchange_contact_id(self, cr, uid, ids, contact, partner, context=None):
data ={}
if not contact:
return data
addr_obj = self.pool.get('res.partner.address')
data['email_from'] = addr_obj.browse(cr, uid, contact).email
data['email_from'] = addr_obj.browse(cr, uid, contact, context).email
return {'value': data}
def onchange_event(self, cr, uid, ids, event_id):
def onchange_event(self, cr, uid, ids, event_id, context=None):
"""This function returns value of Product Name, Unit Price based on Event.
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of Registration IDs
@param event_id: Event ID
@param partner_invoice_id: Partner Invoice ID
"""
partner_invoice_id="";
context = {}
if context is None:
context = {}
if not event_id:
return {'value': {'unit_price': False, 'event_product': False}}
return {}
event_obj = self.pool.get('event.event')
prod_obj = self.pool.get('product.product')
res_obj = self.pool.get('res.partner')
data_event = event_obj.browse(cr, uid, event_id, context=context)
return {'value':
{'date': data_event.date_begin,
'date_deadline': data_event.date_end,
'section_id': data_event.section_id and data_event.section_id.id or False,
'company_id': data_event.company_id and data_event.company_id.id or False,
}
}
data_event = event_obj.browse(cr, uid, event_id)
res = {'value': {'unit_price': False,
'event_product': False,
'user_id': False,
'date': data_event.date_begin,
'date_deadline': data_event.date_end,
'description': data_event.note,
'name': data_event.name,
'section_id': data_event.section_id and data_event.section_id.id or False,
}}
if data_event.user_id.id:
res['value'].update({'user_id': data_event.user_id.id})
if data_event.product_id:
pricelist_id = data_event.pricelist_id and data_event.pricelist_id.id or False
if partner_invoice_id:
partner = res_obj.browse(cr, uid, partner_invoice_id, context=context)
pricelist_id = pricelist_id or partner.property_product_pricelist.id
unit_price = prod_obj._product_price(cr, uid, [data_event.product_id.id], False, False, {'pricelist': pricelist_id})[data_event.product_id.id]
if not unit_price:
unit_price = data_event.unit_price
res['value'].update({'unit_price': unit_price, 'event_product': data_event.product_id.name})
return res
def onchange_partner_id(self, cr, uid, ids, part, event_id, email=False):
"""This function returns value of Patner Invoice id, Unit Price, badget title based on partner and Event.
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of Registration IDs
@param event_id: Event ID
@param partner_invoice_id: Partner Invoice ID
"""
def onchange_partner_id(self, cr, uid, ids, part, context=None):
res_obj = self.pool.get('res.partner')
data = {}
data['contact_id'], data['partner_invoice_id'], data['email_from'] = (False, False, False)
if not part:
return {'value': data}
data['partner_invoice_id'] = part
# this calls onchange_partner_invoice_id
d = self.onchange_partner_invoice_id(cr, uid, ids, event_id, part)
# this updates the dictionary
data.update(d['value'])
addr = res_obj.address_get(cr, uid, [part]).get('default', False)
if addr:
d = self.onchange_contact_id(cr, uid, ids, addr, part)
d = self.onchange_contact_id(cr, uid, ids, addr, part, context)
data.update(d['value'])
return {'value': data}
event_registration()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -5,7 +5,6 @@
<menuitem name="Association" id="base.menu_association" icon="terp-calendar" sequence="9"/>
<menuitem name="Marketing" icon="terp-crm" id="base.marketing_menu" sequence="17"/>
<menuitem name="Events Organisation" id="base.menu_event_main" parent="base.marketing_menu" />
<menuitem name="Events" id="base.menu_event_association" parent="base.menu_association" />
@ -39,11 +38,11 @@
<field name="res_model">event.type</field>
<field name="view_type">form</field>
</record>
<menuitem name="Configuration" id="base.menu_marketing_config_root" parent="base.marketing_menu" sequence="30" groups="base.group_extended"/>
<menuitem name="Configuration" id="base.menu_marketing_config_association" parent="base.menu_association" sequence="30" groups="base.group_extended"/>
<menuitem name="Configuration" id="base.menu_marketing_config_root" parent="base.marketing_menu" sequence="30"/>
<menuitem name="Configuration" id="base.menu_marketing_config_association" parent="base.menu_association" sequence="30"/>
<menuitem name="Types of Events" id="menu_event_type" action="action_event_type" parent="base.menu_marketing_config_root" groups="base.group_extended"/>
<menuitem name="Events Type" id="menu_event_type_association" action="action_event_type" parent="base.menu_marketing_config_association" groups="base.group_extended"/>
<menuitem name="Types of Events" id="menu_event_type" action="action_event_type" parent="base.menu_marketing_config_root"/>
<menuitem name="Events Type" id="menu_event_type_association" action="action_event_type" parent="base.menu_marketing_config_association"/>
<!-- Events Organisation/CONFIGURATION/EVENTS -->
@ -53,8 +52,6 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Events">
<group col="6" colspan="4">
<field name="name"/>
<field name="date_begin"/>
@ -65,55 +62,46 @@
</group>
<notebook colspan="4">
<page string="Event">
<separator string="Description" colspan="4"/>
<field name="note" colspan="4" nolabel="1"/>
<field name="registration_ids" colspan="4" nolabel="1" >
<form string="Registration" >
<group colspan="4" col="4">
<separator string="partner" colspan="4"/>
<field name="name"/>
</group>
<group colspan="4" col="4">
<field name="street"/>
<field name="city"/>
</group>
<group colspan="4" col="4">
<field name="email"/>
<field name="phone"/>
</group>
<group colspan="4" col="4">
<field name="unit_price"/>
<field name="nb_register"/>
</group>
<group colspan="4" col="4">
<field name="partner_id" attrs="{'readonly':[('state','!=', 'draft')]}" on_change="onchange_partner_id(partner_id_address,event_id)" />
</group>
<group col="8" colspan="4">
<separator string="" colspan="4"/>
<newline/>
<field name="state" select="1" colspan="2"/>
<button name="button_reg_close" string="Close Registration" states="open" type="object" icon="gtk-close"/>
<button name="check_confirm" string="Confirm Registration" states="draft" type="object" icon="gtk-apply"/>
<button name="button_reg_cancel" string="Cancel Registration" states="draft,open" type="object" icon="gtk-cancel"/>
</group>
</form>
<tree string="Registration">
<field name="create_date" string="Registration Date" invisible="1"/>
<field name="name" />
<field name="email" />
<field name="nb_register" />
<field name="unit_price"/>
<field name="price_subtotal" invisible="1"/>
<field name="state"/>
<button name="button_reg_close" string="Close Registration" states="open" type="object" icon="gtk-close"/>
<button name="check_confirm" string="Confirm Registration" states="draft" type="object" icon="gtk-apply"/>
<button name="button_reg_cancel" string="Cancel Registration" states="draft,open" type="object" icon="gtk-cancel"/>
<field name="registration_ids" colspan="4" nolabel="1">
<tree string="Registration" editable="top">
<field name="name" />
<field name="email" />
<field name="phone"/>
<field name="nb_register" />
<field name="state"/>
<button name="button_reg_close" string="Close Registration" states="open" type="object" icon="gtk-close"/>
<button name="case_open" string="Confirm Registration" states="draft" type="object" icon="gtk-apply"/>
<button name="button_reg_cancel" string="Cancel Registration" states="draft,open" type="object" icon="gtk-cancel"/>
</tree>
<form string="Registration">
<field name="partner_id" attrs="{'readonly':[('state','!=', 'draft')]}" on_change="onchange_partner_id(partner_id, context)" />
<field name="name"/>
<group colspan="4" col="4">
<field name="street"/>
<field name="city"/>
</group>
<group colspan="4" col="4">
<field name="email"/>
<field name="phone"/>
</group>
<group colspan="4" col="4">
<field name="nb_register"/>
</group>
<group colspan="4" col="4">
</group>
<group col="8" colspan="4">
<separator string="" colspan="4"/>
<newline/>
<field name="state" select="1" colspan="2"/>
<button name="button_reg_close" string="Close Registration" states="open" type="object" icon="gtk-close"/>
<button name="case_open" string="Confirm Registration" states="draft" type="object" icon="gtk-apply"/>
<button name="button_reg_cancel" string="Cancel Registration" states="draft,open" type="object" icon="gtk-cancel"/>
</group>
</form>
</field>
<field name="state" select="1" widget="statusbar"/>
<field name="state" select="1" widget="statusbar" statusbar_visible="draft,confirm,done"/>
<group col="4" colspan="2">
<button string="Cancel Event" name="button_cancel" states="draft,confirm" type="object" icon="gtk-cancel"/>
<button string="Confirm Event" name="button_confirm" states="draft" type="object" icon="gtk-apply"/>
@ -121,27 +109,32 @@
<button string="Set To Draft" name="button_draft" states="cancel" type="object" icon="gtk-convert"/>
</group>
</page>
<page string="Speakers">
<page string="Speakers" groups="base.group_extended">
<field name="main_speaker_id" domain="[('speaker','=',True)]"/>
<field name="speaker_confirmed"/>
<separator string="Other Speakers" colspan="4"/>
<field name="speaker_ids" domain="[('speaker','=',True)]" colspan="4" nolabel="1"/>
</page>
<page string="Extra Info">
<field name="register_min"/>
<field name="register_max"/>
<field name="register_current"/>
<field name="register_prospect"/>
<separator string="Emails" colspan="4"/>
<group col="4" colspan="4">
<group col="2" colspan="2">
<field name="email_registration_id" domain="[('model_id','=','Event Registration')]"/>
</group>
<group col="2" colspan="2">
<field name="email_confirmation_id"/>
</group>
<group col="2" colspan="2">
<separator string="Registrations" colspan="2"/>
<field name="register_min"/>
<field name="register_max"/>
<field name="register_current"/>
<field name="register_prospect"/>
</group>
<group col="2" colspan="2">
<separator string="Emails" colspan="2"/>
<field name="reply_to"/>
<field name="email_registration_id" domain="[('model_id','=','Event Registration')]"/>
<field name="email_confirmation_id"/>
</group>
<group col="2" colspan="2" groups="base.group_extended">
<separator string="Misc" colspan="2"/>
</group>
<group col="2" colspan="2">
<separator string="Sales Team" colspan="2"/>
<field name="section_id" on_change="do_team_change(self, cr, uid, ids, team_id)"/>
</group>
</page>
</notebook>
@ -158,14 +151,13 @@
<field name="arch" type="xml">
<tree string="Events" colors="red:register_min>register_current;black:register_min&lt;=register_current">
<field name="name" string="Name"/>
<field name="main_speaker_id"/>
<field name="language"/>
<field name="type"/>
<field name="date_begin"/>
<field name="date_end"/>
<field name="register_min"/>
<field name="register_current"/>
<field name="register_min"/>
<field name="section_id" invisible="context.get('invisible_section', True)"/>
<field name="main_speaker_id" groups="base.extended"/>
<field name="user_id"/>
<field name="state"/>
<button string="Confirm Event" help="Confirm Event" name="button_confirm" states="draft" type="object" icon="gtk-apply"/>
@ -248,8 +240,8 @@
</field>
</record>
<!-- Events Organisation/CONFIGURATION/EVENTS -->
<!-- Events Organisation/CONFIGURATION/EVENTS -->
<record model="ir.actions.act_window" id="action_event_view">
<field name="name">Events</field>
<field name="type">ir.actions.act_window</field>
@ -282,9 +274,8 @@
<menuitem name="Events" id="menu_event_event" action="action_event_view" parent="base.menu_event_main" />
<menuitem name="Events" id="menu_event_event_assiciation" action="action_event_view" parent="base.menu_event_association" />
<!-- EVENTS/REGISTRATIONS/EVENTS -->
<!-- EVENTS/REGISTRATIONS/EVENTS -->
<record model="ir.ui.view" id="view_event_registration_tree">
<field name="name">event.registration.tree</field>
<field name="model">event.registration</field>
@ -293,13 +284,13 @@
<tree string="Registration" >
<field name="name"/>
<field name="email"/>
<field name="phone"/>
<field name="event_id"/>
<field name="nb_register" invisible="1"/>
<field name="unit_price"/>
<field name="user_id"/>
<field name="state"/>
<button name="button_reg_close" string="Close Registration" states="open" type="object" icon="gtk-close"/>
<button name="check_confirm" string="Confirm Registration" states="draft" type="object" icon="gtk-apply"/>
<button name="case_close" string="Close Registration" states="open" type="object" icon="gtk-close"/>
<button name="case_open" string="Confirm Registration" states="draft" type="object" icon="gtk-apply"/>
<button name="button_reg_cancel" string="Cancel Registration" states="draft,open" type="object" icon="gtk-cancel"/>
</tree>
</field>
@ -312,64 +303,39 @@
<field name="arch" type="xml">
<form string="Registration">
<group col="6" colspan="4">
<field name="event_id" on_change="onchange_event(event_id)" domain="[('state','in',('draft','confirm'))]"/>
<field name="date" />
<field name="date_deadline" />
<field name="event_id" on_change="onchange_event(event_id, context)" domain="[('state','in',('draft','confirm'))]"/>
<field name="nb_register"/>
<field name="origin"/>
<field name="user_id" attrs="{'readonly':[('state','!=', 'draft')]}" />
<field name="name" colspan="4"/>
<field name="user_id" attrs="{'readonly':[('state','!=', 'draft')]}"/>
</group>
<notebook colspan="4">
<page string="Registration">
<page string="Additional Information">
<group colspan="2" col="2">
<separator string="Registration contact" colspan="4"/>
<group colspan="2" col="2">
<field name="name"/>
<separator string="Contact Information" colspan="2"/>
<field name="partner_id" attrs="{'readonly':[('state','!=', 'draft')]}" on_change="onchange_partner_id(partner_id, context)" groups="base.group_extended"/>
<field name="contact_id" attrs="{'readonly':[('state','!=', 'draft')]}" on_change="onchange_contact_id(contact_id, context)" groups="base.group_extended"/>
<field name="email"/>
<field name="phone"/>
<field name="street"/>
<field name="city"/>
</group>
<group colspan="4" col="4">
<field name="street"/>
<field name="city"/>
<field name="email"/>
<field name="phone"/>
<group colspan="2" col="2" groups="base.group_extended">
<separator string="Dates" colspan="2"/>
<field name="date_closed"/>
<field name="date" />
<field name="date_deadline" />
</group>
<group colspan="2" col="2">
<field name="partner_id" attrs="{'readonly':[('state','!=', 'draft')]}" on_change="onchange_partner_id(partner_id_address,event_id)" />
</group>
</group>
<group colspan="2" col="2">
<separator string="Registration Cost" colspan="4"/>
<field name="unit_price"/>
<field name="nb_register"/>
<field name="price_subtotal"/>
<field name="invoice_id"/>
</group>
<separator string="" colspan="4"/>
<group col="8" colspan="4">
<field name="state" select="1" colspan="2" widget="statusbar"/>
<field name="state" select="1" colspan="2" widget="statusbar" statusbar_visible="draft,open,done"/>
<button name="button_reg_cancel" string="Cancel Registration" states="draft,open" type="object" icon="gtk-cancel"/>
<button name="button_reg_close" string="Close Registration" states="open" type="object" icon="gtk-close"/>
<button name="check_confirm" string="Confirm Registration" states="draft" type="object" icon="gtk-apply"/>
</group>
</page>
<page string="Extra Info">
<group col="2" colspan="2" groups="base.group_extended">
<separator string="Dates" colspan="2"/>
<field name="date_closed"/>
<field name="create_date" string="Registration Date"/>
</group>
<group col="2" colspan="2" groups="base.group_extended">
<separator string="Misc" colspan="2"/>
<field name="id"/>
<field name="active"/>
<button name="case_open" string="Confirm Registration" states="draft" type="object" icon="gtk-apply"/>
</group>
</page>
<page string="Emails" groups="base.group_extended">
<group colspan="4">
<field colspan="4" name="email_cc" string="CC" widget="char" size="512"/>
</group>
<field name="message_ids" colspan="4" nolabel="1" mode="tree">
<tree string="History">
<field name="display_text" string="History Information"/>
@ -395,8 +361,7 @@
</field>
</record>
<!-- Calendar view of event registration -->
<!-- Calendar view of event registration -->
<record id="view_event_registration_calendar" model="ir.ui.view">
<field name="name">event.registration.calendar</field>
<field name="model">event.registration</field>
@ -405,7 +370,7 @@
<field name="arch" type="xml">
<calendar color="event_id" date_start="date" date_stop="date_closed" string="Event Registration">
<field name="event_id"/>
<field name="partner_invoice_id"/>
<field name="name"/>
</calendar>
</field>
</record>
@ -417,14 +382,13 @@
<field name="arch" type="xml">
<graph string="Registration" type="bar" orientation="horizontal">
<field name="event_id"/>
<field name = "nb_register" operator="+"/>
<field name= "nb_register" operator="+"/>
</graph>
</field>
</record>
<!-- Search view of event registration form-->
<!-- Search view of event registration -->
<record model="ir.ui.view" id="view_registration_search">
<field name="name">Registrations</field>
<field name="model">event.registration</field>
@ -435,23 +399,23 @@
<filter icon="terp-check" string="New" name="draft" domain="[('state','=','draft')]" help="Registrations in unconfirmed state"/>
<filter icon="terp-camera_test" string="Confirmed" domain="[('state','=','open')]" help="Confirmed registrations"/>
<separator orientation="vertical"/>
<field name="partner_id" />
<field name="event_id" widget="seemaillection"/>
<field name="event_id" widget="selection"/>
<field name="partner_id" groups="base.group_extended"/>
<field name="user_id" widget="selection">
<filter icon="terp-personal"
string="My Registrations"
help="My Registrations"
domain="[('user_id','=',uid)]"/>
</field>
<field name="state"/>
<field name="origin"/>
</group>
<newline/>
<group expand="0" string="Group By...">
<filter string="Responsible" icon="terp-personal" domain="[]" context="{'group_by':'user_id'}"/>
<filter string="Partner" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}"/>
<filter string="Partner" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}" groups="base.group_extended"/>
<separator orientation="vertical"/>
<filter string="Event" icon="terp-crm" domain="[]" context="{'group_by':'event_id'}"/>
<filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'registration_state'}"/>
<filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
</group>
</search>
@ -479,12 +443,5 @@
action="action_registration"/>
<menuitem name="Reporting" id="base.menu_report_association" parent="base.marketing_menu" sequence="20"/>
</data>
</openerp>

View File

@ -1,38 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# 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 <http://www.gnu.org/licenses/>.
#
##############################################################################
from osv import fields, osv
from tools.translate import _
class event_make_invoice(osv.osv_memory):
"""
Make Invoices
"""
_name = "event.make.invoice"
_description = "Event Make Invoice"
def make_invoice(self, cr, uid, ids, context=None):
print ids
event_make_invoice()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,37 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_event_make_invoice" model="ir.ui.view">
<field name="name">event.make.invoice</field>
<field name="model">event.make.invoice</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Create invoices">
<group colspan="4">
<separator string="" colspan="4" />
<label string="" colspan="2"/>
<button special="cancel" string="Close" icon="gtk-close"/>
<button name="make_invoice" string="Done" type="object" icon="gtk-ok"/>
</group>
</form>
</field>
</record>
<record id="action_event_confirm_registration" model="ir.actions.act_window">
<field name="name">Make Invoices</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">event.make.invoice</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="view_event_make_invoice"/>
<field name="target">new</field>
</record>
<act_window id="action_make_invoices"
key2 = "client_action_multi" name="Make Invoice"
res_model="event.make.invoice" src_model="event.registration"
view_mode="form" target="new" view_type="form" />
</data>
</openerp>