From d74a685fae6d7f8f1d9ab2693d0c9765350e0109 Mon Sep 17 00:00:00 2001 From: Cybrosys Technologies Date: Tue, 17 Sep 2024 11:29:57 +0530 Subject: [PATCH] Sep 17: [FIX] Bug Fixed 'all_in_one_purchase_kit' --- all_in_one_purchase_kit/__manifest__.py | 2 +- .../data/mail_template_data.xml | 2 +- all_in_one_purchase_kit/doc/RELEASE_NOTES.md | 8 ++++++- .../static/src/js/PurchaseDashboard.js | 1 - .../static/src/js/purchase_report.js | 24 ++++++++++++++++--- .../static/src/xml/purchase_report_views.xml | 3 +++ .../views/purchase_order_line_views.xml | 2 +- 7 files changed, 34 insertions(+), 8 deletions(-) diff --git a/all_in_one_purchase_kit/__manifest__.py b/all_in_one_purchase_kit/__manifest__.py index 4fd278130..d18ac5ae9 100644 --- a/all_in_one_purchase_kit/__manifest__.py +++ b/all_in_one_purchase_kit/__manifest__.py @@ -21,7 +21,7 @@ ############################################################################### { 'name': 'All In One Purchase Kit', - 'version': '17.0.1.0.0', + 'version': '17.0.1.0.1', 'category': 'Purchases', 'summary': 'An integrated module offering streamlined purchase management', 'description': 'Product Brand for products, Purchase Order Line View,' diff --git a/all_in_one_purchase_kit/data/mail_template_data.xml b/all_in_one_purchase_kit/data/mail_template_data.xml index 661dfcf8e..5ad718ba9 100644 --- a/all_in_one_purchase_kit/data/mail_template_data.xml +++ b/all_in_one_purchase_kit/data/mail_template_data.xml @@ -51,7 +51,7 @@ - + diff --git a/all_in_one_purchase_kit/doc/RELEASE_NOTES.md b/all_in_one_purchase_kit/doc/RELEASE_NOTES.md index 829d79696..1e6ef66a1 100644 --- a/all_in_one_purchase_kit/doc/RELEASE_NOTES.md +++ b/all_in_one_purchase_kit/doc/RELEASE_NOTES.md @@ -4,4 +4,10 @@ #### Version 17.0.1.0.0 #### ADD -- Initial Commit for All In One Purchase Kit +- Initial Commit for All In One Purchase Kit. + +#### 16.09.2024 +#### Version 17.0.1.0.1 +#### UPDATE + +- Updated code, fixed issue while printing pdf/xlsx if there is no data. \ No newline at end of file diff --git a/all_in_one_purchase_kit/static/src/js/PurchaseDashboard.js b/all_in_one_purchase_kit/static/src/js/PurchaseDashboard.js index a49d84a56..e93da160b 100644 --- a/all_in_one_purchase_kit/static/src/js/PurchaseDashboard.js +++ b/all_in_one_purchase_kit/static/src/js/PurchaseDashboard.js @@ -36,7 +36,6 @@ class purchaseDashboard extends Component { this.renderByMonthPurchase(); this.renderTopProduct(); }); - console.warn(this) } /** * Handler for selecting a mode. diff --git a/all_in_one_purchase_kit/static/src/js/purchase_report.js b/all_in_one_purchase_kit/static/src/js/purchase_report.js index 92cdfc8c9..c8b2d74a9 100644 --- a/all_in_one_purchase_kit/static/src/js/purchase_report.js +++ b/all_in_one_purchase_kit/static/src/js/purchase_report.js @@ -1,10 +1,13 @@ /** @odoo-module */ + const { Component } = owl; +import { _t } from "@web/core/l10n/translation"; import { registry } from "@web/core/registry"; import { download } from "@web/core/network/download"; import { useService } from "@web/core/utils/hooks"; -import { useRef, useState } from "@odoo/owl"; +import { useRef, useState, onMounted } from "@odoo/owl"; import { BlockUI } from "@web/core/ui/block_ui"; +import { ConfirmationDialog } from "@web/core/confirmation_dialog/confirmation_dialog"; const actionRegistry = registry.category("actions"); import { uiService } from "@web/core/ui/ui_service"; // Extending components for adding purchase report class @@ -18,6 +21,7 @@ class PurchaseReport extends Component { this.start_date = useRef('date_from'); this.end_date = useRef('date_to'); this.order_by = useRef('order_by'); + this.dialog = useService("dialog"); this.state = useState({ order_line: [], data: null, @@ -25,8 +29,8 @@ class PurchaseReport extends Component { wizard_id : [] }); this.load_data(); - } - async load_data(wizard_id = null) { + } + async load_data(wizard_id = null) { /** * Loads the data for the purchase report. */ @@ -67,6 +71,13 @@ class PurchaseReport extends Component { /** * Generates and downloads an XLSX report for the purchase orders. */ + if (this.state.order_line.length == 0){ + this.dialog.add(ConfirmationDialog, { + body: _t('There is no data to print'), + confirm: () => {}, + }); + return + } var data = this.state.data var action = { 'data': { @@ -93,6 +104,13 @@ class PurchaseReport extends Component { * @param {Event} ev - The event object triggered by the action. * @returns {Promise} - A promise that resolves to the result of the action. */ + if (this.state.order_line.length == 0){ + this.dialog.add(ConfirmationDialog, { + body: _t('There is no data to print'), + confirm: () => {}, + }); + return + } ev.preventDefault(); var self = this; var action_title = self.props.action.display_name; diff --git a/all_in_one_purchase_kit/static/src/xml/purchase_report_views.xml b/all_in_one_purchase_kit/static/src/xml/purchase_report_views.xml index ac46433f7..075688b91 100644 --- a/all_in_one_purchase_kit/static/src/xml/purchase_report_views.xml +++ b/all_in_one_purchase_kit/static/src/xml/purchase_report_views.xml @@ -204,6 +204,9 @@ + diff --git a/all_in_one_purchase_kit/views/purchase_order_line_views.xml b/all_in_one_purchase_kit/views/purchase_order_line_views.xml index f671f59b7..44aa0ebd4 100644 --- a/all_in_one_purchase_kit/views/purchase_order_line_views.xml +++ b/all_in_one_purchase_kit/views/purchase_order_line_views.xml @@ -58,7 +58,7 @@ - +