diff --git a/advance_cash_flow_statements/README.rst b/advance_cash_flow_statements/README.rst new file mode 100644 index 000000000..d49201fdf --- /dev/null +++ b/advance_cash_flow_statements/README.rst @@ -0,0 +1,15 @@ +ADVANCED CASH FLOW STATEMENTS 16 +================================ +Generate 4 levels of Dynamic Cash Flow Statements Report. + +Configuration +============= + +No additional configurations needed + +Credits +======= +Developer: Varsha Vivek K @ cybrosys, Contact: odoo@cybrosys.com + - V14 : Muhammed Nafih @cybrosys + - V15 : Robin K @cybrosys + V16 : Robin K @cybrosys diff --git a/advance_cash_flow_statements/__init__.py b/advance_cash_flow_statements/__init__.py new file mode 100644 index 000000000..1b3e78f96 --- /dev/null +++ b/advance_cash_flow_statements/__init__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2019-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL 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..49f1fd9c5 --- /dev/null +++ b/advance_cash_flow_statements/__manifest__.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2022-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# + +{ + 'name': 'Advanced Cash Flow Statements', + 'version': '16.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, odoo16""", + 'author': "Cybrosys Techno Solutions", + 'company': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'website': "https://www.cybrosys.com", + 'category': 'Accounting', + 'depends': ['base', 'account'], + 'data': ['security/ir.model.access.csv', + 'report/print_report.xml', + 'report/pdf_template.xml', + 'views/account_wizard.xml', + ], + 'assets': { + 'web.assets_backend': [ + 'advance_cash_flow_statements/static/src/js/action_manager.js' + ], + }, + 'images': ['static/description/banner.png'], + 'license': 'LGPL-3', + 'installable': True, + 'application': False, + 'auto_install': 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..d5a39e5e0 --- /dev/null +++ b/advance_cash_flow_statements/controllers/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2019-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# + +from . import main \ No newline at end of file diff --git a/advance_cash_flow_statements/controllers/main.py b/advance_cash_flow_statements/controllers/main.py new file mode 100644 index 000000000..91481804d --- /dev/null +++ b/advance_cash_flow_statements/controllers/main.py @@ -0,0 +1,62 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2019-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# + +import json +from odoo import http +from odoo.http import content_disposition, request +from odoo.http import serialize_exception as _serialize_exception +from odoo.tools import html_escape + + +class XLSXReportController(http.Controller): + + @http.route('/xlsx_reports', type='http', auth='user', methods=['POST'], + csrf=False) + def get_report_xlsx(self, model, options, output_format, report_name, **kw): + print('get_xls report') + uid = request.session.uid + report_obj = request.env[model].with_user(uid) + print(report_obj) + 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) + # print(response,"set") + return response + except Exception as e: + se = _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..879857ffb --- /dev/null +++ b/advance_cash_flow_statements/doc/RELEASE_NOTES.md @@ -0,0 +1,6 @@ +## Module + +#### 10.11.2022 +#### Version 16.0.1.0.0 +##### ADD +- Initial commit for Cash Flow Statement Report diff --git a/advance_cash_flow_statements/report/pdf_template.xml b/advance_cash_flow_statements/report/pdf_template.xml new file mode 100644 index 000000000..04e1550b4 --- /dev/null +++ b/advance_cash_flow_statements/report/pdf_template.xml @@ -0,0 +1,218 @@ + + + + \ No newline at end of file diff --git a/advance_cash_flow_statements/report/print_report.xml b/advance_cash_flow_statements/report/print_report.xml new file mode 100644 index 000000000..96dac09c3 --- /dev/null +++ b/advance_cash_flow_statements/report/print_report.xml @@ -0,0 +1,12 @@ + + + + + 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/security/ir.model.access.csv b/advance_cash_flow_statements/security/ir.model.access.csv new file mode 100644 index 000000000..16c6e0782 --- /dev/null +++ b/advance_cash_flow_statements/security/ir.model.access.csv @@ -0,0 +1,3 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_account_wizard,account.wizard,model_account_wizard,,1,1,1,1 + 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/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/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/categories.png b/advance_cash_flow_statements/static/description/assets/misc/categories.png new file mode 100644 index 000000000..bedf1e0b1 Binary files /dev/null and b/advance_cash_flow_statements/static/description/assets/misc/categories.png differ diff --git a/advance_cash_flow_statements/static/description/assets/misc/check-box.png b/advance_cash_flow_statements/static/description/assets/misc/check-box.png new file mode 100644 index 000000000..42caf24b9 Binary files /dev/null and b/advance_cash_flow_statements/static/description/assets/misc/check-box.png differ diff --git a/advance_cash_flow_statements/static/description/assets/misc/compass.png b/advance_cash_flow_statements/static/description/assets/misc/compass.png new file mode 100644 index 000000000..d5fed8faa Binary files /dev/null and b/advance_cash_flow_statements/static/description/assets/misc/compass.png differ diff --git a/advance_cash_flow_statements/static/description/assets/misc/corporate.png b/advance_cash_flow_statements/static/description/assets/misc/corporate.png new file mode 100644 index 000000000..2eb13edbf Binary files /dev/null and b/advance_cash_flow_statements/static/description/assets/misc/corporate.png differ diff --git a/advance_cash_flow_statements/static/description/assets/misc/customer-support.png b/advance_cash_flow_statements/static/description/assets/misc/customer-support.png new file mode 100644 index 000000000..79efc72ed Binary files /dev/null and b/advance_cash_flow_statements/static/description/assets/misc/customer-support.png differ diff --git a/advance_cash_flow_statements/static/description/assets/misc/cybrosys-logo.png b/advance_cash_flow_statements/static/description/assets/misc/cybrosys-logo.png new file mode 100644 index 000000000..cc3cc0ccf Binary files /dev/null and b/advance_cash_flow_statements/static/description/assets/misc/cybrosys-logo.png differ diff --git a/advance_cash_flow_statements/static/description/assets/misc/features.png b/advance_cash_flow_statements/static/description/assets/misc/features.png new file mode 100644 index 000000000..b41769f77 Binary files /dev/null and b/advance_cash_flow_statements/static/description/assets/misc/features.png differ diff --git a/advance_cash_flow_statements/static/description/assets/misc/logo.png b/advance_cash_flow_statements/static/description/assets/misc/logo.png new file mode 100644 index 000000000..478462d3e Binary files /dev/null and b/advance_cash_flow_statements/static/description/assets/misc/logo.png differ diff --git a/advance_cash_flow_statements/static/description/assets/misc/pictures.png b/advance_cash_flow_statements/static/description/assets/misc/pictures.png new file mode 100644 index 000000000..56d255fe9 Binary files /dev/null and b/advance_cash_flow_statements/static/description/assets/misc/pictures.png differ diff --git a/advance_cash_flow_statements/static/description/assets/misc/pie-chart.png b/advance_cash_flow_statements/static/description/assets/misc/pie-chart.png new file mode 100644 index 000000000..426e05244 Binary files /dev/null and b/advance_cash_flow_statements/static/description/assets/misc/pie-chart.png differ diff --git a/advance_cash_flow_statements/static/description/assets/misc/right-arrow.png b/advance_cash_flow_statements/static/description/assets/misc/right-arrow.png new file mode 100644 index 000000000..730984a06 Binary files /dev/null and b/advance_cash_flow_statements/static/description/assets/misc/right-arrow.png differ diff --git a/advance_cash_flow_statements/static/description/assets/misc/star.png b/advance_cash_flow_statements/static/description/assets/misc/star.png new file mode 100644 index 000000000..2eb9ab29f Binary files /dev/null and b/advance_cash_flow_statements/static/description/assets/misc/star.png differ diff --git a/advance_cash_flow_statements/static/description/assets/misc/support.png b/advance_cash_flow_statements/static/description/assets/misc/support.png new file mode 100644 index 000000000..4f18b8b82 Binary files /dev/null and b/advance_cash_flow_statements/static/description/assets/misc/support.png differ diff --git a/advance_cash_flow_statements/static/description/assets/misc/whatsapp.png b/advance_cash_flow_statements/static/description/assets/misc/whatsapp.png new file mode 100644 index 000000000..d513a5356 Binary files /dev/null and b/advance_cash_flow_statements/static/description/assets/misc/whatsapp.png differ 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..5238bdeab 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..1ae7cfe3b 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..3c3ff1afb 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..3fae4631e 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.gif b/advance_cash_flow_statements/static/description/assets/modules/5.gif new file mode 100644 index 000000000..2a5f8e659 Binary files /dev/null and b/advance_cash_flow_statements/static/description/assets/modules/5.gif 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..7f2815273 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/advance_cash_flow_statements-1.png b/advance_cash_flow_statements/static/description/assets/screenshots/advance_cash_flow_statements-1.png new file mode 100644 index 000000000..0fb8393d1 Binary files /dev/null and b/advance_cash_flow_statements/static/description/assets/screenshots/advance_cash_flow_statements-1.png differ diff --git a/advance_cash_flow_statements/static/description/assets/screenshots/advance_cash_flow_statements-10.png b/advance_cash_flow_statements/static/description/assets/screenshots/advance_cash_flow_statements-10.png new file mode 100644 index 000000000..0a89bbf38 Binary files /dev/null and b/advance_cash_flow_statements/static/description/assets/screenshots/advance_cash_flow_statements-10.png differ diff --git a/advance_cash_flow_statements/static/description/assets/screenshots/advance_cash_flow_statements-2.png b/advance_cash_flow_statements/static/description/assets/screenshots/advance_cash_flow_statements-2.png new file mode 100644 index 000000000..130b9069b Binary files /dev/null and b/advance_cash_flow_statements/static/description/assets/screenshots/advance_cash_flow_statements-2.png differ diff --git a/advance_cash_flow_statements/static/description/assets/screenshots/advance_cash_flow_statements-3.png b/advance_cash_flow_statements/static/description/assets/screenshots/advance_cash_flow_statements-3.png new file mode 100644 index 000000000..73bb4809b Binary files /dev/null and b/advance_cash_flow_statements/static/description/assets/screenshots/advance_cash_flow_statements-3.png differ diff --git a/advance_cash_flow_statements/static/description/assets/screenshots/advance_cash_flow_statements-4.png b/advance_cash_flow_statements/static/description/assets/screenshots/advance_cash_flow_statements-4.png new file mode 100644 index 000000000..e7b93f4c4 Binary files /dev/null and b/advance_cash_flow_statements/static/description/assets/screenshots/advance_cash_flow_statements-4.png differ diff --git a/advance_cash_flow_statements/static/description/assets/screenshots/advance_cash_flow_statements-5.png b/advance_cash_flow_statements/static/description/assets/screenshots/advance_cash_flow_statements-5.png new file mode 100644 index 000000000..ab43c1668 Binary files /dev/null and b/advance_cash_flow_statements/static/description/assets/screenshots/advance_cash_flow_statements-5.png differ diff --git a/advance_cash_flow_statements/static/description/assets/screenshots/advance_cash_flow_statements-6.png b/advance_cash_flow_statements/static/description/assets/screenshots/advance_cash_flow_statements-6.png new file mode 100644 index 000000000..4001ada6c Binary files /dev/null and b/advance_cash_flow_statements/static/description/assets/screenshots/advance_cash_flow_statements-6.png differ diff --git a/advance_cash_flow_statements/static/description/assets/screenshots/advance_cash_flow_statements-7.png b/advance_cash_flow_statements/static/description/assets/screenshots/advance_cash_flow_statements-7.png new file mode 100644 index 000000000..5879cda38 Binary files /dev/null and b/advance_cash_flow_statements/static/description/assets/screenshots/advance_cash_flow_statements-7.png differ diff --git a/advance_cash_flow_statements/static/description/assets/screenshots/advance_cash_flow_statements-8.png b/advance_cash_flow_statements/static/description/assets/screenshots/advance_cash_flow_statements-8.png new file mode 100644 index 000000000..aac91d474 Binary files /dev/null and b/advance_cash_flow_statements/static/description/assets/screenshots/advance_cash_flow_statements-8.png differ diff --git a/advance_cash_flow_statements/static/description/assets/screenshots/advance_cash_flow_statements-9.png b/advance_cash_flow_statements/static/description/assets/screenshots/advance_cash_flow_statements-9.png new file mode 100644 index 000000000..9487717ef Binary files /dev/null and b/advance_cash_flow_statements/static/description/assets/screenshots/advance_cash_flow_statements-9.png differ diff --git a/advance_cash_flow_statements/static/description/assets/screenshots/hero.gif b/advance_cash_flow_statements/static/description/assets/screenshots/hero.gif new file mode 100644 index 000000000..9202cc370 Binary files /dev/null and b/advance_cash_flow_statements/static/description/assets/screenshots/hero.gif differ diff --git a/advance_cash_flow_statements/static/description/banner.png b/advance_cash_flow_statements/static/description/banner.png new file mode 100644 index 000000000..e24fa946e Binary files /dev/null and b/advance_cash_flow_statements/static/description/banner.png 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..a32fc81ca 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..03252eb20 --- /dev/null +++ b/advance_cash_flow_statements/static/description/index.html @@ -0,0 +1,827 @@ +
+ +
+ +
+
+ Community +
+
+ Enterprise +
+
+ Odoo.sh +
+
+
+ + + +

+ Advanced Cash Flow Statements +

+

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

+ + + +
+ + +
+
+ +
+

+ Explore This + Module +

+
+ + + + +
+
+ +
+

+ Overview +

+
+
+
+ Currently, in Odoo community edition there are no Cash Flow + Statements. A cash flow statement is a financial statement + that provides aggregate data regarding all cash inflows a company + receives from its ongoing operations and external investment sources, also includes all cash outflows that pay for business activities and investments during a given period. This module generates four-level cash flow statements and prints its report in both PDF and XLSX format. +
+
+ + + +
+
+ +
+

+ Features +

+
+
+
+
+ +
+ + Available in Odoo 16 community edition. + +
+
+
+ +
+ + + Generate four levels of cash flow statements and + print reports + in both PDF and XLSX format + + +
+
+
+ +
+ + 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 + +
+
+ +
+
+ + + +
+
+ +
+

+ Screenshots +

+
+
+
+ +
+

+ Access Advanced Cash Flow from the Menu +

+

+ Go to Invoicing --> Reporting --> Financial Reports + --> Adv Cash + Flow Statement. +

+ +
+
+

+ Cash Flow Report in PDF and Excel +

+

+ A wizard will be opened once the user clicks on it. + Choose start, + end dates and target moves. Choose one level that + you want to + generate a report. Click the button PDF to get the + cash flow + report in PDF format. Click the button Excel to get + the cash flow + report in excel format. +

+ +
+
+

+ Cash Flow Statement Summary PDF +

+

+ Cash flow statement summary PDF report example. +

+ +
+
+

+ Cash Flow Statement Summary Excel +

+

+ Cash flow statement summary Excel report example. +

+ +
+
+

+ Cash flow Statement Consolidated PDF Report. +

+

+ Cash flow Statement consolidated PDF report example +

+ +
+
+

+ Cash Flow Statement Consolidated Excel +

+

+ Cash flow Statement consolidated Excel report + example. +

+ +
+
+

+ Cash flow Statement Detailed PDF Report +

+

+ Cash flow statement detailed PDF report example. +

+ +
+
+

+ Cash Flow Statement Detailed Excel Report +

+

+ Cash flow statement detailed Excel report example. +

+ +
+
+

+ Cash flow Statement Very Detailed PDF Report + +

+

+ Cash flow Statement very detailed PDF report + example. +

+ +
+
+

+ Cash flow Statement Very Detailed Excel Report + +

+

+ Cash flow statement very detailed Excel report + example. +

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

+ Related + Products +

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

+ Our Services +

+
+ +
+
+
+
+ +
+
+ Odoo + Customization +
+
+ +
+
+ +
+
+ Odoo + Implementation +
+
+ +
+
+ +
+
+ Odoo + Support +
+
+ + +
+
+ +
+
+ Hire + Odoo + Developer +
+
+ +
+
+ +
+
+ Odoo + Integration +
+
+ +
+
+ +
+
+ Odoo + Migration +
+
+ + +
+
+ +
+
+ Odoo + Consultancy +
+
+ +
+
+ +
+
+ Odoo + Implementation +
+
+ +
+
+ +
+
+ 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 86068 + 27707 +

+
+
+
+
+
+
+
+ +
+
+
+ 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..783f6246b --- /dev/null +++ b/advance_cash_flow_statements/static/src/js/action_manager.js @@ -0,0 +1,21 @@ +/** @odoo-module **/ + +import {registry} from "@web/core/registry"; +import { download } from "@web/core/network/download"; +import framework from 'web.framework'; +import session from 'web.session'; + +registry.category("ir.actions.report handlers").add("advance_cash_xlsx", async (action) => { + if (action.report_type === 'xlsx') { + framework.blockUI(); + var def = $.Deferred(); + session.get_file({ + url: '/xlsx_reports', + data: action.data, + success: def.resolve.bind(def), + error: (error) => this.call('crash_manager', 'rpc_error', error), + complete: framework.unblockUI, + }); + return def; + } +}); diff --git a/advance_cash_flow_statements/views/account_wizard.xml b/advance_cash_flow_statements/views/account_wizard.xml new file mode 100644 index 000000000..e261bad24 --- /dev/null +++ b/advance_cash_flow_statements/views/account_wizard.xml @@ -0,0 +1,51 @@ + + + + + Wizard + 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..c6c4cb294 --- /dev/null +++ b/advance_cash_flow_statements/wizard/__init__.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2019-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL 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..8ab4d6059 --- /dev/null +++ b/advance_cash_flow_statements/wizard/account_account.py @@ -0,0 +1,83 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2019-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# + +from odoo import api, models, fields +from odoo.tools.misc import get_lang + + +class AccountCommonReport(models.Model): + _inherit = "account.report" + _description = "Account Common Report" + + company_id = fields.Many2one('res.company', string='Company', required=True, + readonly=True, + default=lambda self: self.env.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)]", + ) + date_from = fields.Date(string='Start Date') + date_to = fields.Date(string='End Date') + target_move = fields.Selection([('posted', 'All Posted Entries'), + ('all', 'All Entries'), + ], string='Target Moves', required=True, + default='posted') + + @api.onchange('company_id') + def _onchange_company_id(self): + 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): + 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): + raise NotImplementedError() + + def check_report(self): + print('Account.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..38b09d8dd --- /dev/null +++ b/advance_cash_flow_statements/wizard/account_wizard.py @@ -0,0 +1,435 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2019-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL 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, xlsxwriter + + +class AccountWizard(models.TransientModel): + _name = "account.wizard" + _inherit = "account.report" + + name = fields.Char(default="Invoice") + date_from = fields.Date(string="Start Date", required=True) + date_to = fields.Date(string="End Date", default=fields.Date.today, + required=True) + today = fields.Date("Report Date", default=fields.Date.today) + 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') + + def generate_pdf_report(self): + 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').report_action(self, + data=data) + + def generate_xlsx_report(self): + 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): + 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.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.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.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.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:F5', '') + sheet.merge_range('C3:F4', 'CASH FLOW STATEMENTS', head) + sheet.merge_range('C4:F4', '') + + 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() + + for i in 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, + str(i['total_debit']) + str(currency_symbol), + amount) + sheet.write(row_num + 1, col_num + 2, + str(i['total_credit']) + str(currency_symbol), + amount) + sheet.write(row_num + 1, col_num + 3, + str(i['total_debit'] - i['total_credit']) + str( + currency_symbol), + amount) + row_num = row_num + 1 + elif data['levels'] == 'consolidated': + sheet.write(row_num + 1, col_num, i['name'], txt_left) + sheet.write(row_num + 1, col_num + 1, + str(i['total_debit']) + str(currency_symbol), + amount) + sheet.write(row_num + 1, col_num + 2, + str(i['total_credit']) + str(currency_symbol), + amount) + sheet.write(row_num + 1, col_num + 3, + str(i['total_debit'] - i['total_credit']) + str( + currency_symbol), + amount) + row_num = row_num + 1 + + for j in journal_res_list: + for k in fetched_data_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, + str(k['total_debit']) + str(currency_symbol), + amount_bold) + sheet.write(row_num + 1, col_num + 2, + str(k['total_credit']) + str(currency_symbol), + amount_bold) + sheet.write(row_num + 1, col_num + 3, + str(k['total_debit'] - k['total_credit']) + str( + currency_symbol), amount_bold) + row_num = row_num + 1 + for l in j['journal_lines']: + sheet.write(row_num + 1, col_num, l['name'], txt_left) + sheet.write(row_num + 1, col_num + 1, + str(l['total_debit']) + str(currency_symbol), + amount) + sheet.write(row_num + 1, col_num + 2, + str(l['total_credit']) + str(currency_symbol), + amount) + sheet.write(row_num + 1, col_num + 3, + str(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, + str(k['total_debit']) + str(currency_symbol), + amount_bold) + sheet.write(row_num + 1, col_num + 2, + str(k['total_credit']) + str(currency_symbol), + amount_bold) + sheet.write(row_num + 1, col_num + 3, + str(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, + str(l['total_debit']) + str(currency_symbol), + amount) + sheet.write(row_num + 1, col_num + 2, + str(l['total_credit']) + str(currency_symbol), + amount) + sheet.write(row_num + 1, col_num + 3, + str(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, + str(m['total_debit']) + str( + currency_symbol), amount) + sheet.write(row_num + 1, col_num + 2, + str(m['total_credit']) + str( + currency_symbol), amount) + sheet.write(row_num + 1, col_num + 3, + str(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): + 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): + state = """AND am.state = 'posted' """ if data[ + 'target_move'] == 'posted' else '' + 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) + 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..c35df329a --- /dev/null +++ b/advance_cash_flow_statements/wizard/report_account_wizard.py @@ -0,0 +1,201 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2019-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL 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" + + @api.model + def _get_report_values(self, docids, data=None): + 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': + state = """ WHERE am.state = 'posted' """ if data[ + 'target_move'] == 'posted' else '' + query2 = """SELECT 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.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.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.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) + + 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': fetched_data, + 'account_res': account_res, + 'journal_res': journal_res, + 'fetched': fetched, + } + + def _get_lines(self, account, data): + 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): + state = """AND am.state = 'posted' """ if data[ + 'target_move'] == 'posted' else '' + 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) + fetched_data = cr.dictfetchall() + if fetched_data: + return { + 'account': account.name, + 'journal_lines': fetched_data, + }