[MERGE] commited rpa's work on report_analytic_planning module
bzr revid: qdp@cyan-20091026085953-t2kppnx9wliqbujd
This commit is contained in:
@@ -12,209 +12,215 @@
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Table1">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<blockBackground colorName="#e6e6e6" start="0,0" stop="0,0"/>
|
||||
<blockBackground colorName="#e6e6e6" start="1,0" stop="1,0"/>
|
||||
<blockBackground colorName="#e6e6e6" start="2,0" stop="2,0"/>
|
||||
<blockBackground colorName="#e6e6e6" start="0,1" stop="0,1"/>
|
||||
<blockBackground colorName="#e6e6e6" start="1,1" stop="1,1"/>
|
||||
<blockBackground colorName="#e6e6e6" start="2,1" stop="2,1"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Table7">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<blockBackground colorName="#ffff99" start="0,0" stop="0,0"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Table2">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<blockBackground colorName="#ffffcc" start="0,0" stop="0,0"/>
|
||||
<blockBackground colorName="#ffffcc" start="1,0" stop="1,0"/>
|
||||
<blockValign value="CENTER"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#808080" start="0,-1" stop="0,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#808080" start="1,-1" stop="1,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#808080" start="2,-1" stop="2,-1"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Table6">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<blockBackground colorName="#ffff99" start="0,0" stop="0,0"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Table3">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<blockBackground colorName="#ffffcc" start="0,0" stop="0,0"/>
|
||||
<blockBackground colorName="#ffffcc" start="1,0" stop="1,0"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="0,0" stop="5,1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#cecece" start="0,1" stop="-1,-1"/>
|
||||
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Table5">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<blockBackground colorName="#ffff99" start="0,0" stop="0,0"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Table4">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<blockBackground colorName="#ffffcc" start="0,0" stop="0,0"/>
|
||||
<blockBackground colorName="#ffffcc" start="1,0" stop="1,0"/>
|
||||
<blockBackground colorName="#ffffcc" start="2,0" stop="2,0"/>
|
||||
<blockBackground colorName="#ffffcc" start="3,0" stop="3,0"/>
|
||||
<blockBackground colorName="#ffffcc" start="4,0" stop="4,0"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="0,0" stop="0,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="1,0" stop="1,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="2,0" stop="2,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="3,0" stop="3,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="3,-1" stop="3,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="4,0" stop="4,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="4,-1" stop="4,-1"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Table5">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Table4">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="0,0" stop="5,1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#b3b3b3" start="0,1" stop="-1,-1"/>
|
||||
|
||||
</blockTableStyle>
|
||||
<initialize>
|
||||
<paraStyle name="all" alignment="justify"/>
|
||||
</initialize>
|
||||
<paraStyle name="P1" fontName="Times-Roman" fontSize="20.0" leading="25" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P2" fontName="Times-Roman" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P3" fontName="Times-Roman" fontSize="12.0" leading="15" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P4" fontName="Times-Roman" alignment="RIGHT"/>
|
||||
<paraStyle name="P5" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="CENTER"/>
|
||||
<paraStyle name="P6" fontName="Helvetica-Bold" fontSize="14.0" leading="17" alignment="CENTER"/>
|
||||
<paraStyle name="P7" fontName="Times-Roman" fontSize="11.0" leading="14"/>
|
||||
<paraStyle name="P8" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="RIGHT"/>
|
||||
<paraStyle name="P9" fontName="Helvetica-Bold" fontSize="14.0" leading="17"/>
|
||||
<paraStyle name="P10" fontName="Times-Roman" fontSize="11.0" leading="14" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P11" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P12" fontName="Times-Roman" fontSize="11.0" leading="14" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P13" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P14" fontName="Times-Roman" fontSize="11.0" leading="14"/>
|
||||
<paraStyle name="Standard" fontName="Times-Roman"/>
|
||||
<paraStyle name="Text body" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P1" fontName="Helvetica"/>
|
||||
<paraStyle name="P2" fontName="Helvetica-Bold" alignment="RIGHT"/>
|
||||
<paraStyle name="P3" fontName="Helvetica-Bold" fontSize="11.0" leading="14"/>
|
||||
<paraStyle name="P4" fontName="Helvetica-Bold" fontSize="11.0" leading="14" alignment="CENTER"/>
|
||||
<paraStyle name="P5" fontName="Helvetica-Bold" fontSize="14.0" leading="17"/>
|
||||
<paraStyle name="P6" fontName="Helvetica" fontSize="11.0" leading="14"/>
|
||||
<paraStyle name="P7" fontName="Helvetica-Bold" fontSize="11.0" leading="14"/>
|
||||
<paraStyle name="P8" fontName="Helvetica-Bold" fontSize="11.0" leading="14" alignment="RIGHT"/>
|
||||
<paraStyle name="P9" fontName="Helvetica-Bold" fontSize="16.0" leading="20" alignment="CENTER"/>
|
||||
<paraStyle name="P10" fontName="Helvetica" fontSize="12.0" leading="15" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P11" fontName="Helvetica" fontSize="11.0" leading="14" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P12" fontName="Helvetica" fontSize="11.0" leading="14" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P13" fontName="Helvetica-Bold" fontSize="11.0" leading="14" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P14" fontName="Helvetica-Bold" fontSize="11.0" leading="14" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P15" fontName="Helvetica-Bold" fontSize="20.0" leading="25" alignment="CENTER"/>
|
||||
<paraStyle name="P16" fontName="Helvetica-Bold" fontSize="11.0" leading="14"/>
|
||||
<paraStyle name="P17" fontName="Helvetica-Bold" fontSize="11.0" leading="14" alignment="RIGHT"/>
|
||||
<paraStyle name="P18" fontName="Helvetica" fontSize="11.0" leading="14"/>
|
||||
<paraStyle name="P19" fontName="Helvetica-Bold" fontSize="11.0" leading="14" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="P20" fontName="Helvetica" fontSize="11.0" leading="14" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Standard" fontName="Helvetica"/>
|
||||
<paraStyle name="Text body" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Heading" fontName="Helvetica" fontSize="14.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="List" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Table Contents" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Caption" fontName="Times-Roman" fontSize="12.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Index" fontName="Times-Roman"/>
|
||||
<paraStyle name="List" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Table Contents" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Caption" fontName="Helvetica" fontSize="12.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Index" fontName="Helvetica"/>
|
||||
<paraStyle name="Table Heading" fontName="Helvetica" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
</stylesheet>
|
||||
<images/>
|
||||
<story>
|
||||
<para style="Standard">[[ repeatIn(objects, 'o') ]]</para>
|
||||
<para style="P1">[[ repeatIn(objects, 'o') ]]</para>
|
||||
<para style="P1">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="P1">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="P15">HR Planning</para>
|
||||
<para style="Standard">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<blockTable colWidths="154.0,199.0,146.0" repeatRows="1" style="Table1">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="Standard">[[ company.name ]]</para>
|
||||
<para style="P1"><font face="Helvetica-Bold">Responsible</font>: [[ o.user_id.name ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P1">HR Planning</para>
|
||||
<para style="P10">[[ o.name]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P2">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="P2">From: [[ o.date_from ]]</para>
|
||||
<para style="P2">To: [[ o.date_to ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="P4">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="P5">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<blockTable colWidths="499.0" style="Table6">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P9">Summary by user</para>
|
||||
<para style="P3">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<blockTable colWidths="108.0,104.0,117.0,103.0,66.0" style="Table3">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P7">User</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P7">Total Planned Tasks</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P7">Remaining tasks</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P7">Time without</para>
|
||||
<para style="P7">tasks</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P8">Timesheet</para>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<para style="Standard">Responsible: [[ o.user_id.name ]]</para>
|
||||
<para style="P6">[[ repeatIn(o.planning_user_ids , 'u') ]] [[ u.user_id.name ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3">[[ o.name]]</para>
|
||||
<para style="P6">[[ formatLang(u.plan_tasks) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4">From: [[ o.date_from ]]</para>
|
||||
<para style="P4">To: [[ o.date_to ]]</para>
|
||||
<para style="P6">[[ formatLang(u.tasks) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P6">[[ formatLang(u.free) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P6">[[ formatLang(u.timesheet) ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="P5">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<blockTable colWidths="499.0" style="Table7">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P6">Summary by project</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<blockTable colWidths="406.0,92.0" style="Table2">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P7">Project</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P8">Quantities</para>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P7"><font face="Times-Roman">[[ repeatIn(o.stat_account_ids , 'p') ]]</font> [ [[ p.account_id.code ]] ] [[ p.account_id.complete_name ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P8">[[ p.quantity ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="P9">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<blockTable colWidths="499.0" style="Table6">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P6">Summary by user</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<blockTable colWidths="406.0,92.0" style="Table3">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P7">User</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P8">Quantities</para>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P7"><font face="Times-Roman">[[ repeatIn(o.stat_user_ids, 'u') ]] </font>[[ u.user_id.name ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P8">[[ u.quantity ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="P9">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<blockTable colWidths="499.0" style="Table5">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P6">Details of user's time by projects</para>
|
||||
<para style="P9">Summary by project</para>
|
||||
<para style="P3">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<blockTable colWidths="142.0,176.0,57.0,64.0,59.0" style="Table4">
|
||||
<blockTable colWidths="107.0,106.0,116.0,104.0,65.0" style="Table4">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P10">User</para>
|
||||
<para style="P13">Project</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P10">Project</para>
|
||||
<para style="P7">Total Planned Tasks</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P11">Planned</para>
|
||||
<para style="P7">Remaining tasks</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P11">Tasks</para>
|
||||
<para style="P7">Time without</para>
|
||||
<para style="P7">tasks</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P11">Real</para>
|
||||
<para style="P8">Timesheet</para>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P12"><font face="Times-Roman">[[ repeatIn(o.stat_ids, 'l') ]]</font> [[ l.user_id.name ]]</para>
|
||||
<para style="P11"><font face="Helvetica" size="11.0">[[ repeatIn(o.planning_account , 'l') ]] </font>[ [[ l.account_id.code ]] ] [[ l.account_id.name ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P12">[ [[ l.account_id.code ]] ] [[ l.account_id.name ]]</para>
|
||||
<para style="P6">[[ formatLang(l.plan_tasks) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P13">[[ l.sum_amount ]]</para>
|
||||
<para style="P6">[[ formatLang(l.tasks) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P13">[[ l.sum_amount_tasks ]]</para>
|
||||
<para style="P6">[[ formatLang(l.plan_open) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P13">[[ l.sum_amount_real ]]</para>
|
||||
<para style="P6">[[ formatLang(l.timesheet) ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="P14">
|
||||
<para style="P3">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</story>
|
||||
</document>
|
||||
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
|
||||
# $Id$
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
@@ -64,23 +65,41 @@ class report_account_analytic_planning(osv.osv):
|
||||
total_free = total_free + p.free
|
||||
result[plan.id] = total_free
|
||||
return result
|
||||
|
||||
def _check_planning_responsible(self, cr, uid, ids, context={}):
|
||||
for obj_plan in self.browse(cr,uid,ids):
|
||||
cr.execute("""
|
||||
SELECT id FROM report_account_analytic_planning plan
|
||||
WHERE ( (%(date_from)s BETWEEN date_from AND date_to)
|
||||
OR (%(date_to)s BETWEEN date_from AND date_to)
|
||||
OR (%(date_from)s < date_from AND %(date_to)s > date_to)
|
||||
) AND user_id = %(uid)s AND id <> %(id)s""",
|
||||
{"date_from": obj_plan.date_from,
|
||||
"date_to": obj_plan.date_to,
|
||||
"uid": obj_plan.user_id.id,
|
||||
"id" : obj_plan.id}
|
||||
)
|
||||
|
||||
res = cr.fetchone()
|
||||
if res:
|
||||
return False
|
||||
return True
|
||||
|
||||
_columns = {
|
||||
'name': fields.char('Planning Name', size=32, required=True, readonly=True, states={'draft':[('readonly', False)]}),
|
||||
'user_id': fields.many2one('res.users', 'Responsible', required=True, readonly=True, states={'draft':[('readonly', False)]}),
|
||||
'date_from':fields.date('Start Date', required=True, readonly=True, states={'draft':[('readonly', False)]}),
|
||||
'date_to':fields.date('End Date', required=True, readonly=True, states={'draft':[('readonly', False)]}),
|
||||
'line_ids': fields.one2many('report_account_analytic.planning.line', 'planning_id', 'Planning lines', readonly=True, states={'draft':[('readonly', False)]}),
|
||||
'name': fields.char('Planning Name', size=32, states={'done':[('readonly', True)]}),
|
||||
'user_id': fields.many2one('res.users', 'Responsible', required=True, states={'done':[('readonly', True)]}),
|
||||
'date_from':fields.date('Start Date', required=True, states={'done':[('readonly', True)]}),
|
||||
'date_to':fields.date('End Date', required=True, states={'done':[('readonly', True)]}),
|
||||
'line_ids': fields.one2many('report_account_analytic.planning.line', 'planning_id', 'Planning lines', states={'done':[('readonly', True)]}),
|
||||
'stat_ids': fields.one2many('report_account_analytic.planning.stat', 'planning_id', 'Planning analysis', readonly=True),
|
||||
'state': fields.selection([('draft','Draft'),('open', 'Open'), ('done', 'Done'),('cancel','Cancelled')], 'Status', required=True),
|
||||
'business_days' : fields.integer('Business Days', required=True, readonly=True, states={'draft':[('readonly', False)]}, help='Set here the number of working days within this planning for one person full time'),
|
||||
'business_days' : fields.integer('Business Days', required=True, states={'done':[('readonly', True)]}, help='Set here the number of working days within this planning for one person full time'),
|
||||
'planning_user_ids': one2many_mod3('report_account_analytic.planning.user', 'planning_id', 'Planning By User'),
|
||||
'planning_account': fields.one2many('report_account_analytic.planning.account', 'planning_id', 'Planning By Account'),
|
||||
'total_planned' : fields.function(_get_total_planned, method=True, string='Total Planned'),
|
||||
'total_free' : fields.function(_get_total_free, method=True, string='Total Free'),
|
||||
}
|
||||
_defaults = {
|
||||
'name': lambda *a: time.strftime('%B-%y'),
|
||||
'date_from': lambda *a: time.strftime('%Y-%m-01'),
|
||||
'date_to': lambda *a: (mx.DateTime.now()+mx.DateTime.RelativeDateTime(months=1, day=1, days=-1)).strftime('%Y-%m-%d'),
|
||||
'user_id': lambda self, cr, uid, c: uid,
|
||||
@@ -89,6 +108,10 @@ class report_account_analytic_planning(osv.osv):
|
||||
}
|
||||
_order = 'date_from desc'
|
||||
|
||||
_constraints = [
|
||||
(_check_planning_responsible, 'Invalid planning ! Planning dates can\'t overlap for the same responsible. ', ['user_id'])
|
||||
]
|
||||
|
||||
def action_open(self, cr, uid, id, context={}):
|
||||
self.write(cr, uid, id, {'state' : 'open'})
|
||||
return True
|
||||
@@ -104,7 +127,7 @@ class report_account_analytic_planning(osv.osv):
|
||||
def action_done(self, cr, uid, id, context={}):
|
||||
self.write(cr, uid, id, {'state' : 'done'})
|
||||
return True
|
||||
|
||||
|
||||
report_account_analytic_planning()
|
||||
|
||||
class report_account_analytic_planning_line(osv.osv):
|
||||
@@ -141,15 +164,36 @@ class report_account_analytic_planning_line(osv.osv):
|
||||
'task_ids': fields.one2many('project.task', 'planning_line_id', 'Planning Tasks'),
|
||||
}
|
||||
_order = 'user_id,account_id'
|
||||
|
||||
report_account_analytic_planning_line()
|
||||
|
||||
|
||||
class account_analytic_account(osv.osv):
|
||||
_name = 'account.analytic.account'
|
||||
_inherit = 'account.analytic.account'
|
||||
_description = 'Analytic Accounts'
|
||||
_columns = {
|
||||
'planning_ids': fields.one2many('report_account_analytic.planning.line', 'account_id', 'Plannings'),
|
||||
}
|
||||
|
||||
account_analytic_account()
|
||||
|
||||
class project_task(osv.osv):
|
||||
_name = "project.task"
|
||||
_inherit = "project.task"
|
||||
_columns = {
|
||||
'planning_line_id': fields.many2one('report_account_analytic.planning.line', 'Planning', ondelete='cascade'),
|
||||
}
|
||||
|
||||
def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False):
|
||||
if not context.get('planning'):
|
||||
return super(project_task,self).search(cr, user, args, offset, limit, order, context)
|
||||
cr.execute(" SELECT t.id, t.name \
|
||||
from project_task t \
|
||||
join report_account_analytic_planning_line l on (l.id = t.planning_line_id )\
|
||||
where l.planning_id=%s" % context.get('planning'))
|
||||
ids = map(lambda x: x[0], cr.fetchall())
|
||||
return ids
|
||||
|
||||
project_task()
|
||||
|
||||
|
||||
|
||||
@@ -82,7 +82,55 @@
|
||||
<field name="amount_unit" />
|
||||
<!-- WIDGET MANY2MANY GIVES ERROR-->
|
||||
<!-- <field name="task_ids" colspan="4" nolabel="1" widget="many2many"/>-->
|
||||
<field name="task_ids" colspan="4" nolabel="1"/>
|
||||
<field name="task_ids" colspan="4" nolabel="1" mode="tree,form">
|
||||
<form string="Tasks">
|
||||
<group colspan="4" col="2">
|
||||
<field name="name" select="1"/>
|
||||
<field name="project_id" required="1" select="1" domain="[('category_id','=',parent.account_id)]"/>
|
||||
</group>
|
||||
<group colspan="4" col="4">
|
||||
<field name="date_deadline" select="2"/>
|
||||
<field name="user_id" select="1" domain="[('id','=',parent.user_id)]"/>
|
||||
</group>
|
||||
<notebook colspan="4">
|
||||
<page string="Information">
|
||||
<group col="3" colspan="4">
|
||||
<field name="effective_hours" widget="float_time" invisible="True" />
|
||||
<field name="planned_hours"
|
||||
widget="float_time"
|
||||
attrs="{'readonly':[('state','!=','draft')]}"
|
||||
on_change="onchange_planned(planned_hours,effective_hours)"/>
|
||||
<field name="remaining_hours" select="2" widget="float_time" attrs="{'readonly':[('state','!=','draft')]}"/>
|
||||
<button name="%(project.action_config_compute_remaining)d" string="Review" type="action" colspan="1" target="new" states="open,pending" icon="gtk-edit"/>
|
||||
</group>
|
||||
<field colspan="4" name="description" nolabel="1" select="2" attrs="{'readonly':[('state','=','done')]}" widget="text_wiki"/>
|
||||
<group col="11" colspan="4">
|
||||
<field name="state" select="1"/>
|
||||
<button name="do_draft" states="open" string="Draft" type="object" icon="gtk-indent"/>
|
||||
<button name="do_open" states="pending,draft" string="Start Task" type="object" icon="gtk-execute"/>
|
||||
<button name="do_reopen" states="done,cancelled" string="Reactivate" type="object" icon="gtk-convert"/>
|
||||
<button name="do_pending" states="open" string="Pending" type="object" icon="gtk-media-pause"/>
|
||||
<button groups="base.group_extended" name="%(project.wizard_delegate_task)d" states="pending,open" string="Delegate" type="action" icon="gtk-sort-descending"/>
|
||||
<button name="%(project.wizard_close_task)d" states="pending,open" string="Done" type="action" icon="gtk-jump-to"/>
|
||||
<button name="do_cancel" states="draft,open,pending" string="Cancel" type="object" icon="gtk-cancel"/>
|
||||
|
||||
</group>
|
||||
</page>
|
||||
<page groups="base.group_extended" string="Extra Info" attrs="{'readonly':[('state','=','done')]}">
|
||||
<group colspan="2" col="2">
|
||||
<field name="priority"/>
|
||||
<field name="sequence"/>
|
||||
</group>
|
||||
<separator string="Miscelleanous" colspan="4"/>
|
||||
<field name="type"/>
|
||||
<field name="active" select="2"/>
|
||||
<field name="partner_id" select="2"/>
|
||||
<separator colspan="4" string="Notes"/>
|
||||
<field colspan="4" name="notes" nolabel="1"/>
|
||||
</page>
|
||||
</notebook>
|
||||
</form>
|
||||
</field>
|
||||
<separator string="Notes" colspan="4" />
|
||||
<field name="note" colspan="4"
|
||||
nolabel="1" />
|
||||
@@ -149,8 +197,8 @@
|
||||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
|
||||
<menuitem id="planning_main" name="Plannings"
|
||||
parent="hr.menu_hr_root" />
|
||||
<menuitem id="planning_main" name="Long Term Planning"
|
||||
parent="project.menu_main" />
|
||||
|
||||
<menuitem action="action_account_analytic_planning_form"
|
||||
id="menu_report_account_analytic_planning" parent="planning_main" />
|
||||
@@ -294,7 +342,43 @@
|
||||
id="menu_report_account_analytic_planning_stat_my_manager"
|
||||
parent="report_analytic_planning.next_id_85" />
|
||||
|
||||
<!-- Analytic account Form -->
|
||||
|
||||
<record id="view_project_planning_form" model="ir.ui.view">
|
||||
<field name="name">planning.account.analytic.account.form</field>
|
||||
<field name="model">account.analytic.account</field>
|
||||
<field name="type">form</field>
|
||||
<field name="inherit_id" ref="account.view_account_analytic_account_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<notebook position="inside">
|
||||
<page string="Planning" >
|
||||
<separator string="Planning lines"/>
|
||||
<field name="planning_ids" colspan="4" nolabel="1">
|
||||
<form string="Planning Lines">
|
||||
<field name="planning_id" select="1"/>
|
||||
<field name="user_id"/>
|
||||
<field name="amount" />
|
||||
<field name="amount_unit" />
|
||||
<separator string="Notes" colspan="4" />
|
||||
<field name="note" colspan="4" nolabel="1" />
|
||||
</form>
|
||||
<tree editable="bottom"
|
||||
string="Planning Lines">
|
||||
<field name="user_id"/>
|
||||
<field name="account_id" />
|
||||
<field name="amount" />
|
||||
<field name="amount_unit" />
|
||||
<field name="task_ids" />
|
||||
<field name="note" />
|
||||
<field name="amount_in_base_uom" invisible="1" sum="Total Planned (in Days)"/>
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
</notebook>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<!-- Task Form -->
|
||||
|
||||
<record id="view_task_planning_form" model="ir.ui.view">
|
||||
@@ -304,10 +388,16 @@
|
||||
<field name="inherit_id" ref="project.view_task_form2"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="priority" position="before">
|
||||
<field name="planning_line_id" select="2"/>
|
||||
<field name="planning_line_id" select="2" domain="[('user_id', '=', user_id)]" />
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!--Added link to open the list of all tasks planned on all lines of this planning.-->
|
||||
<act_window context="{'planning': active_id}"
|
||||
id="act_task_of_lines" name="Planning tasks" res_model="project.task"
|
||||
src_model="report_account_analytic.planning"
|
||||
/>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
Reference in New Issue
Block a user