@ -0,0 +1,49 @@ |
|||
.. image:: https://img.shields.io/badge/license-AGPL--3-blue.svg |
|||
:target: https://www.gnu.org/licenses/agpl-3.0-standalone.html |
|||
:alt: License: AGPL-3 |
|||
|
|||
Trial Balance PDF Report |
|||
======================== |
|||
This module helps to generate the trial Balance PDF Report. |
|||
|
|||
Configuration |
|||
============= |
|||
* No additional configurations needed |
|||
|
|||
Company |
|||
------- |
|||
* `Cybrosys Techno Solutions <https://cybrosys.com/>`__ |
|||
|
|||
License |
|||
------- |
|||
Affero General Public License, v3.0 (AGPL v3). |
|||
(https://www.gnu.org/licenses/agpl-3.0-standalone.html) |
|||
|
|||
Credits |
|||
------- |
|||
* Developers: (V16) Chethana Ramachandran, |
|||
(V17) Jumana Haseen, |
|||
(V18) Aysha Shalin |
|||
Contact: odoo@cybrosys.com |
|||
|
|||
Contacts |
|||
-------- |
|||
* Mail Contact : odoo@cybrosys.com |
|||
* Website : https://cybrosys.com |
|||
|
|||
Bug Tracker |
|||
----------- |
|||
Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. |
|||
|
|||
Maintainer |
|||
========== |
|||
.. image:: https://cybrosys.com/images/logo.png |
|||
:target: https://cybrosys.com |
|||
|
|||
This module is maintained by Cybrosys Technologies. |
|||
|
|||
For support and more information, please visit `Our Website <https://cybrosys.com/>`__ |
|||
|
|||
Further information |
|||
=================== |
|||
HTML Description: `<static/description/index.html>`__ |
@ -0,0 +1,22 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Aysha Shalin (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# 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 (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC |
|||
# LICENSE (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
from . import wizard |
@ -0,0 +1,46 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Jumana Haseen (<https://www.cybrosys.com>) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# 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 (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
{ |
|||
'name': 'Trial Balance PDF Report', |
|||
'version': '18.0.1.0.0', |
|||
'category': 'Accounting', |
|||
'summary': """This module helps to generate the trial balance report in PDF |
|||
format.""", |
|||
'description': """This module provides a trial balance PDF report within the |
|||
Odoo Community version's Invoicing App.""", |
|||
'author': 'Cybrosys Techno Solutions', |
|||
'company': 'Cybrosys Techno Solutions', |
|||
'maintainer': 'Cybrosys Techno Solutions', |
|||
'website': 'https://www.cybrosys.com', |
|||
'depends': ['account'], |
|||
'data': [ |
|||
'security/ir.model.access.csv', |
|||
'report/trial_balance_report_templates.xml', |
|||
'report/trial_balance_report_reports.xml', |
|||
'wizard/trial_balance_report_views.xml', |
|||
], |
|||
'images': ['static/description/banner.png'], |
|||
'license': 'AGPL-3', |
|||
'installable': True, |
|||
'auto_install': False, |
|||
'application': False, |
|||
} |
@ -0,0 +1,6 @@ |
|||
## Module <trial_balance_pdf> |
|||
|
|||
#### 09.10.2024 |
|||
#### Version 18.0.1.0.0 |
|||
##### ADD |
|||
- Initial commit for Trial Balance PDF Report |
@ -0,0 +1,13 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<odoo> |
|||
<!-- Report Action --> |
|||
<record id="action_report_trial_balance" model="ir.actions.report"> |
|||
<field name="name">Trial Balance</field> |
|||
<field name="model">trial.balance.report</field> |
|||
<field name="report_type">qweb-pdf</field> |
|||
<field name="report_name">trial_balance_pdf.report_trial_balance</field> |
|||
<field name="report_file">trial_balance_pdf.report_trial_balance</field> |
|||
<field name="binding_model_id" ref="model_trial_balance_report"/> |
|||
<field name="binding_type">report</field> |
|||
</record> |
|||
</odoo> |
@ -0,0 +1,107 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
<!-- Report Template --> |
|||
<template id="report_trial_balance"> |
|||
<t t-call="web.html_container"> |
|||
<t t-call="web.external_layout"> |
|||
<t t-if="start_date or end_date or journals_name or state"> |
|||
<div style="padding:10px;"> |
|||
<t t-if="start_date"> |
|||
Start Date : |
|||
<t t-esc="start_date"/> |
|||
<br/> |
|||
<br/> |
|||
</t> |
|||
<t t-if="end_date"> |
|||
End Date : |
|||
<t t-esc="end_date"/> |
|||
<br/> |
|||
<br/> |
|||
</t> |
|||
<t t-if="journals_name"> |
|||
Journals: |
|||
<t t-esc="journals_name"/> |
|||
<br/> |
|||
<br/> |
|||
</t> |
|||
<t t-if="state"> |
|||
State: |
|||
<t t-esc="state"/> |
|||
<br/> |
|||
<br/> |
|||
</t> |
|||
</div> |
|||
</t> |
|||
<div class="page"> |
|||
<center> |
|||
<t t-if="query"> |
|||
<h2>Trial Balance</h2> |
|||
</t> |
|||
<t t-else=""> |
|||
<h3>There is no data</h3> |
|||
</t> |
|||
</center> |
|||
</div> |
|||
<br/> |
|||
<t t-if="query"> |
|||
<table class="table table-sm"> |
|||
<thead> |
|||
<tr> |
|||
<th>Code</th> |
|||
<th>Account</th> |
|||
<th>Debit</th> |
|||
<th>Credit</th> |
|||
<th>Balance</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
<tr t-foreach="query" t-as="i"> |
|||
<td> |
|||
<span t-esc="i['code']"/> |
|||
</td> |
|||
<td> |
|||
<span t-esc="i['ac_name']['en_US']"/> |
|||
</td> |
|||
<td> |
|||
<span t-esc="currency"/> |
|||
<span t-esc="i['debit']"/> |
|||
</td> |
|||
<td> |
|||
<span t-esc="currency"/> |
|||
<span t-esc="i['credit']"/> |
|||
</td> |
|||
<td> |
|||
<span t-esc="currency"/> |
|||
<span t-esc="i['balance']"/> |
|||
</td> |
|||
</tr> |
|||
<tr> |
|||
<td colspan="2" style="text-align:center;"> |
|||
<b>Total</b> |
|||
</td> |
|||
<td> |
|||
<b> |
|||
<span t-esc="currency"/> |
|||
<span t-esc="total_debit"/> |
|||
</b> |
|||
</td> |
|||
<td> |
|||
<b> |
|||
<span t-esc="currency"/> |
|||
<span t-esc="total_credit"/> |
|||
</b> |
|||
</td> |
|||
<td> |
|||
<b> |
|||
<span t-esc="currency"/> |
|||
<span t-esc="balance"/> |
|||
</b> |
|||
</td> |
|||
</tr> |
|||
</tbody> |
|||
</table> |
|||
</t> |
|||
</t> |
|||
</t> |
|||
</template> |
|||
</odoo> |
|
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 628 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 210 KiB |
After Width: | Height: | Size: 209 KiB |
After Width: | Height: | Size: 109 KiB |
After Width: | Height: | Size: 495 B |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 624 B |
After Width: | Height: | Size: 136 KiB |
After Width: | Height: | Size: 214 KiB |
After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 310 B |
After Width: | Height: | Size: 929 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 542 B |
After Width: | Height: | Size: 576 B |
After Width: | Height: | Size: 733 B |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 738 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 911 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 600 B |
After Width: | Height: | Size: 673 B |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 462 B |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 926 B |
After Width: | Height: | Size: 9.0 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 7.0 KiB |
After Width: | Height: | Size: 878 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 653 B |
After Width: | Height: | Size: 800 B |
After Width: | Height: | Size: 905 B |
After Width: | Height: | Size: 189 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 839 B |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 5.9 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 427 B |
After Width: | Height: | Size: 627 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 988 B |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 875 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 142 KiB |
After Width: | Height: | Size: 94 KiB |
After Width: | Height: | Size: 86 KiB |
After Width: | Height: | Size: 92 KiB |
After Width: | Height: | Size: 136 KiB |
After Width: | Height: | Size: 162 KiB |
After Width: | Height: | Size: 96 KiB |
After Width: | Height: | Size: 94 KiB |
After Width: | Height: | Size: 35 KiB |
After Width: | Height: | Size: 89 KiB |
After Width: | Height: | Size: 880 KiB |
After Width: | Height: | Size: 88 KiB |
After Width: | Height: | Size: 9.1 KiB |
@ -0,0 +1,22 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################### |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Aysha Shalin (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# 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 (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC |
|||
# LICENSE (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################### |
|||
from . import trial_balance_report |
@ -0,0 +1,137 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################### |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Aysha Shalin (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# 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 (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC |
|||
# LICENSE (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################### |
|||
from odoo import fields, models |
|||
|
|||
selection_field = {'posted': 'Posted Entries only', |
|||
'draft': 'Include UnPosted Entries'} |
|||
|
|||
|
|||
class TrialBalanceReport(models.TransientModel): |
|||
""" Create new model """ |
|||
_name = 'trial.balance.report' |
|||
_description = 'trial balance report' |
|||
|
|||
start_date = fields.Date(string="Start Date", |
|||
help="Select start date to fetch the trial " |
|||
"balance data") |
|||
end_date = fields.Date(string="End Date", |
|||
help="Select end date to fetch the trial " |
|||
"balance data") |
|||
journals_ids = fields.Many2many('account.journal', string="Journals", |
|||
help="Select the journals to added in the" |
|||
"trail balance") |
|||
company_id = fields.Many2one('res.company', string="Company", |
|||
help="Select the company of the journals", |
|||
default=lambda self: self.env.company) |
|||
state = fields.Selection([ |
|||
('posted', 'Posted Entries only'), |
|||
('draft', 'Include UnPosted Entries'), |
|||
], tracking=True, string="State", help="Select the state of journal " |
|||
"entries which we want to report") |
|||
|
|||
def button_to_get_pdf(self): |
|||
""" It will create the report using defined query """ |
|||
where_conditions = [] |
|||
parameters = [] |
|||
state_value = "" |
|||
currency = self.env.user.company_id.currency_id.symbol |
|||
if self.start_date: |
|||
where_conditions.append("account_move_line.date >= %s") |
|||
parameters.append(self.start_date) |
|||
if self.end_date: |
|||
where_conditions.append("account_move_line.date <= %s") |
|||
parameters.append(self.end_date) |
|||
if self.company_id: |
|||
where_conditions.append("account_move_line.company_id = %s") |
|||
parameters.append(str(self.company_id.id)) |
|||
if self.state == 'posted': |
|||
where_conditions.append("parent_state = 'posted'") |
|||
if self.state == 'draft': |
|||
where_conditions.append("parent_state in ('posted', 'draft')") |
|||
if self.journals_ids: |
|||
journal_ids = [journal.id for journal in self.journals_ids] |
|||
where_conditions.append("journal_id IN %s") |
|||
parameters.append(tuple(journal_ids)) |
|||
where_query = " AND ".join(where_conditions) |
|||
query = """ |
|||
SELECT |
|||
account_id, |
|||
account_account.name AS ac_name, |
|||
SUM(account_move_line.debit) AS debit, |
|||
SUM(account_move_line.credit) AS credit, |
|||
SUM(account_move_line.debit) - SUM(account_move_line.credit) AS |
|||
balance |
|||
FROM |
|||
account_move_line |
|||
JOIN |
|||
account_account ON account_account.id = |
|||
account_move_line.account_id |
|||
{} |
|||
GROUP BY |
|||
account_id, |
|||
account_account.name |
|||
""".format("WHERE " + where_query if where_conditions else "") |
|||
self.env.cr.execute(query, tuple(parameters)) |
|||
main_query = self.env.cr.dictfetchall() |
|||
account_ids = self.env['account.account'].search([]).ids |
|||
accounts = self.env['account.account'].browse(account_ids) |
|||
account_codes = {account.id: account.code for account in accounts} |
|||
final_results = [] |
|||
for row in main_query: |
|||
account_id = row['account_id'] |
|||
ac_name = row['ac_name'] |
|||
debit = row['debit'] |
|||
credit = row['credit'] |
|||
balance = row['balance'] |
|||
# Fetch the computed `code` of accounts |
|||
code = account_codes.get(account_id, '') |
|||
final_results.append({ |
|||
'code': code, |
|||
'ac_name': ac_name, |
|||
'debit': debit, |
|||
'credit': credit, |
|||
'balance': balance, |
|||
}) |
|||
total_credit = 0.0 |
|||
total_debit = 0.0 |
|||
for rec in main_query: |
|||
total_credit += rec['credit'] |
|||
total_debit += rec['debit'] |
|||
balance = total_debit - total_credit |
|||
if self.state: |
|||
state_value = selection_field[self.state] |
|||
journals = str(self.journals_ids.mapped('name')) |
|||
result = journals[1:-1].replace("'", "") |
|||
data = { |
|||
'query': final_results, |
|||
'start_date': self.start_date, |
|||
'end_date': self.end_date, |
|||
'total_credit': round(total_credit, 2), |
|||
'total_debit': round(total_debit, 2), |
|||
'balance': round(balance), |
|||
'currency': currency, |
|||
'state': state_value, |
|||
'journals_name': result |
|||
} |
|||
return self.env.ref( |
|||
'trial_balance_pdf.action_report_trial_balance').report_action( |
|||
self, data=data) |
@ -0,0 +1,45 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<odoo> |
|||
<!-- Define Model View --> |
|||
<record id="trial_balance_report_view_form" model="ir.ui.view"> |
|||
<field name="name">trial.balance.report.view.form</field> |
|||
<field name="model">trial.balance.report</field> |
|||
<field name="arch" type="xml"> |
|||
<form> |
|||
<sheet> |
|||
<group> |
|||
<field name="start_date"/> |
|||
<field name="end_date"/> |
|||
</group> |
|||
<group> |
|||
<field name="journals_ids" options="{'no_create': True}" |
|||
widget="many2many_tags"/> |
|||
<field name="company_id" invisible="1"/> |
|||
<field name="state" widget="radio"/> |
|||
</group> |
|||
</sheet> |
|||
<footer> |
|||
<button name="button_to_get_pdf" string="PDF" type="object" |
|||
class="oe_highlight"/> |
|||
<button string="Cancel" class="btn btn-default" |
|||
special="cancel"/> |
|||
</footer> |
|||
</form> |
|||
</field> |
|||
</record> |
|||
<!-- Model Action --> |
|||
<record id="trial_balance_report_action" model="ir.actions.act_window"> |
|||
<field name="name">Trial Balance Report</field> |
|||
<field name="res_model">trial.balance.report</field> |
|||
<field name="view_mode">list,form</field> |
|||
<field name="view_id" ref="trial_balance_report_view_form"/> |
|||
<field name="target">new</field> |
|||
</record> |
|||
<!-- Top Menu --> |
|||
<menuitem id="account_audit_reports" name="Audit Reports" sequence="8" |
|||
parent="account.menu_finance_reports"> |
|||
<menuitem id="account_trial_balance_report" |
|||
name="Trial Balance" |
|||
action="trial_balance_report_action"/> |
|||
</menuitem> |
|||
</odoo> |