diff --git a/pdf_report_action/README.rst b/pdf_report_action/README.rst new file mode 100755 index 000000000..10580bde7 --- /dev/null +++ b/pdf_report_action/README.rst @@ -0,0 +1,46 @@ +.. 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 + +Dynamic Report Operations +========================= +User can get the different types of operations of report in this module + +Configuration +============= +* No additional configurations needed + +Company +------- +* `Cybrosys Techno Solutions `__ + +License +------- +Affero General Public License, Version 3 `(AGPL v3). +`__ + +Credits +------- +* Developers:(V16) Ayisha sumayya, Yadhukrishnan, 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/pdf_report_action/__init__.py b/pdf_report_action/__init__.py new file mode 100755 index 000000000..8ae3b4067 --- /dev/null +++ b/pdf_report_action/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Cybrosys Techno Solutions() +# +# 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 wizard diff --git a/pdf_report_action/__manifest__.py b/pdf_report_action/__manifest__.py new file mode 100755 index 000000000..041f02f7b --- /dev/null +++ b/pdf_report_action/__manifest__.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Cybrosys Techno Solutions() +# +# 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': 'Dynamic Report Operations', + 'version': '16.0.1.0.0', + 'category': 'Productivity', + 'summary': """Perform multiple report operations in Sales/Purchase + /Inventory/ Accounting""", + 'description': "Users can perform various actions such as printing, " + "downloading, and sharing reports of various records in " + "Sales, Purchase, Inventory, Accounting", + 'author': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'website': 'https://www.cybrosys.com', + 'depends': ['sale_management', 'purchase', 'stock', 'account',], + 'data': [ + 'security/ir.model.access.csv', + 'wizard/dynamic_action_views.xml', + ], + 'assets': { + 'web.assets_backend': [ + 'pdf_report_action/static/src/css/report_action.css', + 'pdf_report_action/static/src/js/report_action.js', + 'pdf_report_action/static/src/js/report_action_systray.js', + 'pdf_report_action/static/src/xml/report_action_systray.xml', + ], + }, + 'images': ['static/description/banner.png'], + 'license': 'AGPL-3', + 'installable': True, + 'auto_install': False, + 'application': False, + +} diff --git a/pdf_report_action/doc/RELEASE_NOTES.md b/pdf_report_action/doc/RELEASE_NOTES.md new file mode 100755 index 000000000..6bdedcd0b --- /dev/null +++ b/pdf_report_action/doc/RELEASE_NOTES.md @@ -0,0 +1,6 @@ +## Module + +#### 27.11.2023 +#### Version 16.0.1.0.0 +##### ADD +- Initial Commit for Dynamic Report Operations diff --git a/pdf_report_action/security/ir.model.access.csv b/pdf_report_action/security/ir.model.access.csv new file mode 100755 index 000000000..b107ba172 --- /dev/null +++ b/pdf_report_action/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_dynamic_action_user,access.dynamic.action.user,pdf_report_action.model_dynamic_action,base.group_user,1,1,1,1 diff --git a/pdf_report_action/static/description/assets/icons/check.png b/pdf_report_action/static/description/assets/icons/check.png new file mode 100755 index 000000000..c8e85f51d Binary files /dev/null and b/pdf_report_action/static/description/assets/icons/check.png differ diff --git a/pdf_report_action/static/description/assets/icons/chevron.png b/pdf_report_action/static/description/assets/icons/chevron.png new file mode 100755 index 000000000..2089293d6 Binary files /dev/null and b/pdf_report_action/static/description/assets/icons/chevron.png differ diff --git a/pdf_report_action/static/description/assets/icons/cogs.png b/pdf_report_action/static/description/assets/icons/cogs.png new file mode 100755 index 000000000..95d0bad62 Binary files /dev/null and b/pdf_report_action/static/description/assets/icons/cogs.png differ diff --git a/pdf_report_action/static/description/assets/icons/consultation.png b/pdf_report_action/static/description/assets/icons/consultation.png new file mode 100755 index 000000000..8319d4baa Binary files /dev/null and b/pdf_report_action/static/description/assets/icons/consultation.png differ diff --git a/pdf_report_action/static/description/assets/icons/ecom-black.png b/pdf_report_action/static/description/assets/icons/ecom-black.png new file mode 100755 index 000000000..a9385ff13 Binary files /dev/null and b/pdf_report_action/static/description/assets/icons/ecom-black.png differ diff --git a/pdf_report_action/static/description/assets/icons/education-black.png b/pdf_report_action/static/description/assets/icons/education-black.png new file mode 100755 index 000000000..3eb09b27b Binary files /dev/null and b/pdf_report_action/static/description/assets/icons/education-black.png differ diff --git a/pdf_report_action/static/description/assets/icons/hotel-black.png b/pdf_report_action/static/description/assets/icons/hotel-black.png new file mode 100755 index 000000000..130f613be Binary files /dev/null and b/pdf_report_action/static/description/assets/icons/hotel-black.png differ diff --git a/pdf_report_action/static/description/assets/icons/license.png b/pdf_report_action/static/description/assets/icons/license.png new file mode 100755 index 000000000..a5869797e Binary files /dev/null and b/pdf_report_action/static/description/assets/icons/license.png differ diff --git a/pdf_report_action/static/description/assets/icons/lifebuoy.png b/pdf_report_action/static/description/assets/icons/lifebuoy.png new file mode 100755 index 000000000..658d56ccc Binary files /dev/null and b/pdf_report_action/static/description/assets/icons/lifebuoy.png differ diff --git a/pdf_report_action/static/description/assets/icons/manufacturing-black.png b/pdf_report_action/static/description/assets/icons/manufacturing-black.png new file mode 100755 index 000000000..697eb0e9f Binary files /dev/null and b/pdf_report_action/static/description/assets/icons/manufacturing-black.png differ diff --git a/pdf_report_action/static/description/assets/icons/pos-black.png b/pdf_report_action/static/description/assets/icons/pos-black.png new file mode 100755 index 000000000..97c0f90c1 Binary files /dev/null and b/pdf_report_action/static/description/assets/icons/pos-black.png differ diff --git a/pdf_report_action/static/description/assets/icons/puzzle.png b/pdf_report_action/static/description/assets/icons/puzzle.png new file mode 100755 index 000000000..65cf854e7 Binary files /dev/null and b/pdf_report_action/static/description/assets/icons/puzzle.png differ diff --git a/pdf_report_action/static/description/assets/icons/restaurant-black.png b/pdf_report_action/static/description/assets/icons/restaurant-black.png new file mode 100755 index 000000000..4a35eb939 Binary files /dev/null and b/pdf_report_action/static/description/assets/icons/restaurant-black.png differ diff --git a/pdf_report_action/static/description/assets/icons/service-black.png b/pdf_report_action/static/description/assets/icons/service-black.png new file mode 100755 index 000000000..301ab51cb Binary files /dev/null and b/pdf_report_action/static/description/assets/icons/service-black.png differ diff --git a/pdf_report_action/static/description/assets/icons/trading-black.png b/pdf_report_action/static/description/assets/icons/trading-black.png new file mode 100755 index 000000000..9398ba2f1 Binary files /dev/null and b/pdf_report_action/static/description/assets/icons/trading-black.png differ diff --git a/pdf_report_action/static/description/assets/icons/training.png b/pdf_report_action/static/description/assets/icons/training.png new file mode 100755 index 000000000..884ca024d Binary files /dev/null and b/pdf_report_action/static/description/assets/icons/training.png differ diff --git a/pdf_report_action/static/description/assets/icons/update.png b/pdf_report_action/static/description/assets/icons/update.png new file mode 100755 index 000000000..ecbc5a01a Binary files /dev/null and b/pdf_report_action/static/description/assets/icons/update.png differ diff --git a/pdf_report_action/static/description/assets/icons/user.png b/pdf_report_action/static/description/assets/icons/user.png new file mode 100755 index 000000000..6ffb23d9f Binary files /dev/null and b/pdf_report_action/static/description/assets/icons/user.png differ diff --git a/pdf_report_action/static/description/assets/icons/wrench.png b/pdf_report_action/static/description/assets/icons/wrench.png new file mode 100755 index 000000000..6c04dea0f Binary files /dev/null and b/pdf_report_action/static/description/assets/icons/wrench.png differ diff --git a/pdf_report_action/static/description/assets/misc/categories.png b/pdf_report_action/static/description/assets/misc/categories.png new file mode 100755 index 000000000..bedf1e0b1 Binary files /dev/null and b/pdf_report_action/static/description/assets/misc/categories.png differ diff --git a/pdf_report_action/static/description/assets/misc/check-box.png b/pdf_report_action/static/description/assets/misc/check-box.png new file mode 100755 index 000000000..42caf24b9 Binary files /dev/null and b/pdf_report_action/static/description/assets/misc/check-box.png differ diff --git a/pdf_report_action/static/description/assets/misc/compass.png b/pdf_report_action/static/description/assets/misc/compass.png new file mode 100755 index 000000000..d5fed8faa Binary files /dev/null and b/pdf_report_action/static/description/assets/misc/compass.png differ diff --git a/pdf_report_action/static/description/assets/misc/corporate.png b/pdf_report_action/static/description/assets/misc/corporate.png new file mode 100755 index 000000000..2eb13edbf Binary files /dev/null and b/pdf_report_action/static/description/assets/misc/corporate.png differ diff --git a/pdf_report_action/static/description/assets/misc/customer-support.png b/pdf_report_action/static/description/assets/misc/customer-support.png new file mode 100755 index 000000000..79efc72ed Binary files /dev/null and b/pdf_report_action/static/description/assets/misc/customer-support.png differ diff --git a/pdf_report_action/static/description/assets/misc/cybrosys-logo.png b/pdf_report_action/static/description/assets/misc/cybrosys-logo.png new file mode 100755 index 000000000..cc3cc0ccf Binary files /dev/null and b/pdf_report_action/static/description/assets/misc/cybrosys-logo.png differ diff --git a/pdf_report_action/static/description/assets/misc/features.png b/pdf_report_action/static/description/assets/misc/features.png new file mode 100755 index 000000000..b41769f77 Binary files /dev/null and b/pdf_report_action/static/description/assets/misc/features.png differ diff --git a/pdf_report_action/static/description/assets/misc/logo.png b/pdf_report_action/static/description/assets/misc/logo.png new file mode 100755 index 000000000..478462d3e Binary files /dev/null and b/pdf_report_action/static/description/assets/misc/logo.png differ diff --git a/pdf_report_action/static/description/assets/misc/pictures.png b/pdf_report_action/static/description/assets/misc/pictures.png new file mode 100755 index 000000000..56d255fe9 Binary files /dev/null and b/pdf_report_action/static/description/assets/misc/pictures.png differ diff --git a/pdf_report_action/static/description/assets/misc/pie-chart.png b/pdf_report_action/static/description/assets/misc/pie-chart.png new file mode 100755 index 000000000..426e05244 Binary files /dev/null and b/pdf_report_action/static/description/assets/misc/pie-chart.png differ diff --git a/pdf_report_action/static/description/assets/misc/right-arrow.png b/pdf_report_action/static/description/assets/misc/right-arrow.png new file mode 100755 index 000000000..730984a06 Binary files /dev/null and b/pdf_report_action/static/description/assets/misc/right-arrow.png differ diff --git a/pdf_report_action/static/description/assets/misc/star.png b/pdf_report_action/static/description/assets/misc/star.png new file mode 100755 index 000000000..2eb9ab29f Binary files /dev/null and b/pdf_report_action/static/description/assets/misc/star.png differ diff --git a/pdf_report_action/static/description/assets/misc/support.png b/pdf_report_action/static/description/assets/misc/support.png new file mode 100755 index 000000000..4f18b8b82 Binary files /dev/null and b/pdf_report_action/static/description/assets/misc/support.png differ diff --git a/pdf_report_action/static/description/assets/misc/whatsapp.png b/pdf_report_action/static/description/assets/misc/whatsapp.png new file mode 100755 index 000000000..d513a5356 Binary files /dev/null and b/pdf_report_action/static/description/assets/misc/whatsapp.png differ diff --git a/pdf_report_action/static/description/assets/modules/l1.png b/pdf_report_action/static/description/assets/modules/l1.png new file mode 100755 index 000000000..a3060d797 Binary files /dev/null and b/pdf_report_action/static/description/assets/modules/l1.png differ diff --git a/pdf_report_action/static/description/assets/modules/l2.png b/pdf_report_action/static/description/assets/modules/l2.png new file mode 100755 index 000000000..57eebc5b2 Binary files /dev/null and b/pdf_report_action/static/description/assets/modules/l2.png differ diff --git a/pdf_report_action/static/description/assets/modules/l3.png b/pdf_report_action/static/description/assets/modules/l3.png new file mode 100755 index 000000000..359d3e4d6 Binary files /dev/null and b/pdf_report_action/static/description/assets/modules/l3.png differ diff --git a/pdf_report_action/static/description/assets/modules/l4.jpg b/pdf_report_action/static/description/assets/modules/l4.jpg new file mode 100644 index 000000000..dfcbab806 Binary files /dev/null and b/pdf_report_action/static/description/assets/modules/l4.jpg differ diff --git a/pdf_report_action/static/description/assets/modules/l5.png b/pdf_report_action/static/description/assets/modules/l5.png new file mode 100644 index 000000000..f5a45dac9 Binary files /dev/null and b/pdf_report_action/static/description/assets/modules/l5.png differ diff --git a/pdf_report_action/static/description/assets/modules/l6.png b/pdf_report_action/static/description/assets/modules/l6.png new file mode 100644 index 000000000..efffd3292 Binary files /dev/null and b/pdf_report_action/static/description/assets/modules/l6.png differ diff --git a/pdf_report_action/static/description/assets/screenshots/Screenshot3.png b/pdf_report_action/static/description/assets/screenshots/Screenshot3.png new file mode 100755 index 000000000..66a4031e8 Binary files /dev/null and b/pdf_report_action/static/description/assets/screenshots/Screenshot3.png differ diff --git a/pdf_report_action/static/description/assets/screenshots/Screenshot4.png b/pdf_report_action/static/description/assets/screenshots/Screenshot4.png new file mode 100755 index 000000000..de9ec8d05 Binary files /dev/null and b/pdf_report_action/static/description/assets/screenshots/Screenshot4.png differ diff --git a/pdf_report_action/static/description/assets/screenshots/Screenshot5.png b/pdf_report_action/static/description/assets/screenshots/Screenshot5.png new file mode 100755 index 000000000..471f5f945 Binary files /dev/null and b/pdf_report_action/static/description/assets/screenshots/Screenshot5.png differ diff --git a/pdf_report_action/static/description/assets/screenshots/Screenshot6.png b/pdf_report_action/static/description/assets/screenshots/Screenshot6.png new file mode 100755 index 000000000..6f5ce7a75 Binary files /dev/null and b/pdf_report_action/static/description/assets/screenshots/Screenshot6.png differ diff --git a/pdf_report_action/static/description/assets/screenshots/Screenshot7.png b/pdf_report_action/static/description/assets/screenshots/Screenshot7.png new file mode 100755 index 000000000..30b4bd673 Binary files /dev/null and b/pdf_report_action/static/description/assets/screenshots/Screenshot7.png differ diff --git a/pdf_report_action/static/description/assets/screenshots/Screenshot9.png b/pdf_report_action/static/description/assets/screenshots/Screenshot9.png new file mode 100755 index 000000000..1c5497112 Binary files /dev/null and b/pdf_report_action/static/description/assets/screenshots/Screenshot9.png differ diff --git a/pdf_report_action/static/description/assets/screenshots/hero.gif b/pdf_report_action/static/description/assets/screenshots/hero.gif new file mode 100644 index 000000000..25aebfd11 Binary files /dev/null and b/pdf_report_action/static/description/assets/screenshots/hero.gif differ diff --git a/pdf_report_action/static/description/assets/screenshots/pdf_reprt_action_1.png b/pdf_report_action/static/description/assets/screenshots/pdf_reprt_action_1.png new file mode 100644 index 000000000..f4ed5eb6f Binary files /dev/null and b/pdf_report_action/static/description/assets/screenshots/pdf_reprt_action_1.png differ diff --git a/pdf_report_action/static/description/assets/screenshots/pdf_rprt2.png b/pdf_report_action/static/description/assets/screenshots/pdf_rprt2.png new file mode 100644 index 000000000..41b5b0533 Binary files /dev/null and b/pdf_report_action/static/description/assets/screenshots/pdf_rprt2.png differ diff --git a/pdf_report_action/static/description/assets/screenshots/screenshot8.png b/pdf_report_action/static/description/assets/screenshots/screenshot8.png new file mode 100755 index 000000000..b77be01f5 Binary files /dev/null and b/pdf_report_action/static/description/assets/screenshots/screenshot8.png differ diff --git a/pdf_report_action/static/description/banner.png b/pdf_report_action/static/description/banner.png new file mode 100644 index 000000000..006beadb0 Binary files /dev/null and b/pdf_report_action/static/description/banner.png differ diff --git a/pdf_report_action/static/description/icon.png b/pdf_report_action/static/description/icon.png new file mode 100755 index 000000000..b05fb09cd Binary files /dev/null and b/pdf_report_action/static/description/icon.png differ diff --git a/pdf_report_action/static/description/index.html b/pdf_report_action/static/description/index.html new file mode 100755 index 000000000..e5ada8c17 --- /dev/null +++ b/pdf_report_action/static/description/index.html @@ -0,0 +1,588 @@ +
+ +
+ +
+
+ Community +
+
+ Enterprise +
+
+
+ +
+
+
+ +

+ Dynamic Report Operations +

+

Different Action Types For PDF Report.

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

Explore This + Module

+
+ + + + +
+
+ +
+

Overview +

+
+
+
+ This module allows users to have different actions for pdf report. +
+
+ + + +
+
+ +
+

Features +

+
+
+
+
+ + Define different actions for pdf report +
+
+ + Print, Download, Open and Share by Email +
+
+ + Available for Sales, Purchase, Inventory and Invoice modules +
+
+
+ +
+ + Can share report either using email template or without, according to the module. +
+ +
+
+ + + +
+
+ +
+

Screenshots +

+
+
+
+ +
+

Set Report Action + +

+

Go to Your Module -> Action + ->We can see an option 'PDF Report Action'. +

+ +
+ +
+

There are four actions Print, Download, Open and Share by Email

+ +
+ +
+

Sale Order Report View

+ +
+ +
+

Purchase Order Report View

+ +
+
+

Invoice Report View

+ +
+
+

Stock Picking Report View

+ +
+ +
+

Share Report Via Email

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

+ 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

+
+
+
+
+
+
+
+ +
+
+
+ \ No newline at end of file diff --git a/pdf_report_action/static/src/css/report_action.css b/pdf_report_action/static/src/css/report_action.css new file mode 100755 index 000000000..e6d24b641 --- /dev/null +++ b/pdf_report_action/static/src/css/report_action.css @@ -0,0 +1,6 @@ +.wizard_btn { + margin: 12px; + border-radius: 7px; + height: 40px; + width: 150px; +} diff --git a/pdf_report_action/static/src/js/report_action.js b/pdf_report_action/static/src/js/report_action.js new file mode 100755 index 000000000..6683691f8 --- /dev/null +++ b/pdf_report_action/static/src/js/report_action.js @@ -0,0 +1,8 @@ +/** @odoo-module*/ +import {registry} from "@web/core/registry"; + /** + *Action for open the print screen + */ + registry.category("ir.actions.report handlers").add("xlsx", async (action) => { + var printWindow = window.open(action.data).print(); +}) diff --git a/pdf_report_action/static/src/js/report_action_systray.js b/pdf_report_action/static/src/js/report_action_systray.js new file mode 100644 index 000000000..f92c94757 --- /dev/null +++ b/pdf_report_action/static/src/js/report_action_systray.js @@ -0,0 +1,23 @@ +/** @odoo-module **/ +import core from 'web.core'; +import SystrayMenu from 'web.SystrayMenu'; +import Widget from 'web.Widget'; +var qweb = core.qweb +//Extended the widget to create custom systray widget +const SystrayWidget = Widget.extend({ + template: 'IconSystrayDropdown', + events: { + 'click .o-dropdown': '_onClick', + }, + _onClick: function(ev){ // Function on clicking the systray icon + this.do_action({ + type: 'ir.actions.act_window', + name: 'Open Report Wizard', + res_model: 'dynamic.action', + views: [[false, 'form']], + target: 'new', + }); + }, +}); +SystrayMenu.Items.push(SystrayWidget); +export default SystrayWidget; diff --git a/pdf_report_action/static/src/xml/report_action_systray.xml b/pdf_report_action/static/src/xml/report_action_systray.xml new file mode 100644 index 000000000..2db482e60 --- /dev/null +++ b/pdf_report_action/static/src/xml/report_action_systray.xml @@ -0,0 +1,20 @@ + + + +
+ + + diff --git a/pdf_report_action/wizard/__init__.py b/pdf_report_action/wizard/__init__.py new file mode 100755 index 000000000..71869dbff --- /dev/null +++ b/pdf_report_action/wizard/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Cybrosys Techno Solutions() +# +# 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 dynamic_action diff --git a/pdf_report_action/wizard/dynamic_action.py b/pdf_report_action/wizard/dynamic_action.py new file mode 100755 index 000000000..4f2d377a6 --- /dev/null +++ b/pdf_report_action/wizard/dynamic_action.py @@ -0,0 +1,217 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Cybrosys Techno Solutions() +# +# 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 base64 +from odoo import api, models, fields, _ +from odoo.exceptions import ValidationError + + +class DynamicAction(models.TransientModel): + """ + The class DynamicAction provides print, share, open and download reports + in various models . + Methods: + print_report(self): + In this method print the screen of the form.Return a dict. + download_report(self): + In this method download the report of the form.Return a dict. + open_report(self): + In this methode open the print screen of the form.Return a dict. + share_by_email(self): + In this method share email report of the corresponding form. + Return a dict.3.Some misspelled words are there in the doc + string of the function. check it and correct it + """ + _name = "dynamic.action" + _description = "Dynamic Action" + + res_model = fields.Char('Related Document Model', + help='Model of the related document') + res_id = fields.Integer('Related Document ID', + model_field='res_model', + help='ID of the related document') + resource_ref = fields.Reference(string='Record', + selection='_selection_target_model', + inverse='_set_resource_ref', + help='Reference to the record') + + @api.model + def _selection_target_model(self): + """ Reference field function""" + domain = [('model', 'in', ['account.move', 'sale.order', + 'purchase.order', 'stock.picking'])] + models_with_printing = self.env['ir.model'].sudo().search(domain) + return [(model.model, model.name) for model in models_with_printing] + + def _set_resource_ref(self): + """ Reference field function""" + for participant in self: + if participant.resource_ref: + participant.res_id = participant.resource_ref.id + participant.res_model = participant.resource_ref._name + + def action_print_report(self): + """ print button function""" + form_id = self.res_id + model = self.res_model + server_address = self.env['ir.config_parameter'].sudo().get_param( + 'web.base.url') + if model == 'sale.order': + data = f"{server_address}/report/pdf/sale.report_saleorder/{form_id}" + elif model == 'purchase.order': + data = f"{server_address}/report/pdf/purchase.report_purchaseorder/{form_id}" + elif model == 'stock.picking': + data = f"{server_address}/report/pdf/stock.report_picking/{form_id}" + elif model == 'account.move': + data = f"{server_address}/report/pdf/account.report_invoice/{form_id}" + else: + raise ValidationError(_("No record to print!!!")) + return { + 'type': 'ir.actions.report', + 'data': data, + 'report_type': 'xlsx', + } + + def action_download_report(self): + """ + Summary: + In this method download the report of the form.Return a dict. + Returns: + type:dict , it contains the data for the download report. + """ + form_id = self.res_id + model = self.res_model + if model == 'sale.order': + record = self.env['ir.actions.report']._render_qweb_pdf( + 'sale.report_saleorder', form_id) + elif model == 'purchase.order': + record = self.env['ir.actions.report']._render_qweb_pdf( + 'purchase.report_purchaseorder', form_id) + elif model == 'stock.picking': + record = self.env['ir.actions.report']._render_qweb_pdf( + 'stock.report_picking', form_id) + elif model == 'account.move': + record = self.env['ir.actions.report']._render_qweb_pdf( + 'account.report_invoice', form_id) + else: + raise ValidationError(_("Select a record to download!!!")) + file_name = self.env[model].browse(form_id).name + '.pdf' + attachment = self.env['ir.attachment'].create({ + 'name': file_name, + 'type': 'binary', + 'datas': base64.b64encode(record[0]), + 'res_model': model, + 'res_id': form_id, + 'mimetype': 'application/x-pdf' + }) + return { + 'type': 'ir.actions.act_url', + 'target': 'new', + 'url': f"/web/content/{attachment.id}?download=true" + } + + def action_open_report(self): + """ + Summary: + In this method open the print screen of the form.Return a dict. + Returns: + type:dict , it contains the data for the open print report. + """ + form_id = self.res_id + model = self.res_model + server_address = self.get_base_url() + if model == 'sale.order': + url = f"{server_address}/report/pdf/sale.report_saleorder/{form_id}" + elif model == 'purchase.order': + url = f"{server_address}/report/pdf/purchase.report_purchaseorder/{form_id}" + elif model == 'stock.picking': + url = f"{server_address}/report/pdf/stock.report_picking/{form_id}" + elif model == 'account.move': + url = f"{server_address}/report/pdf/account.report_invoice/{form_id}" + else: + raise ValidationError(_("select any record!!!")) + return { + 'type': 'ir.actions.act_url', + 'target': 'new', + 'url': url + } + + def action_share_email(self): + """ + Summary: + In this method share email report of the corresponding form. + Return a dict. + Returns: + type:dict , it contains the data for the email template. + """ + form_id = self.res_id + model = self.res_model + model_name = self.resource_ref + self.ensure_one() + + if model == 'sale.order': + if model_name.state not in ('sale', 'done'): + mail_template = self.env.ref('sale.email_template_edi_sale') + else: + mail_template = self.env.ref( + 'sale.mail_template_sale_confirmation') + elif model == 'purchase.order': + if model_name.state not in ('purchase', 'done'): + mail_template = self.env.ref( + 'purchase.email_template_edi_purchase') + else: + mail_template = self.env.ref( + 'purchase.email_template_edi_purchase_done') + elif model == 'account.move': + if model_name.move_type == 'out_refund': + mail_template = self.env.ref( + 'account.email_template_edi_credit_note') + else: + mail_template = self.env.ref( + 'account.email_template_edi_invoice') + else: + raise ValidationError(_("select a record or selected record does " + "not have a share option!!!!!!")) + ctx = { + 'default_model': model, + 'default_res_id': form_id, + 'default_use_template': bool(mail_template), + 'default_template_id': mail_template.id if mail_template else None, + 'default_composition_mode': 'comment', + 'mark_so_as_sent': True, + 'default_email_layout_xmlid': 'mail.mail_notification_layout_with_' + 'responsible_signature', + 'proforma': self.env.context.get('proforma', False), + 'force_email': True, + } + if mail_template: + # If module has email template + return { + 'type': 'ir.actions.act_window', + 'view_mode': 'form', + 'res_model': 'mail.compose.message', + 'views': [(False, 'form')], + 'view_id': False, + 'target': 'new', + 'context': ctx, + } + raise ValidationError(_("select a record or selected record does not" + " have a share option!!!!!!!!!!!!")) diff --git a/pdf_report_action/wizard/dynamic_action_views.xml b/pdf_report_action/wizard/dynamic_action_views.xml new file mode 100755 index 000000000..fe50ae40d --- /dev/null +++ b/pdf_report_action/wizard/dynamic_action_views.xml @@ -0,0 +1,42 @@ + + + + + dynamic.action.view.form + dynamic.action + +
+
+ Select model and Record : +


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