Browse Source

Sep 17: [FIX] Bug Fixed 'all_in_one_purchase_kit'

pull/332/head
Cybrosys Technologies 7 months ago
parent
commit
d74a685fae
  1. 2
      all_in_one_purchase_kit/__manifest__.py
  2. 2
      all_in_one_purchase_kit/data/mail_template_data.xml
  3. 8
      all_in_one_purchase_kit/doc/RELEASE_NOTES.md
  4. 1
      all_in_one_purchase_kit/static/src/js/PurchaseDashboard.js
  5. 24
      all_in_one_purchase_kit/static/src/js/purchase_report.js
  6. 3
      all_in_one_purchase_kit/static/src/xml/purchase_report_views.xml
  7. 2
      all_in_one_purchase_kit/views/purchase_order_line_views.xml

2
all_in_one_purchase_kit/__manifest__.py

@ -21,7 +21,7 @@
############################################################################### ###############################################################################
{ {
'name': 'All In One Purchase Kit', 'name': 'All In One Purchase Kit',
'version': '17.0.1.0.0', 'version': '17.0.1.0.1',
'category': 'Purchases', 'category': 'Purchases',
'summary': 'An integrated module offering streamlined purchase management', 'summary': 'An integrated module offering streamlined purchase management',
'description': 'Product Brand for products, Purchase Order Line View,' 'description': 'Product Brand for products, Purchase Order Line View,'

2
all_in_one_purchase_kit/data/mail_template_data.xml

@ -51,7 +51,7 @@
</div> </div>
</field> </field>
</record> </record>
<!-- Function to set noupdate to True--> <!--Function to set noupdate to True-->
<function name="write" model="ir.model.data"> <function name="write" model="ir.model.data">
<function name="search" model="ir.model.data"> <function name="search" model="ir.model.data">
<value eval="[('name', '=', 'email_template_edi_purchase_done'), ('module', '=', 'purchase')]"/> <value eval="[('name', '=', 'email_template_edi_purchase_done'), ('module', '=', 'purchase')]"/>

8
all_in_one_purchase_kit/doc/RELEASE_NOTES.md

@ -4,4 +4,10 @@
#### Version 17.0.1.0.0 #### Version 17.0.1.0.0
#### ADD #### 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.

1
all_in_one_purchase_kit/static/src/js/PurchaseDashboard.js

@ -36,7 +36,6 @@ class purchaseDashboard extends Component {
this.renderByMonthPurchase(); this.renderByMonthPurchase();
this.renderTopProduct(); this.renderTopProduct();
}); });
console.warn(this)
} }
/** /**
* Handler for selecting a mode. * Handler for selecting a mode.

24
all_in_one_purchase_kit/static/src/js/purchase_report.js

@ -1,10 +1,13 @@
/** @odoo-module */ /** @odoo-module */
const { Component } = owl; const { Component } = owl;
import { _t } from "@web/core/l10n/translation";
import { registry } from "@web/core/registry"; import { registry } from "@web/core/registry";
import { download } from "@web/core/network/download"; import { download } from "@web/core/network/download";
import { useService } from "@web/core/utils/hooks"; 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 { BlockUI } from "@web/core/ui/block_ui";
import { ConfirmationDialog } from "@web/core/confirmation_dialog/confirmation_dialog";
const actionRegistry = registry.category("actions"); const actionRegistry = registry.category("actions");
import { uiService } from "@web/core/ui/ui_service"; import { uiService } from "@web/core/ui/ui_service";
// Extending components for adding purchase report class // Extending components for adding purchase report class
@ -18,6 +21,7 @@ class PurchaseReport extends Component {
this.start_date = useRef('date_from'); this.start_date = useRef('date_from');
this.end_date = useRef('date_to'); this.end_date = useRef('date_to');
this.order_by = useRef('order_by'); this.order_by = useRef('order_by');
this.dialog = useService("dialog");
this.state = useState({ this.state = useState({
order_line: [], order_line: [],
data: null, data: null,
@ -25,8 +29,8 @@ class PurchaseReport extends Component {
wizard_id : [] wizard_id : []
}); });
this.load_data(); this.load_data();
} }
async load_data(wizard_id = null) { async load_data(wizard_id = null) {
/** /**
* Loads the data for the purchase report. * 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. * 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 data = this.state.data
var action = { var action = {
'data': { 'data': {
@ -93,6 +104,13 @@ class PurchaseReport extends Component {
* @param {Event} ev - The event object triggered by the action. * @param {Event} ev - The event object triggered by the action.
* @returns {Promise} - A promise that resolves to the result of 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(); ev.preventDefault();
var self = this; var self = this;
var action_title = self.props.action.display_name; var action_title = self.props.action.display_name;

3
all_in_one_purchase_kit/static/src/xml/purchase_report_views.xml

@ -204,6 +204,9 @@
</tr> </tr>
</t> </t>
</tbody> </tbody>
<div t-ref="no_data_popup" class="no_data" style="position: absolute; top: 30%; left: 50%; transform: translate(-50%,-50%); display:none; font-size: large;">
No data for PRINT(PDF) /EXPORT(XLSX)
</div>
</table> </table>
</div> </div>
</div> </div>

2
all_in_one_purchase_kit/views/purchase_order_line_views.xml

@ -58,7 +58,7 @@
</group> </group>
<group> <group>
<group> <group>
<field name="order_id" string="Order"/> <field name="order_id" string="Order" readonly="1"/>
<field name="product_id"/> <field name="product_id"/>
<field name="product_uom"/> <field name="product_uom"/>
<field name="product_qty" <field name="product_qty"

Loading…
Cancel
Save