[REF] change some layout and tooltip

bzr revid: mva@openerp.com-20120216145249-87dl7py5zxbk6awx
This commit is contained in:
MVA 2012-02-16 15:52:49 +01:00
parent 5e5ad36ffd
commit 54347ec4c3
3 changed files with 46 additions and 34 deletions

View File

@ -36,15 +36,15 @@ class event_type(osv.osv):
_description = __doc__
_columns = {
'name': fields.char('Event type', size=64, required=True),
'default_reply_to': fields.char('Default Reply-To', size=64 ),
'default_email_event': fields.many2one('email.template','Registration Confirmation Email'),
'default_email_registration':fields.many2one('email.template','Registration Confirmation Email'),
'default_registration_min':fields.integer('Default Minimum Registration'),
'default_registration_max':fields.integer('Default Maximum Registration'),
'default_reply_to': fields.char('Default Reply-To', size=64,help="It will select this default reply-to value when you choose this event" ),
'default_email_event': fields.many2one('email.template','Event Confirmation Email', help="It will select this default confirmation event mail value when you choose this event"),
'default_email_registration':fields.many2one('email.template','Registration Confirmation Email',help="It will select this default confirmation registration mail value when you choose this event"),
'default_registration_min':fields.integer('Default Minimum Registration',help="It will select this default minimum value when you choose this event"),
'default_registration_max':fields.integer('Default Maximum Registration',help="It will select this default maximum value when you choose this event"),
}
_defaults = {
'default_registration_min' : 0,
'default_registration_max':1000,
'default_registration_max':0,
}
event_type()
@ -63,7 +63,14 @@ class event_event(osv.osv):
for record in reads:
date= time.strptime(record.date_begin,'%Y-%m-%d %H:%M:%S')
date =time.strftime('%Y-%m-%d',date)
name = record.name+' ('+date+')'
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
#TODO create a best method to give the name
res.append((record['id'], name))
return res
@ -147,18 +154,18 @@ class event_event(osv.osv):
_columns = {
'name': fields.char('Name', size=64, required=True, translate=True, readonly=False, states={'done': [('readonly', True)]}),
'name': fields.char('Event 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)]}),
'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="The minimum number of participants required to confirm this event.", readonly=True, states={'draft': [('readonly', False)]}),
'type': fields.many2one('event.type', 'Type of Event', readonly=False, states={'done': [('readonly', True)]}),
'register_max': fields.integer('Maximum Registrations', 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 )", readonly=True, states={'draft': [('readonly', False)]}),
'register_min': fields.integer('Minimum Registrations', help="You can for each event define a minimum registration level. If you do not enough registrations you are not able to confirm your event. (put 0 to ignore this rule )", readonly=True, states={'draft': [('readonly', False)]}),
'register_current': fields.function(_get_register, string='Confirmed Registrations', multi='register_current',
help="Total of Open and Done Registrations"),
help="Total of Confirmed and Done Registrations"),
'register_prospect': fields.function(_get_register, string='Unconfirmed Registrations', multi='register_prospect',
help="Total of Prospect Registrations"),
),
'registration_ids': fields.one2many('event.registration', 'event_id', 'Registrations', readonly=False, states={'done': [('readonly', True)]}),
'date_begin': fields.datetime('Starting Date', required=True, help="Beginning Date of Event", readonly=True, states={'draft': [('readonly', False)]}),
'date_end': fields.datetime('Closing Date', required=True, help="Closing Date of Event", readonly=True, states={'draft': [('readonly', False)]}),
'date_begin': fields.datetime('Starting Date', required=True, readonly=True, states={'draft': [('readonly', False)]}),
'date_end': fields.datetime('Closing Date', required=True, readonly=True, states={'draft': [('readonly', False)]}),
'state': fields.selection([
('draft', 'Draft'),
('confirm', 'Confirmed'),
@ -173,7 +180,7 @@ class event_event(osv.osv):
'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)]}),
'speaker_confirmed': fields.boolean('Speaker Confirmed',help='You can choose this checkbox for your information', 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)]}),
'note': fields.text('Description', readonly=False, states={'done': [('readonly', True)]}),
@ -219,14 +226,14 @@ class event_registration(osv.osv):
_columns = {
'id': fields.integer('ID'),
'origin': fields.char('Origin', size=124, readonly=True, states={'draft': [('readonly', False)]}),
'origin': fields.char('Origin', size=124,readonly=True),
'nb_register': fields.integer('Number of Participants', required=True, readonly=True, states={'draft': [('readonly', False)]}, help="Number of participants for this registration."),
'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)]}),
"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
'date_closed': fields.datetime('Closure Date', readonly=True),
'date_open': fields.datetime('Open Date', readonly=True),
'date_open': fields.datetime('Registration 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="Event End Date", readonly=True),
@ -243,11 +250,13 @@ class event_registration(osv.osv):
'nb_register': 1,
'state': 'draft',
'user_id': lambda self, cr, uid, ctx: uid,
'date_open':fields.date.context_today,
}
_order = 'date_open desc'
def do_draft(self, cr, uid, ids, context=None):
return self.write(cr, uid, ids, {'state': 'draft'}, context=context)
def do_open(self, cr, uid, ids, context=None):
def registration_open(self, cr, uid, ids, context=None):
""" Open Registration
"""
res = self.write(cr, uid, ids, {'state': 'open','date_open':time.strftime('%Y-%m-%d %H:%M:%S')}, context=context)
@ -267,8 +276,8 @@ class event_registration(osv.osv):
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)
def case_open(self, cr, uid, ids, context):
return self.registration_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):

View File

@ -61,7 +61,7 @@
<field name="name"/>
<field name="date_begin"/>
<field name="date_end"/>
<field name="type" on_change="onchange_evnet_type(type,context)" widget="selection"/>
<field name="type" on_change="onchange_evnet_type(type,context)"/>
<field name="user_id"/>
<field name="address_id" />
</group>
@ -101,13 +101,13 @@
<button name="button_reg_cancel" string="Cancel Registration" states="draft,open" type="object" icon="gtk-cancel"/>
</group>
</form>
</field>
</field>
<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"/>
<button string="Event Done" name="button_done" states="confirm" type="object" icon="gtk-jump-to"/>
<button string="Set To Draft" name="button_draft" states="cancel" type="object" icon="gtk-convert"/>
<button string="Set To Draft" name="button_draft" states="cancel,done" type="object" icon="gtk-convert"/>
</group>
</page>
<page string="Speakers" groups="base.group_extended">
@ -157,7 +157,7 @@
<button string="Confirm Event" help="Confirm Event" name="button_confirm" states="draft" type="object" icon="gtk-apply"/>
<button string="Cancel Event" help="Cancel Event" name="button_cancel" states="draft,confirm" type="object" icon="gtk-cancel"/>
<button string="Event Done" help="Event Done" name="button_done" states="confirm" type="object" icon="gtk-jump-to"/>
<button string="Set To Draft" help="Set To Draft" name="button_draft" states="confirm,cancel,done" type="object" icon="gtk-convert"/>
<button string="Set To Draft" help="Set To Draft" name="button_draft" states="cancel,done" type="object" icon="gtk-convert"/>
</tree>
</field>
</record>
@ -172,7 +172,7 @@
<field name="arch" type="xml">
<calendar color="type" date_start="date_begin" date_stop="date_end" string="Event Organization">
<field name="name"/>
<field name="type" widget="selection"/>
<field name="type"/>
</calendar>
</field>
</record>
@ -201,7 +201,7 @@
<field name="arch" type="xml">
<search string="Events">
<group>
<filter icon="terp-check" string="New" name="draft" domain="[('state','=','draft')]" help="Events in New state"/>
<filter icon="terp-check" string="Unconfirmed" name="draft" domain="[('state','=','draft')]" help="Events in New state"/>
<filter icon="terp-camera_test" string="Confirmed" domain="[('state','=','confirm')]" help="Confirmed events"/>
<separator orientation="vertical"/>
<field name="name"/>
@ -244,7 +244,7 @@
name="Registration"
res_model="event.registration"
src_model="event.event"
view_mode="tree,form,calendar,graph"
view_mode="calendar,tree,form,graph"
context="{'search_default_event_id': [active_id], 'default_event_id': active_id}"
view_type="form"/>
@ -278,7 +278,7 @@
<button name="button_reg_cancel" string="Cancel Registration" states="draft,open" type="object" icon="gtk-cancel"/>
<button name="case_open" 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 string="Set To Draft" name="do_draft" states="cancel,done" type="object" icon="gtk-convert"/>
<button string="Set To Unconfirmed" name="do_draft" states="cancel,done" type="object" icon="gtk-convert"/>
</tree>
</field>
</record>
@ -291,16 +291,16 @@
<form string="Registration">
<group col="6" colspan="4">
<field name="event_id" on_change="onchange_event(event_id, context)" domain="[('state','in',('draft','confirm'))]"/>
<field name="partner_id" attrs="{'readonly':[('state','!=', 'draft')]}" on_change="onchange_partner_id(partner_id, context)"/>
<field name="contact_id" attrs="{'readonly':[('state','!=', 'draft')]}" domain="[('partner_id','=',partner_id)]" on_change="onchange_contact_id(contact_id, context)"/>
<field name="nb_register"/>
<field name="user_id" attrs="{'readonly':[('state','!=', 'draft')]}"/>
<field name="origin"/>
<field name="nb_register"/>
</group>
<notebook colspan="4">
<page string="Additional Information">
<group colspan="2" col="2">
<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="name"/>
<field name="email"/>
<field name="phone"/>
@ -319,7 +319,7 @@
<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="case_open" string="Confirm Registration" states="draft" type="object" icon="gtk-apply"/>
<button string="Set To Draft" name="do_draft" states="cancel,done" type="object" icon="gtk-convert"/>
<button string="Set To Unconfirmed" name="do_draft" states="cancel,done" type="object" icon="gtk-convert"/>
</group>
</page>
<page string="Emails" groups="base.group_extended">

View File

@ -29,7 +29,10 @@ class res_partner(osv.osv):
'event_ids': fields.one2many('event.event','main_speaker_id', readonly=True),
'event_registration_ids': fields.one2many('event.registration','partner_id', readonly=True),
}
_defaults = {
'speaker':True
}
res_partner()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: