diff --git a/export_view_pdf/README.rst b/export_view_pdf/README.rst new file mode 100644 index 000000000..fd62a7504 --- /dev/null +++ b/export_view_pdf/README.rst @@ -0,0 +1,44 @@ +.. image:: https://img.shields.io/badge/license-LGPL--3-blue.svg + :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html + :alt: License: LGPL-3 + +Export View PDF +=============== +This module helps to Export current List view in PDF format. + +Company +------- +* `Cybrosys Techno Solutions `__ + +License +------- +General Public License, Version 3 (LGPL v3). +(https://www.gnu.org/licenses/lgpl-3.0-standalone.html) + +Credits +------- +Developer: (v16) shamsad @ Cybrosys, + (V17) SAFA FAHEEM PE @cybrosys, +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/export_view_pdf/__init__.py b/export_view_pdf/__init__.py new file mode 100644 index 000000000..156acf2fb --- /dev/null +++ b/export_view_pdf/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-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 diff --git a/export_view_pdf/__manifest__.py b/export_view_pdf/__manifest__.py new file mode 100644 index 000000000..d7792fc7d --- /dev/null +++ b/export_view_pdf/__manifest__.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-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': "Export View PDF", + 'version': '17.0.1.0.0', + 'category': 'Extra Tools', + 'summary': """Export Current List View in PDF Format""", + 'description': """This module will add option to export the details of the + current list vie in the PDF format.""", + 'author': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'website': "https://www.cybrosys.com", + 'depends': ['base','web'], + 'data': + [ + 'data/export_paper_format.xml', + 'report/export_pdf_group_by_template.xml', + 'report/export_pdf_template.xml', + 'report/ir_exports_report.xml', + ], + 'assets': { + 'web.assets_backend': [ + 'export_view_pdf/static/src/js/export_dialog.js', + 'export_view_pdf/static/src/js/pdf_export.js', + 'export_view_pdf/static/src/xml/export_dialog.xml', + 'export_view_pdf/static/src/xml/export_pdf_dropdown.xml' + ] + }, + 'images': [ + 'static/description/banner.jpg' + ], + 'license': 'LGPL-3', + 'installable': True, + 'auto_install': False, + 'application': False, +} diff --git a/export_view_pdf/controllers/__init__.py b/export_view_pdf/controllers/__init__.py new file mode 100644 index 000000000..02f736c0f --- /dev/null +++ b/export_view_pdf/controllers/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-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 export_view_pdf diff --git a/export_view_pdf/controllers/export_view_pdf.py b/export_view_pdf/controllers/export_view_pdf.py new file mode 100644 index 000000000..1f728855c --- /dev/null +++ b/export_view_pdf/controllers/export_view_pdf.py @@ -0,0 +1,68 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-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 http +from odoo.http import request + + +class ExportData(http.Controller): + """This controller will fetch the data of the fields selected in the + dialog to the pdf report.""" + @http.route('/get_data', auth="user", type='json') + def action_get_export_data(self, **kw): + """ + method to fetch required details + """ + fields = kw['fields'] + model = kw['model'] + Model = request.env[model] + field_names = [f['name'] for f in fields] + columns_headers = [val['label'].strip() for val in fields] + domain = [('id', 'in', kw['res_ids'])] \ + if kw['res_ids'] else kw['domain'] + groupby = kw['grouped_by'] + records = Model.browse(kw['res_ids']) \ + if kw['res_ids'] \ + else Model.search(domain, offset=0, limit=False, order=False) + if groupby: + field_names = [f['name'] for f in fields] + groupby_type = [Model._fields[x.split(':')[0]].type for x in + kw['grouped_by']] + domain = kw['domain'] + groups_data = Model.read_group(domain, + [x if x != '.id' else 'id' for x in + field_names], groupby, lazy=False) + group_by = [] + for rec in groups_data: + ids = Model.search(rec['__domain']) + list_key = [x for x in rec.keys() if + x in field_names and x not in kw['grouped_by']] + export_data = [ids.export_data(field_names).get('datas', [])] + group_tuple = ( + {'count': rec['__count']}, rec.get(kw['grouped_by'][0]), + export_data, + [(rec[x], field_names.index(x)) for x in list_key]) + group_by.append(group_tuple) + return {'header': columns_headers, 'data': export_data, + 'type': groupby_type, 'other': group_by} + else: + export_data = records.export_data(field_names).get('datas', []) + return {'data': export_data, 'header': columns_headers} diff --git a/export_view_pdf/data/export_paper_format.xml b/export_view_pdf/data/export_paper_format.xml new file mode 100644 index 000000000..fd15afc2c --- /dev/null +++ b/export_view_pdf/data/export_paper_format.xml @@ -0,0 +1,20 @@ + + + + + + Export PDF + + custom + Landscape + 40.00 + 32.00 + 7.00 + 7.00 + + 35 + + 90 + + + diff --git a/export_view_pdf/doc/RELEASE_NOTES.md b/export_view_pdf/doc/RELEASE_NOTES.md new file mode 100644 index 000000000..29576cac7 --- /dev/null +++ b/export_view_pdf/doc/RELEASE_NOTES.md @@ -0,0 +1,8 @@ +## Module + +#### 19.01.2024 +#### Version 17.0.1.0.0 +#### ADD +- Initial commit for Export View PDF + + diff --git a/export_view_pdf/report/export_pdf_group_by_template.xml b/export_view_pdf/report/export_pdf_group_by_template.xml new file mode 100644 index 000000000..e626c544d --- /dev/null +++ b/export_view_pdf/report/export_pdf_group_by_template.xml @@ -0,0 +1,57 @@ + + + + + diff --git a/export_view_pdf/report/export_pdf_template.xml b/export_view_pdf/report/export_pdf_template.xml new file mode 100644 index 000000000..8e1f0a745 --- /dev/null +++ b/export_view_pdf/report/export_pdf_template.xml @@ -0,0 +1,29 @@ + + + + + diff --git a/export_view_pdf/report/ir_exports_report.xml b/export_view_pdf/report/ir_exports_report.xml new file mode 100644 index 000000000..ff24e99b9 --- /dev/null +++ b/export_view_pdf/report/ir_exports_report.xml @@ -0,0 +1,20 @@ + + + + + Export + ir.exports + qweb-pdf + export_view_pdf.export_in_pdf + report + + + + + + Export + ir.exports + qweb-pdf + export_view_pdf.export_in_pdf_group_by + + diff --git a/export_view_pdf/static/description/assets/icons/capture (1).png b/export_view_pdf/static/description/assets/icons/capture (1).png new file mode 100644 index 000000000..8824deafc Binary files /dev/null and b/export_view_pdf/static/description/assets/icons/capture (1).png differ diff --git a/export_view_pdf/static/description/assets/icons/check.png b/export_view_pdf/static/description/assets/icons/check.png new file mode 100644 index 000000000..c8e85f51d Binary files /dev/null and b/export_view_pdf/static/description/assets/icons/check.png differ diff --git a/export_view_pdf/static/description/assets/icons/chevron.png b/export_view_pdf/static/description/assets/icons/chevron.png new file mode 100644 index 000000000..2089293d6 Binary files /dev/null and b/export_view_pdf/static/description/assets/icons/chevron.png differ diff --git a/export_view_pdf/static/description/assets/icons/cogs.png b/export_view_pdf/static/description/assets/icons/cogs.png new file mode 100644 index 000000000..95d0bad62 Binary files /dev/null and b/export_view_pdf/static/description/assets/icons/cogs.png differ diff --git a/export_view_pdf/static/description/assets/icons/consultation.png b/export_view_pdf/static/description/assets/icons/consultation.png new file mode 100644 index 000000000..8319d4baa Binary files /dev/null and b/export_view_pdf/static/description/assets/icons/consultation.png differ diff --git a/export_view_pdf/static/description/assets/icons/ecom-black.png b/export_view_pdf/static/description/assets/icons/ecom-black.png new file mode 100644 index 000000000..a9385ff13 Binary files /dev/null and b/export_view_pdf/static/description/assets/icons/ecom-black.png differ diff --git a/export_view_pdf/static/description/assets/icons/education-black.png b/export_view_pdf/static/description/assets/icons/education-black.png new file mode 100644 index 000000000..3eb09b27b Binary files /dev/null and b/export_view_pdf/static/description/assets/icons/education-black.png differ diff --git a/export_view_pdf/static/description/assets/icons/hotel-black.png b/export_view_pdf/static/description/assets/icons/hotel-black.png new file mode 100644 index 000000000..130f613be Binary files /dev/null and b/export_view_pdf/static/description/assets/icons/hotel-black.png differ diff --git a/export_view_pdf/static/description/assets/icons/img.png b/export_view_pdf/static/description/assets/icons/img.png new file mode 100644 index 000000000..70197f477 Binary files /dev/null and b/export_view_pdf/static/description/assets/icons/img.png differ diff --git a/export_view_pdf/static/description/assets/icons/license.png b/export_view_pdf/static/description/assets/icons/license.png new file mode 100644 index 000000000..a5869797e Binary files /dev/null and b/export_view_pdf/static/description/assets/icons/license.png differ diff --git a/export_view_pdf/static/description/assets/icons/lifebuoy.png b/export_view_pdf/static/description/assets/icons/lifebuoy.png new file mode 100644 index 000000000..658d56ccc Binary files /dev/null and b/export_view_pdf/static/description/assets/icons/lifebuoy.png differ diff --git a/export_view_pdf/static/description/assets/icons/manufacturing-black.png b/export_view_pdf/static/description/assets/icons/manufacturing-black.png new file mode 100644 index 000000000..697eb0e9f Binary files /dev/null and b/export_view_pdf/static/description/assets/icons/manufacturing-black.png differ diff --git a/export_view_pdf/static/description/assets/icons/photo-capture.png b/export_view_pdf/static/description/assets/icons/photo-capture.png new file mode 100644 index 000000000..06c111758 Binary files /dev/null and b/export_view_pdf/static/description/assets/icons/photo-capture.png differ diff --git a/export_view_pdf/static/description/assets/icons/pos-black.png b/export_view_pdf/static/description/assets/icons/pos-black.png new file mode 100644 index 000000000..97c0f90c1 Binary files /dev/null and b/export_view_pdf/static/description/assets/icons/pos-black.png differ diff --git a/export_view_pdf/static/description/assets/icons/puzzle.png b/export_view_pdf/static/description/assets/icons/puzzle.png new file mode 100644 index 000000000..65cf854e7 Binary files /dev/null and b/export_view_pdf/static/description/assets/icons/puzzle.png differ diff --git a/export_view_pdf/static/description/assets/icons/restaurant-black.png b/export_view_pdf/static/description/assets/icons/restaurant-black.png new file mode 100644 index 000000000..4a35eb939 Binary files /dev/null and b/export_view_pdf/static/description/assets/icons/restaurant-black.png differ diff --git a/export_view_pdf/static/description/assets/icons/service-black.png b/export_view_pdf/static/description/assets/icons/service-black.png new file mode 100644 index 000000000..301ab51cb Binary files /dev/null and b/export_view_pdf/static/description/assets/icons/service-black.png differ diff --git a/export_view_pdf/static/description/assets/icons/trading-black.png b/export_view_pdf/static/description/assets/icons/trading-black.png new file mode 100644 index 000000000..9398ba2f1 Binary files /dev/null and b/export_view_pdf/static/description/assets/icons/trading-black.png differ diff --git a/export_view_pdf/static/description/assets/icons/training.png b/export_view_pdf/static/description/assets/icons/training.png new file mode 100644 index 000000000..884ca024d Binary files /dev/null and b/export_view_pdf/static/description/assets/icons/training.png differ diff --git a/export_view_pdf/static/description/assets/icons/update.png b/export_view_pdf/static/description/assets/icons/update.png new file mode 100644 index 000000000..ecbc5a01a Binary files /dev/null and b/export_view_pdf/static/description/assets/icons/update.png differ diff --git a/export_view_pdf/static/description/assets/icons/user.png b/export_view_pdf/static/description/assets/icons/user.png new file mode 100644 index 000000000..6ffb23d9f Binary files /dev/null and b/export_view_pdf/static/description/assets/icons/user.png differ diff --git a/export_view_pdf/static/description/assets/icons/wrench.png b/export_view_pdf/static/description/assets/icons/wrench.png new file mode 100644 index 000000000..6c04dea0f Binary files /dev/null and b/export_view_pdf/static/description/assets/icons/wrench.png differ diff --git a/export_view_pdf/static/description/assets/misc/Cybrosys R.png b/export_view_pdf/static/description/assets/misc/Cybrosys R.png new file mode 100644 index 000000000..da4058087 Binary files /dev/null and b/export_view_pdf/static/description/assets/misc/Cybrosys R.png differ diff --git a/export_view_pdf/static/description/assets/misc/email.svg b/export_view_pdf/static/description/assets/misc/email.svg new file mode 100644 index 000000000..15291cdc3 --- /dev/null +++ b/export_view_pdf/static/description/assets/misc/email.svg @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/export_view_pdf/static/description/assets/misc/phone.svg b/export_view_pdf/static/description/assets/misc/phone.svg new file mode 100644 index 000000000..b7bd7f251 --- /dev/null +++ b/export_view_pdf/static/description/assets/misc/phone.svg @@ -0,0 +1,3 @@ + + + diff --git a/export_view_pdf/static/description/assets/misc/star (1) 2.svg b/export_view_pdf/static/description/assets/misc/star (1) 2.svg new file mode 100644 index 000000000..5ae9f507a --- /dev/null +++ b/export_view_pdf/static/description/assets/misc/star (1) 2.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/export_view_pdf/static/description/assets/misc/support (1) 1.svg b/export_view_pdf/static/description/assets/misc/support (1) 1.svg new file mode 100644 index 000000000..7d37a8f30 --- /dev/null +++ b/export_view_pdf/static/description/assets/misc/support (1) 1.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/export_view_pdf/static/description/assets/misc/support-email.svg b/export_view_pdf/static/description/assets/misc/support-email.svg new file mode 100644 index 000000000..eb70370d6 --- /dev/null +++ b/export_view_pdf/static/description/assets/misc/support-email.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/export_view_pdf/static/description/assets/misc/tick-mark.svg b/export_view_pdf/static/description/assets/misc/tick-mark.svg new file mode 100644 index 000000000..2dbb40187 --- /dev/null +++ b/export_view_pdf/static/description/assets/misc/tick-mark.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/export_view_pdf/static/description/assets/misc/whatsapp 1.svg b/export_view_pdf/static/description/assets/misc/whatsapp 1.svg new file mode 100644 index 000000000..0bfaf8fc6 --- /dev/null +++ b/export_view_pdf/static/description/assets/misc/whatsapp 1.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/export_view_pdf/static/description/assets/misc/whatsapp.svg b/export_view_pdf/static/description/assets/misc/whatsapp.svg new file mode 100644 index 000000000..b618aea1d --- /dev/null +++ b/export_view_pdf/static/description/assets/misc/whatsapp.svg @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/export_view_pdf/static/description/assets/modules/1.jpg b/export_view_pdf/static/description/assets/modules/1.jpg new file mode 100644 index 000000000..67c7f7062 Binary files /dev/null and b/export_view_pdf/static/description/assets/modules/1.jpg differ diff --git a/export_view_pdf/static/description/assets/modules/2.png b/export_view_pdf/static/description/assets/modules/2.png new file mode 100644 index 000000000..3bedf7981 Binary files /dev/null and b/export_view_pdf/static/description/assets/modules/2.png differ diff --git a/export_view_pdf/static/description/assets/modules/3.png b/export_view_pdf/static/description/assets/modules/3.png new file mode 100644 index 000000000..164eb62c7 Binary files /dev/null and b/export_view_pdf/static/description/assets/modules/3.png differ diff --git a/export_view_pdf/static/description/assets/modules/4.png b/export_view_pdf/static/description/assets/modules/4.png new file mode 100644 index 000000000..d246d83ac Binary files /dev/null and b/export_view_pdf/static/description/assets/modules/4.png differ diff --git a/export_view_pdf/static/description/assets/modules/5.jpg b/export_view_pdf/static/description/assets/modules/5.jpg new file mode 100644 index 000000000..655cf38f5 Binary files /dev/null and b/export_view_pdf/static/description/assets/modules/5.jpg differ diff --git a/export_view_pdf/static/description/assets/modules/6.jpg b/export_view_pdf/static/description/assets/modules/6.jpg new file mode 100644 index 000000000..1f3f2e27f Binary files /dev/null and b/export_view_pdf/static/description/assets/modules/6.jpg differ diff --git a/export_view_pdf/static/description/assets/screenshots/export_pdf_01.png b/export_view_pdf/static/description/assets/screenshots/export_pdf_01.png new file mode 100644 index 000000000..3aac9118b Binary files /dev/null and b/export_view_pdf/static/description/assets/screenshots/export_pdf_01.png differ diff --git a/export_view_pdf/static/description/assets/screenshots/export_pdf_02.png b/export_view_pdf/static/description/assets/screenshots/export_pdf_02.png new file mode 100644 index 000000000..7db14f1ba Binary files /dev/null and b/export_view_pdf/static/description/assets/screenshots/export_pdf_02.png differ diff --git a/export_view_pdf/static/description/assets/screenshots/export_pdf_03.png b/export_view_pdf/static/description/assets/screenshots/export_pdf_03.png new file mode 100644 index 000000000..cc614d7bb Binary files /dev/null and b/export_view_pdf/static/description/assets/screenshots/export_pdf_03.png differ diff --git a/export_view_pdf/static/description/assets/screenshots/export_pdf_04.png b/export_view_pdf/static/description/assets/screenshots/export_pdf_04.png new file mode 100644 index 000000000..f530eb93b Binary files /dev/null and b/export_view_pdf/static/description/assets/screenshots/export_pdf_04.png differ diff --git a/export_view_pdf/static/description/assets/screenshots/hero.gif b/export_view_pdf/static/description/assets/screenshots/hero.gif new file mode 100644 index 000000000..7edcdc968 Binary files /dev/null and b/export_view_pdf/static/description/assets/screenshots/hero.gif differ diff --git a/export_view_pdf/static/description/banner.jpg b/export_view_pdf/static/description/banner.jpg new file mode 100644 index 000000000..e819da7b7 Binary files /dev/null and b/export_view_pdf/static/description/banner.jpg differ diff --git a/export_view_pdf/static/description/icon.png b/export_view_pdf/static/description/icon.png new file mode 100644 index 000000000..e15974c5b Binary files /dev/null and b/export_view_pdf/static/description/icon.png differ diff --git a/export_view_pdf/static/description/index.html b/export_view_pdf/static/description/index.html new file mode 100644 index 000000000..e7d043ad7 --- /dev/null +++ b/export_view_pdf/static/description/index.html @@ -0,0 +1,561 @@ + + + + + + + Export View PDF Index + + + + + + + + +
+
+
+
+
+ +
+
+
+ Community +
+
+ Enterprise +
+
+ Odoo.sh +
+
+
+
+
+
+

+ Export View PDF

+

+ Export Current List View in PDF Format +

+
+ +
+
+
+
+
+

Key Highlights +

+
+
+
+
+
+ +
+
+

Export Tree View in PDF Format

+
+
+
+
+
+
+ +
+
+

Select the desired field and Export.

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

+ In the List View user can see an option for Export Pdf. +

+
+
+
+
+
+
+ +
+
+

+ When click on the menu it will open a dialog box to select fields to export. +

+
+
+
+
+
+
+ +
+
+

+ Select the desired Field and click on the Export Button. +

+
+
+
+
+
+
+ +
+
+

+ On clicking the Export Button corresponding List view will be exported in PDF Format. +

+
+
+
+
+
+
+
    +
  • + Export Tree View in PDF Format + + +
  • +
  • + Select the desired field and Export +
  • +
+
+
+
+
+
+
Version + 17.0.1.0.0|Released on:19 Jan 2024 +
+

+ + Initial commit for Export View PDF.

+
+
+
+
+
+
+
+

Related Products

+
+
+ +
+
+

Our Services

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

Odoo Customization

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

Odoo Implementation

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

Odoo Support

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

Hire Odoo Developer

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

Odoo Integration

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

Odoo Migration

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

Odoo Consultancy

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

Odoo Implementation

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

Odoo Licensing Consultancy

+
+
+
+
+
+
+

Our Industries

+ +
+
+
+
+
+
+ +

Trading

+

Easily procure and sell your products

+
+
+
+
+ +

POS

+

Easy configuration and convivial experience

+
+
+
+
+ +

Education

+

A platform for educational management

+
+
+
+
+ +

Manufacturing

+

Plan, track and schedule your operations

+
+
+
+
+ +

E-commerce & Website

+

Mobile friendly, awe-inspiring product pages

+
+
+
+
+ +

Service Management

+

Keep track of services and invoice

+
+
+
+
+ +

Restaurant

+

Run your bar or restaurant methodically

+
+
+
+
+ +

Hotel Management

+

An all-inclusive hotel management application

+
+
+
+
+
+
+

Support

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

Got questions or need help? Get in touch.

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

Say hi to us on WhatsApp!

+
+91 + 99456767686
+
+
+
+
+
+
+
+
+ + + + + + diff --git a/export_view_pdf/static/src/js/export_dialog.js b/export_view_pdf/static/src/js/export_dialog.js new file mode 100644 index 000000000..fea7524b4 --- /dev/null +++ b/export_view_pdf/static/src/js/export_dialog.js @@ -0,0 +1,81 @@ +/** @odoo-module */ + +import { Dialog } from "@web/core/dialog/dialog"; +import { _t } from "@web/core/l10n/translation"; +import { useChildRef } from "@web/core/utils/hooks"; + +import { Component } from "@odoo/owl"; + +// extending the dialog component to add the export dialog +export class ExportDialog extends Component { + setup() { + this.env.dialogData.dismiss = () => this._cancel(); + this.modalRef = useChildRef(); + this.isProcess = false; + } + + async _cancel() { + return this.execButton(this.props.cancel); + } + + async _confirm() { + return this.execButton(this.props.confirm); + } + + setButtonsDisabled(disabled) { + this.isProcess = disabled; + if (!this.modalRef.el) { + return; // safety belt for stable versions + } + for (const button of [...this.modalRef.el.querySelectorAll(".modal-footer button")]) { + button.disabled = disabled; + } + } + + async execButton(callback) { + if (this.isProcess) { + return; + } + this.setButtonsDisabled(true); + if (callback) { + let shouldClose; + try { + shouldClose = await callback(); + } catch (e) { + this.props.close(); + throw e; + } + if (shouldClose === false) { + this.setButtonsDisabled(false); + return; + } + } + this.props.close(); + } +} +// setting properties of ExportDialog +ExportDialog.template = "ExportPdf.List"; +ExportDialog.components = { Dialog }; +ExportDialog.props = { + close: Function, + title: { + validate: (m) => { + return ( + typeof m === "string" || (typeof m === "object" && typeof m.toString === "function") + ); + }, + optional: true, + }, + body: String, + confirm: { type: Function, optional: true }, + confirmLabel: { type: String, optional: true }, + confirmClass: { type: String, optional: true }, + cancel: { type: Function, optional: true }, + cancelLabel: { type: String, optional: true }, +}; +ExportDialog.defaultProps = { + confirmLabel: _t("Export"), + cancelLabel: _t("Cancel"), + confirmClass: "btn-primary", + title: _t("Export PDF"), +}; diff --git a/export_view_pdf/static/src/js/pdf_export.js b/export_view_pdf/static/src/js/pdf_export.js new file mode 100644 index 000000000..0f60683e9 --- /dev/null +++ b/export_view_pdf/static/src/js/pdf_export.js @@ -0,0 +1,94 @@ +/** @odoo-module **/ + +import { DropdownItem } from "@web/core/dropdown/dropdown_item"; +import { registry } from "@web/core/registry"; +import { archParseBoolean } from "@web/views/utils"; +import { STATIC_ACTIONS_GROUP_NUMBER } from "@web/search/action_menus/action_menus"; +import { _t } from "@web/core/l10n/translation"; +import { jsonrpc } from "@web/core/network/rpc_service"; +import { ExportDialog } from "../js/export_dialog"; +import { Component } from "@odoo/owl"; + +const cogMenuRegistry = registry.category("cogMenu"); + +/** + * 'Export PDF' menu + * + * This component is used to export PDF the records for particular model. + * @extends Component + */ +export class ExportPdf extends Component { + static template = "web.ExportPdf"; + static components = { DropdownItem }; + + //--------------------------------------------------------------------- + // Protected + //--------------------------------------------------------------------- +// method to define the functionality when clicking on the export pdf menu + async onDirectExportPdf() { + this.env.searchModel.trigger('direct-export-pdf'); + var self = this.__owl__.parent.parent.parent.parent.parent.component; + const fields = this.__owl__.parent.parent.parent.parent.parent.component.props.archInfo.columns + .filter((col) => col.type === "field") + .map((col) => this.__owl__.parent.parent.parent.parent.parent.component.props.fields[col.name]) + const exportField = []; + const exportedFields = fields.map((field) => ({ + name: field.name, + label: field.label || field.string, + })); + const resIds = await this.__owl__.parent.parent.parent.parent.parent.component.getSelectedResIds(); + this.__owl__.parent.parent.parent.parent.parent.component.dialogService.add(ExportDialog, { + title: _t("Export PDF"), + context: exportedFields, + confirm: () => { + let checkboxes = document.querySelectorAll(`#${'check'} input[type="checkbox"]`); + checkboxes.forEach(item => { + if (item.checked === true){ + exportField.push({name:item.name,label:item.value}) + } + }); + var length_field = Array.from(Array(exportField.length).keys()); + jsonrpc('/get_data',{ + 'model':this.__owl__.parent.parent.parent.parent.parent.component.model.root.resModel, + 'res_ids':resIds.length > 0 && resIds, + 'fields':exportField, + 'grouped_by':this.__owl__.parent.parent.parent.parent.parent.component.model.root.groupBy, + 'context': this.__owl__.parent.parent.parent.parent.parent.component.props.context, + 'domain':this.__owl__.parent.parent.parent.parent.parent.component.model.root.domain, + 'context':this.__owl__.parent.parent.parent.parent.parent.component.props.context, + }).then( function (data){ + if (self.model.root.groupBy[0]){ + var group_length=Array.from(Array(self.model.root.groups)); + var action = { + 'type': 'ir.actions.report', + 'report_type': 'qweb-pdf', + 'report_name':'export_view_pdf.export_in_pdf_group_by', + 'data':{'length':length_field,'group_len':[0,1,2,3],'record':data,} + }; + } + else{ + var action = { + 'type': 'ir.actions.report', + 'report_type': 'qweb-pdf', + 'report_name':'export_view_pdf.export_in_pdf', + 'data':{'length':length_field,'record':data} + }; + } + return self.model.action.doAction(action); + }); + }, + cancel: () => {}, + }); + } +} +// for adding export pdf menu item +export const exportPdfItem = { + Component: ExportPdf, + groupNumber: STATIC_ACTIONS_GROUP_NUMBER, + isDisplayed: async (env) => + env.config.viewType === "list" && + !env.model.root.selection.length && + await env.model.user.hasGroup("base.group_allow_export") && + archParseBoolean(env.config.viewArch.getAttribute("export_xlsx"), true), +}; +cogMenuRegistry.add("export-pdf-menu", exportPdfItem, { sequence: 10 }); diff --git a/export_view_pdf/static/src/xml/export_dialog.xml b/export_view_pdf/static/src/xml/export_dialog.xml new file mode 100644 index 000000000..3acd54093 --- /dev/null +++ b/export_view_pdf/static/src/xml/export_dialog.xml @@ -0,0 +1,20 @@ + + + + + + +
+ + +
+
+ +
+
+
diff --git a/export_view_pdf/static/src/xml/export_pdf_dropdown.xml b/export_view_pdf/static/src/xml/export_pdf_dropdown.xml new file mode 100644 index 000000000..a6a2aaf92 --- /dev/null +++ b/export_view_pdf/static/src/xml/export_pdf_dropdown.xml @@ -0,0 +1,9 @@ + + + + + + Export PDF + + +