Company:
diff --git a/addons/account_bank_statement_extensions/report/bank_statement_balance_report.py b/addons/account_bank_statement_extensions/report/bank_statement_balance_report.py
index 59b8efb23e1..f0b63bf148c 100644
--- a/addons/account_bank_statement_extensions/report/bank_statement_balance_report.py
+++ b/addons/account_bank_statement_extensions/report/bank_statement_balance_report.py
@@ -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:
diff --git a/addons/account_budget/report/analytic_account_budget_report.py b/addons/account_budget/report/analytic_account_budget_report.py
index 6701fc06a2b..4e3feaf06b7 100644
--- a/addons/account_budget/report/analytic_account_budget_report.py
+++ b/addons/account_budget/report/analytic_account_budget_report.py
@@ -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:
diff --git a/addons/account_budget/report/budget_report.py b/addons/account_budget/report/budget_report.py
index f00eb8a3713..f8f812639b0 100644
--- a/addons/account_budget/report/budget_report.py
+++ b/addons/account_budget/report/budget_report.py
@@ -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:
diff --git a/addons/account_budget/report/crossovered_budget_report.py b/addons/account_budget/report/crossovered_budget_report.py
index 70cbdecb713..8a001aafb39 100644
--- a/addons/account_budget/report/crossovered_budget_report.py
+++ b/addons/account_budget/report/crossovered_budget_report.py
@@ -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:
-
diff --git a/addons/account_budget/test/account_budget_report.yml b/addons/account_budget/test/account_budget_report.yml
index 80ab9b36b34..a36c2d87d04 100644
--- a/addons/account_budget/test/account_budget_report.yml
+++ b/addons/account_budget/test/account_budget_report.yml
@@ -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')
diff --git a/addons/account_check_writing/report/check_print.py b/addons/account_check_writing/report/check_print.py
index add79fcc35a..be5feb4662b 100644
--- a/addons/account_check_writing/report/check_print.py
+++ b/addons/account_check_writing/report/check_print.py
@@ -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:
diff --git a/addons/account_followup/account_followup.py b/addons/account_followup/account_followup.py
index 5f912b61b37..eae361913ad 100644
--- a/addons/account_followup/account_followup.py
+++ b/addons/account_followup/account_followup.py
@@ -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 += '''
''' + _("Amount due") + ''' : %s ''' % (total)
diff --git a/addons/account_followup/report/account_followup_print.py b/addons/account_followup/report/account_followup_print.py
index eecba81acb9..4e856853915 100644
--- a/addons/account_followup/report/account_followup_print.py
+++ b/addons/account_followup/report/account_followup_print.py
@@ -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:
diff --git a/addons/account_followup/wizard/account_followup_print.py b/addons/account_followup/wizard/account_followup_print.py
index 00ecab7b860..7b7cb8fc77e 100644
--- a/addons/account_followup/wizard/account_followup_print.py
+++ b/addons/account_followup/wizard/account_followup_print.py
@@ -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'] + "" + _("%s partners have no credits and as such the action is cleared") %(str(nbactionscleared)) + ""
- 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',
diff --git a/addons/account_payment/report/payment_order.py b/addons/account_payment/report/payment_order.py
index a851a54ecbb..292d0e11bf4 100644
--- a/addons/account_payment/report/payment_order.py
+++ b/addons/account_payment/report/payment_order.py
@@ -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:
diff --git a/addons/account_payment/test/account_payment_report.yml b/addons/account_payment/test/account_payment_report.yml
index 3def62de429..922d2502203 100644
--- a/addons/account_payment/test/account_payment_report.yml
+++ b/addons/account_payment/test/account_payment_report.yml
@@ -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)
diff --git a/addons/account_test/report/account_test_report.py b/addons/account_test/report/account_test_report.py
index 0cfbc040d82..bb21e3807a8 100644
--- a/addons/account_test/report/account_test_report.py
+++ b/addons/account_test/report/account_test_report.py
@@ -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:
diff --git a/addons/account_voucher/__openerp__.py b/addons/account_voucher/__openerp__.py
index 6a3b0ee81cd..dc8102d6647 100644
--- a/addons/account_voucher/__openerp__.py
+++ b/addons/account_voucher/__openerp__.py
@@ -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,
diff --git a/addons/account_voucher/account_voucher_report.xml b/addons/account_voucher/account_voucher_report.xml
deleted file mode 100644
index 239492d1a27..00000000000
--- a/addons/account_voucher/account_voucher_report.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/addons/account_voucher/report/__init__.py b/addons/account_voucher/report/__init__.py
index 862843352a8..53ac7e915be 100644
--- a/addons/account_voucher/report/__init__.py
+++ b/addons/account_voucher/report/__init__.py
@@ -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:
diff --git a/addons/account_voucher/report/account_voucher.py b/addons/account_voucher/report/account_voucher.py
deleted file mode 100644
index c23c7f4d384..00000000000
--- a/addons/account_voucher/report/account_voucher.py
+++ /dev/null
@@ -1,75 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# 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 .
-#
-##############################################################################
-
-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:
diff --git a/addons/account_voucher/report/account_voucher_print.py b/addons/account_voucher/report/account_voucher_print.py
deleted file mode 100644
index 1bc411947f6..00000000000
--- a/addons/account_voucher/report/account_voucher_print.py
+++ /dev/null
@@ -1,96 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# 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 .
-#
-##############################################################################
-
-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:
diff --git a/addons/account_voucher/test/account_voucher_report.yml b/addons/account_voucher/test/account_voucher_report.yml
deleted file mode 100644
index 96e96e4bdfd..00000000000
--- a/addons/account_voucher/test/account_voucher_report.yml
+++ /dev/null
@@ -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)
diff --git a/addons/lunch/report/order.py b/addons/lunch/report/order.py
index 0bb99f01017..85b216ac632 100644
--- a/addons/lunch/report/order.py
+++ b/addons/lunch/report/order.py
@@ -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/'], 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:
diff --git a/addons/mrp/report/bom_structure.py b/addons/mrp/report/bom_structure.py
index 98949ed75dc..1b286feac46 100644
--- a/addons/mrp/report/bom_structure.py
+++ b/addons/mrp/report/bom_structure.py
@@ -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:
diff --git a/addons/report_intrastat/test/report_intrastat_report.yml b/addons/report_intrastat/test/report_intrastat_report.yml
index 687f605b901..5c70ba67ef2 100644
--- a/addons/report_intrastat/test/report_intrastat_report.yml
+++ b/addons/report_intrastat/test/report_intrastat_report.yml
@@ -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)