diff --git a/pdf_report_action/README.rst b/pdf_report_action/README.rst new file mode 100755 index 000000000..c916a33bd --- /dev/null +++ b/pdf_report_action/README.rst @@ -0,0 +1,47 @@ +.. 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 +------- +* Developer : (V15) Bhagyadev KP +* 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..824507649 --- /dev/null +++ b/pdf_report_action/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Bhagyadev K P() +# +# This program is free software: you can modify +# it under the terms of the GNU Affero General Public License (AGPL) as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +################################################################################ +from . import wizard diff --git a/pdf_report_action/__manifest__.py b/pdf_report_action/__manifest__.py new file mode 100755 index 000000000..a69cc52a9 --- /dev/null +++ b/pdf_report_action/__manifest__.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Bhagyadev K P() +# +# This program is free software: you can modify +# it under the terms of the GNU Affero General Public License (AGPL) as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +################################################################################ +{ + 'name': 'Dynamic Report Operations', + 'version': '15.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', + }, + 'web.assets_qweb': { + '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..855d6a36b --- /dev/null +++ b/pdf_report_action/doc/RELEASE_NOTES.md @@ -0,0 +1,6 @@ +## Module + +#### 19.06.2024 +#### Version 15.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..719f76263 --- /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,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/logo.png b/pdf_report_action/static/description/assets/icons/logo.png new file mode 100755 index 000000000..478462d3e Binary files /dev/null and b/pdf_report_action/static/description/assets/icons/logo.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/m1.png b/pdf_report_action/static/description/assets/modules/m1.png new file mode 100644 index 000000000..922179d26 Binary files /dev/null and b/pdf_report_action/static/description/assets/modules/m1.png differ diff --git a/pdf_report_action/static/description/assets/modules/m2.png b/pdf_report_action/static/description/assets/modules/m2.png new file mode 100644 index 000000000..ff48be9db Binary files /dev/null and b/pdf_report_action/static/description/assets/modules/m2.png differ diff --git a/pdf_report_action/static/description/assets/modules/m3.png b/pdf_report_action/static/description/assets/modules/m3.png new file mode 100644 index 000000000..5fa52dd49 Binary files /dev/null and b/pdf_report_action/static/description/assets/modules/m3.png differ diff --git a/pdf_report_action/static/description/assets/modules/m4.jpg b/pdf_report_action/static/description/assets/modules/m4.jpg new file mode 100644 index 000000000..0dd0f197d Binary files /dev/null and b/pdf_report_action/static/description/assets/modules/m4.jpg differ diff --git a/pdf_report_action/static/description/assets/modules/m5.jpg b/pdf_report_action/static/description/assets/modules/m5.jpg new file mode 100644 index 000000000..a4adceea0 Binary files /dev/null and b/pdf_report_action/static/description/assets/modules/m5.jpg differ diff --git a/pdf_report_action/static/description/assets/modules/m6.jpg b/pdf_report_action/static/description/assets/modules/m6.jpg new file mode 100644 index 000000000..59d366f80 Binary files /dev/null and b/pdf_report_action/static/description/assets/modules/m6.jpg differ diff --git a/pdf_report_action/static/description/assets/screenshots/1.png b/pdf_report_action/static/description/assets/screenshots/1.png new file mode 100644 index 000000000..98aeb7766 Binary files /dev/null and b/pdf_report_action/static/description/assets/screenshots/1.png differ diff --git a/pdf_report_action/static/description/assets/screenshots/2.png b/pdf_report_action/static/description/assets/screenshots/2.png new file mode 100644 index 000000000..f9113a1e8 Binary files /dev/null and b/pdf_report_action/static/description/assets/screenshots/2.png differ diff --git a/pdf_report_action/static/description/assets/screenshots/3.png b/pdf_report_action/static/description/assets/screenshots/3.png new file mode 100644 index 000000000..94e88e173 Binary files /dev/null and b/pdf_report_action/static/description/assets/screenshots/3.png differ diff --git a/pdf_report_action/static/description/assets/screenshots/4.png b/pdf_report_action/static/description/assets/screenshots/4.png new file mode 100644 index 000000000..a87c0dc57 Binary files /dev/null and b/pdf_report_action/static/description/assets/screenshots/4.png differ diff --git a/pdf_report_action/static/description/assets/screenshots/5.png b/pdf_report_action/static/description/assets/screenshots/5.png new file mode 100644 index 000000000..903f0a44e Binary files /dev/null and b/pdf_report_action/static/description/assets/screenshots/5.png differ diff --git a/pdf_report_action/static/description/assets/screenshots/6.png b/pdf_report_action/static/description/assets/screenshots/6.png new file mode 100644 index 000000000..9b23f55da Binary files /dev/null and b/pdf_report_action/static/description/assets/screenshots/6.png differ diff --git a/pdf_report_action/static/description/assets/screenshots/7.png b/pdf_report_action/static/description/assets/screenshots/7.png new file mode 100644 index 000000000..3bb0fd783 Binary files /dev/null and b/pdf_report_action/static/description/assets/screenshots/7.png differ diff --git a/pdf_report_action/static/description/assets/screenshots/8.png b/pdf_report_action/static/description/assets/screenshots/8.png new file mode 100644 index 000000000..83883606a Binary files /dev/null and b/pdf_report_action/static/description/assets/screenshots/8.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..c231ce879 Binary files /dev/null and b/pdf_report_action/static/description/assets/screenshots/hero.gif 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..ccf58aee4 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 100644 index 000000000..22caea304 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..71c116b8a --- /dev/null +++ b/pdf_report_action/static/description/index.html @@ -0,0 +1,666 @@ +
+ +
+ +
+
+ Community +
+
+ Enterprise +
+
+ Odoo.sh +
+
+
+ +
+
+
+ +

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 options. +
+
+
+
+ + Available for Sales, Purchase, Inventory and Invoice modules. +
+
+
+ + + +
+
+ +
+

+ Screenshots +

+
+
+
+
+

We can see a Systray icon 'Report Actions'. +

+ +
+
+

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

+ +
+
+

+ We can select the model and records to perform the report actions +

+ +
+
+

+ 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

+
+
+
+
+
+
+
+ +
+
+
+ +
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..5edc1fb1c --- /dev/null +++ b/pdf_report_action/static/src/css/report_action.css @@ -0,0 +1,9 @@ +.wizard_btn { + margin: 12px; + border-radius: 7px; + height: 40px; + width: 150px; +} +.ui-autocomplete-input { + width: 80px !important; +} 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..4d3df314f --- /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..c47d226d9 --- /dev/null +++ b/pdf_report_action/static/src/js/report_action_systray.js @@ -0,0 +1,24 @@ +/** @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: 'pdf_report_action.IconSystrayDropdown', + events: { + 'click .o-dropdown': '_onClick', + }, + _onClick: function(ev){ // Function on clicking the systray icon + this.do_action({ + type: 'ir.actions.act_window', + name: 'Report Action', + 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..2c110f5d5 --- /dev/null +++ b/pdf_report_action/static/src/xml/report_action_systray.xml @@ -0,0 +1,16 @@ + + + + +
+ +
+
+
diff --git a/pdf_report_action/wizard/__init__.py b/pdf_report_action/wizard/__init__.py new file mode 100755 index 000000000..838021b67 --- /dev/null +++ b/pdf_report_action/wizard/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Bhagyadev K P() +# +# This program is free software: you can modify +# it under the terms of the GNU Affero General Public License (AGPL) as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +################################################################################ +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..44e1bed89 --- /dev/null +++ b/pdf_report_action/wizard/dynamic_action.py @@ -0,0 +1,222 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Bhagyadev K P() +# +# This program is free software: you can modify +# it under the terms of the GNU Affero General Public License (AGPL) as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +################################################################################ +import base64 +from odoo import api, fields, models, _ +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(string='Related Document Model', + help='Model of the related document') + res_id = fields.Integer(string='Related Document ID', + model_field='res_model', + help='ID of the related document') + resource_ref = fields.Reference(string='Record', + selection='_selection_resource_ref', + inverse='_inverse_resource_ref', + help='Reference to the record') + + @api.model + def _selection_resource_ref(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 _inverse_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." + f"report_saleorder/{form_id}") + elif model == 'purchase.order': + data = (f"{server_address}/report/pdf/purchase." + f"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." + f"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': + report_name = 'sale.report_saleorder' + elif model == 'purchase.order': + report_name = 'purchase.report_purchaseorder' + elif model == 'stock.picking': + report_name = 'stock.report_picking' + elif model == 'account.move': + report_name = 'account.report_invoice' + else: + raise ValidationError(_("Select a record to download!!!")) + report = self.env['ir.actions.report']._get_report_from_name( + report_name) + if not report: + raise ValidationError(_("Report not found!")) + pdf_content, content_type = report._render_qweb_pdf([form_id]) + file_name = self.env[model].browse(form_id).name + '.pdf' + attachment = self.env['ir.attachment'].create({ + 'name': file_name, + 'type': 'binary', + 'datas': base64.b64encode(pdf_content), + '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." + f"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." + f"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: + 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..039e3672b --- /dev/null +++ b/pdf_report_action/wizard/dynamic_action_views.xml @@ -0,0 +1,45 @@ + + + + + dynamic.action.view.form + dynamic.action + +
+
+ Select model and Record : + +
+
+
+ + + + + +
+
+
+ +
+
+