Modifs
bzr revid: fp@tinyerp.com-8870fe275d582ac457654fef6c456d888c6b9658
This commit is contained in:
parent
caa1908d54
commit
e5ea66f472
|
@ -75,10 +75,17 @@ class report_account_analytic_planning_stat_account(osv.osv):
|
|||
_rec_name = 'account_id'
|
||||
_auto = False
|
||||
_log_access = False
|
||||
def _sum_amount_real(self, cr, uid, ids, name, args, context):
|
||||
result = {}
|
||||
for line in self.browse(cr, uid, ids, context):
|
||||
cr.execute('select sum(unit_amount) from account_analytic_line where account_id=%d and date>=%s and date<=%s', (line.account_id.id,line.planning_id.date_from,line.planning_id.date_to))
|
||||
result[line.id] = cr.fetchone()[0]
|
||||
return result
|
||||
_columns = {
|
||||
'planning_id': fields.many2one('report_account_analytic.planning', 'Planning'),
|
||||
'account_id': fields.many2one('account.analytic.account', 'Analytic Account', required=True),
|
||||
'quantity': fields.float('Quantity', required=True)
|
||||
'quantity': fields.float('Planned', required=True),
|
||||
'sum_amount_real': fields.function(_sum_amount_real, method=True, string='Timesheet'),
|
||||
}
|
||||
def init(self, cr):
|
||||
cr.execute("""
|
||||
|
@ -172,10 +179,19 @@ class report_account_analytic_planning_stat_user(osv.osv):
|
|||
_rec_name = 'user_id'
|
||||
_auto = False
|
||||
_log_access = False
|
||||
def _sum_amount_real(self, cr, uid, ids, name, args, context):
|
||||
result = {}
|
||||
for line in self.browse(cr, uid, ids, context):
|
||||
result[line.id] = 0.0
|
||||
if line.user_id:
|
||||
cr.execute('select sum(unit_amount) from account_analytic_line where user_id=%d and date>=%s and date<=%s', (line.user_id.id,line.planning_id.date_from,line.planning_id.date_to))
|
||||
result[line.id] = cr.fetchone()[0]
|
||||
return result
|
||||
_columns = {
|
||||
'planning_id': fields.many2one('report_account_analytic.planning', 'Planning', required=True),
|
||||
'user_id': fields.many2one('res.users', 'User'),
|
||||
'quantity': fields.float('Quantity', required=True)
|
||||
'quantity': fields.float('Planned', required=True),
|
||||
'sum_amount_real': fields.function(_sum_amount_real, method=True, string='Timesheet'),
|
||||
}
|
||||
def init(self, cr):
|
||||
cr.execute("""
|
||||
|
|
|
@ -49,14 +49,16 @@
|
|||
<field name="stat_user_ids" colspan="4" nolabel="1">
|
||||
<tree string="Quantities by user">
|
||||
<field name="user_id"/>
|
||||
<field name="quantity"/>
|
||||
<field name="quantity" sum="Total Planned"/>
|
||||
<field name="sum_amount_real" sum="Total Timesheet"/>
|
||||
</tree>
|
||||
</field>
|
||||
</page><page string="Time by account">
|
||||
<field name="stat_account_ids" colspan="4" nolabel="1">
|
||||
<tree string="Quantities by account">
|
||||
<field name="account_id"/>
|
||||
<field name="quantity"/>
|
||||
<field name="quantity" sum="Total Planned"/>
|
||||
<field name="sum_amount_real" sum="Total Timesheet"/>
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
|
|
Loading…
Reference in New Issue