19 changed files with 550 additions and 0 deletions
@ -0,0 +1,4 @@ |
|||
# -*- coding: utf-8 -*- |
|||
from . import report |
|||
from . import wizard |
|||
|
@ -0,0 +1,47 @@ |
|||
# -*- coding: utf-8 -*- |
|||
################################################################################### |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# Copyright (C) 2017-TODAY Cybrosys Technologies(<http://www.cybrosys.com>). |
|||
# Author: fasluca(<https://www.cybrosys.com>) |
|||
# |
|||
# This program is free software: you can modify |
|||
# it under the terms of the GNU Affero General Public License (AGPL) as |
|||
# published by the Free Software Foundation, either version 3 of the |
|||
# License, or (at your option) any later version. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU Affero General Public License for more details. |
|||
# |
|||
# You should have received a copy of the GNU Affero General Public License |
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
################################################################################### |
|||
|
|||
{ |
|||
'name': 'Account Journal Report', |
|||
'summary': """""", |
|||
'version': '11.0.1.0', |
|||
'description': """""", |
|||
'author': 'Cybrosys Techno Solutions', |
|||
'company': 'Cybrosys Techno Solutions', |
|||
'website': "https://cybrosys.com/", |
|||
'category': 'Accounting', |
|||
'depends': ['web', 'account'], |
|||
'license': 'AGPL-3', |
|||
'data': [ |
|||
'views/account_report.xml', |
|||
'views/report_journal.xml', |
|||
'wizard/account_report_common_journal_view.xml', |
|||
'wizard/account_report_cash_journal_view.xml', |
|||
'wizard/account_report_bank_journal_view.xml', |
|||
'views/report_menu_view.xml', |
|||
|
|||
], |
|||
'demo': [], |
|||
'images': ['static/description/banner.jpg'], |
|||
'installable': True, |
|||
'auto_install': False, |
|||
} |
@ -0,0 +1,2 @@ |
|||
# -*- coding: utf-8 -*- |
|||
from . import account_common_journal |
@ -0,0 +1,119 @@ |
|||
# -*- coding: utf-8 -*- |
|||
|
|||
import time |
|||
from odoo import api, models, _ |
|||
from odoo.exceptions import UserError |
|||
|
|||
|
|||
class ReportCommonJournal(models.AbstractModel): |
|||
_name = 'report.account_journal_report.report_common_journal' |
|||
|
|||
def lines(self, target_move, journal_ids, sort_selection, data): |
|||
if isinstance(journal_ids, int): |
|||
journal_ids = [journal_ids] |
|||
|
|||
move_state = ['draft', 'posted'] |
|||
if target_move == 'posted': |
|||
move_state = ['posted'] |
|||
|
|||
query_get_clause = self._get_query_get_clause(data) |
|||
params = [tuple(move_state), tuple(journal_ids)] + query_get_clause[2] |
|||
query = 'SELECT "account_move_line".id FROM ' + query_get_clause[0] + ', account_move am, account_account acc WHERE "account_move_line".account_id = acc.id AND "account_move_line".move_id=am.id AND am.state IN %s AND "account_move_line".journal_id IN %s AND ' + query_get_clause[1] + ' ORDER BY ' |
|||
if sort_selection == 'date': |
|||
query += '"account_move_line".date' |
|||
else: |
|||
query += 'am.name' |
|||
query += ', "account_move_line".move_id, acc.code' |
|||
self.env.cr.execute(query, tuple(params)) |
|||
ids = (x[0] for x in self.env.cr.fetchall()) |
|||
return self.env['account.move.line'].browse(ids) |
|||
|
|||
def _sum_debit(self, data, journal_id): |
|||
move_state = ['draft', 'posted'] |
|||
if data['form'].get('target_move', 'all') == 'posted': |
|||
move_state = ['posted'] |
|||
|
|||
query_get_clause = self._get_query_get_clause(data) |
|||
params = [tuple(move_state), tuple(journal_id.ids)] + query_get_clause[2] |
|||
|
|||
self.env.cr.execute('SELECT SUM(debit) FROM ' + query_get_clause[0] + ', account_move am ' |
|||
'WHERE "account_move_line".move_id=am.id AND am.state IN %s AND "account_move_line".journal_id IN %s AND ' + query_get_clause[1] + ' ', |
|||
tuple(params)) |
|||
return self.env.cr.fetchone()[0] or 0.0 |
|||
|
|||
def _sum_credit(self, data, journal_id): |
|||
move_state = ['draft', 'posted'] |
|||
if data['form'].get('target_move', 'all') == 'posted': |
|||
move_state = ['posted'] |
|||
|
|||
query_get_clause = self._get_query_get_clause(data) |
|||
params = [tuple(move_state), tuple(journal_id.ids)] + query_get_clause[2] |
|||
self.env.cr.execute('SELECT SUM(credit) FROM ' + query_get_clause[0] + ', account_move am ' |
|||
'WHERE "account_move_line".move_id=am.id AND am.state IN %s AND "account_move_line".journal_id IN %s AND ' + query_get_clause[1] + ' ', |
|||
tuple(params)) |
|||
return self.env.cr.fetchone()[0] or 0.0 |
|||
|
|||
def _get_taxes(self, data, journal_id): |
|||
move_state = ['draft', 'posted'] |
|||
if data['form'].get('target_move', 'all') == 'posted': |
|||
move_state = ['posted'] |
|||
|
|||
query_get_clause = self._get_query_get_clause(data) |
|||
params = [tuple(move_state), tuple(journal_id.ids)] + query_get_clause[2] |
|||
query = """ |
|||
SELECT rel.account_tax_id, SUM("account_move_line".balance) AS base_amount |
|||
FROM account_move_line_account_tax_rel rel, """ + query_get_clause[0] + """ |
|||
LEFT JOIN account_move am ON "account_move_line".move_id = am.id |
|||
WHERE "account_move_line".id = rel.account_move_line_id |
|||
AND am.state IN %s |
|||
AND "account_move_line".journal_id IN %s |
|||
AND """ + query_get_clause[1] + """ |
|||
GROUP BY rel.account_tax_id""" |
|||
self.env.cr.execute(query, tuple(params)) |
|||
ids = [] |
|||
base_amounts = {} |
|||
for row in self.env.cr.fetchall(): |
|||
ids.append(row[0]) |
|||
base_amounts[row[0]] = row[1] |
|||
|
|||
|
|||
res = {} |
|||
for tax in self.env['account.tax'].browse(ids): |
|||
self.env.cr.execute('SELECT sum(debit - credit) FROM ' + query_get_clause[0] + ', account_move am ' |
|||
'WHERE "account_move_line".move_id=am.id AND am.state IN %s AND "account_move_line".journal_id IN %s AND ' + query_get_clause[1] + ' AND tax_line_id = %s', |
|||
tuple(params + [tax.id])) |
|||
res[tax] = { |
|||
'base_amount': base_amounts[tax.id], |
|||
'tax_amount': self.env.cr.fetchone()[0] or 0.0, |
|||
} |
|||
if journal_id.type == 'sale': |
|||
#sales operation are credits |
|||
res[tax]['base_amount'] = res[tax]['base_amount'] * -1 |
|||
res[tax]['tax_amount'] = res[tax]['tax_amount'] * -1 |
|||
return res |
|||
|
|||
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 get_report_values(self, docids, data=None): |
|||
if not data.get('form'): |
|||
raise UserError(_("Form content is missing, this report cannot be printed.")) |
|||
|
|||
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) |
|||
return { |
|||
'doc_ids': data['form']['journal_ids'], |
|||
'doc_model': self.env['account.journal'], |
|||
'data': data, |
|||
'docs': self.env['account.journal'].browse(data['form']['journal_ids']), |
|||
'time': time, |
|||
'lines': res, |
|||
'sum_credit': self._sum_credit, |
|||
'sum_debit': self._sum_debit, |
|||
'get_taxes': self._get_taxes, |
|||
} |
After Width: | Height: | Size: 6.9 KiB |
After Width: | Height: | Size: 125 KiB |
After Width: | Height: | Size: 50 KiB |
After Width: | Height: | Size: 9.1 KiB |
@ -0,0 +1,68 @@ |
|||
<section class="oe_container oe_dark"> |
|||
<div class="oe_row oe_spaced"> |
|||
<h2 class="oe_slogan">Account Journal Reports</h2> |
|||
<h4 class="oe_slogan"><a href="https://www.cybrosys.com">Cybrosys Technologies</a></h4> |
|||
</div> |
|||
</section> |
|||
|
|||
<section class="oe_container"> |
|||
<div class="oe_row oe_spaced"> |
|||
<!--<h2 class="oe_slogan" style="color:#875A7B;"></h2>--> |
|||
<h3 class="oe_slogan"> |
|||
Some additional reports to make it easy for accountants |
|||
</h3> |
|||
</div> |
|||
</section> |
|||
|
|||
<section class="oe_container oe_dark"> |
|||
<div class="oe_row oe_spaced"> |
|||
<div class="oe_picture"> |
|||
<h3 class="oe_slogan">Overview</h3> |
|||
<p class="oe_mt32 text-justify" style="text-align: center;"> |
|||
<b>This module adds some journal based reports to the Odoo accounting.like, |
|||
<div> |
|||
<span style="color:green; font-size:18px;"> ⚫ </span> Common Journal<br/> |
|||
<span style="color:green; font-size:18px;"> ⚫ </span> Cash Journal<br/> |
|||
<span style="color:green; font-size:18px;"> ⚫ </span> Bank Journal<br/> |
|||
</div></b> |
|||
</p> |
|||
</div> |
|||
</div> |
|||
</section> |
|||
|
|||
<section class="oe_container"> |
|||
<div class="oe_row oe_spaced"> |
|||
<div class="oe_picture"> |
|||
<div class="oe_screenshot"> |
|||
<img src="acc_jou_rep.png"> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</section> |
|||
|
|||
<section class="oe_container oe_dark"> |
|||
<h2 class="oe_slogan" style="margin-top:20px;" >Need Any Help?</h2> |
|||
<div class="oe_slogan" style="margin-top:10px !important;"> |
|||
<div> |
|||
<a class="btn btn-primary btn-lg mt8" |
|||
style="color: #FFFFFF !important;border-radius: 0;" href="https://www.cybrosys.com"><i |
|||
class="fa fa-envelope"></i> Email </a> <a |
|||
class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;border-radius: 0;" |
|||
href="https://www.cybrosys.com/contact/"><i |
|||
class="fa fa-phone"></i> Contact Us </a> <a |
|||
class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;border-radius: 0;" |
|||
href="https://www.cybrosys.com/odoo-customization-and-installation/"><i |
|||
class="fa fa-check-square"></i> Request Customization </a> |
|||
</div> |
|||
<br> |
|||
<img src="cybro_logo.png" style="width: 190px; margin-bottom: 20px;" class="center-block"> |
|||
<div> |
|||
<a href="https://twitter.com/cybrosys" target="_blank"><i class="fa fa-2x fa-twitter" style="color:white;background: #00a0d1;width:35px;"></i></a></td> |
|||
<a href="https://www.linkedin.com/company/cybrosys-technologies-pvt-ltd" target="_blank"><i class="fa fa-2x fa-linkedin" style="color:white;background: #31a3d6;width:35px;padding-left: 3px;"></i></a></td> |
|||
<a href="https://www.facebook.com/cybrosystechnologies" target="_blank"><i class="fa fa-2x fa-facebook" style="color:white;background: #3b5998;width:35px;padding-left: 8px;"></i></a></td> |
|||
<a href="https://plus.google.com/106641282743045431892/about" target="_blank"><i class="fa fa-2x fa-google-plus" style="color:white;background: #c53c2c;width:35px;padding-left: 3px;"></i></a></td> |
|||
<a href="https://in.pinterest.com/cybrosys" target="_blank"><i class="fa fa-2x fa-pinterest" style="color:white;background: #ac0f18;width:35px;padding-left: 3px;"></i></a></td> |
|||
</div> |
|||
</div> |
|||
</section> |
|||
|
@ -0,0 +1,32 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
<data> |
|||
<!-- QWeb Reports --> |
|||
<report |
|||
id="action_report_common_journal" |
|||
model="account.common.journal.report" |
|||
string="Common Journal" |
|||
report_type="qweb-pdf" |
|||
name="account_journal_report.report_common_journal" |
|||
file="account_journal_report.report_common_journal" |
|||
/> |
|||
|
|||
<report |
|||
id="action_report_cash_journal" |
|||
model="account.common.journal.report" |
|||
string="Cash Journal" |
|||
report_type="qweb-pdf" |
|||
name="account_journal_report.report_common_journal" |
|||
file="account_journal_report.report_common_journal" |
|||
/> |
|||
|
|||
<report |
|||
id="action_report_bank_journal" |
|||
model="account.common.journal.report" |
|||
string="Bank Journal" |
|||
report_type="qweb-pdf" |
|||
name="account_journal_report.report_common_journal" |
|||
file="account_journal_report.report_common_journal" |
|||
/> |
|||
</data> |
|||
</odoo> |
@ -0,0 +1,79 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
<template id="report_common_journal"> |
|||
<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><t t-esc="o.name"/> Journal</h2> |
|||
|
|||
<div class="row mt32"> |
|||
<div class="col-xs-3"> |
|||
<strong>Company:</strong> |
|||
<p t-esc="res_company.name"/> |
|||
</div> |
|||
<div class="col-xs-3"> |
|||
<strong>Journal:</strong> |
|||
<p t-esc="o.name"/> |
|||
</div> |
|||
<div class="col-xs-3"> |
|||
<strong>Entries Sorted By:</strong> |
|||
<p t-if="data['form'].get('sort_selection') != 'l.date'">Journal Entry Number</p> |
|||
<p t-if="data['form'].get('sort_selection') == 'l.date'">Date</p> |
|||
</div> |
|||
<div class="col-xs-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-condensed"> |
|||
<thead> |
|||
<tr> |
|||
<th>Move</th> |
|||
<th>Date</th> |
|||
<th>Account</th> |
|||
<th>Partner</th> |
|||
<th>Label</th> |
|||
<th>Debit</th> |
|||
<th>Credit</th> |
|||
<th t-if="data['form']['amount_currency']">Currency</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
<tr t-foreach="lines[o.id]" t-as="aml"> |
|||
<td><span t-esc="aml.move_id.name != '/' and aml.move_id.name or ('*'+str(aml.move_id.id))"/></td> |
|||
<td><span t-field="aml.date"/></td> |
|||
<td><span t-field="aml.account_id.code"/></td> |
|||
<td><span t-esc="aml.sudo().partner_id and aml.sudo().partner_id.name and aml.sudo().partner_id.name[:23] or ''"/></td> |
|||
<td><span t-esc="aml.name[:35]"/></td> |
|||
<td><span t-esc="aml.debit" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></td> |
|||
<td><span t-esc="aml.credit" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></td> |
|||
<td t-if="data['form']['amount_currency'] and aml.amount_currency"> |
|||
<span t-esc="aml.amount_currency" t-options="{'widget': 'monetary', 'display_currency': aml.currency_id}"/> |
|||
</td> |
|||
</tr> |
|||
</tbody> |
|||
</table> |
|||
|
|||
<div class="row"> |
|||
<div class="col-xs-4 pull-right"> |
|||
<table class="table table-condensed"> |
|||
<tr> |
|||
<td><strong>Total</strong></td> |
|||
<td><span t-esc="sum_debit(data, o)" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></td> |
|||
<td><span t-esc="sum_credit(data, o)" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></td> |
|||
</tr> |
|||
</table> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</t> |
|||
</t> |
|||
</t> |
|||
</template> |
|||
</odoo> |
@ -0,0 +1,65 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
<menuitem |
|||
id="menu_report_journal" |
|||
name="Journal Reports" |
|||
parent="account.menu_finance_legal_statement" |
|||
groups="account.group_account_manager,account.group_account_user" |
|||
sequence="1" |
|||
/> |
|||
|
|||
<menuitem |
|||
id="menu_report_partner" |
|||
name="Partner Reports" |
|||
parent="account.menu_finance_legal_statement" |
|||
groups="account.group_account_manager,account.group_account_user" |
|||
sequence="1" |
|||
/> |
|||
|
|||
<menuitem |
|||
id="account.menu_print_journal" |
|||
name="Sale/Purchase Journal" |
|||
parent="menu_report_journal" |
|||
action="account.action_account_print_journal_menu" |
|||
groups="account.group_account_manager,account.group_account_user" |
|||
/> |
|||
|
|||
<menuitem |
|||
id="menu_print_common_journal" |
|||
name="Common Journal" |
|||
parent="menu_report_journal" |
|||
action="action_account_common_journal_report_menu" |
|||
groups="account.group_account_manager,account.group_account_user" |
|||
/> |
|||
|
|||
<menuitem |
|||
id="menu_print_cash_journal" |
|||
name="Cash Journal" |
|||
parent="menu_report_journal" |
|||
action="action_account_cash_journal_report_menu" |
|||
groups="account.group_account_manager,account.group_account_user" |
|||
/> |
|||
|
|||
<menuitem |
|||
id="menu_print_bank_journal" |
|||
name="Bank Journal" |
|||
parent="menu_report_journal" |
|||
action="action_account_bank_journal_report_menu" |
|||
groups="account.group_account_manager,account.group_account_user" |
|||
/> |
|||
|
|||
<menuitem |
|||
id="account.menu_partner_ledger" |
|||
name="Partner Ledger" |
|||
parent="menu_report_partner" |
|||
action="account.action_account_partner_ledger_menu" |
|||
groups="account.group_account_user" |
|||
/> |
|||
|
|||
<menuitem |
|||
id="account.menu_aged_trial_balance" |
|||
name="Aged Partner Balance" |
|||
action="account.action_account_aged_balance_view" |
|||
parent="menu_report_partner"/> |
|||
|
|||
</odoo> |
@ -0,0 +1,4 @@ |
|||
# -*- coding: utf-8 -*- |
|||
from . import account_report_common_journal |
|||
from . import account_report_cash_journal |
|||
from . import account_report_bank_journal |
@ -0,0 +1,17 @@ |
|||
# -*- coding: utf-8 -*- |
|||
|
|||
from odoo import fields, models |
|||
|
|||
|
|||
class AccountBankJournalReport(models.TransientModel): |
|||
_inherit = "account.common.journal.report" |
|||
_name = "account.bank.journal.report" |
|||
|
|||
sort_selection = fields.Selection([('date', 'Date'), ('move_name', 'Journal Entry Number'),], 'Entries Sorted by', required=True, default='move_name') |
|||
journal_ids = fields.Many2many('account.journal', string='Journals', required=True, |
|||
default=lambda self: self.env['account.journal'].search([('type', 'in', ['bank'])])) |
|||
|
|||
def _print_report(self, data): |
|||
data = self.pre_print_report(data) |
|||
data['form'].update({'sort_selection': self.sort_selection}) |
|||
return self.env.ref('account_journal_report.action_report_bank_journal').with_context(landscape=True).report_action(self, data=data) |
@ -0,0 +1,27 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
<record id="account_report_bank_journal_view" model="ir.ui.view"> |
|||
<field name="name">Bank Journal</field> |
|||
<field name="model">account.bank.journal.report</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_bank_journal_report_menu" model="ir.actions.act_window"> |
|||
<field name="name">Bank Journal</field> |
|||
<field name="res_model">account.bank.journal.report</field> |
|||
<field name="view_type">form</field> |
|||
<field name="view_mode">form</field> |
|||
<field name="view_id" ref="account_report_bank_journal_view"/> |
|||
<field name="target">new</field> |
|||
</record> |
|||
|
|||
</odoo> |
@ -0,0 +1,17 @@ |
|||
# -*- coding: utf-8 -*- |
|||
|
|||
from odoo import fields, models |
|||
|
|||
|
|||
class AccountCashJournalReport(models.TransientModel): |
|||
_inherit = "account.common.journal.report" |
|||
_name = "account.cash.journal.report" |
|||
|
|||
sort_selection = fields.Selection([('date', 'Date'), ('move_name', 'Journal Entry Number'),], 'Entries Sorted by', required=True, default='move_name') |
|||
journal_ids = fields.Many2many('account.journal', string='Journals', required=True, |
|||
default=lambda self: self.env['account.journal'].search([('type', '=', 'cash')])) |
|||
|
|||
def _print_report(self, data): |
|||
data = self.pre_print_report(data) |
|||
data['form'].update({'sort_selection': self.sort_selection}) |
|||
return self.env.ref('account_journal_report.action_report_cash_journal').with_context(landscape=True).report_action(self, data=data) |
@ -0,0 +1,27 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
<record id="account_report_cash_journal_view" model="ir.ui.view"> |
|||
<field name="name">Cash Journal</field> |
|||
<field name="model">account.cash.journal.report</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_cash_journal_report_menu" model="ir.actions.act_window"> |
|||
<field name="name">Cash Journal</field> |
|||
<field name="res_model">account.cash.journal.report</field> |
|||
<field name="view_type">form</field> |
|||
<field name="view_mode">form</field> |
|||
<field name="view_id" ref="account_report_cash_journal_view"/> |
|||
<field name="target">new</field> |
|||
</record> |
|||
|
|||
</odoo> |
@ -0,0 +1,15 @@ |
|||
# -*- coding: utf-8 -*- |
|||
|
|||
from odoo import fields, models |
|||
|
|||
|
|||
class AccountJournalReport(models.TransientModel): |
|||
_inherit = "account.common.journal.report" |
|||
_name = "account.journal.report" |
|||
|
|||
sort_selection = fields.Selection([('date', 'Date'), ('move_name', 'Journal Entry Number'),], 'Entries Sorted by', required=True, default='move_name') |
|||
|
|||
def _print_report(self, data): |
|||
data = self.pre_print_report(data) |
|||
data['form'].update({'sort_selection': self.sort_selection}) |
|||
return self.env.ref('account_journal_report.action_report_common_journal').with_context(landscape=True).report_action(self, data=data) |
@ -0,0 +1,27 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
<record id="account_report_common_journal_view" model="ir.ui.view"> |
|||
<field name="name">Common Journal</field> |
|||
<field name="model">account.journal.report</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_common_journal_report_menu" model="ir.actions.act_window"> |
|||
<field name="name">Common Journal </field> |
|||
<field name="res_model">account.journal.report</field> |
|||
<field name="view_type">form</field> |
|||
<field name="view_mode">form</field> |
|||
<field name="view_id" ref="account_report_common_journal_view"/> |
|||
<field name="target">new</field> |
|||
</record> |
|||
|
|||
</odoo> |
Loading…
Reference in new issue