|
@ -2,7 +2,7 @@ |
|
|
############################################################################## |
|
|
############################################################################## |
|
|
# |
|
|
# |
|
|
# Author: Vincent Renaville, ported by Joel Grand-Guillaume |
|
|
# Author: Vincent Renaville, ported by Joel Grand-Guillaume |
|
|
# Copyright 2010-2012 Camptocamp SA |
|
|
|
|
|
|
|
|
# Copyright 2010-2013 Camptocamp SA |
|
|
# |
|
|
# |
|
|
# This program is free software: you can redistribute it and/or modify |
|
|
# This program is free software: you can redistribute it and/or modify |
|
|
# it under the terms of the GNU Affero General Public License as |
|
|
# it under the terms of the GNU Affero General Public License as |
|
@ -27,8 +27,7 @@ from openerp.tools import DEFAULT_SERVER_DATE_FORMAT |
|
|
class account_hours_block(report_sxw.rml_parse): |
|
|
class account_hours_block(report_sxw.rml_parse): |
|
|
def __init__(self, cr, uid, name, context=None): |
|
|
def __init__(self, cr, uid, name, context=None): |
|
|
super(account_hours_block, self).__init__(cr, uid, name, context=context) |
|
|
super(account_hours_block, self).__init__(cr, uid, name, context=context) |
|
|
self.localcontext.update({ |
|
|
|
|
|
'time': time, |
|
|
|
|
|
|
|
|
self.localcontext.update({'time': time, |
|
|
'date_format': DEFAULT_SERVER_DATE_FORMAT, |
|
|
'date_format': DEFAULT_SERVER_DATE_FORMAT, |
|
|
'analytic_lines': self._get_analytic_lines, |
|
|
'analytic_lines': self._get_analytic_lines, |
|
|
}) |
|
|
}) |
|
@ -37,13 +36,18 @@ class account_hours_block(report_sxw.rml_parse): |
|
|
def _get_analytic_lines(self, hours_block): |
|
|
def _get_analytic_lines(self, hours_block): |
|
|
al_pool = self.pool.get('account.analytic.line') |
|
|
al_pool = self.pool.get('account.analytic.line') |
|
|
aj_pool = self.pool.get('account.analytic.journal') |
|
|
aj_pool = self.pool.get('account.analytic.journal') |
|
|
tcj_ids = aj_pool.search(self.cr,self.uid,[('type','=','general')]) |
|
|
|
|
|
al_ids = al_pool.search( |
|
|
|
|
|
self.cr, |
|
|
|
|
|
|
|
|
tcj_ids = aj_pool.search(self.cr, self.uid, |
|
|
|
|
|
[('type', '=', 'general')]) |
|
|
|
|
|
al_ids = al_pool.search(self.cr, |
|
|
self.uid, |
|
|
self.uid, |
|
|
[('invoice_id', '=', hours_block.invoice_id.id),('journal_id','in',tcj_ids)], |
|
|
|
|
|
|
|
|
[('invoice_id', '=', hours_block.invoice_id.id), |
|
|
|
|
|
('journal_id', 'in', tcj_ids), |
|
|
|
|
|
], |
|
|
order='date desc', |
|
|
order='date desc', |
|
|
context=self.context) |
|
|
context=self.context) |
|
|
return al_pool.browse(self.cr, self.uid, al_ids, context=self.context) |
|
|
return al_pool.browse(self.cr, self.uid, al_ids, context=self.context) |
|
|
|
|
|
|
|
|
report_sxw.report_sxw('report.account.hours.block', 'account.hours.block', 'addons/analytic_hours_block/report/hours_block.rml', parser=account_hours_block) |
|
|
|
|
|
|
|
|
report_sxw.report_sxw('report.account.hours.block', |
|
|
|
|
|
'account.hours.block', |
|
|
|
|
|
'addons/analytic_hours_block/report/hours_block.rml', |
|
|
|
|
|
parser=account_hours_block) |