diff --git a/export_view_pdf/README.rst b/export_view_pdf/README.rst new file mode 100644 index 000000000..fe77c41cb --- /dev/null +++ b/export_view_pdf/README.rst @@ -0,0 +1,47 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + + +Export View PDF +=============== +*This app allows you to export list view in PDF format.* + +Installation +============ +- www.odoo.com/documentation/13.0/setup/install.html +- Install our custom addon + +License +------- +GNU AFFERO GENERAL PUBLIC LICENSE v3.0 (AGPL-3) +(https://www.odoo.com/documentation/13.0/legal/licenses.html) + +Company +------- +* `Cybrosys Techno Solutions `__ + +Credits +------- +* Developer: +(v15) shamsad @ Cybrosys +(v13) arwa @ Cybrosys + +Contacts +-------- +* Mail Contact : odoo@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 +========== +This module is maintained by Cybrosys Technologies. + +For support and more information, please visit https://www.cybrosys.com + +Further information +=================== +HTML Description: ``__ + diff --git a/export_view_pdf/__init__.py b/export_view_pdf/__init__.py new file mode 100644 index 000000000..bc154288a --- /dev/null +++ b/export_view_pdf/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions (Contact : odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################# +from . import controllers diff --git a/export_view_pdf/__manifest__.py b/export_view_pdf/__manifest__.py new file mode 100644 index 000000000..05d9eec6b --- /dev/null +++ b/export_view_pdf/__manifest__.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions (Contact : odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################# +{ + 'name': "Export View PDF", + 'version': '13.0.1.0.0', + 'summary': """Export Current List View in PDF Format """, + 'description': """This module allows you to print list views in PDF + format""", + 'category': 'Extra Tools', + 'author': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'website': "https://www.cybrosys.com", + 'depends': ['base'], + 'data': + [ + 'report/ir_exports_reports.xml', + 'report/ir_exports_templates.xml', + 'views/assets.xml', + ], + 'qweb': [ + 'static/src/xml/button_view.xml', + ], + 'images': [ + 'static/description/banner.png' + ], + 'license': 'AGPL-3', + 'installable': True, + 'application': False, + 'auto_install': False, +} diff --git a/export_view_pdf/controllers/__init__.py b/export_view_pdf/controllers/__init__.py new file mode 100644 index 000000000..816469828 --- /dev/null +++ b/export_view_pdf/controllers/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions (Contact : odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################# +from . import 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..be4d8d02e --- /dev/null +++ b/export_view_pdf/controllers/export_view_pdf.py @@ -0,0 +1,63 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions (Contact : odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################# +from odoo import http +from odoo.http import request + + +class ExportData(http.Controller): + """Controller class for fetching required details and exporting data.""" + @http.route('/get_data', auth="user", type='json') + def get_export_data(self, **kw): + """ + controller to fetch required details + """ + field = kw['field'] + model = kw['model'] + mod = request.env[model] + res_ids = kw['res_ids'] + field_label = kw['exported_fields'] + columns_headers = [val['label'].strip() for val in field_label] + records = request.env[model].browse(res_ids) + new_export_data = [] + if kw['grouped_by']: + field_names = [field for field in kw['field']] + groupby_type = [mod._fields[field.split(':')[0]].type for field in + kw['grouped_by']] + domain = kw['domain'] + groups_data = mod.sudo().read_group(domain, field_names, + kw['grouped_by'], lazy=False) + group_by = [] + for rec in groups_data: + ids = mod.search(rec['__domain']) + list_key = [key for key in rec.keys() if + key in kw['field'] and key not in kw['grouped_by']] + new_export_data = [ids.export_data(field).get('datas', [])] + group_tuple = ( + {'count': rec['__count']}, rec.get(kw['grouped_by'][0]), + new_export_data, + [(rec[key], field.index(key)) for key in list_key]) + group_by.append(group_tuple) + return {'header': columns_headers, 'data': new_export_data, + 'type': groupby_type, 'other': group_by} + else: + new_export_data = records.export_data(field).get('datas', []) + return {'data': new_export_data, 'header': columns_headers} diff --git a/export_view_pdf/doc/RELEASE_NOTES.md b/export_view_pdf/doc/RELEASE_NOTES.md new file mode 100644 index 000000000..0ae3284b6 --- /dev/null +++ b/export_view_pdf/doc/RELEASE_NOTES.md @@ -0,0 +1,6 @@ +## Module + +#### 04.07.2023 +#### Version 13.0.1.0.0 +#### ADD +- Initial commit for Export View PDF \ No newline at end of file diff --git a/export_view_pdf/report/ir_exports_reports.xml b/export_view_pdf/report/ir_exports_reports.xml new file mode 100644 index 000000000..4a98ad31e --- /dev/null +++ b/export_view_pdf/report/ir_exports_reports.xml @@ -0,0 +1,9 @@ + + + + Export + ir.exports + qweb-pdf + export_view_pdf.export_pdf_template + + \ No newline at end of file diff --git a/export_view_pdf/report/ir_exports_templates.xml b/export_view_pdf/report/ir_exports_templates.xml new file mode 100644 index 000000000..f1871cdf1 --- /dev/null +++ b/export_view_pdf/report/ir_exports_templates.xml @@ -0,0 +1,36 @@ + + + + Export + ir.exports + qweb-pdf + export_view_pdf.export_pdf_template + + + + \ No newline at end of file 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/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/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/categories.png b/export_view_pdf/static/description/assets/misc/categories.png new file mode 100644 index 000000000..bedf1e0b1 Binary files /dev/null and b/export_view_pdf/static/description/assets/misc/categories.png differ diff --git a/export_view_pdf/static/description/assets/misc/check-box.png b/export_view_pdf/static/description/assets/misc/check-box.png new file mode 100644 index 000000000..42caf24b9 Binary files /dev/null and b/export_view_pdf/static/description/assets/misc/check-box.png differ diff --git a/export_view_pdf/static/description/assets/misc/compass.png b/export_view_pdf/static/description/assets/misc/compass.png new file mode 100644 index 000000000..d5fed8faa Binary files /dev/null and b/export_view_pdf/static/description/assets/misc/compass.png differ diff --git a/export_view_pdf/static/description/assets/misc/corporate.png b/export_view_pdf/static/description/assets/misc/corporate.png new file mode 100644 index 000000000..2eb13edbf Binary files /dev/null and b/export_view_pdf/static/description/assets/misc/corporate.png differ diff --git a/export_view_pdf/static/description/assets/misc/customer-support.png b/export_view_pdf/static/description/assets/misc/customer-support.png new file mode 100644 index 000000000..79efc72ed Binary files /dev/null and b/export_view_pdf/static/description/assets/misc/customer-support.png differ diff --git a/export_view_pdf/static/description/assets/misc/cybrosys-logo.png b/export_view_pdf/static/description/assets/misc/cybrosys-logo.png new file mode 100644 index 000000000..cc3cc0ccf Binary files /dev/null and b/export_view_pdf/static/description/assets/misc/cybrosys-logo.png differ diff --git a/export_view_pdf/static/description/assets/misc/features.png b/export_view_pdf/static/description/assets/misc/features.png new file mode 100644 index 000000000..b41769f77 Binary files /dev/null and b/export_view_pdf/static/description/assets/misc/features.png differ diff --git a/export_view_pdf/static/description/assets/misc/logo.png b/export_view_pdf/static/description/assets/misc/logo.png new file mode 100644 index 000000000..478462d3e Binary files /dev/null and b/export_view_pdf/static/description/assets/misc/logo.png differ diff --git a/export_view_pdf/static/description/assets/misc/pictures.png b/export_view_pdf/static/description/assets/misc/pictures.png new file mode 100644 index 000000000..56d255fe9 Binary files /dev/null and b/export_view_pdf/static/description/assets/misc/pictures.png differ diff --git a/export_view_pdf/static/description/assets/misc/pie-chart.png b/export_view_pdf/static/description/assets/misc/pie-chart.png new file mode 100644 index 000000000..426e05244 Binary files /dev/null and b/export_view_pdf/static/description/assets/misc/pie-chart.png differ diff --git a/export_view_pdf/static/description/assets/misc/right-arrow.png b/export_view_pdf/static/description/assets/misc/right-arrow.png new file mode 100644 index 000000000..730984a06 Binary files /dev/null and b/export_view_pdf/static/description/assets/misc/right-arrow.png differ diff --git a/export_view_pdf/static/description/assets/misc/star.png b/export_view_pdf/static/description/assets/misc/star.png new file mode 100644 index 000000000..2eb9ab29f Binary files /dev/null and b/export_view_pdf/static/description/assets/misc/star.png differ diff --git a/export_view_pdf/static/description/assets/misc/support.png b/export_view_pdf/static/description/assets/misc/support.png new file mode 100644 index 000000000..4f18b8b82 Binary files /dev/null and b/export_view_pdf/static/description/assets/misc/support.png differ diff --git a/export_view_pdf/static/description/assets/misc/whatsapp.png b/export_view_pdf/static/description/assets/misc/whatsapp.png new file mode 100644 index 000000000..d513a5356 Binary files /dev/null and b/export_view_pdf/static/description/assets/misc/whatsapp.png differ diff --git a/export_view_pdf/static/description/assets/modules/export_stock.png b/export_view_pdf/static/description/assets/modules/export_stock.png new file mode 100644 index 000000000..a8dade6e9 Binary files /dev/null and b/export_view_pdf/static/description/assets/modules/export_stock.png differ diff --git a/export_view_pdf/static/description/assets/modules/fleet_report.png b/export_view_pdf/static/description/assets/modules/fleet_report.png new file mode 100644 index 000000000..67d671382 Binary files /dev/null and b/export_view_pdf/static/description/assets/modules/fleet_report.png differ diff --git a/export_view_pdf/static/description/assets/modules/individual_product.png b/export_view_pdf/static/description/assets/modules/individual_product.png new file mode 100644 index 000000000..9e5f9363b Binary files /dev/null and b/export_view_pdf/static/description/assets/modules/individual_product.png differ diff --git a/export_view_pdf/static/description/assets/modules/print_workorder.png b/export_view_pdf/static/description/assets/modules/print_workorder.png new file mode 100644 index 000000000..bfdcc96c0 Binary files /dev/null and b/export_view_pdf/static/description/assets/modules/print_workorder.png differ diff --git a/export_view_pdf/static/description/assets/modules/project_report.png b/export_view_pdf/static/description/assets/modules/project_report.png new file mode 100644 index 000000000..46288555e Binary files /dev/null and b/export_view_pdf/static/description/assets/modules/project_report.png differ diff --git a/export_view_pdf/static/description/assets/modules/timesheet_emp.png b/export_view_pdf/static/description/assets/modules/timesheet_emp.png new file mode 100644 index 000000000..2c4c891a0 Binary files /dev/null and b/export_view_pdf/static/description/assets/modules/timesheet_emp.png differ diff --git a/export_view_pdf/static/description/assets/screenshots/Screenshot1.png b/export_view_pdf/static/description/assets/screenshots/Screenshot1.png new file mode 100644 index 000000000..2e38df8dd Binary files /dev/null and b/export_view_pdf/static/description/assets/screenshots/Screenshot1.png differ diff --git a/export_view_pdf/static/description/assets/screenshots/Screenshot2.png b/export_view_pdf/static/description/assets/screenshots/Screenshot2.png new file mode 100644 index 000000000..03ab0249d Binary files /dev/null and b/export_view_pdf/static/description/assets/screenshots/Screenshot2.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..c34471a99 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.png b/export_view_pdf/static/description/banner.png new file mode 100644 index 000000000..4ee0c232a Binary files /dev/null and b/export_view_pdf/static/description/banner.png 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..ddf21e3bf 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..853fee08d --- /dev/null +++ b/export_view_pdf/static/description/index.html @@ -0,0 +1,520 @@ +
+ +
+ +
+
+ Community +
+
+
+ +
+
+
+ +

+ Export View PDF

+

A Module For Exporting Tree View in PDF Format

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

Explore This + Module

+
+ + + + +
+
+ +
+

Overview +

+
+
+
+ In Odoo, currently we can export the corresponding tree view in Excel format. Using Export View PDF + App, we can export it in PDF Format. +
+
+ + + +
+
+ +
+

Features +

+
+
+
+
+ + Export All Tree View in PDF Format +
+
+
+
+ + Available in Odoo 13.0 + Community. +
+
+
+ + + +
+
+ +
+

Screenshots +

+
+
+
+ +
+

'Export PDF' button in List View +

+

From the List View user can see a button Export PDF.

+ +
+ +
+

PDF of corresponding List view +

+

On clicking the button corresponding List view will be exported in PDF Format.

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

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/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..8fca0ce05 --- /dev/null +++ b/export_view_pdf/static/src/js/pdf_export.js @@ -0,0 +1,61 @@ +odoo.define('export_view_pdf.print_pdf',function(require){ + "use strict"; +var config = require('web.config'); +var core = require('web.core'); +var ListController = require('web.ListController'); +var ajax = require('web.ajax'); + +ListController.include({ + renderButtons: function($node) { + this._super.apply(this, arguments); + if (this.$buttons) { + this.$buttons.find('.o_list_export_pdf').click(this.proxy('action_def')) ; + } + }, + action_def: function () { + var self=this; + var fields=this._getExportDialogWidget().defaultExportFields; + let exported_fields = this._getExportDialogWidget().defaultExportFields.map(field => ({ + name: field, + label: this._getExportDialogWidget().record.fields[field].string, + })); + let groupedBy = this.renderer.state.groupedBy; + var length_field = Array.from(Array(fields.length).keys()); + var records=this._getExportDialogWidget().record.res_ids + var data_len=Array.from(Array(records.length).keys()); + var group_length=Array.from(Array(self.renderer.state.groupsCount).keys()); + + ajax.jsonRpc('/get_data','call',{ + 'field':fields, + 'model':this._getExportDialogWidget().record.model, + 'res_ids':records, + 'exported_fields':exported_fields, + 'grouped_by':groupedBy, + 'grouped_by_ids': this.initialState.res_ids, + 'amount': this.renderer.state.data.map(({aggregateValues}) =>aggregateValues), + 'domain':this._getExportDialogWidget().record.domain + }) + .then( function (data){ + if (groupedBy[0]){ + var action = { + 'type': 'ir.actions.report', + 'report_type': 'qweb-pdf', + 'report_name':'export_view_pdf.export_pdf_template_group_by', + 'data':{'length':length_field,'group_len':group_length, + 'record':data,} + }; + } + else{ + var action = { + 'type': 'ir.actions.report', + 'report_type': 'qweb-pdf', + 'report_name':'export_view_pdf.export_pdf_template', + 'data':{'length':length_field,'data_len':data_len, + 'record':data} + }; + } + return self.do_action(action); + }); + } + }); +}); \ No newline at end of file diff --git a/export_view_pdf/static/src/xml/button_view.xml b/export_view_pdf/static/src/xml/button_view.xml new file mode 100644 index 000000000..c27bad0eb --- /dev/null +++ b/export_view_pdf/static/src/xml/button_view.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + +
+
+
+ +
+ + +
+
+
+
+
+
\ No newline at end of file diff --git a/export_view_pdf/views/assets.xml b/export_view_pdf/views/assets.xml new file mode 100644 index 000000000..28d7789e9 --- /dev/null +++ b/export_view_pdf/views/assets.xml @@ -0,0 +1,10 @@ + + +