[REF] gamification: use m2o to email.template for report progress, create new field report_template_id, cleaning code

bzr revid: mat@openerp.com-20131224144514-lmbhw88nj7aa3r8i
This commit is contained in:
Martin Trigaux
2013-12-24 15:45:14 +01:00
parent 25117ca97f
commit be7bc54edc
6 changed files with 35 additions and 96 deletions
-22
View File
@@ -1,22 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2013 OpenERP SA (<http://openerp.com>).
#
# 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/>.
#
##############################################################################
import goal_definition
+13 -21
View File
@@ -122,23 +122,22 @@
<header>
<strong>Reminder ${object.name}</strong>
</header>
<p class="oe_grey">${object.report_header or ''}</p>
<p>You have not updated your progress for the goal ${object.definition_id.name} (currently reached at ${object.completeness}%) for at least ${object.remind_update_delay} days. Do not forget to do it.</p>
<p>If you have not changed your score yet, you can use the button "The current value is up to date" to indicate so.</p>
]]></field>
</record>
<record id="email_template_goal_progress_perso" model="email.template">
<field name="name">Personal Goal Progress</field>
<record id="simple_report_template" model="email.template">
<field name="name">Simple Challenge Report Progress</field>
<field name="body_html"><![CDATA[
<header>
<strong>${object.name}</strong>
</header>
<p class="oe_grey">${object.report_header or ''}</p>
<header>
<strong>${object.name}</strong>
</header>
<p class="oe_grey">The following message contains the current progress for the challenge ${object.name}</p>
% if object.visibility_mode == 'personal':
<table width="100%" border="1">
<tr>
<th>Goal</th>
@@ -166,17 +165,8 @@
<td>${line['completeness']} %</td>
</tr>
% endfor
</table>]]></field>
</record>
<record id="email_template_goal_progress_group" model="email.template">
<field name="name">Group Goal Progress</field>
<field name="body_html"><![CDATA[
<header>
<strong>${object.name}</strong>
</header>
<p class="oe_grey">${object.report_header or ''}</p>
</table>
% else:
% for line in ctx["challenge_lines"]:
<table width="100%" border="1">
<tr>
@@ -209,7 +199,9 @@
<br/><br/>
% endfor
]]></field>
% endif
]]></field>
</record>
</data>
</openerp>
@@ -1,32 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2013 OpenERP SA (<http://www.openerp.com>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>
#
##############################################################################
from openerp.osv import osv
class gamification_goal_definition_data(osv.Model):
"""Goal definition data
Methods for more complex goals not possible with the 'sum' and 'count' mode.
Each method should return the value that will be set in the 'current' field
of a user's goal. The return definition must be a float or integer.
"""
_inherit = 'gamification.goal.definition'