diff --git a/advance_cash_flow_statements/README.rst b/advance_cash_flow_statements/README.rst new file mode 100644 index 000000000..5e63de140 --- /dev/null +++ b/advance_cash_flow_statements/README.rst @@ -0,0 +1,48 @@ +.. 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 + +Advanced Cash Flow Statements +============================== +Generate 4 levels of Dynamic Cash Flow Statements Report. + +Configuration +============= +No configuration + +Company +------- +* `Cybrosys Techno Solutions `__ + +License +------- +General Public License, Version 3 (AGPL v3). +(https://www.gnu.org/licenses/agpl-3.0-standalone.html) + +Credits +------- +Developer: (V17) Mily Shajan , + (v17) Gayathri V, +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 `__ + +Further information +=================== +HTML Description: ``__ diff --git a/advance_cash_flow_statements/__init__.py b/advance_cash_flow_statements/__init__.py new file mode 100644 index 000000000..a48d98354 --- /dev/null +++ b/advance_cash_flow_statements/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Gayathri V (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 . +# +########################################################################## +from . import controllers +from . import wizard diff --git a/advance_cash_flow_statements/__manifest__.py b/advance_cash_flow_statements/__manifest__.py new file mode 100644 index 000000000..10b099095 --- /dev/null +++ b/advance_cash_flow_statements/__manifest__.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Gayathri V (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 . +# +########################################################################## +{ + 'name': 'Advanced Cash Flow Statements', + 'version': '17.0.1.0.0', + 'summary': """Generate four levels of cash flow statement reports in PDF and + Excel""", + 'description': """Generate four levels of cash flow statement reports in PDF + and Excel, pdf report, excel report, + cashflow, odoo17""", + 'author': "Cybrosys Techno Solutions", + 'company': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'website': "https://www.cybrosys.com", + 'category': 'Accounting', + 'depends': ['account_accountant', 'account'], + 'data': ['security/ir.model.access.csv', + 'report/account_wizard_reports.xml', + 'report/account_wizard_templates.xml', + 'views/account_wizard_views.xml', + ], + 'assets': { + 'web.assets_backend': [ + 'advance_cash_flow_statements/static/src/js/action_manager.js' + ], + }, + 'images': ['static/description/banner.jpg'], + 'license': 'AGPL-3', + 'installable': True, + 'auto_install': False, + 'application': False, +} diff --git a/advance_cash_flow_statements/controllers/__init__.py b/advance_cash_flow_statements/controllers/__init__.py new file mode 100644 index 000000000..bc361b4f2 --- /dev/null +++ b/advance_cash_flow_statements/controllers/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Gayathri V (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 . +# +########################################################################## +from . import advance_cash_flow_statements diff --git a/advance_cash_flow_statements/controllers/advance_cash_flow_statements.py b/advance_cash_flow_statements/controllers/advance_cash_flow_statements.py new file mode 100644 index 000000000..6f240a561 --- /dev/null +++ b/advance_cash_flow_statements/controllers/advance_cash_flow_statements.py @@ -0,0 +1,58 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Gayathri V (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 . +# +########################################################################## +import json +from odoo import http +from odoo.http import content_disposition, request +from odoo.tools import html_escape + + +class XLSXReportController(http.Controller): + """ Generates an XLSX report. """ + @http.route('/xlsx_reports', type='http', auth='user', + methods=['POST'], csrf=False) + def get_report_xlsx(self, model, options, output_format, report_name): + """ Generates an XLSX report. """ + uid = request.session.uid + report_obj = request.env[model].with_user(uid) + options = json.loads(options) + token = 'dummy-because-api-expects-one' + try: + if output_format == 'xlsx': + response = request.make_response( + None, + headers=[ + ('Content-Type', 'application/vnd.ms-excel'), + ('Content-Disposition', content_disposition( + report_name + '.xlsx')) + ] + ) + report_obj.get_xlsx_report(options, response) + response.set_cookie('fileToken', token) + return response + except Exception as e: + se = http.serialize_exception(e) + error = { + 'code': 200, + 'message': 'Odoo Server Error', + 'data': se + } + return request.make_response(html_escape(json.dumps(error))) diff --git a/advance_cash_flow_statements/doc/RELEASE_NOTES.md b/advance_cash_flow_statements/doc/RELEASE_NOTES.md new file mode 100644 index 000000000..5746e88fc --- /dev/null +++ b/advance_cash_flow_statements/doc/RELEASE_NOTES.md @@ -0,0 +1,6 @@ +## Module + +#### 27.03.2024 +#### Version 17.0.1.0.0 +##### ADD +- Initial commit for Advanced Cash Flow Statements diff --git a/advance_cash_flow_statements/report/account_wizard_reports.xml b/advance_cash_flow_statements/report/account_wizard_reports.xml new file mode 100644 index 000000000..c187dab4f --- /dev/null +++ b/advance_cash_flow_statements/report/account_wizard_reports.xml @@ -0,0 +1,11 @@ + + + + + Cash flow statement Pdf Report + account.wizard + qweb-pdf + advance_cash_flow_statements.cash_flow_pdf_report + advance_cash_flow_statements.cash_flow_pdf_report + + diff --git a/advance_cash_flow_statements/report/account_wizard_templates.xml b/advance_cash_flow_statements/report/account_wizard_templates.xml new file mode 100644 index 000000000..5324bc603 --- /dev/null +++ b/advance_cash_flow_statements/report/account_wizard_templates.xml @@ -0,0 +1,233 @@ + + + + + diff --git a/advance_cash_flow_statements/security/ir.model.access.csv b/advance_cash_flow_statements/security/ir.model.access.csv new file mode 100644 index 000000000..b7a5b4683 --- /dev/null +++ b/advance_cash_flow_statements/security/ir.model.access.csv @@ -0,0 +1,2 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_account_wizard_user,account.wizard.user,model_account_wizard,base.group_user,1,1,1,1 diff --git a/advance_cash_flow_statements/static/description/assets/icons/capture (1).png b/advance_cash_flow_statements/static/description/assets/icons/capture (1).png new file mode 100644 index 000000000..8824deafc Binary files /dev/null and b/advance_cash_flow_statements/static/description/assets/icons/capture (1).png differ diff --git a/advance_cash_flow_statements/static/description/assets/icons/check.png b/advance_cash_flow_statements/static/description/assets/icons/check.png new file mode 100644 index 000000000..c8e85f51d Binary files /dev/null and b/advance_cash_flow_statements/static/description/assets/icons/check.png differ diff --git a/advance_cash_flow_statements/static/description/assets/icons/chevron.png b/advance_cash_flow_statements/static/description/assets/icons/chevron.png new file mode 100644 index 000000000..2089293d6 Binary files /dev/null and b/advance_cash_flow_statements/static/description/assets/icons/chevron.png differ diff --git a/advance_cash_flow_statements/static/description/assets/icons/cogs.png b/advance_cash_flow_statements/static/description/assets/icons/cogs.png new file mode 100644 index 000000000..95d0bad62 Binary files /dev/null and b/advance_cash_flow_statements/static/description/assets/icons/cogs.png differ diff --git a/advance_cash_flow_statements/static/description/assets/icons/consultation.png b/advance_cash_flow_statements/static/description/assets/icons/consultation.png new file mode 100644 index 000000000..8319d4baa Binary files /dev/null and b/advance_cash_flow_statements/static/description/assets/icons/consultation.png differ diff --git a/advance_cash_flow_statements/static/description/assets/icons/ecom-black.png b/advance_cash_flow_statements/static/description/assets/icons/ecom-black.png new file mode 100644 index 000000000..a9385ff13 Binary files /dev/null and b/advance_cash_flow_statements/static/description/assets/icons/ecom-black.png differ diff --git a/advance_cash_flow_statements/static/description/assets/icons/education-black.png b/advance_cash_flow_statements/static/description/assets/icons/education-black.png new file mode 100644 index 000000000..3eb09b27b Binary files /dev/null and b/advance_cash_flow_statements/static/description/assets/icons/education-black.png differ diff --git a/advance_cash_flow_statements/static/description/assets/icons/hotel-black.png b/advance_cash_flow_statements/static/description/assets/icons/hotel-black.png new file mode 100644 index 000000000..130f613be Binary files /dev/null and b/advance_cash_flow_statements/static/description/assets/icons/hotel-black.png differ diff --git a/advance_cash_flow_statements/static/description/assets/icons/img.png b/advance_cash_flow_statements/static/description/assets/icons/img.png new file mode 100644 index 000000000..70197f477 Binary files /dev/null and b/advance_cash_flow_statements/static/description/assets/icons/img.png differ diff --git a/advance_cash_flow_statements/static/description/assets/icons/license.png b/advance_cash_flow_statements/static/description/assets/icons/license.png new file mode 100644 index 000000000..a5869797e Binary files /dev/null and b/advance_cash_flow_statements/static/description/assets/icons/license.png differ diff --git a/advance_cash_flow_statements/static/description/assets/icons/lifebuoy.png b/advance_cash_flow_statements/static/description/assets/icons/lifebuoy.png new file mode 100644 index 000000000..658d56ccc Binary files /dev/null and b/advance_cash_flow_statements/static/description/assets/icons/lifebuoy.png differ diff --git a/advance_cash_flow_statements/static/description/assets/icons/manufacturing-black.png b/advance_cash_flow_statements/static/description/assets/icons/manufacturing-black.png new file mode 100644 index 000000000..697eb0e9f Binary files /dev/null and b/advance_cash_flow_statements/static/description/assets/icons/manufacturing-black.png differ diff --git a/advance_cash_flow_statements/static/description/assets/icons/photo-capture.png b/advance_cash_flow_statements/static/description/assets/icons/photo-capture.png new file mode 100644 index 000000000..06c111758 Binary files /dev/null and b/advance_cash_flow_statements/static/description/assets/icons/photo-capture.png differ diff --git a/advance_cash_flow_statements/static/description/assets/icons/pos-black.png b/advance_cash_flow_statements/static/description/assets/icons/pos-black.png new file mode 100644 index 000000000..97c0f90c1 Binary files /dev/null and b/advance_cash_flow_statements/static/description/assets/icons/pos-black.png differ diff --git a/advance_cash_flow_statements/static/description/assets/icons/puzzle.png b/advance_cash_flow_statements/static/description/assets/icons/puzzle.png new file mode 100644 index 000000000..65cf854e7 Binary files /dev/null and b/advance_cash_flow_statements/static/description/assets/icons/puzzle.png differ diff --git a/advance_cash_flow_statements/static/description/assets/icons/restaurant-black.png b/advance_cash_flow_statements/static/description/assets/icons/restaurant-black.png new file mode 100644 index 000000000..4a35eb939 Binary files /dev/null and b/advance_cash_flow_statements/static/description/assets/icons/restaurant-black.png differ diff --git a/advance_cash_flow_statements/static/description/assets/icons/service-black.png b/advance_cash_flow_statements/static/description/assets/icons/service-black.png new file mode 100644 index 000000000..301ab51cb Binary files /dev/null and b/advance_cash_flow_statements/static/description/assets/icons/service-black.png differ diff --git a/advance_cash_flow_statements/static/description/assets/icons/trading-black.png b/advance_cash_flow_statements/static/description/assets/icons/trading-black.png new file mode 100644 index 000000000..9398ba2f1 Binary files /dev/null and b/advance_cash_flow_statements/static/description/assets/icons/trading-black.png differ diff --git a/advance_cash_flow_statements/static/description/assets/icons/training.png b/advance_cash_flow_statements/static/description/assets/icons/training.png new file mode 100644 index 000000000..884ca024d Binary files /dev/null and b/advance_cash_flow_statements/static/description/assets/icons/training.png differ diff --git a/advance_cash_flow_statements/static/description/assets/icons/update.png b/advance_cash_flow_statements/static/description/assets/icons/update.png new file mode 100644 index 000000000..ecbc5a01a Binary files /dev/null and b/advance_cash_flow_statements/static/description/assets/icons/update.png differ diff --git a/advance_cash_flow_statements/static/description/assets/icons/user.png b/advance_cash_flow_statements/static/description/assets/icons/user.png new file mode 100644 index 000000000..6ffb23d9f Binary files /dev/null and b/advance_cash_flow_statements/static/description/assets/icons/user.png differ diff --git a/advance_cash_flow_statements/static/description/assets/icons/wrench.png b/advance_cash_flow_statements/static/description/assets/icons/wrench.png new file mode 100644 index 000000000..6c04dea0f Binary files /dev/null and b/advance_cash_flow_statements/static/description/assets/icons/wrench.png differ diff --git a/advance_cash_flow_statements/static/description/assets/misc/Cybrosys R.png b/advance_cash_flow_statements/static/description/assets/misc/Cybrosys R.png new file mode 100644 index 000000000..da4058087 Binary files /dev/null and b/advance_cash_flow_statements/static/description/assets/misc/Cybrosys R.png differ diff --git a/advance_cash_flow_statements/static/description/assets/misc/email.svg b/advance_cash_flow_statements/static/description/assets/misc/email.svg new file mode 100644 index 000000000..15291cdc3 --- /dev/null +++ b/advance_cash_flow_statements/static/description/assets/misc/email.svg @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/advance_cash_flow_statements/static/description/assets/misc/phone.svg b/advance_cash_flow_statements/static/description/assets/misc/phone.svg new file mode 100644 index 000000000..b7bd7f251 --- /dev/null +++ b/advance_cash_flow_statements/static/description/assets/misc/phone.svg @@ -0,0 +1,3 @@ + + + diff --git a/advance_cash_flow_statements/static/description/assets/misc/star (1) 2.svg b/advance_cash_flow_statements/static/description/assets/misc/star (1) 2.svg new file mode 100644 index 000000000..5ae9f507a --- /dev/null +++ b/advance_cash_flow_statements/static/description/assets/misc/star (1) 2.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/advance_cash_flow_statements/static/description/assets/misc/support (1) 1.svg b/advance_cash_flow_statements/static/description/assets/misc/support (1) 1.svg new file mode 100644 index 000000000..7d37a8f30 --- /dev/null +++ b/advance_cash_flow_statements/static/description/assets/misc/support (1) 1.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/advance_cash_flow_statements/static/description/assets/misc/support-email.svg b/advance_cash_flow_statements/static/description/assets/misc/support-email.svg new file mode 100644 index 000000000..eb70370d6 --- /dev/null +++ b/advance_cash_flow_statements/static/description/assets/misc/support-email.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/advance_cash_flow_statements/static/description/assets/misc/tick-mark.svg b/advance_cash_flow_statements/static/description/assets/misc/tick-mark.svg new file mode 100644 index 000000000..2dbb40187 --- /dev/null +++ b/advance_cash_flow_statements/static/description/assets/misc/tick-mark.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/advance_cash_flow_statements/static/description/assets/misc/whatsapp 1.svg b/advance_cash_flow_statements/static/description/assets/misc/whatsapp 1.svg new file mode 100644 index 000000000..0bfaf8fc6 --- /dev/null +++ b/advance_cash_flow_statements/static/description/assets/misc/whatsapp 1.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/advance_cash_flow_statements/static/description/assets/misc/whatsapp.svg b/advance_cash_flow_statements/static/description/assets/misc/whatsapp.svg new file mode 100644 index 000000000..b618aea1d --- /dev/null +++ b/advance_cash_flow_statements/static/description/assets/misc/whatsapp.svg @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/advance_cash_flow_statements/static/description/assets/modules/1.png b/advance_cash_flow_statements/static/description/assets/modules/1.png new file mode 100644 index 000000000..ba1058c42 Binary files /dev/null and b/advance_cash_flow_statements/static/description/assets/modules/1.png differ diff --git a/advance_cash_flow_statements/static/description/assets/modules/2.png b/advance_cash_flow_statements/static/description/assets/modules/2.png new file mode 100644 index 000000000..6949185dd Binary files /dev/null and b/advance_cash_flow_statements/static/description/assets/modules/2.png differ diff --git a/advance_cash_flow_statements/static/description/assets/modules/3.png b/advance_cash_flow_statements/static/description/assets/modules/3.png new file mode 100644 index 000000000..4e506f79b Binary files /dev/null and b/advance_cash_flow_statements/static/description/assets/modules/3.png differ diff --git a/advance_cash_flow_statements/static/description/assets/modules/4.png b/advance_cash_flow_statements/static/description/assets/modules/4.png new file mode 100644 index 000000000..e78427938 Binary files /dev/null and b/advance_cash_flow_statements/static/description/assets/modules/4.png differ diff --git a/advance_cash_flow_statements/static/description/assets/modules/5.png b/advance_cash_flow_statements/static/description/assets/modules/5.png new file mode 100755 index 000000000..272ec20f9 Binary files /dev/null and b/advance_cash_flow_statements/static/description/assets/modules/5.png differ diff --git a/advance_cash_flow_statements/static/description/assets/modules/6.png b/advance_cash_flow_statements/static/description/assets/modules/6.png new file mode 100644 index 000000000..7d5c3154f Binary files /dev/null and b/advance_cash_flow_statements/static/description/assets/modules/6.png differ diff --git a/advance_cash_flow_statements/static/description/assets/screenshots/1.png b/advance_cash_flow_statements/static/description/assets/screenshots/1.png new file mode 100644 index 000000000..305c7128e Binary files /dev/null and b/advance_cash_flow_statements/static/description/assets/screenshots/1.png differ diff --git a/advance_cash_flow_statements/static/description/assets/screenshots/10.png b/advance_cash_flow_statements/static/description/assets/screenshots/10.png new file mode 100644 index 000000000..1a27fcd16 Binary files /dev/null and b/advance_cash_flow_statements/static/description/assets/screenshots/10.png differ diff --git a/advance_cash_flow_statements/static/description/assets/screenshots/2.png b/advance_cash_flow_statements/static/description/assets/screenshots/2.png new file mode 100644 index 000000000..9463126b0 Binary files /dev/null and b/advance_cash_flow_statements/static/description/assets/screenshots/2.png differ diff --git a/advance_cash_flow_statements/static/description/assets/screenshots/3.png b/advance_cash_flow_statements/static/description/assets/screenshots/3.png new file mode 100644 index 000000000..db43d5277 Binary files /dev/null and b/advance_cash_flow_statements/static/description/assets/screenshots/3.png differ diff --git a/advance_cash_flow_statements/static/description/assets/screenshots/4.png b/advance_cash_flow_statements/static/description/assets/screenshots/4.png new file mode 100644 index 000000000..d88331e67 Binary files /dev/null and b/advance_cash_flow_statements/static/description/assets/screenshots/4.png differ diff --git a/advance_cash_flow_statements/static/description/assets/screenshots/5.png b/advance_cash_flow_statements/static/description/assets/screenshots/5.png new file mode 100644 index 000000000..8bb72be43 Binary files /dev/null and b/advance_cash_flow_statements/static/description/assets/screenshots/5.png differ diff --git a/advance_cash_flow_statements/static/description/assets/screenshots/6.png b/advance_cash_flow_statements/static/description/assets/screenshots/6.png new file mode 100644 index 000000000..9b0111dda Binary files /dev/null and b/advance_cash_flow_statements/static/description/assets/screenshots/6.png differ diff --git a/advance_cash_flow_statements/static/description/assets/screenshots/7.png b/advance_cash_flow_statements/static/description/assets/screenshots/7.png new file mode 100644 index 000000000..63c0ea456 Binary files /dev/null and b/advance_cash_flow_statements/static/description/assets/screenshots/7.png differ diff --git a/advance_cash_flow_statements/static/description/assets/screenshots/8.png b/advance_cash_flow_statements/static/description/assets/screenshots/8.png new file mode 100644 index 000000000..97f0c2f88 Binary files /dev/null and b/advance_cash_flow_statements/static/description/assets/screenshots/8.png differ diff --git a/advance_cash_flow_statements/static/description/assets/screenshots/9.png b/advance_cash_flow_statements/static/description/assets/screenshots/9.png new file mode 100644 index 000000000..d797f17ba Binary files /dev/null and b/advance_cash_flow_statements/static/description/assets/screenshots/9.png differ diff --git a/advance_cash_flow_statements/static/description/assets/screenshots/hero.png b/advance_cash_flow_statements/static/description/assets/screenshots/hero.png new file mode 100644 index 000000000..006db6822 Binary files /dev/null and b/advance_cash_flow_statements/static/description/assets/screenshots/hero.png differ diff --git a/advance_cash_flow_statements/static/description/banner.jpg b/advance_cash_flow_statements/static/description/banner.jpg new file mode 100644 index 000000000..3d85cac82 Binary files /dev/null and b/advance_cash_flow_statements/static/description/banner.jpg differ diff --git a/advance_cash_flow_statements/static/description/icon.png b/advance_cash_flow_statements/static/description/icon.png new file mode 100644 index 000000000..3f3454cfe Binary files /dev/null and b/advance_cash_flow_statements/static/description/icon.png differ diff --git a/advance_cash_flow_statements/static/description/index.html b/advance_cash_flow_statements/static/description/index.html new file mode 100644 index 000000000..f71b3cd5f --- /dev/null +++ b/advance_cash_flow_statements/static/description/index.html @@ -0,0 +1,712 @@ + + + + + + + Odoo App 3 Index + + + + + + + + +
+
+
+
+
+ +
+
+
+ Community +
+
+ Enterprise +
+
+ Odoo.sh +
+
+
+
+
+
+

+ Advanced Cash Flow Statements

+

+ Generate four levels of cash flow statements. + Print reports in both PDF and XLSX formats +

+
+ +
+
+
+
+
+

Key Highlights +

+
+
+
+
+
+ +
+
+

Levels of Cash Flow

+

Generate four levels of cash flow statements. +

+
+
+
+
+
+
+ +
+
+

Print reports in both PDF and XLSX + formats

+

It gives four levels reports in both formats +

+
+
+
+
+
+ +
+
+
+
+
+ +
+
+

+ Access Advanced Cash Flow from the Menu +
+ Go to Invoicing --> Reporting --> Financial Reports --> Adv Cash Flow Statement. +

+
+
+
+
+
+
+ +
+
+

+ Cash Flow Report in PDF and Excel

+
+
+
+
+
+
+ +
+
+

+ Cash Flow Statement Summary PDF

+
+
+
+
+
+
+ +
+
+

+ Cash Flow Statement Summary Excel

+
+
+
+
+
+
+ +
+
+

+ Cash flow Statement Consolidated PDF Report.

+
+
+
+
+
+
+ +
+
+

+ Cash Flow Statement Consolidated Excel

+
+
+
+
+
+
+ +
+
+

+ Cash flow Statement Detailed PDF Report

+
+
+
+
+
+
+ +
+
+

+ Cash flow Statement Detailed Excel Report

+
+
+
+ +
+
+
+ +
+
+

+ Cash flow Statement Very Detailed PDF Report.

+
+
+
+
+
+
+ +
+
+

+ Cash flow Statement Very Detailed Excel Report.

+
+
+
+
+
+
+
    +
  • + Based on the chosen date + gives four levels of cash flow +
  • +
  • + Analysing of Cash flow as + more easier +
  • +
  • + + Summary +
      +
    • Month wise cash flow report. +
    • +
    +
  • +
  • + + Consolidated +
      +
    • Report based on the cash flow affected accounts. +
    • +
    +
  • +
  • + + Detailed +
      +
    • Report based on the cash flow affected accounts. +
    • +
    +
  • +
  • + Very Detailed +
      +
    • Report shows the cash flow affected account,corresponding journal entries + and its move lines +
    • +
    +
  • + +
+
+
+
+
+
+
Version + 17.0.1.0.0|Released on:27th March 2024 +
+

+ + Initial Commit for Advanced Cash Flow Statements.

+
+
+
+
+
+
+
+

Related Products

+
+
+ +
+
+

Our Services

+ +
+
+
+
+
+
+
+
+ service-icon +
+
+

Odoo Customization

+
+
+
+
+
+
+ service-icon +
+
+

Odoo Implementation

+
+
+
+
+
+
+ service-icon +
+
+

Odoo Support

+
+
+
+
+
+
+ service-icon +
+
+

Hire Odoo Developer

+
+
+
+
+ +
+
+ service-icon +
+
+

Odoo Integration

+
+
+
+
+
+
+ service-icon +
+
+

Odoo Migration

+
+
+
+
+
+
+ service-icon +
+
+

Odoo Consultancy

+
+
+
+
+
+
+ service-icon +
+
+

Odoo Implementation

+
+
+
+
+
+
+ service-icon +
+
+

Odoo Licensing Consultancy

+
+
+
+
+
+
+

Our Industries

+ +
+
+
+
+
+
+ +

Trading

+

Easily procure and sell your products

+
+
+
+
+ +

POS

+

Easy configuration and convivial experience

+
+
+
+
+ +

Education

+

A platform for educational management

+
+
+
+
+ +

Manufacturing

+

Plan, track and schedule your operations

+
+
+
+
+ +

E-commerce & Website

+

Mobile friendly, awe-inspiring product pages

+
+
+
+
+ +

Service Management

+

Keep track of services and invoice

+
+
+
+
+ +

Restaurant

+

Run your bar or restaurant methodically

+
+
+
+
+ +

Hotel Management

+

An all-inclusive hotel management application

+
+
+
+
+
+
+

Support

+
+
+
+
+
+
+
+ +
+ Need + Help? +

Got questions or need help? Get in touch.

+
odoo@cybrosys.com +
+
+
+
+
+
+
+
+ +
+ WhatsApp +

Say hi to us on WhatsApp!

+
+91 + 99456767686 +
+
+
+
+
+
+
+
+
+
+ + + + + + diff --git a/advance_cash_flow_statements/static/src/js/action_manager.js b/advance_cash_flow_statements/static/src/js/action_manager.js new file mode 100644 index 000000000..8eed9cf0e --- /dev/null +++ b/advance_cash_flow_statements/static/src/js/action_manager.js @@ -0,0 +1,16 @@ +/** @odoo-module */ +import { registry } from "@web/core/registry"; +import { BlockUI } from "@web/core/ui/block_ui"; +import { download } from "@web/core/network/download"; +// This function is responsible for generating and downloading an XLSX report. +registry.category("ir.actions.report handlers").add("xlsx", async function (action){ + if (action.report_type === 'xlsx') { + const blockUI = new BlockUI(); + await download({ + url: '/xlsx_reports', + data: action.data, + complete: () => unblockUI, + error: (error) => self.call('crash_manager', 'rpc_error', error), + }); + } +}); diff --git a/advance_cash_flow_statements/views/account_wizard_views.xml b/advance_cash_flow_statements/views/account_wizard_views.xml new file mode 100644 index 000000000..18ed1bbb3 --- /dev/null +++ b/advance_cash_flow_statements/views/account_wizard_views.xml @@ -0,0 +1,52 @@ + + + + + account.wizard.form.view + account.wizard + +
+ + + + + + + + + + +
+
+
+
+
+ + + Cash Flow Statements + ir.actions.act_window + account.wizard + + form + new + + + + +
diff --git a/advance_cash_flow_statements/wizard/__init__.py b/advance_cash_flow_statements/wizard/__init__.py new file mode 100644 index 000000000..ebcc2a719 --- /dev/null +++ b/advance_cash_flow_statements/wizard/__init__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Gayathri V (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 . +# +########################################################################## +from . import account_account +from . import account_wizard +from . import report_account_wizard diff --git a/advance_cash_flow_statements/wizard/account_account.py b/advance_cash_flow_statements/wizard/account_account.py new file mode 100644 index 000000000..707b234b6 --- /dev/null +++ b/advance_cash_flow_statements/wizard/account_account.py @@ -0,0 +1,90 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Gayathri V (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 . +# +########################################################################## +from odoo import api, models, fields +from odoo.tools.misc import get_lang + + +class Account(models.Model): + _inherit = "account.report" + _description = "Account Common Report" + """This is used to inherit account report to add more fields and + functions""" + + company_id = fields.Many2one('res.company', string='Company', required=True, + readonly=True, + default=lambda self: self.env.company, + help='default Company') + journal_ids = fields.Many2many( + comodel_name='account.journal', + string='Journals', + required=True, + default=lambda self: self.env['account.journal'].search( + [('company_id', '=', self.company_id.id)]), + domain="[('company_id', '=', company_id)]", help='Gives the journal of ' + 'the default company') + date_from = fields.Date(string='Start Date', + help='Date at which report need to be start') + date_to = fields.Date(string='End Date', + help='Date at which report need to be End') + target_move = fields.Selection([('posted', 'All Posted Entries'), + ('all', 'All Entries'), + ], string='Target Moves', required=True, + default='posted', help='Type of entries') + + @api.onchange('company_id') + def _onchange_company_id(self): + """ Fetch the journal values based on company""" + if self.company_id: + self.journal_ids = self.env['account.journal'].search( + [('company_id', '=', self.company_id.id)]) + else: + self.journal_ids = self.env['account.journal'].search([]) + + def _build_contexts(self, data): + """ Pass the context values for report""" + 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 '' + result['date_from'] = data['form']['date_from'] or False + result['date_to'] = data['form']['date_to'] or False + result['strict_range'] = True if result['date_from'] else False + result['company_id'] = data['form']['company_id'][0] or False + return result + + def _print_report(self, data): + """ Report print action""" + raise NotImplementedError() + + def check_report(self): + """ Return the values for report""" + self.ensure_one() + data = {'ids': self.env.context.get('active_ids', []), + 'model': self.env.context.get('active_model', 'ir.ui.menu'), + 'form': self.read( + ['date_from', 'date_to', 'journal_ids', 'target_move', + 'company_id'])[0]} + used_context = self._build_contexts(data) + data['form']['used_context'] = dict(used_context, + lang=get_lang(self.env).code) + return self.with_context(discard_logo_check=True)._print_report(data) diff --git a/advance_cash_flow_statements/wizard/account_wizard.py b/advance_cash_flow_statements/wizard/account_wizard.py new file mode 100644 index 000000000..de2d59e12 --- /dev/null +++ b/advance_cash_flow_statements/wizard/account_wizard.py @@ -0,0 +1,467 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Gayathri V (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 . +# +########################################################################## +import json +from datetime import datetime +from odoo import models, fields, _ +from odoo.exceptions import UserError +from odoo.tools import date_utils, io + +try: + from odoo.tools.misc import xlsxwriter +except ImportError: + import xlsxwriter + + +class AccountWizard(models.TransientModel): + _name = "account.wizard" + _description = 'Account Wizard' + + name = fields.Char(default="Invoice", help='Name of Invoice ') + date_from = fields.Date(string="Start Date", required=True, + help='Date at which report need to be start') + date_to = fields.Date(string="End Date", default=fields.Date.today, + required=True, + help='Date at which report need to be end') + today = fields.Date("Report Date", default=fields.Date.today, + help='Date at which report is generated') + levels = fields.Selection([('summary', 'Summary'), + ('consolidated', 'Consolidated'), + ('detailed', 'Detailed'), + ('very', 'Very Detailed')], + string='Levels', required=True, default='summary', + help='Different levels for cash flow statements\n' + 'Summary: Month wise report.\n' + 'Consolidated: Based on account types.\n' + 'Detailed: Based on accounts.\n' + 'Very Detailed: Accounts with their move lines') + target_move = fields.Selection([('posted', 'All Posted Entries'), + ('all', 'All Entries'), + ], string='Target Moves', required=True, + default='posted', help='Type of entries') + + def generate_pdf_report(self): + """ Generate the pdf reports and return values to template""" + self.ensure_one() + logged_users = self.env['res.company']._company_default_get( + 'account.account') + if self.date_from: + if self.date_from > self.date_to: + raise UserError(_("Start date should be less than end date")) + data = { + 'ids': self.ids, + 'model': self._name, + 'date_from': self.date_from, + 'date_to': self.date_to, + 'levels': self.levels, + 'target_move': self.target_move, + 'today': self.today, + 'logged_users': logged_users.name, + } + return self.env.ref( + 'advance_cash_flow_statements.pdf_report_action').report_action( + self, + data=data) + + def generate_xlsx_report(self): + """ Generate xlsx report return values to template""" + date_from = datetime.strptime(str(self.date_from), "%Y-%m-%d") + date_to = datetime.strptime(str(self.date_to), "%Y-%m-%d") + if date_from: + if date_from > date_to: + raise UserError(_("Start date should be less than end date")) + data = { + 'ids': self.ids, + 'model': self._name, + 'date_from': self.date_from, + 'date_to': self.date_to, + 'levels': self.levels, + 'target_move': self.target_move, + 'today': self.today, + } + return { + 'type': 'ir.actions.report', + 'report_type': 'xlsx', + 'data': {'model': 'account.wizard', + 'output_format': 'xlsx', + 'options': json.dumps(data, + default=date_utils.json_default), + 'report_name': 'Adv Cash Flow Statement', + }, + } + + def get_xlsx_report(self, data, response): + """ Update the xlsx template and pass values to templates""" + output = io.BytesIO() + workbook = xlsxwriter.Workbook(output, {'in_memory': True}) + fetched_data = [] + account_res = [] + journal_res = [] + fetched = [] + currency_symbol = self.env.user.company_id.currency_id.symbol + if data['levels'] == 'summary': + state = """ WHERE am.state = 'posted' """ if data[ + 'target_move'] == 'posted' else '' + query3 = """SELECT to_char(am.date, 'Month') as month_part, extract( + YEAR from am.date) as year_part, sum(aml.debit) AS total_debit, sum( + aml.credit) AS total_credit, sum(aml.balance) AS total_balance FROM( + SELECT am.date, am.id, am.state FROM account_move as am + LEFT JOIN account_move_line aml ON aml.move_id = am.id + LEFT JOIN account_account aa ON aa.id = aml.account_id + WHERE am.date BETWEEN '""" + str( + data['date_from']) + """' and '""" + str( + data['date_to']) + """' ) am + LEFT JOIN account_move_line aml ON aml.move_id = am.id + LEFT JOIN account_account aa ON aa.id = aml.account_id + """ + state + """GROUP BY month_part,year_part""" + cr = self._cr + cr.execute(query3) + fetched_data = cr.dictfetchall() + elif data['levels'] == 'consolidated': + state = """ WHERE am.state = 'posted' """ if data[ + 'target_move'] == 'posted' else '' + query2 = """SELECT aa.id,aa.name, sum(aml.debit) AS total_debit, sum( + aml.credit) AS total_credit,sum(aml.balance) AS total_balance FROM ( + SELECT am.id, am.state FROM account_move as am + LEFT JOIN account_move_line aml ON aml.move_id = am.id + LEFT JOIN account_account aa ON aa.id = aml.account_id + WHERE am.date BETWEEN '""" + str( + data['date_from']) + """' and '""" + str( + data['date_to']) + """' ) am + LEFT JOIN account_move_line aml ON aml.move_id = am.id + LEFT JOIN account_account aa ON aa.id = aml.account_id + """ + state + """GROUP BY aa.id,aa.name""" + cr = self._cr + cr.execute(query2) + fetched_data = cr.dictfetchall() + elif data['levels'] == 'detailed': + state = """ WHERE am.state = 'posted' """ if data[ + 'target_move'] == 'posted' else '' + query1 = """SELECT aa.id,aa.name,aa.code, sum(aml.debit) AS total_debit, + sum(aml.credit) AS total_credit,sum( + aml.balance) AS total_balance FROM ( + SELECT am.id, am.state FROM account_move as am + LEFT JOIN account_move_line aml ON aml.move_id = am.id + LEFT JOIN account_account aa ON aa.id = aml.account_id + WHERE am.date BETWEEN '""" + str( + data['date_from']) + """' and '""" + str( + data['date_to']) + """' ) am + LEFT JOIN account_move_line aml ON aml.move_id = am.id + LEFT JOIN account_account aa ON aa.id = aml.account_id + """ + state + """GROUP BY aa.id,aa.name, aa.code""" + cr = self._cr + cr.execute(query1) + fetched_data = cr.dictfetchall() + for account in self.env['account.account'].search([]): + child_lines = self._get_journal_lines(account, data) + if child_lines: + journal_res.append(child_lines) + else: + state = """AND am.state = 'posted' """ if data[ + 'target_move'] == 'posted' else '' + sql = """SELECT DISTINCT aa.name,aa.code, sum( + aml.debit) AS total_debit, + sum(aml.credit) AS total_credit FROM ( + SELECT am.* FROM account_move as am + LEFT JOIN account_move_line aml ON aml.move_id = am.id + LEFT JOIN account_account aa ON aa.id = aml.account_id + WHERE am.date BETWEEN '""" + str( + data['date_from']) + """' and '""" + str( + data['date_to']) + """' """ + state + """) am + LEFT JOIN account_move_line aml ON aml.move_id = am.id + LEFT JOIN account_account aa ON aa.id = aml.account_id + GROUP BY aa.name, aa.code""" + cr = self._cr + cr.execute(sql) + fetched = cr.dictfetchall() + for account in self.env['account.account'].search([]): + child_lines = self._get_lines(account, data) + if child_lines: + account_res.append(child_lines) + + logged_users = self.env['res.company']._company_default_get( + 'account.account') + sheet = workbook.add_worksheet() + bold = workbook.add_format({'align': 'center', + 'bold': True, + 'font_size': '10px', + 'border': 1}) + date = workbook.add_format({'font_size': '10px'}) + cell_format = workbook.add_format({'bold': True, + 'font_size': '10px'}) + head = workbook.add_format({'align': 'center', + 'bold': True, + 'bg_color': '#D3D3D3', + 'font_size': '15px'}) + txt = workbook.add_format({'align': 'left', + 'font_size': '10px'}) + txt_left = workbook.add_format({'align': 'left', + 'font_size': '10px', + 'border': 1}) + txt_center = workbook.add_format({'align': 'center', + 'font_size': '10px', + 'border': 1}) + amount = workbook.add_format({'align': 'right', + 'font_size': '10px', + 'border': 1}) + amount_bold = workbook.add_format({'align': 'right', + 'bold': True, + 'font_size': '10px', + 'border': 1}) + txt_bold = workbook.add_format({'align': 'left', + 'bold': True, + 'font_size': '10px', + 'border': 1}) + + sheet.set_column('C:C', 30, cell_format) + sheet.set_column('D:E', 20, cell_format) + sheet.set_column('F:F', 20, cell_format) + sheet.write('C2', "Report Date", txt) + sheet.write('D2', str(data['today']), txt) + sheet.write('F2', logged_users.name, txt) + sheet.merge_range('C3:F4', 'CASH FLOW STATEMENTS', head) + + if data['target_move'] == 'posted': + sheet.write('C6', "Target Moves :", cell_format) + sheet.write('C7', 'All Posted Entries', date) + else: + sheet.write('C6', "Target Moves :", cell_format) + sheet.write('C7', 'All Entries', date) + + sheet.write('D6', "Date From", cell_format) + sheet.write('E6', str(data['date_from']), date) + sheet.write('D7', "Date To", cell_format) + sheet.write('E7', str(data['date_to']), date) + + sheet.merge_range('C8:F8', '', head) + sheet.write('C9', 'NAME', bold) + sheet.write('D9', 'CASH IN', bold) + sheet.write('E9', 'CASH OUT', bold) + sheet.write('F9', 'BALANCE', bold) + + row_num = 8 + col_num = 2 + fetched_data_list = fetched_data.copy() + account_res_list = account_res.copy() + journal_res_list = journal_res.copy() + fetched_list = fetched.copy() + filtered_fetched_data_list = [entry for entry in fetched_data_list if + None not in entry.values()] + + for i in filtered_fetched_data_list: + if data['levels'] == 'summary': + sheet.write(row_num + 1, col_num, + str(i['month_part']) + str(int(i['year_part'])), + txt_left) + sheet.write(row_num + 1, col_num + 1, + '{:.2f} %'.format(i['total_debit']) + str(currency_symbol), + amount) + sheet.write(row_num + 1, col_num + 2, + '{:.2f} %'.format(i['total_credit']) + str(currency_symbol), + amount) + sheet.write(row_num + 1, col_num + 3, + '{:.2f} %'.format(i['total_debit'] - i['total_credit']) + str( + currency_symbol), + amount) + row_num = row_num + 1 + elif data['levels'] == 'consolidated': + acc = self.env['account.account'].browse(i['id']) + sheet.write(row_num + 1, col_num, acc.name, txt_left) + sheet.write(row_num + 1, col_num + 1, + '{:.2f} %'.format(i['total_debit']) + str(currency_symbol), + amount) + sheet.write(row_num + 1, col_num + 2, + '{:.2f} %'.format(i['total_credit']) + str(currency_symbol), + amount) + if i['total_credit'] and i['total_credit']: + sheet.write(row_num + 1, col_num + 3, + '{:.2f} %'.format(i['total_debit'] - i['total_credit']) + str( + currency_symbol), + amount) + else: + sheet.write(row_num + 1, col_num + 3, + str(0) + str(currency_symbol), + amount) + row_num = row_num + 1 + + for j in journal_res_list: + for k in filtered_fetched_data_list: + account_name = self.env['account.account'].browse(k['id']) + if account_name.name == j['account']: + sheet.write(row_num + 1, col_num, + str(k['code']) + str(account_name.name), + txt_bold) + sheet.write(row_num + 1, col_num + 1, + '{:.2f} %'.format(k['total_debit']) + str(currency_symbol), + amount_bold) + sheet.write(row_num + 1, col_num + 2, + '{:.2f} %'.format(k['total_credit']) + str(currency_symbol), + amount_bold) + if k['total_debit'] and k['total_credit']: + sheet.write(row_num + 1, col_num + 3, + '{:.2f} %'.format(k['total_debit'] - k[ + 'total_credit']) + str( + currency_symbol), amount_bold) + else: + sheet.write(row_num + 1, col_num + 3, + str(0) + str( + currency_symbol), amount_bold) + row_num = row_num + 1 + for l in j['journal_lines']: + acc = self.env['account.account'].browse(l['id']) + sheet.write(row_num + 1, col_num, acc.name, txt_left) + sheet.write(row_num + 1, col_num + 1, + '{:.2f} %'.format(l['total_debit']) + str(currency_symbol), + amount) + sheet.write(row_num + 1, col_num + 2, + '{:.2f} %'.format(l['total_credit']) + str(currency_symbol), + amount) + sheet.write(row_num + 1, col_num + 3, + '{:.2f} %'.format(l['total_debit'] - l['total_credit']) + str( + currency_symbol), + amount) + row_num = row_num + 1 + + for j in account_res_list: + for k in fetched_list: + + if k['name'] == j['account']: + sheet.write(row_num + 1, col_num, + str(k['code']) + str(k['name']), txt_bold) + sheet.write(row_num + 1, col_num + 1, + '{:.2f} %'.format(k['total_debit']) + str(currency_symbol), + amount_bold) + sheet.write(row_num + 1, col_num + 2, + '{:.2f} %'.format(k['total_credit']) + str(currency_symbol), + amount_bold) + sheet.write(row_num + 1, col_num + 3, + '{:.2f} %'.format(k['total_debit'] - k['total_credit']) + str( + currency_symbol), amount_bold) + row_num = row_num + 1 + for l in j['journal_lines']: + if l['account_name'] == j['account']: + sheet.write(row_num + 1, col_num, l['name'], txt_left) + sheet.write(row_num + 1, col_num + 1, + '{:.2f} %'.format(l['total_debit']) + str(currency_symbol), + amount) + sheet.write(row_num + 1, col_num + 2, + '{:.2f} %'.format(l['total_credit']) + str(currency_symbol), + amount) + sheet.write(row_num + 1, col_num + 3, + '{:.2f} %'.format(l['total_debit'] - l['total_credit']) + str( + currency_symbol), + amount) + row_num = row_num + 1 + for m in j['move_lines']: + if m['name'] == l['name']: + sheet.write(row_num + 1, col_num, m['move_name'], + txt_center) + sheet.write(row_num + 1, col_num + 1, + '{:.2f} %'.format(m['total_debit']) + str( + currency_symbol), amount) + sheet.write(row_num + 1, col_num + 2, + '{:.2f} %'.format(m['total_credit']) + str( + currency_symbol), amount) + sheet.write(row_num + 1, col_num + 3, + '{:.2f} %'.format(m['total_debit'] - m[ + 'total_credit']) + str(currency_symbol), + amount) + row_num = row_num + 1 + workbook.close() + output.seek(0) + response.stream.write(output.read()) + output.close() + + def _get_lines(self, account, data): + """ Fetch values for lines""" + state = """AND am.state = 'posted' """ if data[ + 'target_move'] == 'posted' else '' + query = """SELECT aml.account_id,aj.name, am.name as move_name, sum( + aml.debit) AS total_debit, + sum(aml.credit) AS total_credit FROM ( + SELECT am.* FROM account_move as am + LEFT JOIN account_move_line aml ON aml.move_id = am.id + LEFT JOIN account_account aa ON aa.id = aml.account_id + WHERE am.date BETWEEN '""" + str( + data['date_from']) + """' and '""" + str( + data['date_to']) + """' """ + state + """) am + LEFT JOIN account_move_line aml ON aml.move_id = am.id + LEFT JOIN account_account aa ON aa.id = aml.account_id + LEFT JOIN account_journal aj ON aj.id = am.journal_id + WHERE aa.id = """ + str(account.id) + """ + GROUP BY am.name, aml.account_id, aj.name""" + + cr = self._cr + cr.execute(query) + fetched_data = cr.dictfetchall() + + sql2 = """SELECT aa.name as account_name, aj.id, aj.name, sum( + aml.debit) AS total_debit, + sum(aml.credit) AS total_credit FROM ( + SELECT am.* FROM account_move as am + LEFT JOIN account_move_line aml ON aml.move_id = am.id + LEFT JOIN account_account aa ON aa.id = aml.account_id + WHERE am.date BETWEEN '""" + str( + data['date_from']) + """' and '""" + str( + data['date_to']) + """' """ + state + """) am + LEFT JOIN account_move_line aml ON aml.move_id = am.id + LEFT JOIN account_account aa ON aa.id = aml.account_id + LEFT JOIN account_journal aj ON aj.id = am.journal_id + WHERE aa.id = """ + str(account.id) + """ + GROUP BY aa.name, aj.name, aj.id""" + + cr = self._cr + cr.execute(sql2) + fetch_data = cr.dictfetchall() + if fetched_data: + return { + 'account': account.name, + 'code': account.code, + 'move_lines': fetched_data, + 'journal_lines': fetch_data, + } + + def _get_journal_lines(self, account, data): + """ Fetch values based on journal and pass it in sublines""" + state = """AND am.state = 'posted' """ if data[ + 'target_move'] == 'posted' else '' + sql2 = """SELECT aa.id,aa.name as account_name, aj.id, aj.name, sum( + aml.debit) AS total_debit, + sum(aml.credit) AS total_credit FROM ( + SELECT am.* FROM account_move as am + LEFT JOIN account_move_line aml ON aml.move_id = am.id + LEFT JOIN account_account aa ON aa.id = aml.account_id + WHERE am.date BETWEEN '""" + str( + data['date_from']) + """' and '""" + str( + data['date_to']) + """' """ + state + """) am + LEFT JOIN account_move_line aml ON aml.move_id = am.id + LEFT JOIN account_account aa ON aa.id = aml.account_id + LEFT JOIN account_journal aj ON aj.id = am.journal_id + WHERE aa.id = """ + str(account.id) + """ + GROUP BY aa.id,aa.name, aj.name, aj.id""" + cr = self._cr + cr.execute(sql2) + fetched_data = cr.dictfetchall() + if fetched_data: + return { + 'account': account.name, + 'journal_lines': fetched_data, + } diff --git a/advance_cash_flow_statements/wizard/report_account_wizard.py b/advance_cash_flow_statements/wizard/report_account_wizard.py new file mode 100644 index 000000000..f52cbb145 --- /dev/null +++ b/advance_cash_flow_statements/wizard/report_account_wizard.py @@ -0,0 +1,213 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Gayathri V (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 . +# +########################################################################## +from odoo import models, api + + +class ReportAccountWizard(models.AbstractModel): + _name = "report.advance_cash_flow_statements.cash_flow_pdf_report" + _description = 'Report advanced cash flows' + + @api.model + def _get_report_values(self, docids, data=None): + """ Get values return to pdf report""" + fetched_data = [] + account_res = [] + journal_res = [] + fetched = [] + active_model = self.env.context.get('active_model') + docs = self.env[self.env.context.get('active_model')].browse( + self.env.context.get('active_id')) + if data['levels'] == 'summary': + state = """ WHERE am.state = 'posted' """ if data[ + 'target_move'] == 'posted' else '' + query3 = """SELECT to_char(am.date, 'Month') as month_part, extract( + YEAR from am.date) as year_part,sum(aml.debit) AS total_debit, sum( + aml.credit) AS total_credit,sum(aml.balance) AS total_balance FROM( + SELECT am.date, am.id, am.state FROM account_move as am + LEFT JOIN account_move_line aml ON aml.move_id = am.id + LEFT JOIN account_account aa ON aa.id = aml.account_id + WHERE am.date BETWEEN '""" + str( + data['date_from']) + """' and '""" + str( + data['date_to']) + """' ) am + LEFT JOIN account_move_line aml ON aml.move_id = am.id + LEFT JOIN account_account aa ON aa.id = aml.account_id + """ + state + """GROUP BY month_part,year_part""" + cr = self._cr + cr.execute(query3) + fetched_data = cr.dictfetchall() + elif data['levels'] == 'consolidated': + user_lang = self.env.user.lang + state = """ WHERE am.state = 'posted' """ if data[ + 'target_move'] == 'posted' else '' + query2 = """SELECT aa.name ->'%s' as name, sum(aml.debit) AS total_debit, sum( + aml.credit) AS total_credit,sum(aml.balance) AS total_balance FROM( + SELECT am.id, am.state FROM account_move as am + LEFT JOIN account_move_line aml ON aml.move_id = am.id + LEFT JOIN account_account aa ON aa.id = aml.account_id + WHERE am.date BETWEEN '""" %(user_lang) + str( + data['date_from']) + """' and '""" + str( + data['date_to']) + """' ) am + LEFT JOIN account_move_line aml ON aml.move_id = am.id + LEFT JOIN account_account aa ON aa.id = aml.account_id + """ + state + """GROUP BY aa.name""" + cr = self._cr + cr.execute(query2) + fetched_data = cr.dictfetchall() + elif data['levels'] == 'detailed': + user_lang = self.env.user.lang + state = """ WHERE am.state = 'posted' """ if data[ + 'target_move'] == 'posted' else '' + query1 = """SELECT aa.name ->'%s' as name,aa.code, sum( + aml.debit) AS total_debit, sum(aml.credit) AS total_credit, + sum(aml.balance) AS total_balance FROM ( + SELECT am.id, am.state FROM account_move as am + LEFT JOIN account_move_line aml ON aml.move_id = am.id + LEFT JOIN account_account aa ON aa.id = aml.account_id + WHERE am.date BETWEEN '""" %(user_lang) + str( + data['date_from']) + """' and '""" + str( + data['date_to']) + """' ) am + LEFT JOIN account_move_line aml ON aml.move_id = am.id + LEFT JOIN account_account aa ON aa.id = aml.account_id + """ + state + """GROUP BY aa.name, aa.code""" + cr = self._cr + cr.execute(query1) + fetched_data = cr.dictfetchall() + for account in self.env['account.account'].search([]): + child_lines = self._get_journal_lines(account, data) + if child_lines: + journal_res.append(child_lines) + else: + user_lang = self.env.user.lang + state = """AND am.state = 'posted' """ if data[ + 'target_move'] == 'posted' else '' + sql = """SELECT DISTINCT aa.name ->'%s' as name,aa.code, sum( + aml.debit) AS total_debit, + sum(aml.credit) AS total_credit FROM ( + SELECT am.* FROM account_move as am + LEFT JOIN account_move_line aml ON aml.move_id = am.id + LEFT JOIN account_account aa ON aa.id = aml.account_id + WHERE am.date BETWEEN '""" %(user_lang) + str( + data['date_from']) + """' and '""" + str( + data['date_to']) + """' """ + state + """) am + LEFT JOIN account_move_line aml ON aml.move_id = am.id + LEFT JOIN account_account aa ON aa.id = aml.account_id + GROUP BY aa.name, aa.code""" + cr = self._cr + cr.execute(sql) + fetched = cr.dictfetchall() + for account in self.env['account.account'].search([]): + child_lines = self._get_lines(account, data) + if child_lines: + account_res.append(child_lines) + + filtered_fetched_data = [entry for entry in fetched_data if + None not in entry.values()] + + return { + 'date_from': data['date_from'], + 'date_to': data['date_to'], + 'levels': data['levels'], + 'doc_ids': self.ids, + 'doc_model': active_model, + 'docs': docs, + 'fetched_data': filtered_fetched_data, + 'account_res': account_res, + 'journal_res': journal_res, + 'fetched': fetched, + } + + def _get_lines(self, account, data): + """ fetch values for lines""" + user_lang = self.env.user.lang + state = """AND am.state = 'posted' """ if data[ + 'target_move'] == 'posted' else '' + query = """SELECT aml.account_id,aj.name ->'%s' as name, am.name as move_name, sum( + aml.debit) AS total_debit, + sum(aml.credit) AS total_credit FROM ( + SELECT am.* FROM account_move as am + LEFT JOIN account_move_line aml ON aml.move_id = am.id + LEFT JOIN account_account aa ON aa.id = aml.account_id + WHERE am.date BETWEEN '""" %(user_lang) + str( + data['date_from']) + """' and '""" + str( + data['date_to']) + """' """ + state + """) am + LEFT JOIN account_move_line aml ON aml.move_id = am.id + LEFT JOIN account_account aa ON aa.id = aml.account_id + LEFT JOIN account_journal aj ON aj.id = am.journal_id + WHERE aa.id = """ + str(account.id) + """ + GROUP BY am.name, aml.account_id, aj.name""" + + cr = self._cr + cr.execute(query) + fetched_data = cr.dictfetchall() + user_lang = self.env.user.lang + sql2 = """SELECT aa.name ->'%s' as account_name, aj.id, aj.name ->'%s' as name, sum( + aml.debit) AS total_debit, + sum(aml.credit) AS total_credit FROM ( + SELECT am.* FROM account_move as am + LEFT JOIN account_move_line aml ON aml.move_id = am.id + LEFT JOIN account_account aa ON aa.id = aml.account_id + WHERE am.date BETWEEN '""" %(user_lang,user_lang)+ str( + data['date_from']) + """' and '""" + str( + data['date_to']) + """' """ + state + """) am + LEFT JOIN account_move_line aml ON aml.move_id = am.id + LEFT JOIN account_account aa ON aa.id = aml.account_id + LEFT JOIN account_journal aj ON aj.id = am.journal_id + WHERE aa.id = """ + str(account.id) + """ + GROUP BY aa.name, aj.name, aj.id""" + cr = self._cr + cr.execute(sql2) + fetch_data = cr.dictfetchall() + if fetched_data: + return { + 'account': account.name, + 'code': account.code, + 'move_lines': fetched_data, + 'journal_lines': fetch_data, + } + + def _get_journal_lines(self, account, data): + """ fetch values based on journal and pass it in sublines""" + user_lang = self.env.user.lang + state = """AND am.state = 'posted' """ if data[ + 'target_move'] == 'posted' else '' + sql2 = """SELECT aa.name ->'%s' as account_name, aj.id, aj.name ->'%s' as name, sum( + aml.debit) AS total_debit, + sum(aml.credit) AS total_credit FROM ( + SELECT am.* FROM account_move as am + LEFT JOIN account_move_line aml ON aml.move_id = am.id + LEFT JOIN account_account aa ON aa.id = aml.account_id + WHERE am.date BETWEEN '""" %(user_lang,user_lang) + str( + data['date_from']) + """' and '""" + str( + data['date_to']) + """' """ + state + """) am + LEFT JOIN account_move_line aml ON aml.move_id = am.id + LEFT JOIN account_account aa ON aa.id = aml.account_id + LEFT JOIN account_journal aj ON aj.id = am.journal_id + WHERE aa.id = """ + str(account.id) + """ + GROUP BY aa.name, aj.name, aj.id""" + cr = self._cr + cr.execute(sql2) + fetched_data = cr.dictfetchall() + if fetched_data: + return { + 'account': account.name, + 'journal_lines': fetched_data, + }