[IMP] gamification: better search views and shortcut button
bzr revid: mat@openerp.com-20130219132306-tbdaf5wc9aavyx2h
This commit is contained in:
@@ -91,7 +91,7 @@ class gamification_goal_type(osv.Model):
|
||||
- 'Manually' for user defined values""",
|
||||
required=True),
|
||||
'model_id': fields.many2one('ir.model',
|
||||
string='Modeel',
|
||||
string='Model',
|
||||
help='The model object for the field to evaluate' ),
|
||||
'field_id': fields.many2one('ir.model.fields',
|
||||
string='Evaluated Field',
|
||||
@@ -254,15 +254,31 @@ class gamification_goal_plan(osv.Model):
|
||||
]
|
||||
|
||||
def action_start(self, cr, uid, ids, context=None):
|
||||
"""Start a draft goal plan
|
||||
|
||||
Change the state of the plan to in progress
|
||||
TODO: generate related goals"""
|
||||
return self.write(cr, uid, ids, {'state': 'inprogress'}, context=context)
|
||||
|
||||
def action_close(self, cr, uid, ids, context=None):
|
||||
"""Close a plan in progress
|
||||
|
||||
Change the state of the plan to in done
|
||||
TODO: close the related goals"""
|
||||
return self.write(cr, uid, ids, {'state': 'done'}, context=context)
|
||||
|
||||
def action_cancel(self, cr, uid, ids, context=None):
|
||||
"""Cancel a plan in progress
|
||||
|
||||
Change the state of the plan to draft
|
||||
TODO: close the related goals ?"""
|
||||
return self.write(cr, uid, ids, {'state': 'draft'}, context=context)
|
||||
|
||||
def action_reset(self, cr, uid, ids, context=None):
|
||||
"""Reset a closed goal plan
|
||||
|
||||
Change the state of the plan to in progress
|
||||
TODO: reopen unfinished goals ?"""
|
||||
return self.write(cr, uid, ids, {'state': 'inprogress'}, context=context)
|
||||
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
<field name="end_date"/>
|
||||
<field name="completeness" widget="progressbar"/>
|
||||
<field name="state" invisible="1"/>
|
||||
<field name="plan_id" invisible="1"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
@@ -81,11 +82,15 @@
|
||||
<search string="Search Goals">
|
||||
<filter name="my_in_progress" string="My Goals in Progress"
|
||||
domain="[('user_id', '=', uid),('state', '=', 'inprogress')]"/>
|
||||
<field name="plan_id"/>
|
||||
<field name="user_id"/>
|
||||
<field name="type_id"/>
|
||||
<group expand="0" string="Group By...">
|
||||
<filter string="User" domain="[]" context="{'group_by':'user_id'}"/>
|
||||
<filter string="Goal Type" domain="[]" context="{'group_by':'type_id'}"/>
|
||||
<filter string="State" domain="[]" context="{'group_by':'state'}"/>
|
||||
<filter string="End Date" domain="[]" context="{'group_by':'end_date'}"/>
|
||||
<filter string="Plan" domain="[]" context="{'group_by':'plan_id'}"/>
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
|
||||
@@ -21,6 +21,14 @@
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="act_show_goals_from_plan" model="ir.actions.act_window">
|
||||
<field name="res_model">gamification.goal</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="name">Related Goals</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="context">{'search_default_plan_id': [active_id], 'default_plan_id': active_id}</field>
|
||||
</record>
|
||||
|
||||
<record id="goal_plan_form_view" model="ir.ui.view">
|
||||
<field name="name">Goal Plan Form</field>
|
||||
<field name="model">gamification.goal.plan</field>
|
||||
@@ -40,6 +48,12 @@
|
||||
</div>
|
||||
<field name="name"/>
|
||||
</h1>
|
||||
|
||||
<!-- action buttons -->
|
||||
<div class="oe_right oe_button_box">
|
||||
<button name="%(act_show_goals_from_plan)d" type="action" string="Related Goals" help="show all the generated goals for this plan"/>
|
||||
</div>
|
||||
|
||||
<group>
|
||||
<group colspan="4">
|
||||
<field name="period"/>
|
||||
@@ -111,7 +125,8 @@
|
||||
<search string="Search Goal Plans">
|
||||
<filter name="in_progress" string="Plans in Progress"
|
||||
domain="[('state', '=', 'inprogress')]"/>
|
||||
<group expand="0" string="Group By...">
|
||||
<field name="name"/>
|
||||
<group expand="0" string="Group By...">
|
||||
<filter string="State" domain="[]" context="{'group_by':'state'}"/>
|
||||
<filter string="Period" domain="[]" context="{'group_by':'period'}"/>
|
||||
</group>
|
||||
|
||||
@@ -58,7 +58,10 @@
|
||||
<field name="model">gamification.goal.type</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Search Goal Types">
|
||||
<group expand="0" string="Group By...">
|
||||
<field name="name"/>
|
||||
<field name="model_id"/>
|
||||
<field name="field_id"/>
|
||||
<group expand="0" string="Group By...">
|
||||
<filter string="Model" domain="[]" context="{'group_by':'model_id'}"/>
|
||||
<filter string="Computation Mode" domain="[]" context="{'group_by':'computation_mode'}"/>
|
||||
</group>
|
||||
|
||||
Reference in New Issue
Block a user