Skip to content

Commit

Permalink
[REF] report: remove the report module
Browse files Browse the repository at this point in the history
The content of the report module is now dispatched in
the 'base' and the 'web' modules.
  • Loading branch information
smetl committed May 8, 2017
1 parent 3425752 commit e802380
Show file tree
Hide file tree
Showing 256 changed files with 1,644 additions and 36,631 deletions.
2 changes: 1 addition & 1 deletion addons/account/__manifest__.py
Expand Up @@ -15,7 +15,7 @@
'category': 'Accounting',
'website': 'https://www.odoo.com/page/billing',
'images' : ['images/accounts.jpeg','images/bank_statement.jpeg','images/cash_register.jpeg','images/chart_of_accounts.jpeg','images/customer_invoice.jpeg','images/journal_entries.jpeg'],
'depends' : ['base_setup', 'product', 'analytic', 'report', 'web_planner'],
'depends' : ['base_setup', 'product', 'analytic', 'web_planner'],
'data': [
'security/account_security.xml',
'security/ir.model.access.csv',
Expand Down
6 changes: 3 additions & 3 deletions addons/account/models/account_invoice.py
Expand Up @@ -411,7 +411,7 @@ def invoice_print(self):
"""
self.ensure_one()
self.sent = True
return self.env['report'].get_action(self, 'account.report_invoice')
return self.env.ref('account.account_invoices').report_action(self)

@api.multi
def action_invoice_sent(self):
Expand Down Expand Up @@ -564,14 +564,14 @@ def action_invoice_draft(self):
self.write({'state': 'draft', 'date': False})
# Delete former printed invoice
try:
report_invoice = self.env['report']._get_report_from_name('account.report_invoice')
report_invoice = self.env['ir.actions.report']._get_report_from_name('account.report_invoice')
except IndexError:
report_invoice = False
if report_invoice and report_invoice.attachment:
for invoice in self:
with invoice.env.do_in_draft():
invoice.number, invoice.state = invoice.move_name, 'open'
attachment = self.env['report']._attachment_stored(invoice, report_invoice)[invoice.id]
attachment = self.env['ir.actions.report'].retrieve_attachment(invoice.id)
if attachment:
attachment.unlink()
return True
Expand Down
5 changes: 2 additions & 3 deletions addons/account/report/account_aged_partner_balance.py
Expand Up @@ -195,7 +195,7 @@ def _get_partner_move_lines(self, account_type, date_from, target_move, period_l
return res, total, lines

@api.model
def render_html(self, docids, data=None):
def get_report_values(self, docids, data=None):
total = []
model = self.env.context.get('active_model')
docs = self.env[model].browse(self.env.context.get('active_id'))
Expand All @@ -211,7 +211,7 @@ def render_html(self, docids, data=None):
account_type = ['payable', 'receivable']

movelines, total, dummy = self._get_partner_move_lines(account_type, date_from, target_move, data['form']['period_length'])
docargs = {
return {
'doc_ids': self.ids,
'doc_model': model,
'data': data['form'],
Expand All @@ -220,4 +220,3 @@ def render_html(self, docids, data=None):
'get_partner_lines': movelines,
'get_direction': total,
}
return self.env['report'].render('account.report_agedpartnerbalance', docargs)
5 changes: 2 additions & 3 deletions addons/account/report/account_balance.py
Expand Up @@ -56,19 +56,18 @@ def _get_accounts(self, accounts, display_account):


@api.model
def render_html(self, docids, data=None):
def get_report_values(self, docids, data=None):
self.model = self.env.context.get('active_model')
docs = self.env[self.model].browse(self.env.context.get('active_ids', []))
display_account = data['form'].get('display_account')
accounts = docs if self.model == 'account.account' else self.env['account.account'].search([])
account_res = self.with_context(data['form'].get('used_context'))._get_accounts(accounts, display_account)

docargs = {
return {
'doc_ids': self.ids,
'doc_model': self.model,
'data': data['form'],
'docs': docs,
'time': time,
'Accounts': account_res,
}
return self.env['report'].render('account.report_trialbalance', docargs)
5 changes: 2 additions & 3 deletions addons/account/report/account_general_ledger.py
Expand Up @@ -108,7 +108,7 @@ def _get_account_move_entry(self, accounts, init_balance, sortby, display_accoun
return account_res

@api.model
def render_html(self, docids, data=None):
def get_report_values(self, docids, data=None):
self.model = self.env.context.get('active_model')
docs = self.env[self.model].browse(self.env.context.get('active_ids', []))

Expand All @@ -121,7 +121,7 @@ def render_html(self, docids, data=None):

accounts = docs if self.model == 'account.account' else self.env['account.account'].search([])
accounts_res = self.with_context(data['form'].get('used_context',{}))._get_account_move_entry(accounts, init_balance, sortby, display_account)
docargs = {
return {
'doc_ids': docids,
'doc_model': self.model,
'data': data['form'],
Expand All @@ -130,4 +130,3 @@ def render_html(self, docids, data=None):
'Accounts': accounts_res,
'print_journal': codes,
}
return self.env['report'].render('account.report_generalledger', docargs)
5 changes: 2 additions & 3 deletions addons/account/report/account_journal.py
Expand Up @@ -94,14 +94,14 @@ def _get_query_get_clause(self, data):
return self.env['account.move.line'].with_context(data['form'].get('used_context', {}))._query_get()

@api.model
def render_html(self, docids, data=None):
def get_report_values(self, docids, data=None):
target_move = data['form'].get('target_move', 'all')
sort_selection = data['form'].get('sort_selection', 'date')

res = {}
for journal in data['form']['journal_ids']:
res[journal] = self.with_context(data['form'].get('used_context', {})).lines(target_move, journal, sort_selection, data)
docargs = {
return {
'doc_ids': data['form']['journal_ids'],
'doc_model': self.env['account.journal'],
'data': data,
Expand All @@ -112,4 +112,3 @@ def render_html(self, docids, data=None):
'sum_debit': self._sum_debit,
'get_taxes': self._get_taxes,
}
return self.env['report'].render('account.report_journal', docargs)
5 changes: 2 additions & 3 deletions addons/account/report/account_overdue_report.py
Expand Up @@ -31,7 +31,7 @@ def _get_account_move_lines(self, partner_ids):
return res

@api.model
def render_html(self, docids, data=None):
def get_report_values(self, docids, data=None):
totals = {}
lines = self._get_account_move_lines(docids)
lines_to_display = {}
Expand All @@ -57,7 +57,7 @@ def render_html(self, docids, data=None):
totals[partner_id][currency]['paid'] += line['credit']
totals[partner_id][currency]['mat'] += line['mat']
totals[partner_id][currency]['total'] += line['debit'] - line['credit']
docargs = {
return {
'doc_ids': docids,
'doc_model': 'res.partner',
'docs': self.env['res.partner'].browse(docids),
Expand All @@ -66,4 +66,3 @@ def render_html(self, docids, data=None):
'Totals': totals,
'Date': fields.date.today(),
}
return self.env['report'].render('account.report_overdue', values=docargs)
5 changes: 2 additions & 3 deletions addons/account/report/account_partner_ledger.py
Expand Up @@ -68,7 +68,7 @@ def _sum_partner(self, data, partner, field):
return result

@api.model
def render_html(self, docids, data=None):
def get_report_values(self, docids, data=None):
data['computed'] = {}

obj_partner = self.env['res.partner']
Expand Down Expand Up @@ -107,7 +107,7 @@ def render_html(self, docids, data=None):
partners = obj_partner.browse(partner_ids)
partners = sorted(partners, key=lambda x: (x.ref, x.name))

docargs = {
return {
'doc_ids': partner_ids,
'doc_model': self.env['res.partner'],
'data': data,
Expand All @@ -116,4 +116,3 @@ def render_html(self, docids, data=None):
'lines': self._lines,
'sum_partner': self._sum_partner,
}
return self.env['report'].render('account.report_partnerledger', docargs)
5 changes: 2 additions & 3 deletions addons/account/report/account_report_financial.py
Expand Up @@ -143,16 +143,15 @@ def get_account_lines(self, data):
return lines

@api.model
def render_html(self, docids, data=None):
def get_report_values(self, docids, data=None):
self.model = self.env.context.get('active_model')
docs = self.env[self.model].browse(self.env.context.get('active_id'))
report_lines = self.get_account_lines(data.get('form'))
docargs = {
return {
'doc_ids': self.ids,
'doc_model': self.model,
'data': data['form'],
'docs': docs,
'time': time,
'get_account_lines': report_lines,
}
return self.env['report'].render('account.report_financial', docargs)
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="report_payment_receipt">
<t t-call="report.html_container">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="o">
<t t-call="report.external_layout">
<t t-call="web.external_layout">
<div class="page">
<h3><strong>Payment Receipt: <span t-field="o.name"/></strong></h3>
<div class="row mt64">
Expand Down
4 changes: 2 additions & 2 deletions addons/account/views/report_agedpartnerbalance.xml
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="report_agedpartnerbalance">
<t t-call="report.html_container">
<t t-call="report.internal_layout">
<t t-call="web.html_container">
<t t-call="web.internal_layout">
<div class="page">
<h2>Aged Partner Balance</h2>

Expand Down
4 changes: 2 additions & 2 deletions addons/account/views/report_financial.xml
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="report_financial">
<t t-call="report.html_container">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="o">
<t t-call="report.internal_layout">
<t t-call="web.internal_layout">
<div class="page">
<h2 t-esc="data['account_report_id'][1]"/>

Expand Down
4 changes: 2 additions & 2 deletions addons/account/views/report_generalledger.xml
Expand Up @@ -2,12 +2,12 @@
<odoo>

<template id="report_generalledger">
<t t-call="report.html_container">
<t t-call="web.html_container">
<t t-set="data_report_margin_top" t-value="12"/>
<t t-set="data_report_header_spacing" t-value="9"/>
<t t-set="data_report_dpi" t-value="110"/>

<t t-call="report.internal_layout">
<t t-call="web.internal_layout">
<div class="page">
<h2><span t-esc="res_company.name"/>: General ledger</h2>

Expand Down
6 changes: 3 additions & 3 deletions addons/account/views/report_invoice.xml
Expand Up @@ -2,7 +2,7 @@
<odoo>
<data>
<template id="report_invoice_document">
<t t-call="report.external_layout">
<t t-call="web.external_layout">
<t t-set="o" t-value="o.with_context({'lang':o.partner_id.lang})" />
<div class="page">
<div class="row">
Expand Down Expand Up @@ -164,7 +164,7 @@
</template>

<template id="report_invoice">
<t t-call="report.html_container">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="o">
<t t-call="account.report_invoice_document" t-lang="o.partner_id.lang"/>
</t>
Expand All @@ -183,7 +183,7 @@
</template>

<template id="account_invoice_report_duplicate_main">
<t t-call="report.html_container">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="o">
<t t-call="account.account_invoice_report_duplicate" t-lang="o.partner_id.lang"/>
</t>
Expand Down
4 changes: 2 additions & 2 deletions addons/account/views/report_journal.xml
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="report_journal">
<t t-call="report.html_container">
<t t-call="web.html_container">
<t t-set="data_report_margin_top" t-value="12"/>
<t t-set="data_report_header_spacing" t-value="9"/>
<t t-set="data_report_dpi" t-value="110"/>
<t t-foreach="docs" t-as="o">
<t t-call="report.internal_layout">
<t t-call="web.internal_layout">
<div class="page">
<h2><t t-esc="o.name"/> Journal</h2>

Expand Down
4 changes: 2 additions & 2 deletions addons/account/views/report_overdue.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="account.report_overdue_document">
<t t-call="report.external_layout">
<t t-call="web.external_layout">
<div class="page">
<div class="row">
<div class="col-xs-5 col-xs-offset-7">
Expand Down Expand Up @@ -79,7 +79,7 @@
</template>

<template id="report_overdue">
<t t-call="report.html_container">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="o">
<t t-call="account.report_overdue_document" t-lang="o.lang"/>
</t>
Expand Down
4 changes: 2 additions & 2 deletions addons/account/views/report_partnerledger.xml
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="report_partnerledger">
<t t-call="report.html_container">
<t t-call="web.html_container">
<t t-set="data_report_margin_top" t-value="12"/>
<t t-set="data_report_header_spacing" t-value="9"/>
<t t-set="data_report_dpi" t-value="110"/>
<t t-foreach="docs" t-as="o">
<t t-call="report.internal_layout">
<t t-call="web.internal_layout">
<div class="page">
<h2>Partner Ledger</h2>

Expand Down
4 changes: 2 additions & 2 deletions addons/account/views/report_trialbalance.xml
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="report_trialbalance">
<t t-call="report.html_container">
<t t-call="report.internal_layout">
<t t-call="web.html_container">
<t t-call="web.internal_layout">
<div class="page">
<h2><span t-esc="res_company.name"/>: Trial Balance</h2>

Expand Down
2 changes: 1 addition & 1 deletion addons/account/wizard/account_financial_report.py
Expand Up @@ -48,4 +48,4 @@ def check_report(self):

def _print_report(self, data):
data['form'].update(self.read(['date_from_cmp', 'debit_credit', 'date_to_cmp', 'filter_cmp', 'account_report_id', 'enable_filter', 'label_filter', 'target_move'])[0])
return self.env['report'].get_action(self, 'account.report_financial', data=data, config=False)
return self.env.ref('account.action_report_financial').report_action(self, data=data, config=False)
Expand Up @@ -38,4 +38,4 @@ def _print_report(self, data):
}
start = stop - relativedelta(days=1)
data['form'].update(res)
return self.env['report'].with_context(landscape=True).get_action(self, 'account.report_agedpartnerbalance', data=data)
return self.env.ref('account.action_report_aged_partner_balance').with_context(landscape=True).report_action(self, data=data)
2 changes: 1 addition & 1 deletion addons/account/wizard/account_report_general_ledger.py
Expand Up @@ -20,4 +20,4 @@ def _print_report(self, data):
if data['form'].get('initial_balance') and not data['form'].get('date_from'):
raise UserError(_("You must define a Start Date"))
records = self.env[data['model']].browse(data.get('ids', []))
return self.env['report'].with_context(landscape=True).get_action(records, 'account.report_generalledger', data=data)
return self.env.ref('account.action_report_general_ledger').with_context(landscape=True).report_action(records, data=data)
2 changes: 1 addition & 1 deletion addons/account/wizard/account_report_partner_ledger.py
Expand Up @@ -15,4 +15,4 @@ class AccountPartnerLedger(models.TransientModel):
def _print_report(self, data):
data = self.pre_print_report(data)
data['form'].update({'reconciled': self.reconciled, 'amount_currency': self.amount_currency})
return self.env['report'].get_action(self, 'account.report_partnerledger', data=data)
return self.env.ref('account.action_report_partnerledger').report_action(self, data=data)
2 changes: 1 addition & 1 deletion addons/account/wizard/account_report_print_journal.py
Expand Up @@ -14,4 +14,4 @@ class AccountPrintJournal(models.TransientModel):
def _print_report(self, data):
data = self.pre_print_report(data)
data['form'].update({'sort_selection': self.sort_selection})
return self.env['report'].with_context(landscape=True).get_action(self, 'account.report_journal', data=data)
return self.env.ref('account.action_report_journal').with_context(landscape=True).report_action(self, data=data)
2 changes: 1 addition & 1 deletion addons/account/wizard/account_report_trial_balance.py
Expand Up @@ -13,4 +13,4 @@ class AccountBalanceReport(models.TransientModel):
def _print_report(self, data):
data = self.pre_print_report(data)
records = self.env[data['model']].browse(data.get('ids', []))
return self.env['report'].get_action(records, 'account.report_trialbalance', data=data)
return self.env.ref('account.action_report_trial_balance').report_action(records, data=data)
8 changes: 3 additions & 5 deletions addons/account_test/report/report_account_test.py
Expand Up @@ -61,16 +61,14 @@ def _format(item):
return result

@api.model
def render_html(self, docids, data=None):
Report = self.env['report']
report = Report._get_report_from_name('account_test.report_accounttest')
def get_report_values(self, docids, data=None):
report = self.env['ir.actions.report']._get_report_from_name('account_test.report_accounttest')
records = self.env['accounting.assert.test'].browse(self.ids)
docargs = {
return {
'doc_ids': self._ids,
'doc_model': report.model,
'docs': records,
'data': data,
'execute_code': self.execute_code,
'datetime': datetime
}
return Report.render('account_test.report_accounttest', docargs)
4 changes: 2 additions & 2 deletions addons/account_test/report/report_account_test_templates.xml
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="report_accounttest">
<t t-call="report.html_container">
<t t-call="report.internal_layout">
<t t-call="web.html_container">
<t t-call="web.internal_layout">
<div class="page">
<h2>Accouting tests on <span t-esc="datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')"/></h2>
<div t-foreach="docs" t-as="o">
Expand Down

1 comment on commit e802380

@tde-banana-odoo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You cannot customize reports anymore ... did someone test before merge ?

Please sign in to comment.