[REM] account: Remove deprecated pdf reports

This commit is contained in:
Antony Lesuisse
2018-10-01 16:37:59 +02:00
parent 837c738d8b
commit e51b4f659f
36 changed files with 3 additions and 1892 deletions
+1 -16
View File
@@ -42,34 +42,19 @@ You could use this simplified accounting in case you work with an (external) acc
'views/account.xml',
'views/report_invoice.xml',
'report/account_invoice_report_view.xml',
'views/report_overdue.xml',
'views/account_cash_rounding_view.xml',
'wizard/account_report_common_view.xml',
'wizard/account_report_print_journal_view.xml',
'views/report_journal.xml',
'wizard/account_report_partner_ledger_view.xml',
'views/report_partnerledger.xml',
'wizard/account_report_general_ledger_view.xml',
'views/report_generalledger.xml',
'wizard/account_report_trial_balance_view.xml',
'views/report_trialbalance.xml',
'views/account_financial_report_data.xml',
'wizard/account_financial_report_view.xml',
'views/report_financial.xml',
'wizard/account_report_aged_partner_balance_view.xml',
'views/report_agedpartnerbalance.xml',
'views/tax_adjustments.xml',
'wizard/wizard_tax_adjustments_view.xml',
'views/res_config_settings_views.xml',
'views/account_invoice_import_wizard_view.xml',
'views/account_journal_dashboard_view.xml',
'views/account_portal_templates.xml',
'report/account_report_payment_receipt_templates.xml',
'views/report_payment_receipt_templates.xml',
'data/payment_receipt_data.xml',
'wizard/setup_wizards_view.xml',
'views/account_onboarding_templates.xml',
'wizard/account_report_tax_view.xml',
'views/report_tax.xml',
'data/service_cron_reverse.xml',
'views/account_fiscal_year_view.xml',
'views/account_incoterms_view.xml',
+1 -8
View File
@@ -1,13 +1,6 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import account_financial_report
from . import account_invoice_report
from . import account_overdue_report
from . import account_general_ledger
from . import account_balance
from . import account_report_financial
from . import account_aged_partner_balance
from . import account_partner_ledger
from . import account_journal
from . import account_tax
from . import account_aged_partner_balance
-82
View File
@@ -1,82 +0,0 @@
# -*- coding: utf-8 -*-
import time
from odoo import api, models, _
from odoo.exceptions import UserError
class ReportTrialBalance(models.AbstractModel):
_name = 'report.account.report_trialbalance'
_description = 'Trial Balance Report'
def _get_accounts(self, accounts, display_account):
""" compute the balance, debit and credit for the provided accounts
:Arguments:
`accounts`: list of accounts record,
`display_account`: it's used to display either all accounts or those accounts which balance is > 0
:Returns a list of dictionary of Accounts with following key and value
`name`: Account name,
`code`: Account code,
`credit`: total amount of credit,
`debit`: total amount of debit,
`balance`: total amount of balance,
"""
account_result = {}
# Prepare sql query base on selected parameters from wizard
tables, where_clause, where_params = self.env['account.move.line']._query_get()
tables = tables.replace('"','')
if not tables:
tables = 'account_move_line'
wheres = [""]
if where_clause.strip():
wheres.append(where_clause.strip())
filters = " AND ".join(wheres)
# compute the balance, debit and credit for the provided accounts
request = ("SELECT account_id AS id, SUM(debit) AS debit, SUM(credit) AS credit, (SUM(debit) - SUM(credit)) AS balance" +\
" FROM " + tables + " WHERE account_id IN %s " + filters + " GROUP BY account_id")
params = (tuple(accounts.ids),) + tuple(where_params)
self.env.cr.execute(request, params)
for row in self.env.cr.dictfetchall():
account_result[row.pop('id')] = row
account_res = []
for account in accounts:
res = dict((fn, 0.0) for fn in ['credit', 'debit', 'balance'])
currency = account.currency_id and account.currency_id or account.company_id.currency_id
res['code'] = account.code
res['name'] = account.name
if account.id in account_result:
res['debit'] = account_result[account.id].get('debit')
res['credit'] = account_result[account.id].get('credit')
res['balance'] = account_result[account.id].get('balance')
if display_account == 'all':
account_res.append(res)
if display_account == 'not_zero' and not currency.is_zero(res['balance']):
account_res.append(res)
if display_account == 'movement' and (not currency.is_zero(res['debit']) or not currency.is_zero(res['credit'])):
account_res.append(res)
return account_res
@api.model
def _get_report_values(self, docids, data=None):
if not data.get('form') or not self.env.context.get('active_model'):
raise UserError(_("Form content is missing, this report cannot be printed."))
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)
return {
'doc_ids': self.ids,
'doc_model': self.model,
'data': data['form'],
'docs': docs,
'time': time,
'Accounts': account_res,
'company_id': self.env['res.company'].browse(
data['form']['company_id'][0]),
}
@@ -1,65 +0,0 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, models, fields
# ---------------------------------------------------------
# Account Financial Report
# ---------------------------------------------------------
class account_financial_report(models.Model):
_name = "account.financial.report"
_description = "Account Report"
@api.multi
@api.depends('parent_id', 'parent_id.level')
def _get_level(self):
'''Returns a dictionary with key=the ID of a record and value = the level of this
record in the tree structure.'''
for report in self:
level = 0
if report.parent_id:
level = report.parent_id.level + 1
report.level = level
def _get_children_by_order(self):
'''returns a recordset of all the children computed recursively, and sorted by sequence. Ready for the printing'''
res = self
children = self.search([('parent_id', 'in', self.ids)], order='sequence ASC')
if children:
for child in children:
res += child._get_children_by_order()
return res
name = fields.Char('Report Name', required=True, translate=True)
parent_id = fields.Many2one('account.financial.report', 'Parent')
children_ids = fields.One2many('account.financial.report', 'parent_id', 'Account Report')
sequence = fields.Integer('Sequence')
level = fields.Integer(compute='_get_level', string='Level', store=True)
type = fields.Selection([
('sum', 'View'),
('accounts', 'Accounts'),
('account_type', 'Account Type'),
('account_report', 'Report Value'),
], 'Type', default='sum')
account_ids = fields.Many2many('account.account', 'account_account_financial_report', 'report_line_id', 'account_id', 'Accounts')
account_report_id = fields.Many2one('account.financial.report', 'Report Value')
account_type_ids = fields.Many2many('account.account.type', 'account_account_financial_report_type', 'report_id', 'account_type_id', 'Account Types')
sign = fields.Selection([(-1, 'Reverse balance sign'), (1, 'Preserve balance sign')], 'Sign on Reports', required=True, default=1,
help='For accounts that are typically more debited than credited and that you would like to print as negative amounts in your reports, you should reverse the sign of the balance; e.g.: Expense account. The same applies for accounts that are typically more credited than debited and that you would like to print as positive amounts in your reports; e.g.: Income account.')
display_detail = fields.Selection([
('no_detail', 'No detail'),
('detail_flat', 'Display children flat'),
('detail_with_hierarchy', 'Display children with hierarchy')
], 'Display details', default='detail_flat')
style_overwrite = fields.Selection([
(0, 'Automatic formatting'),
(1, 'Main Title 1 (bold, underlined)'),
(2, 'Title 2 (bold)'),
(3, 'Title 3 (bold, smaller)'),
(4, 'Normal Text'),
(5, 'Italic Text (smaller)'),
(6, 'Smallest Text'),
], 'Financial Report Style', default=0,
help="You can set up here the format you want this record to be displayed. If you leave the automatic formatting, it will be computed based on the financial reports hierarchy (auto-computed field 'level').")
@@ -1,139 +0,0 @@
# -*- coding: utf-8 -*-
import time
from odoo import api, models, _
from odoo.exceptions import UserError
class ReportGeneralLedger(models.AbstractModel):
_name = 'report.account.report_generalledger'
_description = 'General Ledger Report'
def _get_account_move_entry(self, accounts, init_balance, sortby, display_account):
"""
:param:
accounts: the recordset of accounts
init_balance: boolean value of initial_balance
sortby: sorting by date or partner and journal
display_account: type of account(receivable, payable and both)
Returns a dictionary of accounts with following key and value {
'code': account code,
'name': account name,
'debit': sum of total debit amount,
'credit': sum of total credit amount,
'balance': total balance,
'amount_currency': sum of amount_currency,
'move_lines': list of move line
}
"""
cr = self.env.cr
MoveLine = self.env['account.move.line']
move_lines = {x: [] for x in accounts.ids}
# Prepare initial sql query and Get the initial move lines
if init_balance:
init_tables, init_where_clause, init_where_params = MoveLine.with_context(date_from=self.env.context.get('date_from'), date_to=False, initial_bal=True)._query_get()
init_wheres = [""]
if init_where_clause.strip():
init_wheres.append(init_where_clause.strip())
init_filters = " AND ".join(init_wheres)
filters = init_filters.replace('account_move_line__move_id', 'm').replace('account_move_line', 'l')
sql = ("""SELECT 0 AS lid, l.account_id AS account_id, '' AS ldate, '' AS lcode, 0.0 AS amount_currency, '' AS lref, 'Initial Balance' AS lname, COALESCE(SUM(l.debit),0.0) AS debit, COALESCE(SUM(l.credit),0.0) AS credit, COALESCE(SUM(l.debit),0) - COALESCE(SUM(l.credit), 0) as balance, '' AS lpartner_id,\
'' AS move_name, '' AS mmove_id, '' AS currency_code,\
NULL AS currency_id,\
'' AS invoice_id, '' AS invoice_type, '' AS invoice_number,\
'' AS partner_name\
FROM account_move_line l\
LEFT JOIN account_move m ON (l.move_id=m.id)\
LEFT JOIN res_currency c ON (l.currency_id=c.id)\
LEFT JOIN res_partner p ON (l.partner_id=p.id)\
LEFT JOIN account_invoice i ON (m.id =i.move_id)\
JOIN account_journal j ON (l.journal_id=j.id)\
WHERE l.account_id IN %s""" + filters + ' GROUP BY l.account_id')
params = (tuple(accounts.ids),) + tuple(init_where_params)
cr.execute(sql, params)
for row in cr.dictfetchall():
move_lines[row.pop('account_id')].append(row)
sql_sort = 'l.date, l.move_id'
if sortby == 'sort_journal_partner':
sql_sort = 'j.code, p.name, l.move_id'
# Prepare sql query base on selected parameters from wizard
tables, where_clause, where_params = MoveLine._query_get()
wheres = [""]
if where_clause.strip():
wheres.append(where_clause.strip())
filters = " AND ".join(wheres)
filters = filters.replace('account_move_line__move_id', 'm').replace('account_move_line', 'l')
# Get move lines base on sql query and Calculate the total balance of move lines
sql = ('''SELECT l.id AS lid, l.account_id AS account_id, l.date AS ldate, j.code AS lcode, l.currency_id, l.amount_currency, l.ref AS lref, l.name AS lname, COALESCE(l.debit,0) AS debit, COALESCE(l.credit,0) AS credit, COALESCE(SUM(l.debit),0) - COALESCE(SUM(l.credit), 0) AS balance,\
m.name AS move_name, c.symbol AS currency_code, p.name AS partner_name\
FROM account_move_line l\
JOIN account_move m ON (l.move_id=m.id)\
LEFT JOIN res_currency c ON (l.currency_id=c.id)\
LEFT JOIN res_partner p ON (l.partner_id=p.id)\
JOIN account_journal j ON (l.journal_id=j.id)\
JOIN account_account acc ON (l.account_id = acc.id) \
WHERE l.account_id IN %s ''' + filters + ''' GROUP BY l.id, l.account_id, l.date, j.code, l.currency_id, l.amount_currency, l.ref, l.name, m.name, c.symbol, p.name ORDER BY ''' + sql_sort)
params = (tuple(accounts.ids),) + tuple(where_params)
cr.execute(sql, params)
for row in cr.dictfetchall():
balance = 0
for line in move_lines.get(row['account_id']):
balance += line['debit'] - line['credit']
row['balance'] += balance
move_lines[row.pop('account_id')].append(row)
# Calculate the debit, credit and balance for Accounts
account_res = []
for account in accounts:
currency = account.currency_id and account.currency_id or account.company_id.currency_id
res = dict((fn, 0.0) for fn in ['credit', 'debit', 'balance'])
res['code'] = account.code
res['name'] = account.name
res['move_lines'] = move_lines[account.id]
for line in res.get('move_lines'):
res['debit'] += line['debit']
res['credit'] += line['credit']
res['balance'] = line['balance']
if display_account == 'all':
account_res.append(res)
if display_account == 'movement' and res.get('move_lines'):
account_res.append(res)
if display_account == 'not_zero' and not currency.is_zero(res['balance']):
account_res.append(res)
return account_res
@api.model
def _get_report_values(self, docids, data=None):
if not data.get('form') or not self.env.context.get('active_model'):
raise UserError(_("Form content is missing, this report cannot be printed."))
self.model = self.env.context.get('active_model')
docs = self.env[self.model].browse(self.env.context.get('active_ids', []))
init_balance = data['form'].get('initial_balance', True)
sortby = data['form'].get('sortby', 'sort_date')
display_account = data['form']['display_account']
codes = []
if data['form'].get('journal_ids', False):
codes = [journal.code for journal in self.env['account.journal'].search([('id', 'in', data['form']['journal_ids'])])]
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)
return {
'doc_ids': docids,
'doc_model': self.model,
'data': data['form'],
'docs': docs,
'time': time,
'Accounts': accounts_res,
'print_journal': codes,
'company_id': self.env['res.company'].browse(
data['form']['company_id'][0]),
}
@@ -1,70 +0,0 @@
# -*- coding: utf-8 -*-
import time
from odoo import api, fields, models
class ReportOverdue(models.AbstractModel):
_name = 'report.account.report_overdue'
_description = 'Account Overdue Report'
def _get_account_move_lines(self, partner_ids):
res = {x: [] for x in partner_ids}
self.env.cr.execute("SELECT m.name AS move_id, l.date, l.name, l.ref, l.date_maturity, l.partner_id, l.blocked, l.amount_currency, l.currency_id, "
"CASE WHEN at.type = 'receivable' "
"THEN SUM(l.debit) "
"ELSE SUM(l.credit * -1) "
"END AS debit, "
"CASE WHEN at.type = 'receivable' "
"THEN SUM(l.credit) "
"ELSE SUM(l.debit * -1) "
"END AS credit, "
"CASE WHEN l.date_maturity < %s "
"THEN SUM(l.debit - l.credit) "
"ELSE 0 "
"END AS mat "
"FROM account_move_line l "
"JOIN account_account_type at ON (l.user_type_id = at.id) "
"JOIN account_move m ON (l.move_id = m.id) "
"WHERE l.partner_id IN %s AND at.type IN ('receivable', 'payable') AND l.full_reconcile_id IS NULL GROUP BY l.date, l.name, l.ref, l.date_maturity, l.partner_id, at.type, l.blocked, l.amount_currency, l.currency_id, l.move_id, m.name", (((fields.date.today(), ) + (tuple(partner_ids),))))
for row in self.env.cr.dictfetchall():
res[row.pop('partner_id')].append(row)
return res
@api.model
def _get_report_values(self, docids, data=None):
totals = {}
lines = self._get_account_move_lines(docids)
lines_to_display = {}
company_currency = self.env.user.company_id.currency_id
for partner_id in docids:
lines_to_display[partner_id] = {}
totals[partner_id] = {}
for line_tmp in lines[partner_id]:
line = line_tmp.copy()
currency = line['currency_id'] and self.env['res.currency'].browse(line['currency_id']) or company_currency
if currency not in lines_to_display[partner_id]:
lines_to_display[partner_id][currency] = []
totals[partner_id][currency] = dict((fn, 0.0) for fn in ['due', 'paid', 'mat', 'total'])
if line['debit'] and line['currency_id']:
line['debit'] = line['amount_currency']
if line['credit'] and line['currency_id']:
line['credit'] = line['amount_currency']
if line['mat'] and line['currency_id']:
line['mat'] = line['amount_currency']
lines_to_display[partner_id][currency].append(line)
if not line['blocked']:
totals[partner_id][currency]['due'] += line['debit']
totals[partner_id][currency]['paid'] += line['credit']
totals[partner_id][currency]['mat'] += line['mat']
totals[partner_id][currency]['total'] += line['debit'] - line['credit']
return {
'doc_ids': docids,
'doc_model': 'res.partner',
'docs': self.env['res.partner'].browse(docids),
'time': time,
'Lines': lines_to_display,
'Totals': totals,
'Date': fields.date.today(),
'company_id': self.env['res.company'].browse([self.env.user.company_id.id]),
}
@@ -1,123 +0,0 @@
# -*- coding: utf-8 -*-
from datetime import datetime
import time
from odoo import api, models, _
from odoo.exceptions import UserError
class ReportPartnerLedger(models.AbstractModel):
_name = 'report.account.report_partnerledger'
_description = 'Partner Ledger Report'
def _lines(self, data, partner):
full_account = []
currency = self.env['res.currency']
query_get_data = self.env['account.move.line'].with_context(data['form'].get('used_context', {}))._query_get()
reconcile_clause = "" if data['form']['reconciled'] else ' AND "account_move_line".full_reconcile_id IS NULL '
params = [partner.id, tuple(data['computed']['move_state']), tuple(data['computed']['account_ids'])] + query_get_data[2]
query = """
SELECT "account_move_line".id, "account_move_line".date, j.code, acc.code as a_code, acc.name as a_name, "account_move_line".ref, m.name as move_name, "account_move_line".name, "account_move_line".debit, "account_move_line".credit, "account_move_line".amount_currency,"account_move_line".currency_id, c.symbol AS currency_code
FROM """ + query_get_data[0] + """
LEFT JOIN account_journal j ON ("account_move_line".journal_id = j.id)
LEFT JOIN account_account acc ON ("account_move_line".account_id = acc.id)
LEFT JOIN res_currency c ON ("account_move_line".currency_id=c.id)
LEFT JOIN account_move m ON (m.id="account_move_line".move_id)
WHERE "account_move_line".partner_id = %s
AND m.state IN %s
AND "account_move_line".account_id IN %s AND """ + query_get_data[1] + reconcile_clause + """
ORDER BY "account_move_line".date"""
self.env.cr.execute(query, tuple(params))
res = self.env.cr.dictfetchall()
sum = 0.0
lang_code = self.env.context.get('lang') or 'en_US'
lang = self.env['res.lang']
lang_id = lang._lang_get(lang_code)
date_format = lang_id.date_format
for r in res:
r['displayed_name'] = '-'.join(
r[field_name] for field_name in ('move_name', 'ref', 'name')
if r[field_name] not in (None, '', '/')
)
sum += r['debit'] - r['credit']
r['progress'] = sum
r['currency_id'] = currency.browse(r.get('currency_id'))
full_account.append(r)
return full_account
def _sum_partner(self, data, partner, field):
if field not in ['debit', 'credit', 'debit - credit']:
return
result = 0.0
query_get_data = self.env['account.move.line'].with_context(data['form'].get('used_context', {}))._query_get()
reconcile_clause = "" if data['form']['reconciled'] else ' AND "account_move_line".full_reconcile_id IS NULL '
params = [partner.id, tuple(data['computed']['move_state']), tuple(data['computed']['account_ids'])] + query_get_data[2]
query = """SELECT sum(""" + field + """)
FROM """ + query_get_data[0] + """, account_move AS m
WHERE "account_move_line".partner_id = %s
AND m.id = "account_move_line".move_id
AND m.state IN %s
AND account_id IN %s
AND """ + query_get_data[1] + reconcile_clause
self.env.cr.execute(query, tuple(params))
contemp = self.env.cr.fetchone()
if contemp is not None:
result = contemp[0] or 0.0
return result
@api.model
def _get_report_values(self, docids, data=None):
if not data.get('form'):
raise UserError(_("Form content is missing, this report cannot be printed."))
data['computed'] = {}
obj_partner = self.env['res.partner']
query_get_data = self.env['account.move.line'].with_context(data['form'].get('used_context', {}))._query_get()
data['computed']['move_state'] = ['draft', 'posted']
if data['form'].get('target_move', 'all') == 'posted':
data['computed']['move_state'] = ['posted']
result_selection = data['form'].get('result_selection', 'customer')
if result_selection == 'supplier':
data['computed']['ACCOUNT_TYPE'] = ['payable']
elif result_selection == 'customer':
data['computed']['ACCOUNT_TYPE'] = ['receivable']
else:
data['computed']['ACCOUNT_TYPE'] = ['payable', 'receivable']
self.env.cr.execute("""
SELECT a.id
FROM account_account a
WHERE a.internal_type IN %s
AND NOT a.deprecated""", (tuple(data['computed']['ACCOUNT_TYPE']),))
data['computed']['account_ids'] = [a for (a,) in self.env.cr.fetchall()]
params = [tuple(data['computed']['move_state']), tuple(data['computed']['account_ids'])] + query_get_data[2]
reconcile_clause = "" if data['form']['reconciled'] else ' AND "account_move_line".full_reconcile_id IS NULL '
query = """
SELECT DISTINCT "account_move_line".partner_id
FROM """ + query_get_data[0] + """, account_account AS account, account_move AS am
WHERE "account_move_line".partner_id IS NOT NULL
AND "account_move_line".account_id = account.id
AND am.id = "account_move_line".move_id
AND am.state IN %s
AND "account_move_line".account_id IN %s
AND NOT account.deprecated
AND """ + query_get_data[1] + reconcile_clause
self.env.cr.execute(query, tuple(params))
partner_ids = [res['partner_id'] for res in self.env.cr.dictfetchall()]
partners = obj_partner.browse(partner_ids)
partners = sorted(partners, key=lambda x: (x.ref or '', x.name or ''))
return {
'doc_ids': partner_ids,
'doc_model': self.env['res.partner'],
'data': data,
'docs': partners,
'time': time,
'lines': self._lines,
'sum_partner': self._sum_partner,
'company_id': self.env['res.company'].browse(
data['form']['company_id'][0]),
}
@@ -1,164 +0,0 @@
# -*- coding: utf-8 -*-
import time
from odoo import api, models, _
from odoo.exceptions import UserError
class ReportFinancial(models.AbstractModel):
_name = 'report.account.report_financial'
_description = 'Financial Report'
def _compute_account_balance(self, accounts):
""" compute the balance, debit and credit for the provided accounts
"""
mapping = {
'balance': "COALESCE(SUM(debit),0) - COALESCE(SUM(credit), 0) as balance",
'debit': "COALESCE(SUM(debit), 0) as debit",
'credit': "COALESCE(SUM(credit), 0) as credit",
}
res = {}
for account in accounts:
res[account.id] = dict.fromkeys(mapping, 0.0)
if accounts:
tables, where_clause, where_params = self.env['account.move.line']._query_get()
tables = tables.replace('"', '') if tables else "account_move_line"
wheres = [""]
if where_clause.strip():
wheres.append(where_clause.strip())
filters = " AND ".join(wheres)
request = "SELECT account_id as id, " + ', '.join(mapping.values()) + \
" FROM " + tables + \
" WHERE account_id IN %s " \
+ filters + \
" GROUP BY account_id"
params = (tuple(accounts._ids),) + tuple(where_params)
self.env.cr.execute(request, params)
for row in self.env.cr.dictfetchall():
res[row['id']] = row
return res
def _compute_report_balance(self, reports):
'''returns a dictionary with key=the ID of a record and value=the credit, debit and balance amount
computed for this record. If the record is of type :
'accounts' : it's the sum of the linked accounts
'account_type' : it's the sum of leaf accounts with such an account_type
'account_report' : it's the amount of the related report
'sum' : it's the sum of the children of this record (aka a 'view' record)'''
res = {}
fields = ['credit', 'debit', 'balance']
for report in reports:
if report.id in res:
continue
res[report.id] = dict((fn, 0.0) for fn in fields)
if report.type == 'accounts':
# it's the sum of the linked accounts
res[report.id]['account'] = self._compute_account_balance(report.account_ids)
for value in res[report.id]['account'].values():
for field in fields:
res[report.id][field] += value.get(field)
elif report.type == 'account_type':
# it's the sum the leaf accounts with such an account type
accounts = self.env['account.account'].search([('user_type_id', 'in', report.account_type_ids.ids)])
res[report.id]['account'] = self._compute_account_balance(accounts)
for value in res[report.id]['account'].values():
for field in fields:
res[report.id][field] += value.get(field)
elif report.type == 'account_report' and report.account_report_id:
# it's the amount of the linked report
res2 = self._compute_report_balance(report.account_report_id)
for key, value in res2.items():
for field in fields:
res[report.id][field] += value[field]
elif report.type == 'sum':
# it's the sum of the children of this account.report
res2 = self._compute_report_balance(report.children_ids)
for key, value in res2.items():
for field in fields:
res[report.id][field] += value[field]
return res
def get_account_lines(self, data):
lines = []
account_report = self.env['account.financial.report'].search([('id', '=', data['account_report_id'][0])])
child_reports = account_report._get_children_by_order()
res = self.with_context(data.get('used_context'))._compute_report_balance(child_reports)
if data['enable_filter']:
comparison_res = self.with_context(data.get('comparison_context'))._compute_report_balance(child_reports)
for report_id, value in comparison_res.items():
res[report_id]['comp_bal'] = value['balance']
report_acc = res[report_id].get('account')
if report_acc:
for account_id, val in comparison_res[report_id].get('account').items():
report_acc[account_id]['comp_bal'] = val['balance']
for report in child_reports:
vals = {
'name': report.name,
'balance': res[report.id]['balance'] * report.sign,
'type': 'report',
'level': bool(report.style_overwrite) and report.style_overwrite or report.level,
'account_type': report.type or False, #used to underline the financial report balances
}
if data['debit_credit']:
vals['debit'] = res[report.id]['debit']
vals['credit'] = res[report.id]['credit']
if data['enable_filter']:
vals['balance_cmp'] = res[report.id]['comp_bal'] * report.sign
lines.append(vals)
if report.display_detail == 'no_detail':
#the rest of the loop is used to display the details of the financial report, so it's not needed here.
continue
if res[report.id].get('account'):
sub_lines = []
for account_id, value in res[report.id]['account'].items():
#if there are accounts to display, we add them to the lines with a level equals to their level in
#the COA + 1 (to avoid having them with a too low level that would conflicts with the level of data
#financial reports for Assets, liabilities...)
flag = False
account = self.env['account.account'].browse(account_id)
vals = {
'name': account.code + ' ' + account.name,
'balance': value['balance'] * report.sign or 0.0,
'type': 'account',
'level': report.display_detail == 'detail_with_hierarchy' and 4,
'account_type': account.internal_type,
}
if data['debit_credit']:
vals['debit'] = value['debit']
vals['credit'] = value['credit']
if not account.company_id.currency_id.is_zero(vals['debit']) or not account.company_id.currency_id.is_zero(vals['credit']):
flag = True
if not account.company_id.currency_id.is_zero(vals['balance']):
flag = True
if data['enable_filter']:
vals['balance_cmp'] = value['comp_bal'] * report.sign
if not account.company_id.currency_id.is_zero(vals['balance_cmp']):
flag = True
if flag:
sub_lines.append(vals)
lines += sorted(sub_lines, key=lambda sub_line: sub_line['name'])
return lines
@api.model
def _get_report_values(self, docids, data=None):
if not data.get('form') or not self.env.context.get('active_model') or not self.env.context.get('active_id'):
raise UserError(_("Form content is missing, this report cannot be printed."))
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'))
return {
'doc_ids': self.ids,
'doc_model': self.model,
'data': data['form'],
'docs': docs,
'time': time,
'get_account_lines': report_lines,
'company_id': self.env['res.company'].browse(
data['form']['company_id'][0]),
}
-72
View File
@@ -1,72 +0,0 @@
# -*- coding: utf-8 -*-
from odoo import api, models, _
from odoo.exceptions import UserError
class ReportTax(models.AbstractModel):
_name = 'report.account.report_tax'
_description = 'Tax Report'
@api.model
def _get_report_values(self, docids, data=None):
if not data.get('form'):
raise UserError(_("Form content is missing, this report cannot be printed."))
return {
'data': data['form'],
'lines': self.get_lines(data.get('form')),
'company_id': self.env['res.company'].browse(
data['form']['company_id'][0]),
}
def _sql_from_amls_one(self):
sql = """SELECT "account_move_line".tax_line_id, COALESCE(SUM("account_move_line".debit-"account_move_line".credit), 0)
FROM %s
WHERE %s AND "account_move_line".tax_exigible GROUP BY "account_move_line".tax_line_id"""
return sql
def _sql_from_amls_two(self):
sql = """SELECT r.account_tax_id, COALESCE(SUM("account_move_line".debit-"account_move_line".credit), 0)
FROM %s
INNER JOIN account_move_line_account_tax_rel r ON ("account_move_line".id = r.account_move_line_id)
INNER JOIN account_tax t ON (r.account_tax_id = t.id)
WHERE %s AND "account_move_line".tax_exigible GROUP BY r.account_tax_id"""
return sql
def _compute_from_amls(self, options, taxes):
#compute the tax amount
sql = self._sql_from_amls_one()
tables, where_clause, where_params = self.env['account.move.line']._query_get()
query = sql % (tables, where_clause)
self.env.cr.execute(query, where_params)
results = self.env.cr.fetchall()
for result in results:
if result[0] in taxes:
taxes[result[0]]['tax'] = abs(result[1])
#compute the net amount
sql2 = self._sql_from_amls_two()
query = sql2 % (tables, where_clause)
self.env.cr.execute(query, where_params)
results = self.env.cr.fetchall()
for result in results:
if result[0] in taxes:
taxes[result[0]]['net'] = abs(result[1])
@api.model
def get_lines(self, options):
taxes = {}
for tax in self.env['account.tax'].search([('type_tax_use', '!=', 'none')]):
if tax.children_tax_ids:
for child in tax.children_tax_ids:
if child.type_tax_use != 'none':
continue
taxes[child.id] = {'tax': 0, 'net': 0, 'name': child.name, 'type': tax.type_tax_use}
else:
taxes[tax.id] = {'tax': 0, 'net': 0, 'name': tax.name, 'type': tax.type_tax_use}
self.with_context(date_from=options['date_from'], date_to=options['date_to'], strict_range=True)._compute_from_amls(options, taxes)
groups = dict((tp, []) for tp in ['sale', 'purchase'])
for tax in taxes.values():
if tax['tax']:
groups[tax['type']].append(tax)
return groups
@@ -67,8 +67,6 @@ access_account_invoice_line_accountant,account.invoice.line accountant,model_acc
access_account_account_invoice,account.account invoice,model_account_account,account.group_account_invoice,1,0,0,0
access_account_analytic_accountant,account.analytic.account accountant,analytic.model_account_analytic_account,account.group_account_user,1,1,1,1
access_account_account_type_invoice,account.account.type invoice,model_account_account_type,account.group_account_invoice,1,0,0,0
access_account_financial_report,account.financial.report,model_account_financial_report,account.group_account_user,1,1,1,1
access_account_financial_report_invoice,account.financial.report invoice,model_account_financial_report,account.group_account_invoice,1,0,0,0
access_account_account_tax,account.account.tag,model_account_account_tag,account.group_account_user,1,1,1,1
access_account_account_tax_user,account.account.tag,model_account_account_tag,account.group_account_invoice,1,0,0,0
access_account_reconcile_model,account.reconcile.model,model_account_reconcile_model,account.group_account_user,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
67 access_account_account_invoice account.account invoice model_account_account account.group_account_invoice 1 0 0 0
68 access_account_analytic_accountant account.analytic.account accountant analytic.model_account_analytic_account account.group_account_user 1 1 1 1
69 access_account_account_type_invoice account.account.type invoice model_account_account_type account.group_account_invoice 1 0 0 0
access_account_financial_report account.financial.report model_account_financial_report account.group_account_user 1 1 1 1
access_account_financial_report_invoice account.financial.report invoice model_account_financial_report account.group_account_invoice 1 0 0 0
70 access_account_account_tax account.account.tag model_account_account_tag account.group_account_user 1 1 1 1
71 access_account_account_tax_user account.account.tag model_account_account_tag account.group_account_invoice 1 0 0 0
72 access_account_reconcile_model account.reconcile.model model_account_reconcile_model account.group_account_user 1 1 1 1
+1 -3
View File
@@ -17,12 +17,11 @@
<menuitem id="menu_finance_entries_management" name="Management" parent="menu_finance_entries" sequence="10" groups="account.group_account_invoice"/>
<menuitem id="menu_finance_entries_actions" name="Actions" parent="account.menu_finance_entries"/>
<menuitem id="menu_finance_entries_generate_entries" name="Generate Entries" parent="account.menu_finance_entries"/>
<menuitem id="menu_finance_reports" name="Reporting" parent="menu_finance" sequence="20" groups="account.group_account_manager"/>
<!-- Reporting sub-menus -->
<menuitem id="account_reports_management_menu" name="Management" parent="account.menu_finance_reports" sequence="4"/>
<menuitem id="account_reports_legal_statements_menu" name="Generic Statements" parent="account.menu_finance_reports" sequence="1" groups="account.group_account_user"/>
<menuitem id="account_reports_business_intelligence_menu" name="Business Intelligence" parent="account.menu_finance_reports" sequence="5" groups="account.group_account_invoice"/>
<menuitem id="menu_finance_legal_statement" name="PDF Reports" parent="account.menu_finance_reports"/>
<menuitem id="menu_finance_configuration" name="Configuration" parent="menu_finance" sequence="35" groups="account.group_account_manager"/>
<!-- Configuration Sub-Menu -->
@@ -30,7 +29,6 @@
<menuitem id="account_management_menu" name="Management" parent="account.menu_finance_configuration" sequence="3" groups="account.group_account_manager"/>
<menuitem id="menu_analytic_accounting" name="Analytic Accounting" parent="menu_finance_configuration" groups="analytic.group_analytic_accounting,analytic.group_analytic_tags" sequence="5"/>
<menuitem id="menu_action_currency_form" action="base.action_currency_form" name="Currencies" parent="account_account_menu" sequence="1" groups="base.group_multi_currency"/>
<menuitem id="menu_account_reports" name="Financial Reports" parent="menu_finance_configuration" groups="account.group_account_user"/>
-56
View File
@@ -25,44 +25,6 @@
print_report_name="(object._get_report_base_filename())"
/>
<report
id="action_report_print_overdue"
model="res.partner"
report_type="qweb-pdf"
string="Due Payments"
name="account.report_overdue"
file="account.report_overdue"
print_report_name="'Due Payments - %s' % (object.name)"
/>
<report
id="action_report_general_ledger"
model="account.report.general.ledger"
string="General Ledger"
report_type="qweb-pdf"
name="account.report_generalledger"
file="account.report_generalledger"
/>
<report
id="action_report_trial_balance"
model="account.balance.report"
string="Trial Balance"
report_type="qweb-pdf"
name="account.report_trialbalance"
file="account.report_trialbalance"
/>
<report
id="action_report_financial"
model="account.financial.report"
string="Financial report"
menu="False"
report_type="qweb-pdf"
name="account.report_financial"
file="account.report_financial"
/>
<report
id="action_report_aged_partner_balance"
model="res.partner"
@@ -82,15 +44,6 @@
file="account.report_journal"
/>
<report
id="action_report_partnerledger"
model="account.report.partner.ledger"
string="Partner Ledger"
report_type="qweb-pdf"
name="account.report_partnerledger"
file="account.report_partnerledger"
/>
<report
id="action_report_payment_receipt"
model="account.payment"
@@ -101,14 +54,5 @@
menu="True"
/>
<report
id="action_report_account_tax"
model="account.tax.report"
string="Tax Report"
report_type="qweb-pdf"
name="account.report_tax"
file="account.report_tax"
/>
</data>
</odoo>
-71
View File
@@ -2300,77 +2300,6 @@
parent="account.menu_finance_payables"
action="base.action_partner_supplier_form" sequence="200"/>
<!-- Account Financial Report -->
<record id="view_account_financial_report_form" model="ir.ui.view">
<field name="name">account.financial.report.form</field>
<field name="model">account.financial.report</field>
<field name="arch" type="xml">
<form string="Account Report">
<group col="4">
<field name="name"/>
<field name="parent_id"/>
<field name="sequence"/>
<field name="type"/>
<field name="sign"/>
<field name="style_overwrite"/>
</group>
<notebook attrs="{'invisible': [('type','not in',['accounts','account_type', 'account_report'])]}">
<page string="Report">
<group>
<field name="display_detail" attrs="{'invisible': [('type','not in',['accounts','account_type'])]}"/>
<field name="account_report_id" attrs="{'invisible': [('type', '!=', 'account_report')]}"/>
</group>
<field name="account_ids" attrs="{'invisible': [('type', '!=', 'accounts')]}"/>
<field name="account_type_ids" attrs="{'invisible': [('type', '!=', 'account_type')]}"/>
</page>
</notebook>
</form>
</field>
</record>
<record id="view_account_financial_report_tree" model="ir.ui.view">
<field name="name">account.financial.report.tree</field>
<field name="model">account.financial.report</field>
<field name="arch" type="xml">
<tree string="Account Report">
<field name="name"/>
<field name="parent_id" invisible="1"/>
<field name="type"/>
<field name="account_report_id"/>
</tree>
</field>
</record>
<record id="view_account_financial_report_search" model="ir.ui.view">
<field name="name">account.financial.report.search</field>
<field name="model">account.financial.report</field>
<field name="arch" type="xml">
<search string="Account Report">
<field name="name" string="Account Report"/>
<field name="type"/>
<field name="account_report_id"/>
<group expand="0" string="Group By">
<filter string="Parent Report" name="parentreport" domain="" context="{'group_by':'parent_id'}"/>
<filter string="Report Type" name="reporttype" domain="[]" context="{'group_by':'type'}"/>
</group>
</search>
</field>
</record>
<record id="action_account_financial_report_tree" model="ir.actions.act_window">
<field name="name">Financial Reports</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">account.financial.report</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="search_view_id" ref="view_account_financial_report_search"/>
<field name="view_id" ref="view_account_financial_report_tree"/>
</record>
<menuitem id="menu_account_financial_reports_tree" name="Account Reports" parent="menu_account_reports" action="action_account_financial_report_tree"/>
<!-- Manual reconciliation -->
<record id="action_manual_reconciliation" model="ir.actions.client">
<field name="name">Reconciliation</field>
-110
View File
@@ -1,110 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="report_financial">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="o">
<t t-call="web.internal_layout">
<div class="page">
<h2 t-esc="data['account_report_id'][1]"/>
<div class="row mt32 mb32">
<div class="col-4">
<strong>Target Moves:</strong>
<p>
<span t-if="data['target_move'] == 'all'">All Entries</span>
<span t-if="data['target_move'] == 'posted'">All Posted Entries</span>
</p>
</div>
<div class="col-4">
<p>
<t t-if="data['date_from']"><strong>Date from :</strong> <span t-esc="data['date_from']"/><br/></t>
<t t-if="data['date_to']"><strong>Date to :</strong> <span t-esc="data['date_to']"/></t>
</p>
</div>
</div>
<table class="table table-sm" t-if="data['debit_credit'] == 1">
<thead>
<tr>
<th><span>Name</span></th>
<th class="text-right"><span>Debit</span></th>
<th class="text-right"><span>Credit</span></th>
<th class="text-right"><span>Balance</span></th>
</tr>
</thead>
<tbody>
<tr t-foreach="get_account_lines" t-as="a">
<t t-if="a['level'] != 0">
<t t-if="a.get('level') &gt; 3"><t t-set="style" t-value="'font-weight: normal;'"/></t>
<t t-if="not a.get('level') &gt; 3"><t t-set="style" t-value="'font-weight: bold;'"/></t>
<td>
<span style="color: white;" t-esc="'..' * a.get('level', 0)"/>
<span t-att-style="style" t-esc="a.get('name')"/>
</td>
<td class="text-right" style="white-space: text-nowrap;">
<span t-att-style="style" t-esc="a.get('debit')" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</td>
<td class="text-right" style="white-space: text-nowrap;">
<span t-att-style="style" t-esc="a.get('credit')" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</td>
<td class="text-right" style="white-space: text-nowrap;">
<span t-att-style="style" t-esc="a.get('balance')" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</td>
</t>
</tr>
</tbody>
</table>
<table class="table table-sm" t-if="not data['enable_filter'] and not data['debit_credit']">
<thead>
<tr>
<th><span>Name</span></th>
<th class="text-right"><span>Balance</span></th>
</tr>
</thead>
<tbody>
<tr t-foreach="get_account_lines" t-as="a">
<t t-if="a['level'] != 0">
<t t-if="a.get('level') &gt; 3"><t t-set="style" t-value="'font-weight: normal;'"/></t>
<t t-if="not a.get('level') &gt; 3"><t t-set="style" t-value="'font-weight: bold;'"/></t>
<td>
<span style="color: white;" t-esc="'..' * a.get('level', 0)"/>
<span t-att-style="style" t-esc="a.get('name')"/>
</td>
<td class="text-right"><span t-att-style="style" t-esc="a.get('balance')" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></td>
</t>
</tr>
</tbody>
</table>
<table class="table table-sm" t-if="data['enable_filter'] == 1 and not data['debit_credit']">
<thead>
<tr>
<th><span>Name</span></th>
<th class="text-right"><span>Balance</span></th>
<th class="text-right"><span t-esc="data['label_filter']"/></th>
</tr>
</thead>
<tbody>
<tr t-foreach="get_account_lines" t-as="a">
<t t-if="a['level'] != 0">
<t t-if="a.get('level') &gt; 3"><t t-set="style" t-value="'font-weight: normal;'"/></t>
<t t-if="not a.get('level') &gt; 3"><t t-set="style" t-value="'font-weight: bold;'"/></t>
<td>
<span style="color: white;" t-esc="'..'"/>
<span t-att-style="style" t-esc="a.get('name')"/>
</td>
<td class="text-right"><span t-att-style="style" t-esc="a.get('balance')" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></td>
<td class="text-right"><span t-att-style="style" t-esc="a.get('balance_cmp')"/></td>
</t>
</tr>
</tbody>
</table>
</div>
</t>
</t>
</t>
</template>
</odoo>
@@ -1,107 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="report_generalledger">
<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="web.internal_layout">
<div class="page">
<h2><span t-esc="res_company.name"/>: General ledger</h2>
<div class="row mt32">
<div class="col-4">
<strong>Journals:</strong>
<p t-esc="', '.join([ lt or '' for lt in print_journal ])"/>
</div>
<div class="col-4">
<strong>Display Account</strong>
<p>
<span t-if="data['display_account'] == 'all'">All accounts'</span>
<span t-if="data['display_account'] == 'movement'">With movements</span>
<span t-if="data['display_account'] == 'not_zero'">With balance not equal to zero</span>
</p>
</div>
<div class="col-4">
<strong>Target Moves:</strong>
<p t-if="data['target_move'] == 'all'">All Entries</p>
<p t-if="data['target_move'] == 'posted'">All Posted Entries</p>
</div>
</div>
<div class="row mb32">
<div class="col-4">
<strong>Sorted By:</strong>
<p t-if="data['sortby'] == 'sort_date'">Date</p>
<p t-if="data['sortby'] == 'sort_journal_partner'">Journal and Partner</p>
</div>
<div class="col-4">
<t t-if="data['date_from']"><strong>Date from :</strong> <span t-esc="data['date_from']"/><br/></t>
<t t-if="data['date_to']"><strong>Date to :</strong> <span t-esc="data['date_to']"/></t>
</div>
</div>
<table class="table table-sm">
<thead>
<tr class="text-center">
<th>Date</th>
<th>JRNL</th>
<th>Partner</th>
<th>Ref</th>
<th>Move</th>
<th>Entry Label</th>
<th>Debit</th>
<th>Credit</th>
<th>Balance</th>
<th groups="base.group_multi_currency">Currency</th>
</tr>
</thead>
<tbody>
<t t-foreach="Accounts" t-as="account">
<tr style="font-weight: bold;">
<td colspan="6">
<span style="color: white;" t-esc="'..'"/>
<span t-esc="account['code']"/>
<span t-esc="account['name']"/>
</td>
<td class="text-right">
<span t-esc="account['debit']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</td>
<td class="text-right">
<span t-esc="account['credit']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</td>
<td class="text-right">
<span t-esc="account['balance']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</td>
<td groups="base.group_multi_currency"/>
</tr>
<tr t-foreach="account['move_lines']" t-as="line">
<td><span t-esc="line['ldate']"/></td>
<td><span t-esc="line['lcode']"/></td>
<td><span t-esc="line['partner_name']"/></td>
<td><span t-if="line['lref']" t-esc="line['lref']"/></td>
<td><span t-esc="line['move_name']"/></td>
<td><span t-esc="line['lname']"/></td>
<td class="text-right">
<span t-esc="line['debit']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</td>
<td class="text-right">
<span t-esc="line['credit']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</td>
<td class="text-right">
<span t-esc="line['balance']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</td>
<td class="text-right" groups="base.group_multi_currency">
<span t-esc="line['amount_currency'] if line['amount_currency'] > 0.00 else ''"/>
<span t-esc="line['currency_code'] if line['amount_currency'] > 0.00 else ''"/>
</td>
</tr>
</t>
</tbody>
</table>
</div>
</t>
</t>
</template>
</odoo>
-88
View File
@@ -1,88 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="account.report_overdue_document">
<t t-call="web.external_layout">
<div class="page">
<div class="row">
<div class="col-5 offset-7">
<span t-field="o.name"/><br/>
<span t-raw="o.contact_address.replace('\n\n', '\n').replace('\n', '&lt;br&gt;')"/>
<span t-field="o.vat"/>
</div>
<p>
Document: Customer account statement<br/>
Date: <span t-esc="Date"/><br/>
<t t-if="o.ref">Customer ref: <span t-field="o.ref"/></t>
</p>
<t t-if="Lines[o.id]">
<span t-field="res_company.with_context(lang=o.lang).overdue_msg"/>
<table class="table table-sm" t-foreach="Lines[o.id]" t-as="currency">
<thead>
<tr>
<th>Reference number</th>
<th class="text-center">Date</th>
<th class="text-center">Due Date</th>
<th>Communication</th>
<th class="text-right">Due</th>
<th class="text-right">Paid</th>
<th class="text-center">Litigation</th>
</tr>
</thead>
<tr t-foreach="Lines[o.id][currency]" t-as="line">
<td>
<span t-esc="line['move_id']"/>
</td>
<td>
<span t-esc="line['date']"/>
</td>
<td>
<span t-esc="line['date_maturity']"/>
</td>
<td>
<t t-if="line['name'] != '/'"><span t-esc="line['name']"/></t>
<span t-esc="line['ref']"/>
</td>
<td class="text-right">
<span t-esc="line['debit']" t-options="{'widget': 'monetary', 'display_currency': currency}"/>
</td>
<td class="text-right">
<span t-esc="line['credit']" t-options="{'widget': 'monetary', 'display_currency': currency}"/>
</td>
<td class="text-center">
<span t-if="line['blocked']">x</span>
</td>
</tr>
<tr>
<td colspan="3"></td>
<td><strong>Subtotal :</strong></td>
<td class="text-right"><span t-esc="Totals[o.id][currency]['due']" t-options="{'widget': 'monetary', 'display_currency': currency}"/></td>
<td class="text-right"><span t-esc="Totals[o.id][currency]['paid']" t-options="{'widget': 'monetary', 'display_currency': currency}"/></td>
<td class="text-right"><span t-esc="Totals[o.id][currency]['mat']" t-options="{'widget': 'monetary', 'display_currency': currency}"/></td>
<td></td>
</tr>
<tr>
<td colspan="3"></td>
<td><strong>Balance :</strong></td>
<td class="text-right">
<span t-esc="Totals[o.id][currency]['due'] - Totals[o.id][currency]['paid']" t-options="{'widget': 'monetary', 'display_currency': currency}"/>
</td>
</tr>
</table>
</t>
<p t-if="not Lines[o.id]">
<strong>There is nothing due with this customer.</strong>
</p>
</div>
</div>
</t>
</template>
<template id="report_overdue">
<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>
</t>
</template>
</odoo>
@@ -1,93 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="report_partnerledger">
<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="web.internal_layout">
<div class="page">
<h2>Partner Ledger</h2>
<div class="row">
<div class="col-3">
<strong>Company:</strong>
<p t-esc="res_company.name"/>
</div>
<div class="col-3">
<t t-if="data['form']['date_from']"><strong>Date from :</strong> <span t-esc="data['form']['date_from']"/><br/></t>
<t t-if="data['form']['date_to']"><strong>Date to :</strong> <span t-esc="data['form']['date_to']"/></t>
</div>
<div class="col-3">
<strong>Target Moves:</strong>
<p t-if="data['form']['target_move'] == 'all'">All Entries</p>
<p t-if="data['form']['target_move'] == 'posted'">All Posted Entries</p>
</div>
</div>
<table class="table table-sm">
<thead>
<tr>
<th>Date</th>
<th>JRNL</th>
<th>Account</th>
<th>Ref</th>
<th>Debit</th>
<th>Credit</th>
<th>Balance</th>
<th t-if="data['form']['amount_currency']">Currency</th>
</tr>
</thead>
<tbody>
<tr>
<td colspan="4">
<strong t-esc="o.ref"/>
- <strong t-esc="o.name"/>
</td>
<td class="text-right">
<strong t-esc="sum_partner(data, o, 'debit')" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</td>
<td class="text-right">
<strong t-esc="sum_partner(data, o, 'credit')" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</td>
<td class="text-right">
<strong t-esc="sum_partner(data, o, 'debit - credit')" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</td>
</tr>
<tr t-foreach="lines(data, o)" t-as="line">
<td>
<span t-esc="line['date']"/>
</td>
<td>
<span t-esc="line['code']"/>
</td>
<td>
<span t-esc="line['a_code']"/>
</td>
<td>
<span t-esc="line['displayed_name']"/>
</td>
<td class="text-right">
<span t-esc="line['debit']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</td>
<td class="text-right">
<span t-esc="line['credit']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</td>
<td class="text-right">
<span t-esc="line['progress']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</td>
<td class="text-right" t-if="data['form']['amount_currency']">
<t t-if="line['currency_id']">
<span t-esc="line['amount_currency']" t-options="{'widget': 'monetary', 'display_currency': line['currency_id']}"/>
</t>
</td>
</tr>
</tbody>
</table>
</div>
</t>
</t>
</t>
</template>
</odoo>
-39
View File
@@ -1,39 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="report_tax">
<t t-call="web.html_container">
<t t-call="web.internal_layout">
<div class="page">
<h3> Tax Report</h3>
<div class="row">
<div class="col-4">
<t t-if="data['date_from']"><strong>From</strong> <span t-esc="data['date_from']"/><br/></t>
<t t-if="data['date_to']"><strong>to </strong><span t-esc="data['date_to']"/></t>
</div>
</div>
<table class="table table-sm">
<thead>
<tr class="text-center">
<th>Sale</th>
<th>Net</th>
<th>Tax</th>
</tr>
</thead>
<tr t-foreach="lines['sale']" t-as="line">
<td><span t-esc="line.get('name')"/></td>
<td><span t-att-style="style" t-esc="line.get('net')" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></td>
<td><span t-att-style="style" t-esc="line.get('tax')" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></td>
</tr>
<tr><td colspan="3"><strong>Purchase</strong></td>
</tr>
<tr t-foreach="lines['purchase']" t-as="line">
<td><span t-esc="line.get('name')"/></td>
<td><span t-att-style="style" t-esc="line.get('net')" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></td>
<td><span t-att-style="style" t-esc="line.get('tax')" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></td>
</tr>
</table>
</div>
</t>
</t>
</template>
</odoo>
@@ -1,68 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="report_trialbalance">
<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>
<div class="row mt32">
<div class="col-4">
<strong>Display Account:</strong>
<p>
<span t-if="data['display_account'] == 'all'">All accounts</span>
<span t-if="data['display_account'] == 'movement'">With movements</span>
<span t-if="data['display_account'] == 'not_zero'">With balance not equal to zero</span>
</p>
</div>
<div class="col-4">
<p>
<t t-if="data['date_from']"><strong>Date from :</strong> <span t-esc="data['date_from']"/><br/></t>
<t t-if="data['date_to']"><strong>Date to :</strong> <span t-esc="data['date_to']"/></t>
</p>
</div>
<div class="col-4">
<strong>Target Moves:</strong>
<p>
<span t-if="data['target_move'] == 'all'">All Entries</span>
<span t-if="data['target_move'] == 'posted'">All Posted Entries</span>
</p>
</div>
</div>
<table class="table table-sm">
<thead>
<tr>
<th>Code</th>
<th>Account</th>
<th class="text-right">Debit</th>
<th class="text-right">Credit</th>
<th class="text-right">Balance</th>
</tr>
</thead>
<tbody>
<tr t-foreach="Accounts" t-as="account">
<td>
<span t-att-style="style" t-esc="account['code']"/>
</td>
<td>
<span style="color: white;" t-esc="'..'"/>
<span t-att-style="style" t-esc="account['name']"/>
</td>
<td class="text-right">
<span t-att-style="style" t-esc="account['debit']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</td>
<td class="text-right">
<span t-att-style="style" t-esc="account['credit']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</td>
<td class="text-right">
<span t-att-style="style" t-esc="account['balance']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
</td>
</tr>
</tbody>
</table>
</div>
</t>
</t>
</template>
</odoo>
-8
View File
@@ -9,16 +9,8 @@ from . import account_validate_account_move
from . import pos_box
from . import account_move_reversal
from . import account_report_common
from . import account_report_common_account
from . import account_report_common_partner
from . import account_report_common_journal
from . import account_report_print_journal
from . import account_report_general_ledger
from . import account_report_partner_ledger
from . import account_report_trial_balance
from . import account_financial_report
from . import account_report_aged_partner_balance
from . import setup_wizards
from . import wizard_tax_adjustments
from . import account_report_tax
from . import account_invoice_send
@@ -1,51 +0,0 @@
# -*- coding: utf-8 -*-
from odoo import api, fields, models
class AccountingReport(models.TransientModel):
_name = "accounting.report"
_inherit = "account.common.report"
_description = "Accounting Report"
@api.model
def _get_account_report(self):
reports = []
if self._context.get('active_id'):
menu = self.env['ir.ui.menu'].browse(self._context.get('active_id')).name
reports = self.env['account.financial.report'].search([('name', 'ilike', menu)])
return reports and reports[0] or False
enable_filter = fields.Boolean(string='Enable Comparison')
account_report_id = fields.Many2one('account.financial.report', string='Account Reports', required=True, default=_get_account_report)
label_filter = fields.Char(string='Column Label', help="This label will be displayed on report to show the balance computed for the given comparison filter.")
filter_cmp = fields.Selection([('filter_no', 'No Filters'), ('filter_date', 'Date')], string='Filter by', required=True, default='filter_no')
date_from_cmp = fields.Date(string='Start Date Comparison')
date_to_cmp = fields.Date(string='End Date Comparison')
debit_credit = fields.Boolean(string='Display Debit/Credit Columns', help="This option allows you to get more details about the way your balances are computed. Because it is space consuming, we do not allow to use it while doing a comparison.")
def _build_comparison_context(self, data):
result = {}
result['journal_ids'] = 'journal_ids' in data['form'] and data['form']['journal_ids'] or False
result['state'] = 'target_move' in data['form'] and data['form']['target_move'] or ''
if data['form']['filter_cmp'] == 'filter_date':
result['date_from'] = data['form']['date_from_cmp']
result['date_to'] = data['form']['date_to_cmp']
result['strict_range'] = True
return result
@api.multi
def check_report(self):
res = super(AccountingReport, self).check_report()
data = {}
data['form'] = self.read(['account_report_id', 'date_from_cmp', 'date_to_cmp', 'journal_ids', 'filter_cmp', 'target_move'])[0]
for field in ['account_report_id']:
if isinstance(data['form'][field], tuple):
data['form'][field] = data['form'][field][0]
comparison_context = self._build_comparison_context(data)
res['data']['form']['comparison_context'] = comparison_context
return res
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.ref('account.action_report_financial').report_action(self, data=data, config=False)
@@ -1,76 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="accounting_report_view" model="ir.ui.view">
<field name="name">Accounting Report</field>
<field name="model">accounting.report</field>
<field name="inherit_id" ref="account.account_common_report_view"/>
<field name="arch" type="xml">
<field name="target_move" position="before">
<field name="account_report_id" domain="[('parent_id','=',False)]"/>
</field>
<field name="target_move" position="after">
<field name="enable_filter"/>
<field name="debit_credit" attrs="{'invisible': [('enable_filter','=',True)]}"/>
</field>
<field name="journal_ids" position="after">
<notebook tabpos="up" colspan="4">
<page string="Comparison" name="comparison" attrs="{'invisible': [('enable_filter','=',False)]}">
<group>
<field name="label_filter" attrs="{'required': [('enable_filter', '=', True)]}"/>
<field name="filter_cmp"/>
</group>
<group string="Dates" attrs="{'invisible':[('filter_cmp', '!=', 'filter_date')]}">
<field name="date_from_cmp" attrs="{'required':[('filter_cmp', '=', 'filter_date')]}"/>
<field name="date_to_cmp" attrs="{'required':[('filter_cmp', '=', 'filter_date')]}"/>
</group>
</page>
</notebook>
</field>
<field name="journal_ids" position="replace"/>
<field name="company_id" position="replace"/>
<field name="date_to" position="after">
<field name="company_id" options="{'no_create': True}" groups="base.group_multi_company" invisible="0"/>
</field>
</field>
</record>
<record id="action_account_report_bs" model="ir.actions.act_window">
<field name="name">Balance Sheet</field>
<field name="res_model">accounting.report</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="accounting_report_view"/>
<field name="target">new</field>
<field name="context" eval="{'default_account_report_id':ref('account.account_financial_report_balancesheet0')}"/>
</record>
<menuitem id="menu_account_report_bs" name="Balance Sheet" action="action_account_report_bs" parent="menu_finance_legal_statement" groups="account.group_account_user"/>
<record id="action_account_report_pl" model="ir.actions.act_window">
<field name="name">Profit and Loss</field>
<field name="res_model">accounting.report</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="accounting_report_view"/>
<field name="target">new</field>
<field name="context" eval="{'default_account_report_id':ref('account.account_financial_report_profitandloss0')}"/>
</record>
<menuitem id="menu_account_report_pl" name="Profit and Loss" action="action_account_report_pl" parent="menu_finance_legal_statement" groups="account.group_account_user"/>
<record id="action_account_report" model="ir.actions.act_window">
<field name="name">Financial Reports</field>
<field name="res_model">accounting.report</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="accounting_report_view"/>
<field name="target">new</field>
</record>
<menuitem id="menu_account_report" name="Financial Report" action="action_account_report" parent="menu_finance_legal_statement" sequence="100" groups="account.group_account_user"/>
</odoo>
@@ -1,41 +0,0 @@
# -*- coding: utf-8 -*-
import time
from datetime import datetime
from dateutil.relativedelta import relativedelta
from odoo import api, fields, models, _
from odoo.exceptions import UserError
class AccountAgedTrialBalance(models.TransientModel):
_name = 'account.aged.trial.balance'
_inherit = 'account.common.partner.report'
_description = 'Aged Trial Balance Report'
period_length = fields.Integer(string='Period Length (days)', required=True, default=30)
journal_ids = fields.Many2many('account.journal', string='Journals', required=True)
date_from = fields.Date(default=lambda *a: time.strftime('%Y-%m-%d'))
def _print_report(self, data):
res = {}
data = self.pre_print_report(data)
data['form'].update(self.read(['period_length'])[0])
period_length = data['form']['period_length']
if period_length<=0:
raise UserError(_('You must set a period length greater than 0.'))
if not data['form']['date_from']:
raise UserError(_('You must set a start date.'))
start = fields.Date.from_string(data['form']['date_from'])
for i in range(5)[::-1]:
stop = start - relativedelta(days=period_length - 1)
res[str(i)] = {
'name': (i!=0 and (str((5-(i+1)) * period_length +1) + '-' + str((5-i) * period_length)) or ('+'+str(4 * period_length))),
'stop': start.strftime('%Y-%m-%d'),
'start': (i!=0 and stop.strftime('%Y-%m-%d') or False),
}
start = stop - relativedelta(days=1)
data['form'].update(res)
return self.env.ref('account.action_report_aged_partner_balance').with_context(landscape=True).report_action(self, data=data)
@@ -1,44 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="account_aged_balance_view" model="ir.ui.view">
<field name="name">Aged Partner Balance</field>
<field name="model">account.aged.trial.balance</field>
<field name="arch" type="xml">
<form string="Report Options">
<separator string="Aged Partner Balance"/>
<span class="o_form_label">Aged Partner Balance is a more detailed report of your receivables by intervals. Odoo calculates a table of credit balance by start Date. So if you request an interval of 30 days Odoo generates an analysis of creditors for the past month, past two months, and so on. </span>
<group col="4">
<field name="date_from"/>
<field name="period_length"/>
<newline/>
<field name="result_selection" widget="radio"/>
<field name="target_move" widget="radio"/>
<field name="company_id" options="{'no_create': True}" groups="base.group_multi_company"/>
</group>
<field name="journal_ids" required="0" invisible="1"/>
<footer>
<button name="check_report" string="Print" type="object" default_focus="1" class="oe_highlight"/>
<button string="Cancel" class="btn btn-secondary" special="cancel"/>
</footer>
</form>
</field>
</record>
<record id="action_account_aged_balance_view" model="ir.actions.act_window">
<field name="name">Aged Partner Balance</field>
<field name="res_model">account.aged.trial.balance</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="account_aged_balance_view"/>
<field name="context">{}</field>
<field name="target">new</field>
</record>
<menuitem id="menu_aged_trial_balance"
name="Aged Partner Balance"
action="action_account_aged_balance_view"
parent="account.menu_finance_legal_statement"/>
</odoo>
@@ -1,18 +0,0 @@
# -*- coding: utf-8 -*-
from odoo import api, fields, models
class AccountCommonAccountReport(models.TransientModel):
_name = 'account.common.account.report'
_description = 'Common Account Report'
_inherit = "account.common.report"
display_account = fields.Selection([('all','All'), ('movement','With movements'),
('not_zero','With balance is not equal to 0'),],
string='Display Accounts', required=True, default='movement')
@api.multi
def pre_print_report(self, data):
data['form'].update(self.read(['display_account'])[0])
return data
@@ -1,18 +0,0 @@
# -*- coding: utf-8 -*-
from odoo import fields, models
class AccountingCommonPartnerReport(models.TransientModel):
_name = 'account.common.partner.report'
_description = 'Common Partner Report'
_inherit = "account.common.report"
result_selection = fields.Selection([('customer', 'Receivable Accounts'),
('supplier', 'Payable Accounts'),
('customer_supplier', 'Receivable and Payable Accounts')
], string="Partner's", required=True, default='customer')
def pre_print_report(self, data):
data['form'].update(self.read(['result_selection'])[0])
return data
@@ -1,23 +0,0 @@
# -*- coding: utf-8 -*-
from odoo import fields, models, _
from odoo.exceptions import UserError
class AccountReportGeneralLedger(models.TransientModel):
_inherit = "account.common.account.report"
_name = "account.report.general.ledger"
_description = "General Ledger Report"
initial_balance = fields.Boolean(string='Include Initial Balances',
help='If you selected date, this field allow you to add a row to display the amount of debit/credit/balance that precedes the filter you\'ve set.')
sortby = fields.Selection([('sort_date', 'Date'), ('sort_journal_partner', 'Journal & Partner')], string='Sort by', required=True, default='sort_date')
journal_ids = fields.Many2many('account.journal', 'account_report_general_ledger_journal_rel', 'account_id', 'journal_id', string='Journals', required=True)
def _print_report(self, data):
data = self.pre_print_report(data)
data['form'].update(self.read(['initial_balance', 'sortby'])[0])
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.ref('account.action_report_general_ledger').with_context(landscape=True).report_action(records, data=data)
@@ -1,40 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="account_report_general_ledger_view" model="ir.ui.view">
<field name="name">General Ledger</field>
<field name="model">account.report.general.ledger</field>
<field name="inherit_id" ref="account_common_report_view"/>
<field name="arch" type="xml">
<data>
<xpath expr="//field[@name='target_move']" position="after">
<field name="sortby" widget="radio"/>
<field name="display_account" widget="radio"/>
<field name="initial_balance"/>
<newline/>
</xpath>
</data>
</field>
</record>
<record id="action_account_general_ledger_menu" model="ir.actions.act_window">
<field name="name">General Ledger</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">account.report.general.ledger</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="account_report_general_ledger_view"/>
<field name="target">new</field>
<field name="binding_model_id" ref="account.model_account_account" />
<field name="binding_type">report</field>
</record>
<menuitem
id="menu_general_ledger"
name="General Ledger"
parent="account.menu_finance_legal_statement"
action="action_account_general_ledger_menu"
groups="account.group_account_user"
/>
</odoo>
@@ -1,18 +0,0 @@
# -*- coding: utf-8 -*-
from odoo import fields, models, _
from odoo.exceptions import UserError
class AccountPartnerLedger(models.TransientModel):
_inherit = "account.common.partner.report"
_name = "account.report.partner.ledger"
_description = "Account Partner Ledger Report"
amount_currency = fields.Boolean("With Currency", help="It adds the currency column on report if the currency differs from the company currency.")
reconciled = fields.Boolean('Reconciled Entries')
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.ref('account.action_report_partnerledger').report_action(self, data=data)
@@ -1,41 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="account_report_partner_ledger_view" model="ir.ui.view">
<field name="name">Partner Ledger</field>
<field name="model">account.report.partner.ledger</field>
<field name="inherit_id" ref="account.account_common_report_view"/>
<field name="arch" type="xml">
<data>
<xpath expr="//field[@name='target_move']" position="after">
<field name="result_selection"/>
<field name="amount_currency" groups="base.group_multi_currency"/>
<newline/>
<field name="reconciled"/>
<newline/>
</xpath>
</data>
</field>
</record>
<record id="action_account_partner_ledger_menu" model="ir.actions.act_window">
<field name="name">Partner Ledger</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">account.report.partner.ledger</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="account_report_partner_ledger_view"/>
<field name="target">new</field>
<field name="binding_model_id" ref="account.model_account_account" />
<field name="binding_type">report</field>
</record>
<menuitem
id="menu_partner_ledger"
name="Partner Ledger"
parent="account.menu_finance_legal_statement"
action="action_account_partner_ledger_menu"
groups="account.group_account_user"
/>
</odoo>
@@ -1,37 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="account_report_print_journal_view" model="ir.ui.view">
<field name="name">Journals Audit</field>
<field name="model">account.print.journal</field>
<field name="inherit_id" ref="account.account_common_report_view"/>
<field name="arch" type="xml">
<data>
<xpath expr="//field[@name='target_move']" position="after">
<field name="amount_currency" groups="base.group_multi_currency"/>
<field name="sort_selection" widget="radio"/>
<newline/>
</xpath>
</data>
</field>
</record>
<record id="action_account_print_journal_menu" model="ir.actions.act_window">
<field name="name">Journals Audit</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">account.print.journal</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="account_report_print_journal_view"/>
<field name="target">new</field>
</record>
<menuitem
id="menu_print_journal"
name="Journals Audit"
parent="account.menu_finance_legal_statement"
action="action_account_print_journal_menu"
groups="account.group_account_manager,account.group_account_user"
/>
</odoo>
@@ -1,12 +0,0 @@
# -*- coding: utf-8 -*-
from odoo import models
class AccountTaxReport(models.TransientModel):
_inherit = "account.common.report"
_name = 'account.tax.report'
_description = 'Tax Report'
def _print_report(self, data):
return self.env.ref('account.action_report_account_tax').report_action(self, data=data)
@@ -1,35 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="accounting_tax_report_view" model="ir.ui.view">
<field name="name">Tax Reports</field>
<field name="model">account.tax.report</field>
<field name="inherit_id" ref="account.account_common_report_view"/>
<field name="arch" type="xml">
<data>
<field name="journal_ids" position="replace"/>
<field name="target_move" position="replace"/>
<xpath expr="//field[@name='date_from']" position="attributes">
<attribute name="required">1</attribute>
</xpath>
<xpath expr="//field[@name='date_to']" position="attributes">
<attribute name="required">1</attribute>
</xpath>
</data>
</field>
</record>
<record id="action_account_tax_report" model="ir.actions.act_window">
<field name="name">Tax Reports</field>
<field name="res_model">account.tax.report</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="accounting_tax_report_view"/>
<field name="context">{}</field>
<field name="target">new</field>
</record>
<menuitem id="menu_account_report" name="Tax Report" action="action_account_tax_report" parent="account.menu_finance_legal_statement" groups="account.group_account_manager,account.group_account_user"/>
</odoo>
@@ -1,16 +0,0 @@
# -*- coding: utf-8 -*-
from odoo import fields, models
class AccountBalanceReport(models.TransientModel):
_inherit = "account.common.account.report"
_name = 'account.balance.report'
_description = 'Trial Balance Report'
journal_ids = fields.Many2many('account.journal', 'account_balance_report_journal_rel', 'account_id', 'journal_id', string='Journals', required=True, default=[])
def _print_report(self, data):
data = self.pre_print_report(data)
records = self.env[data['model']].browse(data.get('ids', []))
return self.env.ref('account.action_report_trial_balance').report_action(records, data=data)
@@ -1,38 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="account_report_balance_view" model="ir.ui.view">
<field name="name">Trial Balance</field>
<field name="model">account.balance.report</field>
<field name="inherit_id" ref="account_common_report_view"/>
<field name="arch" type="xml">
<data>
<field name="journal_ids" position="replace"/>
<xpath expr="//field[@name='target_move']" position="after">
<field name="display_account" widget="radio"/>
<newline/>
</xpath>
</data>
</field>
</record>
<record id="action_account_balance_menu" model="ir.actions.act_window">
<field name="name">Trial Balance</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">account.balance.report</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="account_report_balance_view"/>
<field name="target">new</field>
<field name="binding_model_id" ref="account.model_account_account" />
<field name="binding_type">report</field>
</record>
<menuitem id="menu_general_Balance_report"
name="Trial Balance"
parent="account.menu_finance_legal_statement"
action="action_account_balance_menu"
groups="account.group_account_user"/>
</odoo>