[REVIEW]: code review

bzr revid: mga@mga-20100324155718-25uh10n09j6j3gty
This commit is contained in:
Mantavya Gajjar 2010-03-24 21:27:18 +05:30
parent c51d845b93
commit 2535f44d2b
5 changed files with 111 additions and 117 deletions

View File

@ -19,32 +19,27 @@
#
##############################################################################
{
"name" : "Basic Calendar Functionality",
"version" : "1.0",
"depends" : [
"base",
],
'description': """
Full featured calendar system that support:
- Alerts (create requests)
- Recurring events (*)
- Invitations to others people
""",
"depends" : ["base"],
'description': """Full featured calendar system that support:
- Alerts (create requests)
- Recurring events (*)
- Invitations to others people""",
"author" : "Tiny",
'category': 'Generic Modules/Others',
'website': 'http://www.openerp.com',
"init_xml" : [
'base_calendar_data.xml'
],
'base_calendar_data.xml'
],
"demo_xml" : [],
"update_xml" : [
'security/ir.model.access.csv',
'wizard/calendar_event_edit_all_view.xml',
'wizard/base_calendar_invite_attendee_view.xml',
'base_calendar_view.xml'
],
'security/ir.model.access.csv',
'wizard/calendar_event_edit_all_view.xml',
'wizard/base_calendar_invite_attendee_view.xml',
'base_calendar_view.xml'
],
"installable" : True,
"active" : False,
}

View File

@ -7,19 +7,19 @@
<field name="model">calendar.attendee</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Invitation details">
<field name="email" string="Invitation To"/>
<form string="Invitation details">
<field name="email" string="Invitation To"/>
<field name="sent_by_uid" string="Invitation From" />
<notebook colspan="4">
<page string="Invitation">
<notebook colspan="4">
<page string="Invitation">
<separator string="Invitation Detail" colspan="4" />
<group colspan="4" col="4">
<field name="user_id" string="Invited User"/>
<newline/>
<field name="partner_address_id"
string="Partner Contact" />
string="Partner Contact" />
<field name="partner_id"
string="Partner" readonly="1" />
string="Partner" readonly="1" />
<field name="role" string="Role" />
<field name="cutype" string="Invitation type" />
<field name="rsvp" />
@ -31,60 +31,60 @@
<field name="language"/>
<field name="ref" colspan="4" readonly="1"/>
</group>
</page>
<page string="Delegation Info">
<separator string="Delegated From" colspan="4" />
<field name="parent_ids" nolabel="1"
colspan="4" readonly="1" />
<separator string="Delegated To" colspan="4" />
<field name="child_ids" nolabel="1"
colspan="4" readonly="1" />
</page>
</notebook>
<group col="6" colspan="4">
<field name="state" />
<button name="do_tentative"
states="needs-action,declined,accepted"
string="Uncertain" type="object"
icon="terp-crm" />
<button name="do_accept" string="Accept"
states="needs-action,tentative,declined"
type="object" icon="gtk-apply" />
<button name="do_decline" string="Decline"
states="needs-action,tentative,accepted"
type="object" icon="gtk-cancel" />
<button
name="%(base_calendar.action_view_calendar_invite_attendee_wizard)d"
string="Delegate" type="action"
icon="gtk-sort-descending"
states="needs-action,tentative,declined,accepted"
context="{'model' : 'calendar.attendee', 'attendee_field' : 'child_ids'}" />
</group>
</form>
</page>
<page string="Delegation Info">
<separator string="Delegated From" colspan="4" />
<field name="parent_ids" nolabel="1"
colspan="4" readonly="1" />
<separator string="Delegated To" colspan="4" />
<field name="child_ids" nolabel="1"
colspan="4" readonly="1" />
</page>
</notebook>
<group col="6" colspan="4">
<field name="state" />
<button name="do_tentative"
states="needs-action,declined,accepted"
string="Uncertain" type="object"
icon="terp-crm" />
<button name="do_accept" string="Accept"
states="needs-action,tentative,declined"
type="object" icon="gtk-apply" />
<button name="do_decline" string="Decline"
states="needs-action,tentative,accepted"
type="object" icon="gtk-cancel" />
<button
name="%(base_calendar.action_view_calendar_invite_attendee_wizard)d"
string="Delegate" type="action"
icon="gtk-sort-descending"
states="needs-action,tentative,declined,accepted"
context="{'model' : 'calendar.attendee', 'attendee_field' : 'child_ids'}" />
</group>
</form>
</field>
</record>
<record id="base_calendar_attendee_tree_view" model="ir.ui.view">
<record id="base_calendar_attendee_tree_view" model="ir.ui.view">
<field name="name">calendar.attendee.tree</field>
<field name="model">calendar.attendee</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Invitation details">
<field name="email" string="Invitation To"/>
<tree string="Invitation details">
<field name="email" string="Invitation To"/>
<field name="partner_id" string="Partner" />
<field name="partner_address_id" string="Contact" />
<field name="role" />
<field name="state" />
</tree>
<field name="role" />
<field name="state" />
</tree>
</field>
</record>
</record>
<record id="base_calendar_attendee_search_view" model="ir.ui.view">
<record id="base_calendar_attendee_search_view" model="ir.ui.view">
<field name="name">calendar.attendee.search</field>
<field name="model">calendar.attendee</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Search Invitations">
<search string="Search Invitations">
<filter icon="gtk-apply" string="Accepted"
domain="[('state','=', 'accepted')]"
separator="1" help="Accepted Invitations" />
@ -99,14 +99,14 @@
<field name="event_date" select="1"/>
</search>
</field>
</record>
</record>
<record id="res_alarm_form_view" model="ir.ui.view">
<field name="name">res.alarm.form</field>
<field name="model">res.alarm</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Reminder details">
<form string="Reminder details">
<field name="name" />
<field name="active" />
<separator string="Reminder Details" colspan="4" />
@ -117,7 +117,7 @@
<separator string="" colspan="4" />
<field name="duration" />
<field name="repeat" />
</form>
</form>
</field>
</record>
@ -126,33 +126,30 @@
<field name="model">res.alarm</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Reminder details">
<field name="name" select="1"/>
<field name="trigger_interval" select="1"/>
<field name="trigger_duration" select="1"/>
<field name="trigger_occurs" select="1"/>
<field name="trigger_related" select="1"/>
</tree>
<tree string="Reminder details">
<field name="name" select="1"/>
<field name="trigger_interval" select="1"/>
<field name="trigger_duration" select="1"/>
<field name="trigger_occurs" select="1"/>
<field name="trigger_related" select="1"/>
</tree>
</field>
</record>
<record id="action_res_alarm_view" model="ir.actions.act_window">
<field name="name">Available Alarms</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">res.alarm</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="name">Available Alarms</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">res.alarm</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
</record>
<!-- Available alarms-->
<menuitem id="base.menu_calendar_configuration" name="Calendar"
parent="base.menu_base_config" sequence="10" />
<!--Available alarms-->
<menuitem id="base.menu_calendar_configuration" name="Calendar"
parent="base.menu_base_config" sequence="10" />
<menuitem name="Available Alarms" id="menu_crm_meeting_avail_alarm"
action="base_calendar.action_res_alarm_view"
parent="base.menu_calendar_configuration" />
<menuitem name="Available Alarms" id="menu_crm_meeting_avail_alarm"
action="base_calendar.action_res_alarm_view"
parent="base.menu_calendar_configuration" />
</data>
</openerp>

View File

@ -40,13 +40,12 @@ class base_calendar_invite_attendee(osv.osv_memory):
'email': fields.char('Email', size=124),
'contact_ids': fields.many2many('res.partner.address', 'invite_contact_rel',
'invite_id', 'contact_id', 'Contacts'),
'send_mail': fields.boolean('Send mail?', help='Check this if you want\
to send an Email to Invited Person')
}
'send_mail': fields.boolean('Send mail?', help='Check this if you want to send an Email to Invited Person')
}
_defaults = {
'type': lambda *x: 'internal'
}
'type': lambda *x: 'internal'
}
def do_invite(self, cr, uid, ids, context=None):
"""
@ -57,19 +56,22 @@ class base_calendar_invite_attendee(osv.osv_memory):
@param context: A standard dictionary for contextual values
@return: Dictionary of {}.
"""
if not context:
context = {}
model = False
model_field = False
context_id = context and context.get('active_id', False) or False
if not context or not context.get('model'):
return {}
else:
model = context.get('model')
model_field = context.get('attendee_field', False)
for datas in self.read(cr, uid, ids, context=context):
model = False
model_field = False
context_id = context and context.get('active_id', False) or False
if not context or not context.get('model'):
return {}
else:
model = context.get('model')
model_field = context.get('attendee_field', False)
obj = self.pool.get(model)
res_obj = obj.browse(cr, uid, context_id)
type = datas.get('type')

View File

@ -19,7 +19,8 @@
#
##############################################################################
from osv import fields, osv
from osv import osv
from osv import fields
class calendar_event_edit_all(osv.osv_memory):
@ -73,17 +74,16 @@ class calendar_event_edit_all(osv.osv_memory):
_name = "calendar.event.edit.all"
_description = "Calendar Edit all event"
_columns = {
'name': fields.char('Title', size=64, required=True),
'date': fields.datetime('Start Date', required=True),
'date_deadline': fields.datetime('End Date', required=True),
'location': fields.char('Location', size=124),
'alarm_id': fields.many2one('res.alarm', 'Reminder'),
}
'name': fields.char('Title', size=64, required=True),
'date': fields.datetime('Start Date', required=True),
'date_deadline': fields.datetime('End Date', required=True),
'location': fields.char('Location', size=124),
'alarm_id': fields.many2one('res.alarm', 'Reminder'),
}
_defaults = {
'date': _default_values,
'date_deadline': _default_deadline
}
'date': _default_values,
'date_deadline': _default_deadline
}
calendar_event_edit_all()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_calendar_event_edit_all" model="ir.ui.view">
<record id="view_calendar_event_edit_all" model="ir.ui.view">
<field name="name">calendar.event.edit.all.form</field>
<field name="model">calendar.event.edit.all</field>
<field name="type">form</field>
@ -26,8 +26,8 @@
</group>
</form>
</field>
</record>
</record>
<record id="action_calendar_event_edit_all" model="ir.actions.act_window">
<field name="name">Edit all events</field>
<field name="res_model">calendar.event.edit.all</field>