[REM] hr_timesheet_invoice: removed unused report cost ledger. It was duplicated code of the same report defined in account module AND calling its rml.

bzr revid: qdp-launchpad@openerp.com-20120224111713-d1j8hubz33cx5wyf
This commit is contained in:
Quentin (OpenERP) 2012-02-24 12:17:13 +01:00
parent de320e0691
commit 881ffef816
9 changed files with 0 additions and 680 deletions

View File

@ -42,7 +42,6 @@ reports, etc.""",
'hr_timesheet_invoice_report.xml',
'report/report_analytic_view.xml',
'report/hr_timesheet_invoice_report_view.xml',
'wizard/hr_timesheet_invoice_analytic_cost_ledger_view.xml',
'wizard/hr_timesheet_analytic_profit_view.xml',
'wizard/hr_timesheet_invoice_create_view.xml',
'wizard/hr_timesheet_invoice_create_final_view.xml',

View File

@ -1,8 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<report auto="False" id="account_analytic_account_cost_ledger" menu="False" model="account.analytic.account" name="hr.timesheet.invoice.account.analytic.account.cost_ledger" rml="account/project/report/cost_ledger.rml" string="Cost Ledger"/>
<report
auto="False"
id="report_analytical_profit"

View File

@ -19,7 +19,6 @@
#
##############################################################################
import cost_ledger
import account_analytic_profit
import report_analytic
import hr_timesheet_invoice_report

View File

@ -1,174 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# 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 pooler
import time
from report import report_sxw
class account_analytic_cost_ledger(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(account_analytic_cost_ledger, self).__init__(cr, uid, name, context=context)
self.sum_revenue={}
self.account_sum_revenue={}
self.localcontext.update( {
'time': time,
'lines_g': self._lines_g,
'lines_a': self._lines_a,
'account_sum_debit': self._account_sum_debit,
'account_sum_credit': self._account_sum_credit,
'account_sum_balance': self._account_sum_balance,
'account_sum_qty': self._account_sum_qty,
'account_sum_revenue': self._account_sum_revenue,
'account_g_sum_revenue': self._account_g_sum_revenue,
'sum_debit': self._sum_debit,
'sum_credit': self._sum_credit,
'sum_balance': self._sum_balance,
'sum_qty': self._sum_qty,
'sum_revenue': self._sum_revenue,
})
def _lines_g(self, account_id, date1, date2):
self.cr.execute("SELECT sum(aal.amount) AS balance, aa.code AS code, aa.name AS name, aa.id AS id, sum(aal.unit_amount) AS quantity \
FROM account_account AS aa, account_analytic_line AS aal \
WHERE (aal.account_id=%s) AND (aal.date>=%s) AND (aal.date<=%s) AND (aal.general_account_id=aa.id) AND aa.active \
GROUP BY aa.code, aa.name, aa.id ORDER BY aa.code", (account_id, date1, date2))
res = self.cr.dictfetchall()
for r in res:
if r['balance'] > 0:
r['debit'] = r['balance']
r['credit'] = 0.0
elif r['balance'] < 0:
r['debit'] = 0.0
r['credit'] = -r['balance']
else:
r['debit'] = 0.0
r['credit'] = 0.0
return res
def _lines_a(self, general_account_id, account_id, date1, date2):
self.cr.execute("SELECT aal.id AS id, aal.name AS name, aal.code AS code, aal.amount AS balance, aal.date AS date, aaj.code AS cj, aal.unit_amount AS quantity \
FROM account_analytic_line AS aal, account_analytic_journal AS aaj \
WHERE (aal.general_account_id=%s) AND (aal.account_id=%s) AND (aal.date>=%s) AND (aal.date<=%s) \
AND (aal.journal_id=aaj.id) \
ORDER BY aal.date, aaj.code, aal.code", (general_account_id, account_id, date1, date2))
res = self.cr.dictfetchall()
line_obj = self.pool.get('account.analytic.line')
price_obj = self.pool.get('product.pricelist')
lines = {}
for l in line_obj.browse(self.cr, self.uid, [ x['id'] for x in res]):
lines[l.id] = l
if not account_id in self.sum_revenue:
self.sum_revenue[account_id] = 0.0
if not general_account_id in self.account_sum_revenue:
self.account_sum_revenue[general_account_id] = 0.0
for r in res:
id = r['id']
revenue = 0.0
if lines[id].amount < 0 and lines[id].product_id and lines[id].product_uom_id and lines[id].account_id.pricelist_id:
ctx = {'uom': lines[id].product_uom_id.id}
price = price_obj.price_get(self.cr, self.uid, [lines[id].account_id.pricelist_id.id], lines[id].product_id.id, lines[id].unit_amount, False, context=ctx)[lines[id].account_id.pricelist_id.id]
revenue = round(price * lines[id].unit_amount, 2)
r['revenue'] = revenue
self.sum_revenue[account_id] += revenue
self.account_sum_revenue[general_account_id] += revenue
if r['balance'] > 0:
r['debit'] = r['balance']
r['credit'] = 0.0
elif r['balance'] < 0:
r['debit'] = 0.0
r['credit'] = -r['balance']
else:
r['debit'] = 0.0
r['credit'] = 0.0
return res
def _account_sum_debit(self, account_id, date1, date2):
self.cr.execute("SELECT sum(amount) FROM account_analytic_line WHERE account_id=%s AND date>=%s AND date<=%s AND amount>0", (account_id, date1, date2))
return self.cr.fetchone()[0] or 0.0
def _account_sum_credit(self, account_id, date1, date2):
self.cr.execute("SELECT -sum(amount) FROM account_analytic_line WHERE account_id=%s AND date>=%s AND date<=%s AND amount<0", (account_id, date1, date2))
return self.cr.fetchone()[0] or 0.0
def _account_sum_balance(self, account_id, date1, date2):
debit = self._account_sum_debit(account_id, date1, date2)
credit = self._account_sum_credit(account_id, date1, date2)
return (debit-credit)
def _account_sum_qty(self, account_id, date1, date2):
self.cr.execute("SELECT sum(unit_amount) FROM account_analytic_line WHERE account_id=%s AND date>=%s AND date<=%s", (account_id, date1, date2))
return self.cr.fetchone()[0] or 0.0
def _account_sum_revenue(self, account_id):
return self.sum_revenue.get(account_id, 0.0)
def _account_g_sum_revenue(self, general_account_id):
return self.account_sum_revenue.get(general_account_id, 0.0)
def _sum_debit(self, accounts, date1, date2):
ids = map(lambda x: x.id, accounts)
if not ids:
return 0.0
self.cr.execute("SELECT sum(amount) FROM account_analytic_line WHERE account_id =ANY(%s) AND date>=%s AND date<=%s AND amount>0", (ids,date1, date2))
return self.cr.fetchone()[0] or 0.0
def _sum_credit(self, accounts, date1, date2):
ids = map(lambda x: x.id, accounts)
if not ids:
return 0.0
ids = map(lambda x: x.id, accounts)
self.cr.execute("SELECT -sum(amount) FROM account_analytic_line WHERE account_id =ANY(%s) AND date>=%s AND date<=%s AND amount<0", (ids, date1, date2))
return self.cr.fetchone()[0] or 0.0
def _sum_balance(self, accounts, date1, date2):
debit = self._sum_debit(accounts, date1, date2) or 0.0
credit = self._sum_credit(accounts, date1, date2) or 0.0
return (debit-credit)
def _sum_qty(self, accounts, date1, date2):
ids = map(lambda x: x.id, accounts)
if not ids:
return 0.0
ids = map(lambda x: x.id, accounts)
self.cr.execute("SELECT sum(unit_amount) FROM account_analytic_line WHERE account_id =ANY(%s) AND date>=%s AND date<=%s", (ids,date1, date2))
return self.cr.fetchone()[0] or 0.0
def _sum_revenue(self, accounts):
ids = map(lambda x: x.id, accounts)
if not ids:
return 0.0
res = 0.0
for id in ids:
res += self.sum_revenue.get(id, 0.0)
return res
report_sxw.report_sxw(
'report.hr.timesheet.invoice.account.analytic.account.cost_ledger',
'account.analytic.account',
'addons/hr_timesheet_invoice/report/cost_ledger.rml',
parser=account_analytic_cost_ledger, header='internal')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,404 +0,0 @@
<?xml version="1.0"?>
<document filename="test.pdf">
<template title="Cost Ledger" author="OpenERP S.A. (sales@openerp.com)" allowSplitting="20">
<pageTemplate id="first">
<frame id="first" x1="57.0" y1="57.0" width="481" height="728"/>
</pageTemplate>
</template>
<stylesheet>
<blockTableStyle id="Standard_Outline">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Table_main_header">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<blockBackground colorName="#ffffff" start="0,0" stop="0,-1"/>
<blockBackground colorName="#ffffff" start="1,0" stop="1,-1"/>
<blockBackground colorName="#ffffff" start="2,0" stop="2,-1"/>
</blockTableStyle>
<blockTableStyle id="Table_period_date_header">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="0,0" stop="0,-1"/>
<lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="0,0" stop="0,0"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="1,0" stop="1,-1"/>
<lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="1,0" stop="1,0"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="2,0" stop="2,-1"/>
<lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="2,0" stop="2,0"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="3,0" stop="3,-1"/>
<lineStyle kind="LINEAFTER" colorName="#e6e6e6" start="3,0" stop="3,-1"/>
<lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="3,0" stop="3,0"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/>
</blockTableStyle>
<blockTableStyle id="Table_period_date_content">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="0,0" stop="0,-1"/>
<lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="0,0" stop="0,0"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="1,0" stop="1,-1"/>
<lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="1,0" stop="1,0"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="2,0" stop="2,-1"/>
<lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="2,0" stop="2,0"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="3,0" stop="3,-1"/>
<lineStyle kind="LINEAFTER" colorName="#e6e6e6" start="3,0" stop="3,-1"/>
<lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="3,0" stop="3,0"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/>
</blockTableStyle>
<blockTableStyle id="Table_account_detail_header">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="3,-1" stop="3,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="4,-1" stop="4,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="5,-1" stop="5,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="6,-1" stop="6,-1"/>
</blockTableStyle>
<blockTableStyle id="Table_account_code_name">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<blockBackground colorName="#ffffff" start="0,0" stop="0,-1"/>
</blockTableStyle>
<blockTableStyle id="Table1">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="4,-1" stop="4,-1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="5,-1" stop="5,-1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="6,-1" stop="6,-1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="7,-1" stop="7,-1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="8,-1" stop="8,-1"/>
<lineStyle kind="LINEABOVE" colorName="#ffffff" start="9,0" stop="9,0"/>
<lineStyle kind="LINEBELOW" colorName="#ffffff" start="9,-1" stop="9,-1"/>
<lineStyle kind="LINEABOVE" colorName="#ffffff" start="10,0" stop="10,0"/>
<lineStyle kind="LINEBELOW" colorName="#ffffff" start="10,-1" stop="10,-1"/>
<lineStyle kind="LINEABOVE" colorName="#ffffff" start="11,0" stop="11,0"/>
<lineStyle kind="LINEBELOW" colorName="#ffffff" start="11,-1" stop="11,-1"/>
<lineStyle kind="LINEABOVE" colorName="#ffffff" start="12,0" stop="12,0"/>
<lineStyle kind="LINEBELOW" colorName="#ffffff" start="12,-1" stop="12,-1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="4,-1" stop="4,-1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="5,-1" stop="5,-1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="6,-1" stop="6,-1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="7,-1" stop="7,-1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="4,-1" stop="4,-1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="5,-1" stop="5,-1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="6,-1" stop="6,-1"/>
<lineStyle kind="LINEABOVE" colorName="#ffffff" start="0,3" stop="0,3"/>
<lineStyle kind="LINEBELOW" colorName="#ffffff" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEABOVE" colorName="#ffffff" start="1,3" stop="1,3"/>
<lineStyle kind="LINEBELOW" colorName="#ffffff" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEABOVE" colorName="#ffffff" start="2,3" stop="2,3"/>
<lineStyle kind="LINEBELOW" colorName="#ffffff" start="2,-1" stop="2,-1"/>
<lineStyle kind="LINEABOVE" colorName="#ffffff" start="3,3" stop="3,3"/>
<lineStyle kind="LINEBELOW" colorName="#ffffff" start="3,-1" stop="3,-1"/>
</blockTableStyle>
<blockTableStyle id="Table4">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="4,-1" stop="4,-1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="5,-1" stop="5,-1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="6,-1" stop="6,-1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="7,-1" stop="7,-1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="4,-1" stop="4,-1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="5,-1" stop="5,-1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="6,-1" stop="6,-1"/>
</blockTableStyle>
<blockTableStyle id="Table_move_content">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="4,-1" stop="4,-1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="5,-1" stop="5,-1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="6,-1" stop="6,-1"/>
</blockTableStyle>
<blockTableStyle id="Table_move_repeat">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEABOVE" colorName="#ffffff" start="0,0" stop="0,0"/>
<lineStyle kind="LINEBELOW" colorName="#ffffff" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEABOVE" colorName="#ffffff" start="1,0" stop="1,0"/>
<lineStyle kind="LINEBELOW" colorName="#ffffff" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEABOVE" colorName="#ffffff" start="2,0" stop="2,0"/>
<lineStyle kind="LINEBELOW" colorName="#ffffff" start="2,-1" stop="2,-1"/>
<lineStyle kind="LINEABOVE" colorName="#ffffff" start="3,0" stop="3,0"/>
<lineStyle kind="LINEBELOW" colorName="#ffffff" start="3,-1" stop="3,-1"/>
</blockTableStyle>
<blockTableStyle id="Table_account_code_total">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<blockBackground colorName="#ffffff" start="0,0" stop="0,-1"/>
<blockBackground colorName="#ffffff" start="1,0" stop="1,-1"/>
<blockBackground colorName="#ffffff" start="2,0" stop="2,-1"/>
<blockBackground colorName="#ffffff" start="3,0" stop="3,-1"/>
</blockTableStyle>
<blockTableStyle id="Table_account_total">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<initialize>
<paraStyle name="all" alignment="justify"/>
</initialize>
<paraStyle name="Standard" fontName="Times-Roman"/>
<paraStyle name="Text body" fontName="Times-Roman" spaceBefore="0.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="0.0"/>
<paraStyle name="Table Heading" fontName="Times-Roman" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="Caption" fontName="Times-Roman" fontSize="10.0" leading="13" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="Index" fontName="Times-Roman"/>
<paraStyle name="Heading" fontName="Helvetica" fontSize="15.0" leading="19" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="Footer" fontName="Times-Roman"/>
<paraStyle name="Horizontal Line" fontName="Times-Roman" fontSize="6.0" leading="8" spaceBefore="0.0" spaceAfter="14.0"/>
<paraStyle name="terp_header" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="Heading 9" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="terp_tblheader_General" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="terp_tblheader_Details" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="terp_default_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_Bold_8" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_tblheader_General_Centre" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="terp_tblheader_General_Right" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="terp_tblheader_Details_Centre" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="terp_tblheader_Details_Right" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="terp_default_Right_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_Centre_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_header_Right" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="terp_header_Centre" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="CENTER" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="terp_default_address" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_Bold_9" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_Centre_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_Right_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_bold_right_9" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_bold_8_20" rightIndent="0.0" leftIndent="-6.0" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_bold_9_20" rightIndent="0.0" leftIndent="-6.0" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_bold_9_10" rightIndent="0.0" leftIndent="-3.0" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_bold_8_10" rightIndent="0.0" leftIndent="-3.0" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
</stylesheet>
<images/>
<story>
<blockTable colWidths="161.0,161.0,161.0" repeatRows="1" style="Table_main_header">
<tr>
<td>
<para style="terp_default_8">[[ company.name ]]</para>
</td>
<td>
<para style="terp_header_Centre">Cost Ledger</para>
</td>
<td>
<para style="terp_default_8">
<font color="white"> </font>
</para>
<para style="terp_default_8">
<font color="white"> </font>
</para>
</td>
</tr>
</blockTable>
<para style="terp_default_8">
<font color="white"> </font>
</para>
<para style="terp_default_8">
<font color="white"> </font>
</para>
<blockTable colWidths="120.0,120.0,120.0,121.0" style="Table_period_date_header">
<tr>
<td>
<para style="terp_tblheader_General_Centre">Period from startdate</para>
</td>
<td>
<para style="terp_tblheader_General_Centre">Period to enddate</para>
</td>
<td>
<para style="terp_tblheader_General_Centre">Currency</para>
</td>
<td>
<para style="terp_tblheader_General_Centre">Printing date</para>
</td>
</tr>
</blockTable>
<blockTable colWidths="120.0,120.0,120.0,121.0" style="Table_period_date_content">
<tr>
<td>
<para style="terp_default_Centre_8">[[ data['form']['date1'] ]]</para>
</td>
<td>
<para style="terp_default_Centre_8">[[ data['form']['date2'] ]]</para>
</td>
<td>
<para style="terp_default_Centre_8">[[ company.currency_id.name ]]</para>
</td>
<td>
<para style="terp_default_Centre_8">[[ time.strftime('%Y-%m-%d') ]] at [[ time.strftime('%H:%M:%S') ]]</para>
</td>
</tr>
</blockTable>
<para style="terp_default_8">
<font color="white"> </font>
</para>
<para style="terp_default_Centre_8">
<font color="white"> </font>
</para>
<blockTable colWidths="54.0,29.0,42.0,184.0,57.0,57.0,57.0" style="Table_account_detail_header">
<tr>
<td>
<para style="terp_tblheader_Details_Centre">Date</para>
</td>
<td>
<para style="terp_tblheader_Details_Centre">J.C.</para>
</td>
<td>
<para style="terp_tblheader_Details_Centre">Code</para>
</td>
<td>
<para style="terp_tblheader_Details_Centre">Move name</para>
</td>
<td>
<para style="terp_tblheader_Details_Right">Debit </para>
</td>
<td>
<para style="terp_tblheader_Details_Right">Credit</para>
</td>
<td>
<para style="terp_tblheader_Details_Right">Balance</para>
</td>
</tr>
</blockTable>
<para style="terp_default_8">
<font color="white"> </font>
</para>
<para style="terp_default_8">[[ repeatIn(objects,'o') ]]</para>
<section>
<blockTable colWidths="481.0" style="Table_account_code_name">
<tr>
<td>
<para style="terp_default_bold_9_20">[[ o.code ]] [[ o.complete_name ]]</para>
</td>
</tr>
</blockTable>
<para style="terp_default_8">
<font color="white"> </font>
</para>
<section>
<blockTable colWidths="482.0" style="Table1">
<tr>
<td>
<para style="terp_default_8">[[ repeatIn(lines_g(o.id,data['form']['date1'],data['form']['date2']),'move_g') ]]</para>
<blockTable colWidths="471.0" style="Table4">
<tr>
<td>
<para style="terp_default_bold_8_10">[[ move_g['code'] ]] [[ move_g['name'] ]]</para>
<para style="terp_default_8">
<font color="white"> </font>
</para>
<blockTable colWidths="38.0,34.0,41.0,192.0,51.0,57.0,54.0" style="Table_move_content">
<tr>
<td>
<para style="terp_default_Centre_9">[[ repeatIn(lines_a(move_g['id'],o.id,data['form']['date1'],data['form']['date2']),'move_a') ]]</para>
<para style="terp_default_Centre_9">[[ move_a['date'] ]]</para>
</td>
<td>
<para style="terp_default_Centre_9">[[ move_a['cj'] ]]</para>
</td>
<td>
<para style="terp_default_Centre_9">[[ move_a['code'] ]]</para>
</td>
<td>
<para style="terp_default_Centre_9">[[ move_a['name'] ]]</para>
</td>
<td>
<para style="terp_default_Right_9">[[ '%.2f' % move_a['debit'] ]]</para>
</td>
<td>
<para style="terp_default_Right_9">[[ '%.2f' % move_a['credit'] ]]</para>
</td>
<td>
<para style="terp_default_Right_9">[[ '%.2f' % move_a['balance'] ]]</para>
</td>
</tr>
</blockTable>
</td>
</tr>
</blockTable>
<blockTable colWidths="310.0,52.0,57.0,57.0" style="Table_move_repeat">
<tr>
<td>
<para style="terp_default_bold_9_10">Total ([[ move_g['code'] ]])</para>
</td>
<td>
<para style="terp_default_bold_right_9">[[ '%.2f' % move_g['debit'] ]]</para>
</td>
<td>
<para style="terp_default_bold_right_9">[[ '%.2f' % move_g['credit'] ]]</para>
</td>
<td>
<para style="terp_default_bold_right_9">[[ '%.2f' % move_g['balance'] ]]</para>
</td>
</tr>
</blockTable>
</td>
</tr>
</blockTable>
</section>
<blockTable colWidths="312.0,57.0,57.0,56.0" style="Table_account_code_total">
<tr>
<td>
<para style="terp_default_bold_9_10">Total ([[ o.code ]])</para>
</td>
<td>
<para style="terp_default_bold_right_9">[[ '%.2f' % (account_sum_debit(o.id,data['form']['date1'],data['form']['date2']) or 0.0) ]]</para>
</td>
<td>
<para style="terp_default_bold_right_9">[[ '%.2f' % (account_sum_credit(o.id,data['form']['date1'],data['form']['date2']) or 0.0) ]]</para>
</td>
<td>
<para style="terp_default_bold_right_9">[[ '%.2f' % (account_sum_balance(o.id,data['form']['date1'],data['form']['date2']) or 0.0)]]</para>
</td>
</tr>
</blockTable>
</section>
<blockTable colWidths="311.0,59.0,56.0,57.0" style="Table_account_total">
<tr>
<td>
<para style="terp_default_bold_9_10">Total</para>
</td>
<td>
<para style="terp_default_bold_right_9">[[ '%.2f' % (sum_debit(objects,data['form']['date1'],data['form']['date2']) or 0.0) ]]</para>
</td>
<td>
<para style="terp_default_bold_right_9">[[ '%.2f' % (sum_credit(objects,data['form']['date1'],data['form']['date2']) or 0.0) ]]</para>
</td>
<td>
<para style="terp_default_bold_right_9">[[ '%.2f' % (sum_balance(objects,data['form']['date1'],data['form']['date2']) or 0.0) ]]</para>
</td>
</tr>
</blockTable>
<para style="terp_default_8">
<font color="white"> </font>
</para>
</story>
</document>

View File

@ -7,14 +7,3 @@
(data, format) = netsvc.LocalService('report.account.analytic.profit').create(cr, uid, [], data_dict, {})
if tools.config['test_report_directory']:
file(os.path.join(tools.config['test_report_directory'], 'hr_timesheet_invoice-account_analytic_profit_report.'+format), 'wb+').write(data)
-
Print the HR Cost Ledger report through the wizard
-
!python {model: account.analytic.account}: |
import netsvc, tools, os, time
ctx={}
acc_ids = [ref('account.analytic_absences'),ref('account.analytic_internal'),ref('account.analytic_sednacom'),ref('account.analytic_thymbra'),ref('account.analytic_partners_camp_to_camp')]
ctx.update({'model': 'ir.ui.menu','active_ids': acc_ids})
data_dict = {'date1': time.strftime('%Y-01-01'), 'date2': time.strftime('%Y-%m-%d')}
from tools import test_reports
test_reports.try_report_action(cr, uid, 'action_hr_timesheet_invoice_cost_ledger',wiz_data=data_dict, context=ctx, our_module='hr_timesheet_invoice')

View File

@ -22,7 +22,6 @@
import hr_timesheet_invoice_create
import hr_timesheet_analytic_profit
import hr_timesheet_final_invoice_create
import hr_timesheet_analytic_cost_ledger_report
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,52 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# 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 time
from osv import osv, fields
class hr_timesheet_analytic_cost_ledger(osv.osv_memory):
_name = 'hr.timesheet.analytic.cost.ledger'
_description = 'hr.timesheet.analytic.cost.ledger'
_columns = {
'date1': fields.date('Start of period', required=True),
'date2': fields.date('End of period', required=True)
}
_defaults = {
'date1': lambda *a: time.strftime('%Y-01-01'),
'date2': lambda *a: time.strftime('%Y-%m-%d')
}
def print_report(self, cr, uid, ids, context=None):
if context is None:
context = {}
datas = {
'ids': 'active_ids' in context and context['active_ids'] or [],
'model': 'account.analytic.account',
'form': self.read(cr, uid, ids, context=context)[0]
}
return {
'type': 'ir.actions.report.xml',
'report_name': 'hr.timesheet.invoice.account.analytic.account.cost_ledger',
'datas': datas,
}
hr_timesheet_analytic_cost_ledger()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,34 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_hr_timesheet_invoice_cost_ledger" model="ir.ui.view">
<field name="name">Cost Ledger</field>
<field name="model">hr.timesheet.analytic.cost.ledger</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Select Period">
<group col="4" colspan="6">
<field name="date1"/>
<field name="date2"/>
</group>
<separator colspan="4"/>
<group col="2" colspan="4">
<button special="cancel" string="Cancel" icon='gtk-cancel'/>
<button name="print_report" string="Print" colspan="1" type="object" icon="STOCK_PRINT"/>
</group>
</form>
</field>
</record>
<record id="action_hr_timesheet_invoice_cost_ledger" model="ir.actions.act_window">
<field name="name">Cost Ledger</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">hr.timesheet.analytic.cost.ledger</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
</data>
</openerp>