[IMP] account* reports: removed unused class/report/commented code/test, added the abstract_report wrapper on all old style report classes + some fixes on views and wizards in order to use these classes to render the qweb reports
bzr revid: sle@openerp.com-20140402164053-gry12scy8zca68lv
This commit is contained in:
parent
2c90fad7ac
commit
106d06ce5d
|
@ -1,49 +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 openerp.report import report_sxw
|
||||
|
||||
#
|
||||
# Use period and Journal for selection or resources
|
||||
#
|
||||
class journal_print(report_sxw.rml_parse):
|
||||
def lines(self, journal_id, *args):
|
||||
self.cr.execute('select id from account_analytic_line where journal_id=%s order by date,id', (journal_id,))
|
||||
ids = map(lambda x: x[0], self.cr.fetchall())
|
||||
res = self.pool.get('account.analytic.line').browse(self.cr, self.uid, ids)
|
||||
return res
|
||||
def _sum_lines(self, journal_id):
|
||||
self.cr.execute('select sum(amount) from account_analytic_line where journal_id=%s', (journal_id,))
|
||||
return self.cr.fetchone()[0] or 0.0
|
||||
def __init__(self, cr, uid, name, context):
|
||||
super(journal_print, self).__init__(cr, uid, name, context=context)
|
||||
self.localcontext = {
|
||||
'time': time,
|
||||
'lines': self.lines,
|
||||
'sum_lines': self._sum_lines,
|
||||
}
|
||||
report_sxw.report_sxw('report.account.analytic.journal.print', 'account.analytic.journal', 'addons/account/project/report/analytic_journal.rml',parser=journal_print)
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
##############################################################################
|
||||
|
||||
import time
|
||||
|
||||
from openerp.osv import osv
|
||||
from openerp.report import report_sxw
|
||||
|
||||
|
||||
|
@ -56,7 +56,6 @@ class account_analytic_balance(report_sxw.rml_parse):
|
|||
self.get_children(data['child_ids'])
|
||||
return True
|
||||
|
||||
|
||||
def _get_objects(self, empty_acc):
|
||||
if self.read_data:
|
||||
return self.read_data
|
||||
|
@ -143,18 +142,16 @@ class account_analytic_balance(report_sxw.rml_parse):
|
|||
WHERE account_id IN %s AND date>=%s AND date<=%s",query_params)
|
||||
return self.cr.fetchone()[0] or 0.0
|
||||
|
||||
|
||||
|
||||
def _sum_balance(self, accounts, date1, date2):
|
||||
debit = self._sum_all(accounts, date1, date2, 'debit') or 0.0
|
||||
credit = self._sum_all(accounts, date1, date2, 'credit') or 0.0
|
||||
return (debit-credit)
|
||||
|
||||
|
||||
report_sxw.report_sxw('report.account.analytic.account.balance',
|
||||
'account.analytic.account', 'addons/account/project/report/analytic_balance.rml',
|
||||
parser=account_analytic_balance, header="internal")
|
||||
|
||||
class report_analyticbalance(osv.AbstractModel):
|
||||
_name = 'report.account.report_analyticbalance'
|
||||
_inherit = 'report.abstract_report'
|
||||
_template = 'account.report_analyticbalance'
|
||||
_wrapped_report_class = account_analytic_balance
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
|
|
@ -20,9 +20,10 @@
|
|||
##############################################################################
|
||||
|
||||
import time
|
||||
|
||||
from openerp.osv import osv
|
||||
from openerp.report import report_sxw
|
||||
|
||||
|
||||
#
|
||||
# Use period and Journal for selection or resources
|
||||
#
|
||||
|
@ -57,8 +58,11 @@ class account_analytic_journal(report_sxw.rml_parse):
|
|||
res = self.cr.dictfetchone()
|
||||
return res['sum'] or 0
|
||||
|
||||
report_sxw.report_sxw('report.account.analytic.journal', 'account.analytic.journal', 'addons/account/project/report/analytic_journal.rml',parser=account_analytic_journal,header="internal")
|
||||
|
||||
class report_analyticjournal(osv.AbstractModel):
|
||||
_name = 'report.account.report_analyticjournal'
|
||||
_inherit = 'report.abstract_report'
|
||||
_template = 'account.report_analyticjournal'
|
||||
_wrapped_report_class = account_analytic_journal
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
|
|
@ -20,9 +20,10 @@
|
|||
##############################################################################
|
||||
|
||||
import time
|
||||
|
||||
from openerp.osv import osv
|
||||
from openerp.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)
|
||||
|
@ -100,8 +101,11 @@ class account_analytic_cost_ledger(report_sxw.rml_parse):
|
|||
credit = self._sum_credit(accounts, date1, date2)
|
||||
return (debit-credit)
|
||||
|
||||
report_sxw.report_sxw('report.account.analytic.account.cost_ledger', 'account.analytic.account', 'addons/account/project/report/cost_ledger.rml',parser=account_analytic_cost_ledger, header="internal")
|
||||
|
||||
class report_analyticcostledger(osv.AbstractModel):
|
||||
_name = 'report.account.report_analyticcostledger'
|
||||
_inherit = 'report.abstract_report'
|
||||
_template = 'account.report_analyticcostledger'
|
||||
_wrapped_report_class = account_analytic_cost_ledger
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
##############################################################################
|
||||
|
||||
import time
|
||||
|
||||
from openerp.osv import osv
|
||||
from openerp.report import report_sxw
|
||||
|
||||
class account_inverted_analytic_balance(report_sxw.rml_parse):
|
||||
|
@ -120,8 +120,11 @@ class account_inverted_analytic_balance(report_sxw.rml_parse):
|
|||
WHERE account_id IN %s AND date>=%s AND date<=%s", (tuple(ids),date1, date2,))
|
||||
return self.cr.fetchone()[0] or 0.0
|
||||
|
||||
report_sxw.report_sxw('report.account.analytic.account.inverted.balance', 'account.analytic.account', 'addons/account/project/report/inverted_analytic_balance.rml',parser=account_inverted_analytic_balance, header="internal")
|
||||
|
||||
class report_invertedanalyticbalance(osv.AbstractModel):
|
||||
_name = 'report.account.report_invertedanalyticbalance'
|
||||
_inherit = 'report.abstract_report'
|
||||
_template = 'account.report_invertedanalyticbalance'
|
||||
_wrapped_report_class = account_inverted_analytic_balance
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
|
|
@ -19,9 +19,10 @@
|
|||
#
|
||||
##############################################################################
|
||||
import time
|
||||
|
||||
from openerp.osv import osv
|
||||
from openerp.report import report_sxw
|
||||
|
||||
|
||||
class account_analytic_quantity_cost_ledger(report_sxw.rml_parse):
|
||||
def __init__(self, cr, uid, name, context):
|
||||
super(account_analytic_quantity_cost_ledger, self).__init__(cr, uid, name, context=context)
|
||||
|
@ -116,9 +117,11 @@ class account_analytic_quantity_cost_ledger(report_sxw.rml_parse):
|
|||
AND journal_id IN %s",(tuple(ids), date1, date2, tuple(journal_ids)))
|
||||
return self.cr.fetchone()[0] or 0.0
|
||||
|
||||
report_sxw.report_sxw('report.account.analytic.account.quantity_cost_ledger',
|
||||
'account.analytic.account',
|
||||
'addons/account/project/report/quantity_cost_ledger.rml',
|
||||
parser=account_analytic_quantity_cost_ledger, header="internal")
|
||||
|
||||
class report_analyticcostledgerquantity(osv.AbstractModel):
|
||||
_name = 'report.account.report_analyticcostledgerquantity'
|
||||
_inherit = 'report.abstract_report'
|
||||
_template = 'account.report_analyticcostledgerquantity'
|
||||
_wrapped_report_class = account_analytic_quantity_cost_ledger
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -22,28 +22,28 @@
|
|||
<tr>
|
||||
<td colspan="2">Total</td>
|
||||
<td>
|
||||
<span t-esc="formatLang(sum_all(get_objects(empty_acc), date1, date2, 'debit'))"/>
|
||||
<span t-esc="formatLang(sum_all(get_objects(data['form']['empty_acc']), data['form']['date1'], data['form']['date2'], 'debit'))"/>
|
||||
</td>
|
||||
<td>
|
||||
<span t-esc="formatLang(sum_all(get_objects(empty_acc), date1, date2, 'credit'))"/>
|
||||
<span t-esc="formatLang(sum_all(get_objects(data['form']['empty_acc']), data['form']['date1'], data['form']['date2'], 'credit'))"/>
|
||||
</td>
|
||||
<td>
|
||||
<span t-esc="formatLang(sum_balance(get_objects(empty_acc), date1, date2),currency_obj=res_company.currency_id)"/>
|
||||
<span t-esc="formatLang(sum_balance(get_objects(data['form']['empty_acc']), data['form']['date1'], data['form']['date2']),currency_obj=res_company.currency_id)"/>
|
||||
</td>
|
||||
<td>
|
||||
<span t-esc="formatLang(sum_all(get_objects(empty_acc), date1, date2, 'quantity'))"/>
|
||||
<span t-esc="formatLang(sum_all(get_objects(data['form']['empty_acc']), data['form']['date1'], data['form']['date2'], 'quantity'))"/>
|
||||
</td>
|
||||
</tr>
|
||||
<t t-foreach="get_objects(empty_acc)" t-as="o">
|
||||
<t t-foreach="get_objects(data['form']['empty_acc'])" t-as="o">
|
||||
<tr>
|
||||
<td><span t-esc="o['code']"/></td>
|
||||
<td><span t-esc="o['complete_name']"/></td>
|
||||
<td><span t-esc="formatLang(move_sum(o['id'], date1, date2, 'debit'))"/></td>
|
||||
<td><span t-esc="formatLang(move_sum(o['id'], date1, date2, 'credit'))"/></td>
|
||||
<td><span t-esc="formatLang(move_sum_balance(o['id'], date1, date2), currency_obj=res_company.currency_id)"/></td>
|
||||
<td><span t-esc="formatLang(move_sum(o['id'], date1, date2, 'quantity'))"/></td>
|
||||
<td><span t-esc="formatLang(move_sum(o['id'], data['form']['date1'], data['form']['date2'], 'debit'))"/></td>
|
||||
<td><span t-esc="formatLang(move_sum(o['id'], data['form']['date1'], data['form']['date2'], 'credit'))"/></td>
|
||||
<td><span t-esc="formatLang(move_sum_balance(o['id'], data['form']['date1'], data['form']['date2']), currency_obj=res_company.currency_id)"/></td>
|
||||
<td><span t-esc="formatLang(move_sum(o['id'], data['form']['date1'], data['form']['date2'], 'quantity'))"/></td>
|
||||
</tr>
|
||||
<tr t-foreach="lines_g(o['id'], date1, date2)" t-as="move_g">
|
||||
<tr t-foreach="lines_g(o['id'], data['form']['date1'], data['form']['date2'])" t-as="move_g">
|
||||
<td><span t-esc="move_g['code']"/></td>
|
||||
<td><span t-esc="move_g['name']"/></td>
|
||||
<td><span t-esc="formatLang(move_g['debit'])"/></td>
|
||||
|
|
|
@ -10,11 +10,11 @@
|
|||
<div class="row mt32 mb32">
|
||||
<div class="col-xs-3">
|
||||
<strong>Period From:</strong>
|
||||
<p t-esc="formatLang(date1, date=True)"/>
|
||||
<p t-esc="formatLang(data['form']['date1'], date=True)"/>
|
||||
</div>
|
||||
<div class="col-xs-3">
|
||||
<strong>Period To:</strong>
|
||||
<p t-esc="formatLang(date2, date=True)"/>
|
||||
<p t-esc="formatLang(data['form']['date2'], date=True)"/>
|
||||
</div>
|
||||
<div class="col-xs-3">
|
||||
<strong>Printing Date:</strong>
|
||||
|
@ -38,10 +38,10 @@
|
|||
<td>Total:</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td><span t-esc="formatLang(sum_debit(docs, date1, date2))"/></td>
|
||||
<td><span t-esc="formatLang(sum_credit(docs,date1,date2))"/></td>
|
||||
<td><span t-esc="formatLang(sum_debit(docs, data['form']['date1'], data['form']['date2']))"/></td>
|
||||
<td><span t-esc="formatLang(sum_credit(docs,data['form']['date1'],data['form']['date2']))"/></td>
|
||||
<td>
|
||||
<span t-esc="formatLang(sum_debit(docs, date1, date2) - sum_credit(docs, date1, date2), currency_obj=res_company.currency_id)"/>
|
||||
<span t-esc="formatLang(sum_debit(docs, data['form']['date1'], data['form']['date2']) - sum_credit(docs, data['form']['date1'], data['form']['date2']), currency_obj=res_company.currency_id)"/>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
@ -50,12 +50,12 @@
|
|||
<td><span t-esc="account.code"/></td>
|
||||
<td></td>
|
||||
<td><span t-esc="account.complete_name"/></td>
|
||||
<td><span t-esc="formatLang(sum_debit([account], date1, date2))"/></td>
|
||||
<td><span t-esc="formatLang(sum_credit([account], date1, date2))"/></td>
|
||||
<td><span t-esc="formatLang(sum_debit([account], date1, date2) - sum_credit([account], date1, date2), currency_obj=res_company.currency_id)"/></td>
|
||||
<td><span t-esc="formatLang(sum_debit([account], data['form']['date1'], data['form']['date2']))"/></td>
|
||||
<td><span t-esc="formatLang(sum_credit([account], data['form']['date1'], data['form']['date2']))"/></td>
|
||||
<td><span t-esc="formatLang(sum_debit([account], data['form']['date1'], data['form']['date2']) - sum_credit([account], data['form']['date1'], data['form']['date2']), currency_obj=res_company.currency_id)"/></td>
|
||||
</tr>
|
||||
|
||||
<t t-foreach="lines_g(account, date1, date2)" t-as="move_g">
|
||||
<t t-foreach="lines_g(account, data['form']['date1'], data['form']['date2'])" t-as="move_g">
|
||||
<tr>
|
||||
<td><span t-esc="move_g['code']"/></td>
|
||||
<td></td>
|
||||
|
@ -66,7 +66,7 @@
|
|||
<span t-esc="formatLang(move_g['balance'], currency_obj=res_company.currency_id)"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr t-foreach="lines_a(move_g, account, date1, date2)" t-as="move_a">
|
||||
<tr t-foreach="lines_a(move_g, account, data['form']['date1'], data['form']['date2'])" t-as="move_a">
|
||||
<td>
|
||||
<t t-esc="formatLang(move_a['date'], date=True)"></t>
|
||||
</td>
|
||||
|
|
|
@ -10,11 +10,11 @@
|
|||
<div class="row mt32 mb32">
|
||||
<div class="col-xs-3">
|
||||
<strong>Period From:</strong>
|
||||
<p t-esc="formatLang(date1, date=True)"/>
|
||||
<p t-esc="formatLang(data['form']['date1'], date=True)"/>
|
||||
</div>
|
||||
<div class="col-xs-3">
|
||||
<strong>Period To:</strong>
|
||||
<p t-esc="formatLang(date2, date=True)"/>
|
||||
<p t-esc="formatLang(data['form']['date2'], date=True)"/>
|
||||
</div>
|
||||
<div class="col-xs-3">
|
||||
<strong>Printing Date:</strong>
|
||||
|
@ -39,7 +39,7 @@
|
|||
<td></td>
|
||||
<td></td>
|
||||
<td>
|
||||
<span t-esc="sum_quantity(docs, date1, date2, journals)"/>
|
||||
<span t-esc="sum_quantity(docs, data['form']['date1'], data['form']['date2'], data['form']['journal'])"/>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
@ -54,11 +54,11 @@
|
|||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<span t-esc="account_sum_quantity(account.id, date1, date2, journals)"/>
|
||||
<span t-esc="account_sum_quantity(account.id, data['form']['date1'], data['form']['date2'], data['form']['journal'])"/>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<t t-foreach="lines_g(account.id, date1, date2, journals)" t-as="move_g">
|
||||
<t t-foreach="lines_g(account.id, data['form']['date1'], data['form']['date2'], data['form']['journal'])" t-as="move_g">
|
||||
<tr style="font-weight:bold;">
|
||||
<td><span t-esc="move_g['code']"/></td>
|
||||
<td colspan="2"><span t-esc="move_g['name']"/></td>
|
||||
|
@ -66,7 +66,7 @@
|
|||
<td class="text-right"><span t-esc="move_g['quantity']"/></td>
|
||||
</tr>
|
||||
|
||||
<t t-foreach="lines_a(move_g['id'], account.id, date1, date2, journals)" t-as="move_a">
|
||||
<t t-foreach="lines_a(move_g['id'], account.id, data['form']['date1'], data['form']['date2'], data['form']['journal'])" t-as="move_a">
|
||||
<tr style="font-weight:normal;">
|
||||
<td><span t-esc="formatLang(move_a['date'], date=True)"/></td>
|
||||
<td><span t-esc="move_a['cj']"/></td>
|
||||
|
|
|
@ -11,11 +11,11 @@
|
|||
<div class="row mt32 mb32">
|
||||
<div class="col-xs-3">
|
||||
<strong>Period From:</strong>
|
||||
<p t-esc="formatLang(date1, date=True)"/>
|
||||
<p t-esc="formatLang(data['form']['date1'], date=True)"/>
|
||||
</div>
|
||||
<div class="col-xs-3">
|
||||
<strong>Period To:</strong>
|
||||
<p t-esc="formatLang(date2, date=True)"/>
|
||||
<p t-esc="formatLang(data['form']['date2'], date=True)"/>
|
||||
</div>
|
||||
<div class="col-xs-3">
|
||||
<strong>Currency:</strong>
|
||||
|
@ -35,12 +35,12 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<th colspan="4"><t t-if="o.code"><span t-esc="o.code"/></t> - <span t-esc="o.name"/></th>
|
||||
<th><span t-esc="formatLang(sum_general(o.id, date1, date2))"/></th>
|
||||
<th><span t-esc="formatLang(sum_analytic(o.id, date1, date2))"/></th>
|
||||
<th><span t-esc="formatLang(sum_general(o.id, data['form']['date1'], data['form']['date2']))"/></th>
|
||||
<th><span t-esc="formatLang(sum_analytic(o.id, data['form']['date1'], data['form']['date2']))"/></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<t t-foreach="lines(o.id, date1, date2)" t-as="move">
|
||||
<t t-foreach="lines(o.id, data['form']['date1'], data['form']['date2'])" t-as="move">
|
||||
<tr>
|
||||
<td></td>
|
||||
<td></td>
|
||||
|
@ -56,7 +56,7 @@
|
|||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr t-foreach="lines_a(move.id, o.id, date1, date2)" t-as="move_a">
|
||||
<tr t-foreach="lines_a(move.id, o.id, data['form']['date1'], data['form']['date2'])" t-as="move_a">
|
||||
<td>
|
||||
<span t-esc="formatLang(move_a.date,date = True)"/>
|
||||
</td>
|
||||
|
@ -71,13 +71,13 @@
|
|||
<td><span t-esc="formatLang(move_a.amount)"/></td>
|
||||
</tr>
|
||||
</t>
|
||||
<tr t-foreach="lines_a(False, o.id, date1, date2)" t-as="move_a">
|
||||
<tr t-foreach="lines_a(False, o.id, data['form']['date1'], data['form']['date2'])" t-as="move_a">
|
||||
<td><span t-esc="formatLang(move_a.date,date = True)"/></td>
|
||||
<td><p t-if="move_a.code"><span t-esc="move_a.code"/></p></td>
|
||||
<td><span t-esc="move_a.name"/></td>
|
||||
<td><span t-esc="move_a.account_id.code"/> - <span t-esc="move_a.account_id.name"/></td>
|
||||
<td></td>
|
||||
<td><span t-esc="formatLang( move_a.amount)"/></td>
|
||||
<td><span t-esc="formatLang(move_a.amount)"/></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
|
@ -22,14 +22,14 @@
|
|||
<tr>
|
||||
<td><strong>Total</strong></td>
|
||||
<td></td>
|
||||
<td><strong t-esc="formatLang(sum_debit(docs, date1, date2))"/></td>
|
||||
<td><strong t-esc="formatLang(sum_credit(docs, date1, date2))"/></td>
|
||||
<td><strong t-esc="formatLang(sum_debit(docs, data['form']['date1'], data['form']['date2']))"/></td>
|
||||
<td><strong t-esc="formatLang(sum_credit(docs, data['form']['date1'], data['form']['date2']))"/></td>
|
||||
<td>
|
||||
<strong t-esc="formatLang(sum_balance(docs, date1, date2), currency_obj=res_company.currency_id)"/>
|
||||
<strong t-esc="formatLang(sum_balance(docs, data['form']['date1'], data['form']['date2']), currency_obj=res_company.currency_id)"/>
|
||||
</td>
|
||||
<td><strong><span t-esc="formatLang(sum_quantity(docs, date1, date2))"/></strong></td>
|
||||
<td><strong><span t-esc="formatLang(sum_quantity(docs, data['form']['date1'], data['form']['date2']))"/></strong></td>
|
||||
</tr>
|
||||
<t t-foreach="lines_g(docs, date1, date2)" t-as="move_g">
|
||||
<t t-foreach="lines_g(docs, data['form']['date1'], data['form']['date2'])" t-as="move_g">
|
||||
<tr>
|
||||
<td>
|
||||
<strong t-esc="move_g['code']"/>
|
||||
|
@ -58,7 +58,7 @@
|
|||
</strong>
|
||||
</td>
|
||||
</tr>
|
||||
<t t-foreach="lines_a(docs, move_g['id'], date1, date2)" t-as="move_a">
|
||||
<t t-foreach="lines_a(docs, move_g['id'], data['form']['date1'], data['form']['date2'])" t-as="move_a">
|
||||
<tr>
|
||||
<td>
|
||||
<span t-esc="move_a['code']"/>
|
||||
|
|
|
@ -49,7 +49,6 @@ class account_analytic_cost_ledger_journal_report(osv.osv_memory):
|
|||
}
|
||||
|
||||
datas['form']['active_ids'] = context.get('active_ids', False)
|
||||
|
||||
return self.pool['report'].get_action(cr, uid, ids, 'account.report_analyticcostledgerquantity', data=datas, context=context)
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -46,9 +46,7 @@ class account_analytic_inverted_balance(osv.osv_memory):
|
|||
'model': 'account.analytic.account',
|
||||
'form': data
|
||||
}
|
||||
|
||||
datas['form']['active_ids'] = context.get('active_ids', False)
|
||||
|
||||
return self.pool['report'].get_action(cr, uid, ids, 'account.report_invertedanalyticbalance', data=datas, context=context)
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -20,9 +20,11 @@
|
|||
##############################################################################
|
||||
|
||||
import time
|
||||
from openerp.osv import osv
|
||||
from openerp.report import report_sxw
|
||||
from common_report_header import common_report_header
|
||||
|
||||
|
||||
class aged_trial_report(report_sxw.rml_parse, common_report_header):
|
||||
|
||||
def __init__(self, cr, uid, name, context):
|
||||
|
@ -375,8 +377,11 @@ class aged_trial_report(report_sxw.rml_parse, common_report_header):
|
|||
return self._translate('Receivable and Payable Accounts')
|
||||
return ''
|
||||
|
||||
report_sxw.report_sxw('report.account.aged_trial_balance', 'res.partner',
|
||||
'addons/account/report/account_aged_partner_balance.rml',parser=aged_trial_report, header="internal landscape")
|
||||
|
||||
class report_agedpartnerbalance(osv.AbstractModel):
|
||||
_name = 'report.account.report_agedpartnerbalance'
|
||||
_inherit = 'report.abstract_report'
|
||||
_template = 'account.report_agedpartnerbalance'
|
||||
_wrapped_report_class = aged_trial_report
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -21,9 +21,11 @@
|
|||
|
||||
import time
|
||||
|
||||
from openerp.osv import osv
|
||||
from openerp.report import report_sxw
|
||||
from common_report_header import common_report_header
|
||||
|
||||
|
||||
class account_balance(report_sxw.rml_parse, common_report_header):
|
||||
_name = 'report.account.account.balance'
|
||||
|
||||
|
@ -58,11 +60,6 @@ class account_balance(report_sxw.rml_parse, common_report_header):
|
|||
objects = self.pool.get('account.account').browse(self.cr, self.uid, new_ids)
|
||||
return super(account_balance, self).set_context(objects, data, new_ids, report_type=report_type)
|
||||
|
||||
#def _add_header(self, node, header=1):
|
||||
# if header == 0:
|
||||
# self.rml_header = ""
|
||||
# return True
|
||||
|
||||
def _get_account(self, data):
|
||||
if data['model']=='account.account':
|
||||
return self.pool.get('account.account').browse(self.cr, self.uid, data['form']['id']).company_id.name
|
||||
|
@ -131,6 +128,11 @@ class account_balance(report_sxw.rml_parse, common_report_header):
|
|||
_process_child(accounts,form['display_account'],parent)
|
||||
return self.result_acc
|
||||
|
||||
report_sxw.report_sxw('report.account.account.balance', 'account.account', 'addons/account/report/account_balance.rml', parser=account_balance, header="internal")
|
||||
|
||||
class report_trialbalance(osv.AbstractModel):
|
||||
_name = 'report.account.report_trialbalance'
|
||||
_inherit = 'report.abstract_report'
|
||||
_template = 'account.report_trialbalance'
|
||||
_wrapped_report_class = account_balance
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -20,11 +20,14 @@
|
|||
##############################################################################
|
||||
|
||||
import time
|
||||
from openerp.osv import osv
|
||||
from openerp.report import report_sxw
|
||||
from common_report_header import common_report_header
|
||||
#
|
||||
# Use period and Journal for selection or resources
|
||||
#
|
||||
|
||||
|
||||
class journal_print(report_sxw.rml_parse, common_report_header):
|
||||
|
||||
def __init__(self, cr, uid, name, context=None):
|
||||
|
@ -103,6 +106,11 @@ class journal_print(report_sxw.rml_parse, common_report_header):
|
|||
return True
|
||||
return data['form']['amount_currency']
|
||||
|
||||
report_sxw.report_sxw('report.account.central.journal', 'account.journal.period', 'addons/account/report/account_central_journal.rml', parser=journal_print, header='external')
|
||||
|
||||
class report_agedpartnerbalance(osv.AbstractModel):
|
||||
_name = 'report.account.report_centraljournal'
|
||||
_inherit = 'report.abstract_report'
|
||||
_template = 'account.report_centraljournal'
|
||||
_wrapped_report_class = journal_print
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -23,6 +23,8 @@ import time
|
|||
from openerp.report import report_sxw
|
||||
from common_report_header import common_report_header
|
||||
from openerp.tools.translate import _
|
||||
from openerp.osv import osv
|
||||
|
||||
|
||||
class report_account_common(report_sxw.rml_parse, common_report_header):
|
||||
|
||||
|
@ -105,8 +107,11 @@ class report_account_common(report_sxw.rml_parse, common_report_header):
|
|||
lines.append(vals)
|
||||
return lines
|
||||
|
||||
report_sxw.report_sxw('report.account.financial.report', 'account.financial.report',
|
||||
'addons/account/report/account_financial_report.rml', parser=report_account_common, header='internal')
|
||||
|
||||
class report_financial(osv.AbstractModel):
|
||||
_name = 'report.account.report_financial'
|
||||
_inherit = 'report.abstract_report'
|
||||
_template = 'account.report_financial'
|
||||
_wrapped_report_class = report_account_common
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -20,8 +20,10 @@
|
|||
##############################################################################
|
||||
|
||||
import time
|
||||
from common_report_header import common_report_header
|
||||
from openerp.osv import osv
|
||||
from openerp.report import report_sxw
|
||||
from common_report_header import common_report_header
|
||||
|
||||
|
||||
class journal_print(report_sxw.rml_parse, common_report_header):
|
||||
|
||||
|
@ -156,6 +158,11 @@ class journal_print(report_sxw.rml_parse, common_report_header):
|
|||
(tuple(move_state), period_id, tuple(journals)))
|
||||
return self.cr.fetchone()[0] or 0.0
|
||||
|
||||
report_sxw.report_sxw('report.account.general.journal', 'account.journal.period', 'addons/account/report/general_journal.rml', parser=journal_print, header='internal')
|
||||
|
||||
class report_generaljournal(osv.AbstractModel):
|
||||
_name = 'report.account.report_generaljournal'
|
||||
_inherit = 'report.abstract_report'
|
||||
_template = 'account.report_generaljournal'
|
||||
_wrapped_report_class = journal_print
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -28,9 +28,11 @@
|
|||
##############################################################################
|
||||
|
||||
import time
|
||||
from openerp.osv import osv
|
||||
from openerp.report import report_sxw
|
||||
from common_report_header import common_report_header
|
||||
|
||||
|
||||
class general_ledger(report_sxw.rml_parse, common_report_header):
|
||||
_name = 'report.account.general.ledger'
|
||||
|
||||
|
@ -304,7 +306,11 @@ class general_ledger(report_sxw.rml_parse, common_report_header):
|
|||
return self._translate('Journal & Partner')
|
||||
return self._translate('Date')
|
||||
|
||||
report_sxw.report_sxw('report.account.general.ledger', 'account.account', 'addons/account/report/account_general_ledger.rml', parser=general_ledger, header='internal')
|
||||
report_sxw.report_sxw('report.account.general.ledger_landscape', 'account.account', 'addons/account/report/account_general_ledger_landscape.rml', parser=general_ledger, header='internal landscape')
|
||||
|
||||
class report_generalledger(osv.AbstractModel):
|
||||
_name = 'report.account.report_generalledger'
|
||||
_inherit = 'report.abstract_report'
|
||||
_template = 'account.report_generalledger'
|
||||
_wrapped_report_class = general_ledger
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -20,8 +20,10 @@
|
|||
##############################################################################
|
||||
|
||||
import time
|
||||
from common_report_header import common_report_header
|
||||
from openerp.osv import osv
|
||||
from openerp.report import report_sxw
|
||||
from common_report_header import common_report_header
|
||||
|
||||
|
||||
class journal_print(report_sxw.rml_parse, common_report_header):
|
||||
|
||||
|
@ -196,7 +198,18 @@ class journal_print(report_sxw.rml_parse, common_report_header):
|
|||
return self._translate('Reference Number')
|
||||
return self._translate('Date')
|
||||
|
||||
report_sxw.report_sxw('report.account.journal.period.print', 'account.journal.period', 'addons/account/report/account_journal.rml', parser=journal_print, header='external')
|
||||
report_sxw.report_sxw('report.account.journal.period.print.sale.purchase', 'account.journal.period', 'addons/account/report/account_journal_sale_purchase.rml', parser=journal_print, header='external')
|
||||
|
||||
class report_journal(osv.AbstractModel):
|
||||
_name = 'report.account.report_journal'
|
||||
_inherit = 'report.abstract_report'
|
||||
_template = 'account.report_journal'
|
||||
_wrapped_report_class = journal_print
|
||||
|
||||
|
||||
class report_salepurchasejournal(osv.AbstractModel):
|
||||
_name = 'report.account.report_salepurchasejournal'
|
||||
_inherit = 'report.abstract_report'
|
||||
_template = 'account.report_salepurchasejournal'
|
||||
_wrapped_report_class = journal_print
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -20,11 +20,12 @@
|
|||
##############################################################################
|
||||
|
||||
import time
|
||||
|
||||
from openerp.osv import osv
|
||||
from openerp.tools.translate import _
|
||||
from openerp.report import report_sxw
|
||||
from common_report_header import common_report_header
|
||||
|
||||
|
||||
class partner_balance(report_sxw.rml_parse, common_report_header):
|
||||
|
||||
def __init__(self, cr, uid, name, context=None):
|
||||
|
@ -301,6 +302,11 @@ class partner_balance(report_sxw.rml_parse, common_report_header):
|
|||
return _('Receivable and Payable Accounts')
|
||||
return ''
|
||||
|
||||
report_sxw.report_sxw('report.account.partner.balance', 'res.partner', 'account/report/account_partner_balance.rml',parser=partner_balance, header="internal")
|
||||
|
||||
class report_partnerbalance(osv.AbstractModel):
|
||||
_name = 'report.account.report_partnerbalance'
|
||||
_inherit = 'report.abstract_report'
|
||||
_template = 'account.report_partnerbalance'
|
||||
_wrapped_report_class = partner_balance
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -20,10 +20,11 @@
|
|||
##############################################################################
|
||||
|
||||
import time
|
||||
import re
|
||||
from openerp.osv import osv
|
||||
from openerp.tools.translate import _
|
||||
from openerp.report import report_sxw
|
||||
from common_report_header import common_report_header
|
||||
from openerp.tools.translate import _
|
||||
|
||||
|
||||
class third_party_ledger(report_sxw.rml_parse, common_report_header):
|
||||
|
||||
|
@ -297,12 +298,18 @@ class third_party_ledger(report_sxw.rml_parse, common_report_header):
|
|||
return True
|
||||
return False
|
||||
|
||||
report_sxw.report_sxw('report.account.third_party_ledger', 'res.partner',
|
||||
'addons/account/report/account_partner_ledger.rml',parser=third_party_ledger,
|
||||
header='internal')
|
||||
|
||||
report_sxw.report_sxw('report.account.third_party_ledger_other', 'res.partner',
|
||||
'addons/account/report/account_partner_ledger_other.rml',parser=third_party_ledger,
|
||||
header='internal')
|
||||
class report_partnerledger(osv.AbstractModel):
|
||||
_name = 'report.account.report_partnerledger'
|
||||
_inherit = 'report.abstract_report'
|
||||
_template = 'account.report_partnerledger'
|
||||
_wrapped_report_class = third_party_ledger
|
||||
|
||||
|
||||
class report_partnerledgerother(osv.AbstractModel):
|
||||
_name = 'report.account.report_partnerledgerother'
|
||||
_inherit = 'report.abstract_report'
|
||||
_template = 'account.report_partnerledgerother'
|
||||
_wrapped_report_class = third_party_ledger
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -22,15 +22,36 @@
|
|||
import time
|
||||
|
||||
from openerp.report import report_sxw
|
||||
from openerp.osv import osv
|
||||
|
||||
|
||||
class Overdue(report_sxw.rml_parse):
|
||||
def __init__(self, cr, uid, name, context):
|
||||
super(Overdue, self).__init__(cr, uid, name, context=context)
|
||||
self.localcontext.update( {
|
||||
ids = context.get('active_ids')
|
||||
partner_obj = self.pool['res.partner']
|
||||
docs = partner_obj.browse(cr, uid, ids, context)
|
||||
|
||||
due = {}
|
||||
paid = {}
|
||||
mat = {}
|
||||
|
||||
for partner in docs:
|
||||
due[partner.id] = reduce(lambda x, y: x + ((y['account_id']['type'] == 'receivable' and y['debit'] or 0) or (y['account_id']['type'] == 'payable' and y['credit'] * -1 or 0)), self._lines_get(partner), 0)
|
||||
paid[partner.id] = reduce(lambda x, y: x + ((y['account_id']['type'] == 'receivable' and y['credit'] or 0) or (y['account_id']['type'] == 'payable' and y['debit'] * -1 or 0)), self._lines_get(partner), 0)
|
||||
mat[partner.id] = reduce(lambda x, y: x + (y['debit'] - y['credit']), filter(lambda x: x['date_maturity'] < time.strftime('%Y-%m-%d'), self._lines_get(partner)), 0)
|
||||
|
||||
addresses = self.pool['res.partner']._address_display(cr, uid, ids, None, None)
|
||||
self.localcontext.update({
|
||||
'docs': docs,
|
||||
'time': time,
|
||||
'getLines': self._lines_get,
|
||||
'tel_get': self._tel_get,
|
||||
'message': self._message,
|
||||
'due': due,
|
||||
'paid': paid,
|
||||
'mat': mat,
|
||||
'addresses': addresses
|
||||
})
|
||||
self.context = context
|
||||
|
||||
|
@ -41,7 +62,7 @@ class Overdue(report_sxw.rml_parse):
|
|||
addresses = res_partner.address_get(self.cr, self.uid, [partner.id], ['invoice'])
|
||||
adr_id = addresses and addresses['invoice'] or False
|
||||
if adr_id:
|
||||
adr=res_partner_address.read(self.cr, self.uid, [adr_id])[0]
|
||||
adr=res_partner.read(self.cr, self.uid, [adr_id])[0]
|
||||
return adr['phone']
|
||||
else:
|
||||
return partner.phone or False
|
||||
|
@ -62,5 +83,10 @@ class Overdue(report_sxw.rml_parse):
|
|||
return message.split('\n')
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
class report_overdue(osv.AbstractModel):
|
||||
_name = 'report.account.report_overdue'
|
||||
_inherit = 'report.abstract_report'
|
||||
_template = 'account.report_overdue'
|
||||
_wrapped_report_class = Overdue
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -19,24 +19,16 @@
|
|||
#
|
||||
##############################################################################
|
||||
|
||||
import time
|
||||
from openerp.osv import osv
|
||||
from openerp.addons.web import http
|
||||
from openerp.addons.web.http import request
|
||||
from openerp.report import report_sxw
|
||||
from common_report_header import common_report_header
|
||||
try:
|
||||
import cStringIO as StringIO
|
||||
except ImportError:
|
||||
import StringIO
|
||||
import xlwt
|
||||
|
||||
|
||||
class tax_report(osv.AbstractModel, common_report_header):
|
||||
_name = 'report.account.report_vat'
|
||||
|
||||
def render_html(self, cr, uid, ids, data=None, context=None):
|
||||
report_obj = request.registry['report']
|
||||
self.cr, self.uid, self.context = cr, uid, context
|
||||
class tax_report(report_sxw.rml_parse, common_report_header):
|
||||
|
||||
def set_context(self, objects, data, ids, report_type=None):
|
||||
new_ids = ids
|
||||
res = {}
|
||||
self.period_ids = []
|
||||
period_obj = self.pool.get('account.period')
|
||||
|
@ -46,30 +38,42 @@ class tax_report(osv.AbstractModel, common_report_header):
|
|||
|
||||
if data['form'].get('period_from', False) and data['form'].get('period_to', False):
|
||||
self.period_ids = period_obj.build_ctx_periods(self.cr, self.uid, data['form']['period_from'], data['form']['period_to'])
|
||||
periods_l = period_obj.read(self.cr, self.uid, self.period_ids, ['name'])
|
||||
for period in periods_l:
|
||||
if res['periods'] == '':
|
||||
res['periods'] = period['name']
|
||||
else:
|
||||
res['periods'] += ", "+ period['name']
|
||||
return super(tax_report, self).set_context(objects, data, new_ids, report_type=report_type)
|
||||
|
||||
docargs = {
|
||||
'fiscalyear': self._get_fiscalyear(data),
|
||||
'account': self._get_account(data),
|
||||
'based_on': self._get_basedon(data),
|
||||
'period_from': self.get_start_period(data),
|
||||
'period_to': self.get_end_period(data),
|
||||
'taxlines': self._get_lines(self._get_basedon(data), company_id=data['form']['company_id'], cr=cr, uid=uid),
|
||||
}
|
||||
return report_obj.render(self.cr, self.uid, [], 'account.report_vat', docargs, context=context)
|
||||
def __init__(self, cr, uid, name, context=None):
|
||||
super(tax_report, self).__init__(cr, uid, name, context=context)
|
||||
self.localcontext.update({
|
||||
'time': time,
|
||||
'get_codes': self._get_codes,
|
||||
'get_general': self._get_general,
|
||||
'get_currency': self._get_currency,
|
||||
'get_lines': self._get_lines,
|
||||
'get_fiscalyear': self._get_fiscalyear,
|
||||
'get_account': self._get_account,
|
||||
'get_start_period': self.get_start_period,
|
||||
'get_end_period': self.get_end_period,
|
||||
'get_basedon': self._get_basedon,
|
||||
})
|
||||
|
||||
def _get_basedon(self, form):
|
||||
return form['form']['based_on']
|
||||
|
||||
def _get_lines(self, based_on, company_id=False, parent=False, level=0, context=None, cr=None, uid=None):
|
||||
def _get_lines(self, based_on, company_id=False, parent=False, level=0, context=None):
|
||||
period_list = self.period_ids
|
||||
res = self._get_codes(based_on, company_id, parent, level, period_list, cr=cr, uid=uid, context=context)
|
||||
res = self._get_codes(based_on, company_id, parent, level, period_list, context=context)
|
||||
if period_list:
|
||||
res = self._add_codes(based_on, res, period_list, context=context)
|
||||
else:
|
||||
cr.execute ("select id from account_fiscalyear")
|
||||
fy = cr.fetchall()
|
||||
cr.execute ("select id from account_period where fiscalyear_id = %s",(fy[0][0],))
|
||||
periods = cr.fetchall()
|
||||
self.cr.execute ("select id from account_fiscalyear")
|
||||
fy = self.cr.fetchall()
|
||||
self.cr.execute ("select id from account_period where fiscalyear_id = %s",(fy[0][0],))
|
||||
periods = self.cr.fetchall()
|
||||
for p in periods:
|
||||
period_list.append(p[0])
|
||||
res = self._add_codes(based_on, res, period_list, context=context)
|
||||
|
@ -89,7 +93,7 @@ class tax_report(osv.AbstractModel, common_report_header):
|
|||
}
|
||||
|
||||
top_result.append(res_dict)
|
||||
res_general = self._get_general(res[i][1].id, period_list, company_id, based_on, cr=cr, uid=uid, context=context)
|
||||
res_general = self._get_general(res[i][1].id, period_list, company_id, based_on, context=context)
|
||||
ind_general = 0
|
||||
while ind_general < len(res_general):
|
||||
res_general[ind_general]['type'] = 2
|
||||
|
@ -100,14 +104,14 @@ class tax_report(osv.AbstractModel, common_report_header):
|
|||
i+=1
|
||||
return top_result
|
||||
|
||||
def _get_general(self, tax_code_id, period_list, company_id, based_on, cr=None, uid=None, context=None):
|
||||
def _get_general(self, tax_code_id, period_list, company_id, based_on, context=None):
|
||||
if not self.display_detail:
|
||||
return []
|
||||
res = []
|
||||
obj_account = self.pool.get('account.account')
|
||||
periods_ids = tuple(period_list)
|
||||
if based_on == 'payments':
|
||||
cr.execute('SELECT SUM(line.tax_amount) AS tax_amount, \
|
||||
self.cr.execute('SELECT SUM(line.tax_amount) AS tax_amount, \
|
||||
SUM(line.debit) AS debit, \
|
||||
SUM(line.credit) AS credit, \
|
||||
COUNT(*) AS count, \
|
||||
|
@ -131,7 +135,7 @@ class tax_report(osv.AbstractModel, common_report_header):
|
|||
company_id, periods_ids, 'paid',))
|
||||
|
||||
else:
|
||||
cr.execute('SELECT SUM(line.tax_amount) AS tax_amount, \
|
||||
self.cr.execute('SELECT SUM(line.tax_amount) AS tax_amount, \
|
||||
SUM(line.debit) AS debit, \
|
||||
SUM(line.credit) AS credit, \
|
||||
COUNT(*) AS count, \
|
||||
|
@ -148,21 +152,23 @@ class tax_report(osv.AbstractModel, common_report_header):
|
|||
AND account.active \
|
||||
GROUP BY account.id,account.name,account.code', ('draft', tax_code_id,
|
||||
company_id, periods_ids,))
|
||||
res = cr.dictfetchall()
|
||||
res = self.cr.dictfetchall()
|
||||
|
||||
i = 0
|
||||
while i<len(res):
|
||||
res[i]['account'] = obj_account.browse(cr, uid, res[i]['account_id'], context=context)
|
||||
res[i]['account'] = obj_account.browse(self.cr, self.uid, res[i]['account_id'], context=context)
|
||||
i+=1
|
||||
return res
|
||||
|
||||
def _get_codes(self, based_on, company_id, parent=False, level=0, period_list=None, cr=None, uid=None, context=None):
|
||||
def _get_codes(self, based_on, company_id, parent=False, level=0, period_list=None, context=None):
|
||||
obj_tc = self.pool.get('account.tax.code')
|
||||
ids = obj_tc.search(cr, uid, [('parent_id', '=', parent), ('company_id', '=', company_id)], order='sequence', context=context)
|
||||
ids = obj_tc.search(self.cr, self.uid, [('parent_id','=',parent),('company_id','=',company_id)], order='sequence', context=context)
|
||||
|
||||
res = []
|
||||
for code in obj_tc.browse(cr, uid, ids, {'based_on': based_on}):
|
||||
for code in obj_tc.browse(self.cr, self.uid, ids, {'based_on': based_on}):
|
||||
res.append(('.'*2*level, code))
|
||||
res += self._get_codes(based_on, company_id, code.id, level+1, cr=cr, uid=uid, context=context)
|
||||
|
||||
res += self._get_codes(based_on, company_id, code.id, level+1, context=context)
|
||||
return res
|
||||
|
||||
def _add_codes(self, based_on, account_list=None, period_list=None, context=None):
|
||||
|
@ -184,7 +190,11 @@ class tax_report(osv.AbstractModel, common_report_header):
|
|||
res.append((account[0], code))
|
||||
return res
|
||||
|
||||
def _get_currency(self, form, context=None):
|
||||
return self.pool.get('res.company').browse(self.cr, self.uid, form['company_id'], context=context).currency_id.name
|
||||
|
||||
def sort_result(self, accounts, context=None):
|
||||
# On boucle sur notre rapport
|
||||
result_accounts = []
|
||||
ind=0
|
||||
old_level=0
|
||||
|
@ -200,8 +210,7 @@ class tax_report(osv.AbstractModel, common_report_header):
|
|||
bcl_rup_ind = ind - 1
|
||||
|
||||
while (bcl_current_level >= int(accounts[bcl_rup_ind]['level']) and bcl_rup_ind >= 0 ):
|
||||
res_tot = {
|
||||
'code': accounts[bcl_rup_ind]['code'],
|
||||
res_tot = { 'code': accounts[bcl_rup_ind]['code'],
|
||||
'name': '',
|
||||
'debit': 0,
|
||||
'credit': 0,
|
||||
|
@ -225,40 +234,10 @@ class tax_report(osv.AbstractModel, common_report_header):
|
|||
return result_accounts
|
||||
|
||||
|
||||
class tax_report_xls(http.Controller):
|
||||
|
||||
@http.route(['/report/account.report_vat_xls'], type='http', auth='user', website=True, multilang=True)
|
||||
def report_account_tax_xls(self, **data):
|
||||
|
||||
# Very ugly lines, only for the proof of concept of 'controller' report
|
||||
taxreport_obj = request.registry['report.account.report_vat']
|
||||
from openerp.addons.report.controllers.main import ReportController
|
||||
eval_params = ReportController()._eval_params
|
||||
|
||||
cr, uid = request.cr, request.uid
|
||||
data = eval_params(data)
|
||||
data = {'form': data}
|
||||
|
||||
taxreport_obj.render_html(cr, uid, [], data=data)
|
||||
lines = taxreport_obj._get_lines(taxreport_obj._get_basedon(data), company_id=data['form']['company_id'], cr=cr, uid=uid)
|
||||
|
||||
if lines:
|
||||
xls = StringIO.StringIO()
|
||||
xls_workbook = xlwt.Workbook()
|
||||
vat_sheet = xls_workbook.add_sheet('report_vat')
|
||||
|
||||
for x in range(0, len(lines)):
|
||||
for y in range(0, len(lines[0])):
|
||||
vat_sheet.write(x, y, lines[x].values()[y])
|
||||
|
||||
xls_workbook.save(xls)
|
||||
xls.seek(0)
|
||||
content = xls.read()
|
||||
|
||||
response = request.make_response(content, headers=[
|
||||
('Content-Type', 'application/vnd.ms-excel'),
|
||||
('Content-Disposition', 'attachment; filename=report_vat.xls;')
|
||||
])
|
||||
return response
|
||||
class report_vat(osv.AbstractModel):
|
||||
_name = 'report.account.report_vat'
|
||||
_inherit = 'report.abstract_report'
|
||||
_template = 'account.report_vat'
|
||||
_wrapped_report_class = tax_report
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -16,10 +16,9 @@
|
|||
import os
|
||||
import openerp.report
|
||||
from openerp import tools
|
||||
data, format = openerp.report.render_report(cr, uid, [ref('account.account_invoice_customer0')], 'account.invoice', {}, {})
|
||||
data, format = openerp.report.render_report(cr, uid, [ref('account.account_invoice_customer0')], 'account.report_invoice', {}, {})
|
||||
if tools.config['test_report_directory']:
|
||||
file(os.path.join(tools.config['test_report_directory'], 'account-invoice.'+format), 'wb+').write(data)
|
||||
|
||||
-
|
||||
In order to test the PDF reports defined on a partner, we will print the Overdue Report
|
||||
-
|
||||
|
@ -27,7 +26,7 @@
|
|||
import os
|
||||
import openerp.report
|
||||
from openerp import tools
|
||||
data, format = openerp.report.render_report(cr, uid, [ref('base.res_partner_1'),ref('base.res_partner_2'),ref('base.res_partner_12')], 'account.overdue', {}, {})
|
||||
data, format = openerp.report.render_report(cr, uid, [ref('base.res_partner_1'),ref('base.res_partner_2'),ref('base.res_partner_12')], 'account.report_overdue', {}, {})
|
||||
if tools.config['test_report_directory']:
|
||||
file(os.path.join(tools.config['test_report_directory'], 'account-report_overdue.'+format), 'wb+').write(data)
|
||||
-
|
||||
|
@ -86,8 +85,8 @@
|
|||
Print the General Ledger Report in Landscape Mode
|
||||
-
|
||||
!python {model: account.account}: |
|
||||
ctx={}
|
||||
data_dict = {'chart_account_id':ref('account.chart0'),'landscape':True}
|
||||
ctx={'landscape': True}
|
||||
data_dict = {'chart_account_id':ref('account.chart0')}
|
||||
from openerp.tools import test_reports
|
||||
test_reports.try_report_action(cr, uid, 'action_account_general_ledger_menu',wiz_data=data_dict, context=ctx, our_module='account')
|
||||
-
|
||||
|
|
|
@ -52,11 +52,11 @@
|
|||
<span t-if="data['form']['direction_selection'] == 'future'">Due</span>
|
||||
<span t-if="data['form']['direction_selection'] != 'future'">Not due</span>
|
||||
</th>
|
||||
<th class="text-right"><span t-esc="data['form']['4[name]']"/></th>
|
||||
<th class="text-right"><span t-esc="data['form']['3[name]']"/></th>
|
||||
<th class="text-right"><span t-esc="data['form']['2[name]']"/></th>
|
||||
<th class="text-right"><span t-esc="data['form']['1[name]']"/></th>
|
||||
<th class="text-right">+<span t-esc="data['form']['0[name]']"/></th>
|
||||
<th class="text-right"><span t-esc="data['form']['4']['name']"/></th>
|
||||
<th class="text-right"><span t-esc="data['form']['3']['name']"/></th>
|
||||
<th class="text-right"><span t-esc="data['form']['2']['name']"/></th>
|
||||
<th class="text-right"><span t-esc="data['form']['1']['name']"/></th>
|
||||
<th class="text-right"><span t-esc="data['form']['0']['name']"/></th>
|
||||
<th class="text-right">Total</th>
|
||||
</tr>
|
||||
<tr t-if="get_lines(data['form']) or get_lines_with_out_partner(data['form'])">
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
<div class="page">
|
||||
<div class="row">
|
||||
<div class="col-xs-4 col-xs-offset-6">
|
||||
<span t-field="partner.name"/><br/>
|
||||
<span t-raw="addresses[partner.id].replace('\n\n', '\n').replace('\n', '<br>')"/>
|
||||
<span t-field="partner.vat"/>
|
||||
</div>
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr t-foreach="taxlines" t-as="taxline">
|
||||
<tr t-foreach="get_lines(data['form']['based_on'], data['form']['company_id'])" t-as="taxline">
|
||||
<t t-if="len(taxline['level']) > 5">
|
||||
<t t-set="style" t-value="'font-weight:normal;'"/>
|
||||
</t>
|
||||
|
|
|
@ -84,8 +84,6 @@ class accounting_report(osv.osv_memory):
|
|||
if isinstance(data['form'][field], tuple):
|
||||
data['form'][field] = data['form'][field][0]
|
||||
comparison_context = self._build_comparison_context(cr, uid, ids, data, context=context)
|
||||
res['data'] = {}
|
||||
res['data']['form'] = data['form']
|
||||
res['data']['form']['comparison_context'] = comparison_context
|
||||
return res
|
||||
|
||||
|
|
|
@ -57,6 +57,8 @@ class account_partner_ledger(osv.osv_memory):
|
|||
context = {}
|
||||
data = self.pre_print_report(cr, uid, ids, data, context=context)
|
||||
data['form'].update(self.read(cr, uid, ids, ['initial_balance', 'filter', 'page_split', 'amount_currency'])[0])
|
||||
if data['form'].get('page_split') is True:
|
||||
return self.pool['report'].get_action(cr, uid, ids, 'account.report_partnerledgerother', data=data, context=context)
|
||||
return self.pool['report'].get_action(cr, uid, ids, 'account.report_partnerledger', data=data, context=context)
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -76,7 +76,7 @@ The analytic plan validates the minimum and maximum percentage at the time of cr
|
|||
'views/report_crossoveredanalyticplans.xml',
|
||||
],
|
||||
'demo': [],
|
||||
'test': [],
|
||||
'test': ['test/acount_analytic_plans_report.yml'],
|
||||
'installable': True,
|
||||
'auto_install': False,
|
||||
}
|
||||
|
|
|
@ -20,9 +20,10 @@
|
|||
##############################################################################
|
||||
|
||||
import time
|
||||
|
||||
from openerp.osv import osv
|
||||
from openerp.report import report_sxw
|
||||
|
||||
|
||||
class crossovered_analytic(report_sxw.rml_parse):
|
||||
def __init__(self, cr, uid, name, context):
|
||||
super(crossovered_analytic, self).__init__(cr, uid, name, context = context)
|
||||
|
@ -173,7 +174,11 @@ class crossovered_analytic(report_sxw.rml_parse):
|
|||
final.append(item)
|
||||
return final
|
||||
|
||||
report_sxw.report_sxw('report.account.analytic.account.crossovered.analytic', 'account.analytic.account', 'addons/account_analytic_plans/report/crossovered_analytic.rml',parser = crossovered_analytic, header='internal')
|
||||
|
||||
class report_crossoveredanalyticplans(osv.AbstractModel):
|
||||
_name = 'report.account_analytic_plans.report_crossoveredanalyticplans'
|
||||
_inherit = 'report.abstract_report'
|
||||
_template = 'account_analytic_plans.report_crossoveredanalyticplans'
|
||||
_wrapped_report_class = crossovered_analytic
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
|
|
@ -6,6 +6,6 @@
|
|||
import openerp.report
|
||||
from openerp import tools
|
||||
data_dict = {'model': 'account.analytic.account', 'form': {'date1':time.strftime("%Y-01-01"),'date2':time.strftime('%Y-%m-%d'),'journal_ids':[6,0,(ref('account.cose_journal_sale'))],'ref':ref('account.analytic_root'),'empty_line':True,'id':ref('account.analytic_root'),'context':{}}}
|
||||
data, format = openerp.report.render_report(cr, uid, [ref('account.analytic_root')], 'account.analytic.account.crossovered.analytic', data_dict, {})
|
||||
data, format = openerp.report.render_report(cr, uid, [ref('account.analytic_root')], 'account_analytic_plans.report_crossoveredanalyticplans', data_dict, {})
|
||||
if tools.config['test_report_directory']:
|
||||
file(os.path.join(tools.config['test_report_directory'], 'account_analytic_plans-crossovered_analyitic.'+format), 'wb+').write(data)
|
||||
|
|
|
@ -11,11 +11,11 @@
|
|||
<div class="row mt32 mb32">
|
||||
<div class="col-xs-3">
|
||||
<strong>From Date:</strong>
|
||||
<p t-esc="formatLang(date1, date=True)"/>
|
||||
<p t-esc="formatLang(data['form']['date1'], date=True)"/>
|
||||
</div>
|
||||
<div class="col-xs-3">
|
||||
<strong>To Date:</strong>
|
||||
<p t-esc="formatLang(date2, date=True)"/>
|
||||
<p t-esc="formatLang(data['form']['date2'], date=True)"/>
|
||||
</div>
|
||||
<div class="col-xs-3">
|
||||
<strong>Company:</strong>
|
||||
|
|
|
@ -21,15 +21,14 @@
|
|||
##############################################################################
|
||||
|
||||
import time
|
||||
|
||||
from openerp.osv import osv
|
||||
from openerp.report import report_sxw
|
||||
|
||||
|
||||
class bank_statement_balance_report(report_sxw.rml_parse):
|
||||
|
||||
def set_context(self, objects, data, ids, report_type=None):
|
||||
cr = self.cr
|
||||
uid = self.uid
|
||||
context = self.context
|
||||
|
||||
cr.execute('SELECT s.name as s_name, s.date AS s_date, j.code as j_code, s.balance_end_real as s_balance ' \
|
||||
'FROM account_bank_statement s ' \
|
||||
|
@ -46,7 +45,6 @@ class bank_statement_balance_report(report_sxw.rml_parse):
|
|||
})
|
||||
super(bank_statement_balance_report, self).set_context(objects, data, ids, report_type=report_type)
|
||||
|
||||
|
||||
def __init__(self, cr, uid, name, context):
|
||||
if context is None:
|
||||
context = {}
|
||||
|
@ -56,12 +54,11 @@ class bank_statement_balance_report(report_sxw.rml_parse):
|
|||
})
|
||||
self.context = context
|
||||
|
||||
report_sxw.report_sxw(
|
||||
'report.bank.statement.balance.report',
|
||||
'account.bank.statement',
|
||||
'addons/account_bank_statement_extensions/report/bank_statement_balance_report.rml',
|
||||
parser=bank_statement_balance_report,
|
||||
header='internal'
|
||||
)
|
||||
|
||||
class report_bankstatementbalance(osv.AbstractModel):
|
||||
_name = 'report.account_bank_statement_extensions.report_bankstatementbalance'
|
||||
_inherit = 'report.abstract_report'
|
||||
_template = 'account_bank_statement_extensions.report_bankstatementbalance'
|
||||
_wrapped_report_class = bank_statement_balance_report
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -20,10 +20,10 @@
|
|||
##############################################################################
|
||||
|
||||
import time
|
||||
import datetime
|
||||
|
||||
from openerp.osv import osv
|
||||
from openerp.report import report_sxw
|
||||
|
||||
|
||||
class analytic_account_budget_report(report_sxw.rml_parse):
|
||||
def __init__(self, cr, uid, name, context):
|
||||
super(analytic_account_budget_report, self).__init__(cr, uid, name, context=context)
|
||||
|
@ -166,6 +166,11 @@ class analytic_account_budget_report(report_sxw.rml_parse):
|
|||
result.append(res)
|
||||
return result
|
||||
|
||||
report_sxw.report_sxw('report.account.analytic.account.budget', 'account.analytic.account', 'addons/account_budget/report/analytic_account_budget_report.rml',parser=analytic_account_budget_report,header='internal')
|
||||
|
||||
class report_analyticaccountbudget(osv.AbstractModel):
|
||||
_name = 'report.account_budget.report_analyticaccountbudget'
|
||||
_inherit = 'report.abstract_report'
|
||||
_template = 'account_budget.report_analyticaccountbudget'
|
||||
_wrapped_report_class = analytic_account_budget_report
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
##############################################################################
|
||||
|
||||
import time
|
||||
from openerp.osv import osv
|
||||
from openerp.report import report_sxw
|
||||
|
||||
tot = {}
|
||||
|
@ -187,6 +188,11 @@ class budget_report(report_sxw.rml_parse):
|
|||
result.append(res)
|
||||
return result
|
||||
|
||||
report_sxw.report_sxw('report.account.budget', 'account.budget.post', 'addons/account_budget/report/budget_report.rml', parser=budget_report, header='internal')
|
||||
|
||||
class report_budget(osv.AbstractModel):
|
||||
_name = 'report.account_budget.report_budget'
|
||||
_inherit = 'report.abstract_report'
|
||||
_template = 'account_budget.report_budget'
|
||||
_wrapped_report_class = budget_report
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -20,11 +20,9 @@
|
|||
##############################################################################
|
||||
|
||||
import time
|
||||
import datetime
|
||||
|
||||
from openerp.osv import osv
|
||||
from openerp.report import report_sxw
|
||||
import operator
|
||||
from openerp import osv
|
||||
|
||||
|
||||
class budget_report(report_sxw.rml_parse):
|
||||
def __init__(self, cr, uid, name, context):
|
||||
|
@ -191,7 +189,11 @@ class budget_report(report_sxw.rml_parse):
|
|||
result.append(res)
|
||||
return result
|
||||
|
||||
report_sxw.report_sxw('report.crossovered.budget.report', 'crossovered.budget', 'addons/account_budget/report/crossovered_budget_report.rml',parser=budget_report,header='internal')
|
||||
|
||||
class report_crossoveredbudget(osv.AbstractModel):
|
||||
_name = 'report.account_budget.report_crossoveredbudget'
|
||||
_inherit = 'report.abstract_report'
|
||||
_template = 'account_budget.report_crossoveredbudget'
|
||||
_wrapped_report_class = budget_report
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
|
|
@ -2,35 +2,22 @@
|
|||
Print the Analytic Budget Report through wizard
|
||||
-
|
||||
!python {model: account.analytic.account}: |
|
||||
import os, time
|
||||
from openerp import netsvc, tools
|
||||
ctx={}
|
||||
ctx.update({'model': 'account.analytic.account','active_ids': [ref('account.analytic_root')]})
|
||||
data_dict = {}
|
||||
ctx = {'model': 'account.analytic.account','active_ids': [ref('account.analytic_root')]}
|
||||
from openerp.tools import test_reports
|
||||
test_reports.try_report_action(cr, uid, 'action_account_budget_analytic',wiz_data=data_dict, context=ctx, our_module='account_budget')
|
||||
test_reports.try_report_action(cr, uid, 'action_account_budget_analytic',wiz_data={}, context=ctx, our_module='account_budget')
|
||||
|
||||
-
|
||||
Print the Budget Report through wizard
|
||||
-
|
||||
!python {model: account.budget.post}: |
|
||||
import os, time
|
||||
from openerp import netsvc, tools
|
||||
ctx={}
|
||||
ctx.update({'model': 'account.budget.post','active_ids': [ref('account_budget.account_budget_post_sales0')]})
|
||||
data_dict = {}
|
||||
ctx = {'model': 'account.budget.post','active_ids': [ref('account_budget.account_budget_post_sales0')]}
|
||||
from openerp.tools import test_reports
|
||||
test_reports.try_report_action(cr, uid, 'action_account_budget_report',wiz_data=data_dict, context=ctx, our_module='account_budget')
|
||||
test_reports.try_report_action(cr, uid, 'action_account_budget_report',wiz_data={}, context=ctx, our_module='account_budget')
|
||||
|
||||
-
|
||||
Print the CrossOvered Budget Report mode through wizard
|
||||
-
|
||||
!python {model: crossovered.budget}: |
|
||||
import os, time
|
||||
from openerp import netsvc, tools
|
||||
ctx={}
|
||||
ctx.update({'model': 'account.budget.post','active_ids': [ref('account_budget.crossovered_budget_budgetoptimistic0')]})
|
||||
data_dict = {}
|
||||
ctx = {'model': 'account.budget.post','active_ids': [ref('account_budget.crossovered_budget_budgetoptimistic0')]}
|
||||
from openerp.tools import test_reports
|
||||
test_reports.try_report_action(cr, uid, 'action_account_budget_crossvered_report',wiz_data=data_dict, context=ctx, our_module='account_budget')
|
||||
|
||||
test_reports.try_report_action(cr, uid, 'action_account_budget_crossvered_report',wiz_data={}, context=ctx, our_module='account_budget')
|
||||
|
|
|
@ -20,8 +20,9 @@
|
|||
##############################################################################
|
||||
|
||||
import time
|
||||
from openerp.osv import osv
|
||||
from openerp.report import report_sxw
|
||||
from openerp.tools import amount_to_text_en
|
||||
|
||||
|
||||
class report_print_check(report_sxw.rml_parse):
|
||||
def __init__(self, cr, uid, name, context):
|
||||
|
@ -33,13 +34,14 @@ class report_print_check(report_sxw.rml_parse):
|
|||
'get_lines': self.get_lines,
|
||||
'fill_stars' : self.fill_stars,
|
||||
})
|
||||
|
||||
def fill_stars(self, amount):
|
||||
if len(amount) < 100:
|
||||
stars = 100 - len(amount)
|
||||
return ' '.join([amount,'*'*stars])
|
||||
|
||||
else: return amount
|
||||
|
||||
|
||||
def get_lines(self, voucher_lines):
|
||||
result = []
|
||||
self.number_lines = len(voucher_lines)
|
||||
|
@ -63,24 +65,11 @@ class report_print_check(report_sxw.rml_parse):
|
|||
result.append(res)
|
||||
return result
|
||||
|
||||
report_sxw.report_sxw(
|
||||
'report.account.print.check.top',
|
||||
'account.voucher',
|
||||
'addons/account_check_writing/report/check_print_top.rml',
|
||||
parser=report_print_check,header=False
|
||||
)
|
||||
|
||||
report_sxw.report_sxw(
|
||||
'report.account.print.check.middle',
|
||||
'account.voucher',
|
||||
'addons/account_check_writing/report/check_print_middle.rml',
|
||||
parser=report_print_check,header=False
|
||||
)
|
||||
class report_check(osv.AbstractModel):
|
||||
_name = 'report.account_check_writing.report_check'
|
||||
_inherit = 'report.abstract_report'
|
||||
_template = 'account_check_writing.report_check'
|
||||
_wrapped_report_class = report_print_check
|
||||
|
||||
report_sxw.report_sxw(
|
||||
'report.account.print.check.bottom',
|
||||
'account.voucher',
|
||||
'addons/account_check_writing/report/check_print_bottom.rml',
|
||||
parser=report_print_check,header=False
|
||||
)
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
|
||||
from openerp.osv import fields, osv
|
||||
from lxml import etree
|
||||
import openerp.tools as tools
|
||||
from openerp.tools.translate import _
|
||||
|
||||
class followup(osv.osv):
|
||||
|
@ -243,7 +242,8 @@ class res_partner(osv.osv):
|
|||
if partner.unreconciled_aml_ids:
|
||||
company = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id
|
||||
current_date = fields.date.context_today(self, cr, uid, context=context)
|
||||
final_res = self.pool['report.account_followup.report_followup']._lines_get_with_partner(partner, company.id, cr=cr, uid=uid)
|
||||
rml_parse = account_followup_print.report_rappel(cr, uid, "followup_rml_parser")
|
||||
final_res = rml_parse._lines_get_with_partner(partner, company.id)
|
||||
|
||||
for currency_dict in final_res:
|
||||
currency = currency_dict.get('line', [{'currency_id': company.currency_id}])[0]['currency_id']
|
||||
|
@ -272,8 +272,7 @@ class res_partner(osv.osv):
|
|||
|
||||
total = reduce(lambda x, y: x+y['balance'], currency_dict['line'], 0.00)
|
||||
|
||||
report_obj = self.pool.get('report')
|
||||
total = report_obj.formatLang(total, dp='Account', currency_obj=currency, cr=cr, uid=uid)
|
||||
total = rml_parse.formatLang(total, dp='Account', currency_obj=currency)
|
||||
followup_table += '''<tr> </tr>
|
||||
</table>
|
||||
<center>''' + _("Amount due") + ''' : %s </center>''' % (total)
|
||||
|
|
|
@ -21,9 +21,10 @@
|
|||
|
||||
import time
|
||||
from collections import defaultdict
|
||||
|
||||
from openerp.osv import osv
|
||||
from openerp.report import report_sxw
|
||||
|
||||
|
||||
class report_rappel(report_sxw.rml_parse):
|
||||
_name = "account_followup.report.rappel"
|
||||
|
||||
|
@ -108,8 +109,11 @@ class report_rappel(report_sxw.rml_parse):
|
|||
}
|
||||
return text
|
||||
|
||||
report_sxw.report_sxw('report.account_followup.followup.print',
|
||||
'account_followup.stat.by.partner', 'addons/account_followup/report/account_followup_print.rml',
|
||||
parser=report_rappel)
|
||||
|
||||
class report_followup(osv.AbstractModel):
|
||||
_name = 'report.account_followup.report_followup'
|
||||
_inherit = 'report.abstract_report'
|
||||
_template = 'account_followup.report_followup'
|
||||
_wrapped_report_class = report_rappel
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -218,18 +218,18 @@ class account_followup_print(osv.osv_memory):
|
|||
#Update partners
|
||||
self.do_update_followup_level(cr, uid, to_update, partner_list, date, context=context)
|
||||
#process the partners (send mails...)
|
||||
restot = self.process_partners(cr, uid, partner_list, data, context=context)
|
||||
restot_context = context.copy()
|
||||
restot = self.process_partners(cr, uid, partner_list, data, context=restot_context)
|
||||
context.update(restot_context)
|
||||
#clear the manual actions if nothing is due anymore
|
||||
nbactionscleared = self.clear_manual_actions(cr, uid, partner_list, context=context)
|
||||
if nbactionscleared > 0:
|
||||
restot['resulttext'] = restot['resulttext'] + "<li>" + _("%s partners have no credits and as such the action is cleared") %(str(nbactionscleared)) + "</li>"
|
||||
res = restot['action']
|
||||
|
||||
#return the next action
|
||||
mod_obj = self.pool.get('ir.model.data')
|
||||
model_data_ids = mod_obj.search(cr, uid, [('model','=','ir.ui.view'),('name','=','view_account_followup_sending_results')], context=context)
|
||||
resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id']
|
||||
context.update({'description': restot['resulttext'], 'needprinting': restot['needprinting'], 'report_data': res})
|
||||
context.update({'description': restot['resulttext'], 'needprinting': restot['needprinting'], 'report_data': restot['action']})
|
||||
return {
|
||||
'name': _('Send Letters and Emails: Actions Summary'),
|
||||
'view_type': 'form',
|
||||
|
|
|
@ -20,9 +20,10 @@
|
|||
##############################################################################
|
||||
|
||||
import time
|
||||
|
||||
from openerp.osv import osv
|
||||
from openerp.report import report_sxw
|
||||
|
||||
|
||||
class payment_order(report_sxw.rml_parse):
|
||||
|
||||
def __init__(self, cr, uid, name, context=None):
|
||||
|
@ -70,6 +71,11 @@ class payment_order(report_sxw.rml_parse):
|
|||
return value_name[0][1]
|
||||
return False
|
||||
|
||||
report_sxw.report_sxw('report.payment.order', 'payment.order', 'addons/account_payment/report/payment_order.rml', parser=payment_order, header="external")
|
||||
|
||||
class report_paymentorder(osv.AbstractModel):
|
||||
_name = 'report.account_payment.report_paymentorder'
|
||||
_inherit = 'report.abstract_report'
|
||||
_template = 'account_payment.report_paymentorder'
|
||||
_wrapped_report_class = payment_order
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -5,6 +5,6 @@
|
|||
import os
|
||||
import openerp.report
|
||||
from openerp import tools
|
||||
data, format = openerp.report.render_report(cr, uid, [ref('payment_order_1')], 'payment.order', {}, {})
|
||||
data, format = openerp.report.render_report(cr, uid, [ref('payment_order_1')], 'account_payment.report_paymentorder', {}, {})
|
||||
if tools.config['test_report_directory']:
|
||||
file(os.path.join(tools.config['test_report_directory'], 'account_payment-payment_order_report.'+format), 'wb+').write(data)
|
||||
|
|
|
@ -23,8 +23,10 @@
|
|||
import datetime
|
||||
import time
|
||||
|
||||
from openerp.report import report_sxw
|
||||
from openerp.osv import osv
|
||||
from openerp.tools.translate import _
|
||||
from openerp.report import report_sxw
|
||||
|
||||
|
||||
#
|
||||
# Use period and Journal for selection or resources
|
||||
|
@ -84,6 +86,11 @@ class report_assert_account(report_sxw.rml_parse):
|
|||
|
||||
return result
|
||||
|
||||
report_sxw.report_sxw('report.account.test.assert.print', 'accounting.assert.test', 'addons/account_test/report/account_test.rml', parser=report_assert_account, header=False)
|
||||
|
||||
class report_accounttest(osv.AbstractModel):
|
||||
_name = 'report.account_test.report_accounttest'
|
||||
_inherit = 'report.abstract_report'
|
||||
_template = 'account_test.report_accounttest'
|
||||
_wrapped_report_class = report_assert_account
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -58,7 +58,6 @@ This module manages:
|
|||
'report/account_voucher_sales_receipt_view.xml',
|
||||
'security/account_voucher_security.xml',
|
||||
'account_voucher_data.xml',
|
||||
'account_voucher_report.xml',
|
||||
],
|
||||
'test' : [
|
||||
'test/account_voucher_users.yml',
|
||||
|
@ -73,7 +72,6 @@ This module manages:
|
|||
'test/case3_eur_eur.yml',
|
||||
'test/case4_cad_chf.yml',
|
||||
'test/case_eur_usd.yml',
|
||||
'account_voucher_report.yml',
|
||||
],
|
||||
'auto_install': False,
|
||||
'application': True,
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<!-- <report id="report_account_voucher"
|
||||
string="Voucher"
|
||||
model="account.voucher"
|
||||
name="voucher.cash_receipt.drcr"
|
||||
rml="account_voucher/report/account_voucher.rml"
|
||||
auto="False"
|
||||
header = "False"
|
||||
menu="True"/> -->
|
||||
|
||||
<!-- This report is awfull so it's better to hide it -->
|
||||
<!-- <report id="report_account_voucher_print"
|
||||
string="Voucher Print"
|
||||
model="account.voucher"
|
||||
name="voucher.print"
|
||||
rml="account_voucher/report/account_voucher_print.rml"
|
||||
auto="False"
|
||||
header = "False"
|
||||
menu="True"/>-->
|
||||
</data>
|
||||
</openerp>
|
|
@ -19,8 +19,6 @@
|
|||
#
|
||||
##############################################################################
|
||||
|
||||
import account_voucher
|
||||
import account_voucher_print
|
||||
import account_voucher_sales_receipt
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -1,75 +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 openerp.report import report_sxw
|
||||
from openerp.tools import amount_to_text_en
|
||||
|
||||
class report_voucher(report_sxw.rml_parse):
|
||||
def __init__(self, cr, uid, name, context):
|
||||
super(report_voucher, self).__init__(cr, uid, name, context)
|
||||
self.localcontext.update({
|
||||
'time': time,
|
||||
'convert':self.convert,
|
||||
'get_title': self.get_title,
|
||||
'debit':self.debit,
|
||||
'credit':self.credit,
|
||||
'get_ref': self._get_ref
|
||||
})
|
||||
|
||||
def convert(self, amount, cur):
|
||||
amt_en = amount_to_text_en.amount_to_text(amount, 'en', cur)
|
||||
return amt_en
|
||||
|
||||
def get_title(self, type):
|
||||
title = ''
|
||||
if type:
|
||||
title = type[0].swapcase() + type[1:] + " Voucher"
|
||||
return title
|
||||
|
||||
def debit(self, move_ids):
|
||||
debit = 0.0
|
||||
for move in move_ids:
|
||||
debit += move.debit
|
||||
return debit
|
||||
|
||||
def credit(self, move_ids):
|
||||
credit = 0.0
|
||||
for move in move_ids:
|
||||
credit += move.credit
|
||||
return credit
|
||||
|
||||
def _get_ref(self, voucher_id, move_ids):
|
||||
voucher_line_obj = self.pool.get('account.voucher.line')
|
||||
voucher_line = voucher_line_obj.search(self.cr, self.uid, [('partner_id', '=', move_ids.partner_id.id), ('voucher_id', '=', voucher_id)])
|
||||
if voucher_line:
|
||||
voucher = voucher_line_obj.browse(self.cr, self.uid, voucher_line)[0]
|
||||
return voucher.name
|
||||
else:
|
||||
return
|
||||
report_sxw.report_sxw(
|
||||
'report.voucher.cash_receipt.drcr',
|
||||
'account.voucher',
|
||||
'addons/account_voucher/report/account_voucher.rml',
|
||||
parser=report_voucher,header="external"
|
||||
)
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -1,96 +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 openerp.report import report_sxw
|
||||
from openerp.tools import amount_to_text_en
|
||||
|
||||
class report_voucher_print(report_sxw.rml_parse):
|
||||
def __init__(self, cr, uid, name, context):
|
||||
super(report_voucher_print, self).__init__(cr, uid, name, context)
|
||||
self.localcontext.update({
|
||||
'time': time,
|
||||
'get_title': self.get_title,
|
||||
'get_lines':self.get_lines,
|
||||
'get_on_account':self.get_on_account,
|
||||
'convert':self.convert
|
||||
})
|
||||
|
||||
def convert(self, amount, cur):
|
||||
amt_en = amount_to_text_en.amount_to_text(amount, 'en', cur)
|
||||
return amt_en
|
||||
|
||||
def get_lines(self, voucher):
|
||||
result = []
|
||||
if voucher.type in ('payment','receipt'):
|
||||
type = voucher.line_ids and voucher.line_ids[0].type or False
|
||||
for move in voucher.move_ids:
|
||||
res = {}
|
||||
amount = move.credit
|
||||
if type == 'dr':
|
||||
amount = move.debit
|
||||
if amount > 0.0:
|
||||
res['pname'] = move.partner_id.name
|
||||
res['ref'] = 'Agst Ref'+" "+str(move.name)
|
||||
res['aname'] = move.account_id.name
|
||||
res['amount'] = amount
|
||||
result.append(res)
|
||||
else:
|
||||
type = voucher.line_ids and voucher.line_ids[0].type or False
|
||||
for move in voucher.move_ids:
|
||||
res = {}
|
||||
amount = move.credit
|
||||
if type == 'dr':
|
||||
amount = move.debit
|
||||
if amount > 0.0:
|
||||
res['pname'] = move.partner_id.name
|
||||
res['ref'] = move.name
|
||||
res['aname'] = move.account_id.name
|
||||
res['amount'] = amount
|
||||
result.append(res)
|
||||
return result
|
||||
|
||||
def get_title(self, type):
|
||||
title = ''
|
||||
if type:
|
||||
title = type[0].swapcase() + type[1:] + " Voucher"
|
||||
return title
|
||||
|
||||
def get_on_account(self, voucher):
|
||||
name = ""
|
||||
if voucher.type == 'receipt':
|
||||
name = "Received cash from "+str(voucher.partner_id.name)
|
||||
elif voucher.type == 'payment':
|
||||
name = "Payment from "+str(voucher.partner_id.name)
|
||||
elif voucher.type == 'sale':
|
||||
name = "Sale to "+str(voucher.partner_id.name)
|
||||
elif voucher.type == 'purchase':
|
||||
name = "Purchase from "+str(voucher.partner_id.name)
|
||||
return name
|
||||
|
||||
report_sxw.report_sxw(
|
||||
'report.voucher.print',
|
||||
'account.voucher',
|
||||
'addons/account_voucher/report/account_voucher_print.rml',
|
||||
parser=report_voucher_print,header="external"
|
||||
)
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -1,27 +0,0 @@
|
|||
-
|
||||
Demo for Account Voucher
|
||||
-
|
||||
!record {model: account.voucher, id: account_voucher_voucheraxelor0again, view: view_sale_receipt_form}:
|
||||
type: sale
|
||||
account_id: account.cash
|
||||
company_id: base.main_company
|
||||
journal_id: account.bank_journal
|
||||
name: Voucher Axelor
|
||||
narration: PC Assemble SC234
|
||||
amount: 1000.0
|
||||
line_ids:
|
||||
- account_id: account.cash
|
||||
amount: 1000.0
|
||||
name: Voucher Axelor
|
||||
period_id: account.period_6
|
||||
|
||||
-
|
||||
In order to test the PDF reports defined on a account_voucher, we will print account voucher Report
|
||||
-
|
||||
!python {model: account.voucher}: |
|
||||
import os
|
||||
import openerp.report
|
||||
from openerp import tools
|
||||
data, format = openerp.report.render_report(cr, uid, [ref("account_voucher_voucheraxelor0again")], 'voucher.cash_receipt.drcr', {}, {})
|
||||
if tools.config['test_report_directory']:
|
||||
file(os.path.join(tools.config['test_report_directory'], 'account_voucher-report.'+format), 'wb+').write(data)
|
|
@ -20,11 +20,11 @@
|
|||
##############################################################################
|
||||
|
||||
import time
|
||||
from openerp.addons.web import http
|
||||
from openerp.addons.web.http import request
|
||||
from openerp.report import report_sxw
|
||||
from openerp.osv import osv
|
||||
|
||||
|
||||
class order(http.Controller):
|
||||
class order(report_sxw.rml_parse):
|
||||
|
||||
def get_lines(self, user,objects):
|
||||
lines=[]
|
||||
|
@ -60,24 +60,23 @@ class order(http.Controller):
|
|||
notes.append(obj.note)
|
||||
return notes
|
||||
|
||||
@http.route(['/report/lunch.report_lunchorder/<docids>'], type='http', auth='user', website=True, multilang=True)
|
||||
def report_lunch(self, docids):
|
||||
self.cr, self.uid, self.context = request.cr, request.uid, request.context
|
||||
|
||||
ids = [int(i) for i in docids.split(',')]
|
||||
report_obj = request.registry['lunch.order.line']
|
||||
docs = report_obj.browse(self.cr, self.uid, ids, context=self.context)
|
||||
|
||||
def __init__(self, cr, uid, name, context):
|
||||
super(order, self).__init__(cr, uid, name, context)
|
||||
self.net_total=0.0
|
||||
docargs = {
|
||||
'docs': docs,
|
||||
self.localcontext.update({
|
||||
'time': time,
|
||||
'get_lines': self.get_lines,
|
||||
'get_users': self.get_users,
|
||||
'get_total': self.get_total,
|
||||
'get_nettotal': self.get_nettotal,
|
||||
'get_note': self.get_note,
|
||||
}
|
||||
return request.registry['report'].render(self.cr, self.uid, [], 'lunch.report_lunchorder', docargs)
|
||||
})
|
||||
|
||||
|
||||
class report_lunchorder(osv.AbstractModel):
|
||||
_name = 'report.lunch.report_lunchorder'
|
||||
_inherit = 'report.abstract_report'
|
||||
_template = 'lunch.report_lunchorder'
|
||||
_wrapped_report_class = order
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -19,22 +19,18 @@
|
|||
#
|
||||
##############################################################################
|
||||
|
||||
import time
|
||||
from openerp.osv import osv
|
||||
from openerp.report import report_sxw
|
||||
|
||||
|
||||
class bom_structure(osv.AbstractModel):
|
||||
_name = 'report.mrp.report_mrpbomstructure'
|
||||
|
||||
def render_html(self, cr, uid, ids, data=None, context=None):
|
||||
mrpbom_obj = self.pool['mrp.bom']
|
||||
report_obj = self.pool['report']
|
||||
docs = mrpbom_obj.browse(cr, uid, ids, context=context)
|
||||
|
||||
docargs = {
|
||||
'docs': docs,
|
||||
'get_children': self.get_children,
|
||||
}
|
||||
return report_obj.render(cr, uid, [], 'mrp.report_mrpbomstructure', docargs, context=context)
|
||||
class bom_structure(report_sxw.rml_parse):
|
||||
def __init__(self, cr, uid, name, context):
|
||||
super(bom_structure, self).__init__(cr, uid, name, context=context)
|
||||
self.localcontext.update({
|
||||
'time': time,
|
||||
'get_children':self.get_children,
|
||||
})
|
||||
|
||||
def get_children(self, object, level=0):
|
||||
result = []
|
||||
|
@ -62,4 +58,11 @@ class bom_structure(osv.AbstractModel):
|
|||
|
||||
return children
|
||||
|
||||
|
||||
class report_lunchorder(osv.AbstractModel):
|
||||
_name = 'report.mrp.report_mrpbomstructure'
|
||||
_inherit = 'report.abstract_report'
|
||||
_template = 'mpr.report_mrpbomstructure'
|
||||
_wrapped_report_class = bom_structure
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -16,6 +16,6 @@
|
|||
import os
|
||||
import openerp.report
|
||||
from openerp import tools
|
||||
data, format = openerp.report.render_report(cr, uid, [ref('test_invoice_1')], 'account.invoice.intrastat', {}, {})
|
||||
data, format = openerp.report.render_report(cr, uid, [ref('test_invoice_1')], 'report_intrastat.report_intrastatinvoice', {}, {})
|
||||
if tools.config['test_report_directory']:
|
||||
file(os.path.join(tools.config['test_report_directory'], 'report_intrastat-intrastat_report.'+format), 'wb+').write(data)
|
||||
|
|
Loading…
Reference in New Issue