mirror of
https://github.com/OCA/contract.git
synced 2025-02-13 17:57:24 +02:00
[MERGE]
This commit is contained in:
@@ -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,21 +27,27 @@ 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({
|
self.localcontext.update({'time': time,
|
||||||
'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,
|
})
|
||||||
})
|
|
||||||
self.context = context
|
self.context = context
|
||||||
|
|
||||||
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')
|
||||||
al_ids = al_pool.search(
|
aj_pool = self.pool.get('account.analytic.journal')
|
||||||
self.cr,
|
tcj_ids = aj_pool.search(self.cr, self.uid,
|
||||||
self.uid,
|
[('type', '=', 'general')])
|
||||||
[('invoice_id', '=', hours_block.invoice_id.id)],
|
al_ids = al_pool.search(self.cr,
|
||||||
order='date desc',
|
self.uid,
|
||||||
context=self.context)
|
[('invoice_id', '=', hours_block.invoice_id.id),
|
||||||
|
('journal_id', 'in', tcj_ids),
|
||||||
|
],
|
||||||
|
order='date desc',
|
||||||
|
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)
|
||||||
|
|||||||
Reference in New Issue
Block a user