@ -1,15 +1,52 @@ |
|||||
Custom List View V16 |
.. image:: https://img.shields.io/badge/license-LGPL--3-green.svg |
||||
==================== |
:target: https://www.gnu.org/licenses/lgpl-3.0-standalone.html |
||||
|
:alt: License: LGPL-3 |
||||
|
|
||||
This module will helps to show row number, fixed header, duplicate record and highlight selected record in list view |
Custom List View |
||||
|
================== |
||||
|
This module enhances list views by displaying row numbers, maintaining a fixed |
||||
|
header, identifying duplicate records, and highlighting selected records. |
||||
|
Additionally, it facilitates the printing of list views in PDF, CSV, and Excel |
||||
|
formats, allows for the copying of list values to the clipboard, and introduces |
||||
|
a pagination feature. |
||||
|
|
||||
|
Configuration |
||||
|
============= |
||||
|
* No additional configurations needed |
||||
|
|
||||
|
Company |
||||
|
------- |
||||
|
* `Cybrosys Techno Solutions <https://cybrosys.com/>`__ |
||||
|
|
||||
|
License |
||||
|
------- |
||||
|
GNU LESSER GENERAL PUBLIC LICENSE, v3.0 (LGPL v3). |
||||
|
(https://www.gnu.org/licenses/lgpl-3.0-standalone.html) |
||||
|
|
||||
Credits |
Credits |
||||
======= |
------- |
||||
Cybrosys Techno Solutions |
* Developers : (V16) Rosmy John, Muhsina V |
||||
|
(V15) Aiswarya J P |
||||
Author |
Contact : odoo@cybrosys.com |
||||
------ |
|
||||
* Cybrosys Techno Solutions <odoo@cybrosys.com> |
Contacts |
||||
Aiswarya J P @ Cybro V15 |
-------- |
||||
Rosmy John @ Cybro V16 |
* 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 <https://cybrosys.com/>`__ |
||||
|
|
||||
|
Further information |
||||
|
=================== |
||||
|
HTML Description: `<static/description/index.html>`__ |
||||
|
@ -0,0 +1,22 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>) |
||||
|
# |
||||
|
# 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 <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from . import custom_list_view |
@ -0,0 +1,68 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>) |
||||
|
# |
||||
|
# 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 <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from odoo import http |
||||
|
from odoo.http import request |
||||
|
|
||||
|
|
||||
|
class ExportData(http.Controller): |
||||
|
""" Controller class for exporting data from Odoo models.""" |
||||
|
@http.route('/get_data', auth="user", type='json') |
||||
|
def get_export_data(self, **kw): |
||||
|
"""Controller method to fetch required details and export data. |
||||
|
:param kw: Dictionary containing the following keys: |
||||
|
- fields: List of fields to export |
||||
|
- model: Name of the Odoo model |
||||
|
- res_ids: List of record IDs to export (optional) |
||||
|
- domain: Domain for record filtering (optional) |
||||
|
:return: Dictionary containing exported data and column headers""" |
||||
|
model = request.env[kw['model']] |
||||
|
field_names = [field['name'] for field in kw['fields']] |
||||
|
columns_headers = [val['label'].strip() for val in kw['fields']] |
||||
|
domain = [('id', 'in', kw['res_ids'])] \ |
||||
|
if kw['res_ids'] else kw['domain'] |
||||
|
records = model.browse(kw['res_ids']) \ |
||||
|
if kw['res_ids'] \ |
||||
|
else model.search(domain, offset=0, limit=False, order=False) |
||||
|
export_data = records.export_data(field_names).get('datas', []) |
||||
|
return {'data': export_data, 'header': columns_headers} |
||||
|
|
||||
|
@http.route('/get_data/copy', auth="user", type='json') |
||||
|
def get_export_data_copy(self, **kw): |
||||
|
"""Controller method to fetch required details, export data, and add |
||||
|
column headers. |
||||
|
:param kw: Dictionary containing the following keys: |
||||
|
- fields: List of fields to export |
||||
|
- model: Name of the Odoo model |
||||
|
- res_ids: List of record IDs to export (optional) |
||||
|
- domain: Domain for record filtering (optional) |
||||
|
:return: List of lists containing exported data with column headers""" |
||||
|
model = request.env[kw['model']] |
||||
|
field_names = [field['name'] for field in kw['fields']] |
||||
|
columns_headers = [val['label'].strip() for val in kw['fields']] |
||||
|
domain = [('id', 'in', kw['res_ids'])] \ |
||||
|
if kw['res_ids'] else kw['domain'] |
||||
|
records = model.browse(kw['res_ids']) \ |
||||
|
if kw['res_ids'] \ |
||||
|
else model.search(domain, offset=0, limit=False, order=False) |
||||
|
export_data = records.export_data(field_names).get('datas', []) |
||||
|
export_data.insert(0, columns_headers) |
||||
|
return export_data |
@ -0,0 +1,13 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8" ?> |
||||
|
<odoo> |
||||
|
<!-- Define the action for exporting PDF --> |
||||
|
<record id="action_pdf_list_view" model="ir.actions.report"> |
||||
|
<field name="name">Export</field> |
||||
|
<field name="model">ir.exports</field> |
||||
|
<field name="report_type">qweb-pdf</field> |
||||
|
<field name="report_name">custom_list_view.print_pdf_listview</field> |
||||
|
<field name="report_file">custom_list_view.print_pdf_listview</field> |
||||
|
<field name="print_report_name">Pdf Report - ${object.name}</field> |
||||
|
<field name="binding_type">report</field> |
||||
|
</record> |
||||
|
</odoo> |
@ -0,0 +1,31 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8" ?> |
||||
|
<odoo> |
||||
|
<!-- Template for printing a PDF list view. --> |
||||
|
<template id="print_pdf_listview"> |
||||
|
<t t-call="web.html_container"> |
||||
|
<t t-call="web.internal_layout"> |
||||
|
<div class="page"> |
||||
|
<table class="table table-bordered" |
||||
|
style="table-layout: fixed"> |
||||
|
<!-- Render table headers --> |
||||
|
<t t-foreach="length" t-as="length"> |
||||
|
<th style="background-color: #F2F2F2; padding: 10px; color: "> |
||||
|
<span t-out="record['header'][length]"/> |
||||
|
</th> |
||||
|
</t> |
||||
|
<!-- Render table data rows --> |
||||
|
<t t-foreach="record['data']" t-as="rec"> |
||||
|
<tr> |
||||
|
<t t-foreach="length+1" t-as="ln"> |
||||
|
<td style="background-color: #F2F2F2; padding: 10px;"> |
||||
|
<span t-out="rec[ln]"/> |
||||
|
</td> |
||||
|
</t> |
||||
|
</tr> |
||||
|
</t> |
||||
|
</table> |
||||
|
</div> |
||||
|
</t> |
||||
|
</t> |
||||
|
</template> |
||||
|
</odoo> |
Before Width: | Height: | Size: 60 KiB After Width: | Height: | Size: 84 KiB |
Before Width: | Height: | Size: 56 KiB After Width: | Height: | Size: 85 KiB |
Before Width: | Height: | Size: 56 KiB After Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 59 KiB After Width: | Height: | Size: 92 KiB |
Before Width: | Height: | Size: 1.8 MiB After Width: | Height: | Size: 1.3 MiB |
Before Width: | Height: | Size: 57 KiB After Width: | Height: | Size: 81 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 84 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 82 KiB |
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 88 KiB |
After Width: | Height: | Size: 290 KiB |
After Width: | Height: | Size: 286 KiB |
After Width: | Height: | Size: 287 KiB |
After Width: | Height: | Size: 283 KiB |
After Width: | Height: | Size: 292 KiB |
After Width: | Height: | Size: 255 KiB |
After Width: | Height: | Size: 279 KiB |
Before Width: | Height: | Size: 149 KiB |
Before Width: | Height: | Size: 152 KiB After Width: | Height: | Size: 599 KiB |
Before Width: | Height: | Size: 138 KiB |
Before Width: | Height: | Size: 136 KiB |
Before Width: | Height: | Size: 145 KiB |
@ -1,30 +0,0 @@ |
|||||
/** @odoo-module */ |
|
||||
import { patch } from "@web/core/utils/patch"; |
|
||||
import { ListController } from '@web/views/list/list_controller'; |
|
||||
|
|
||||
const { Component, onWillStart, useSubEnv, useEffect, useRef } = owl; |
|
||||
|
|
||||
patch(ListController.prototype, "getActionMenuItems", { |
|
||||
async _onDuplicateSelectedRecords() { |
|
||||
for (var record in this.model.root.records) { |
|
||||
if (this.model.root.records[record].selected) { |
|
||||
await this.model.root.records[record].duplicate(); |
|
||||
} |
|
||||
} |
|
||||
window.location.reload(); |
|
||||
}, |
|
||||
|
|
||||
getActionMenuItems() { |
|
||||
const actionMenuItems = this._super.apply(this, arguments); |
|
||||
var self = this; |
|
||||
if (actionMenuItems) { |
|
||||
actionMenuItems.other.splice(1, 0, { |
|
||||
description: this.env._t("Duplicate"), |
|
||||
callback: (x) => { |
|
||||
this._onDuplicateSelectedRecords(); |
|
||||
} |
|
||||
}); |
|
||||
} |
|
||||
return actionMenuItems; |
|
||||
} |
|
||||
}); |
|
@ -0,0 +1,176 @@ |
|||||
|
/** @odoo-module */ |
||||
|
import { patch } from "@web/core/utils/patch"; |
||||
|
import { ListController } from '@web/views/list/list_controller'; |
||||
|
import { download } from "@web/core/network/download"; |
||||
|
var ajax = require('web.ajax'); |
||||
|
var Dialog = require('web.Dialog'); |
||||
|
|
||||
|
patch(ListController.prototype, "CustomListView", { |
||||
|
/** |
||||
|
* Duplicate selected records and reload the page. |
||||
|
*/ |
||||
|
async _onDuplicateSelectedRecords() { |
||||
|
for (var record in this.model.root.records) { |
||||
|
if (this.model.root.records[record].selected) { |
||||
|
await this.model.root.records[record].duplicate(); |
||||
|
} |
||||
|
} |
||||
|
window.location.reload(); |
||||
|
}, |
||||
|
/** |
||||
|
* Get the action menu items and add a "Duplicate" option. |
||||
|
* |
||||
|
* @returns {Object} Action menu items. |
||||
|
*/ |
||||
|
getActionMenuItems() { |
||||
|
const actionMenuItems = this._super.apply(this, arguments); |
||||
|
var self = this; |
||||
|
if (actionMenuItems) { |
||||
|
actionMenuItems.other.splice(1, 0, { |
||||
|
description: this.env._t("Duplicate"), |
||||
|
callback: (x) => { |
||||
|
this._onDuplicateSelectedRecords(); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
return actionMenuItems; |
||||
|
}, |
||||
|
/** |
||||
|
* Handle the click event for exporting data to a PDF. |
||||
|
*/ |
||||
|
_onClickPDF: async function() { |
||||
|
var self = this; |
||||
|
// Retrieve the fields to export
|
||||
|
const fields = this.props.archInfo.columns |
||||
|
.filter((col) => col.optional === false || col.optional === "show") |
||||
|
.map((col) => this.props.fields[col.name]) |
||||
|
const exportFields = fields.map((field) => ({ |
||||
|
name: field.name, |
||||
|
label: field.label || field.string, |
||||
|
})); |
||||
|
const resIds = await this.getSelectedResIds(); |
||||
|
var length_field = Array.from(Array(exportFields.length).keys()); |
||||
|
// Make a JSON-RPC request to retrieve the data for the report
|
||||
|
ajax.jsonRpc('/get_data', 'call', { |
||||
|
'model': this.model.root.resModel, |
||||
|
'res_ids': resIds.length > 0 && resIds, |
||||
|
'fields': exportFields, |
||||
|
'grouped_by': this.model.root.groupBy, |
||||
|
'context': this.props.context, |
||||
|
'domain': this.model.root.domain, |
||||
|
'context': this.props.context, |
||||
|
}).then(function(data) { |
||||
|
var model = self.model.root.resModel |
||||
|
// Generate and download the PDF report
|
||||
|
return self.model.action.doAction({ |
||||
|
type: "ir.actions.report", |
||||
|
report_type: "qweb-pdf", |
||||
|
report_name: 'custom_list_view.print_pdf_listview', |
||||
|
report_file: "custom_list_view.print_pdf_listview", |
||||
|
data: { |
||||
|
'length': length_field, |
||||
|
'record': data |
||||
|
} |
||||
|
}); |
||||
|
}); |
||||
|
}, |
||||
|
/** |
||||
|
* Handle the click event for exporting data to Excel. |
||||
|
*/ |
||||
|
_onClickExcel: async function() { |
||||
|
// Retrieve the fields to export
|
||||
|
const fields = this.props.archInfo.columns |
||||
|
.filter((col) => col.optional === false || col.optional === "show") |
||||
|
.map((col) => this.props.fields[col.name]) |
||||
|
.filter((field) => field.exportable !== false); |
||||
|
const exportFields = fields.map((field) => ({ |
||||
|
name: field.name, |
||||
|
label: field.label || field.string, |
||||
|
store: field.store, |
||||
|
type: field.field_type || field.type, |
||||
|
})); |
||||
|
const resIds = await this.getSelectedResIds(); |
||||
|
const import_compat = false |
||||
|
// Make a request to download the Excel file
|
||||
|
await download({ |
||||
|
data: { |
||||
|
data: JSON.stringify({ |
||||
|
import_compat, |
||||
|
context: this.props.context, |
||||
|
domain: this.model.root.domain, |
||||
|
fields: exportFields, |
||||
|
groupby: this.model.root.groupBy, |
||||
|
ids: resIds.length > 0 && resIds, |
||||
|
model: this.model.root.resModel, |
||||
|
}), |
||||
|
}, |
||||
|
url: `/web/export/xlsx`, |
||||
|
}); |
||||
|
}, |
||||
|
/** |
||||
|
* Handle the click event for exporting data to CSV. |
||||
|
*/ |
||||
|
_onClickCSV: async function() { |
||||
|
const fields = this.props.archInfo.columns |
||||
|
.filter((col) => col.optional === false || col.optional === "show") |
||||
|
.map((col) => this.props.fields[col.name]) |
||||
|
.filter((field) => field.exportable !== false); |
||||
|
const exportFields = fields.map((field) => ({ |
||||
|
name: field.name, |
||||
|
label: field.label || field.string, |
||||
|
store: field.store, |
||||
|
type: field.field_type || field.type, |
||||
|
})); |
||||
|
const resIds = await this.getSelectedResIds(); |
||||
|
const import_compat = false |
||||
|
// Make a request to download the CSV file
|
||||
|
await download({ |
||||
|
data: { |
||||
|
data: JSON.stringify({ |
||||
|
import_compat, |
||||
|
context: this.props.context, |
||||
|
domain: this.model.root.domain, |
||||
|
fields: exportFields, |
||||
|
groupby: this.model.root.groupBy, |
||||
|
ids: resIds.length > 0 && resIds, |
||||
|
model: this.model.root.resModel, |
||||
|
}), |
||||
|
}, |
||||
|
url: `/web/export/csv`, |
||||
|
}); |
||||
|
}, |
||||
|
/** |
||||
|
* Handle the click event for copying data to the clipboard. |
||||
|
*/ |
||||
|
_onClickCopy: async function() { |
||||
|
var self = this; |
||||
|
// Retrieve the fields to export
|
||||
|
const fields = this.props.archInfo.columns |
||||
|
.filter((col) => col.type === "field") |
||||
|
.map((col) => this.props.fields[col.name]) |
||||
|
const exportFields = fields.map((field) => ({ |
||||
|
name: field.name, |
||||
|
label: field.label || field.string, |
||||
|
})); |
||||
|
const resIds = await this.getSelectedResIds(); |
||||
|
var length_field = Array.from(Array(exportFields.length).keys()); |
||||
|
// Make a JSON-RPC request to retrieve the data to copy
|
||||
|
ajax.jsonRpc('/get_data/copy', 'call', { |
||||
|
'model': this.model.root.resModel, |
||||
|
'res_ids': resIds.length > 0 && resIds, |
||||
|
'fields': exportFields, |
||||
|
'grouped_by': this.model.root.groupBy, |
||||
|
'context': this.props.context, |
||||
|
'domain': this.model.root.domain, |
||||
|
'context': this.props.context, |
||||
|
}).then(function(data) { |
||||
|
// Format the data as text and copy it to the clipboard
|
||||
|
var recText = data.map(function(record) { |
||||
|
return record.join("\t"); // Join the elements of each array with tabs ("\t")
|
||||
|
}).join("\n"); |
||||
|
// Copy the recText to the clipboard
|
||||
|
navigator.clipboard.writeText(recText); |
||||
|
Dialog.alert(self, "Records Copied to Clipboard ", {}); |
||||
|
}); |
||||
|
}, |
||||
|
}); |
@ -0,0 +1,25 @@ |
|||||
|
/** @odoo-module **/ |
||||
|
import { session } from "@web/session"; |
||||
|
import { ListRenderer } from "@web/views/list/list_renderer"; |
||||
|
import { patch } from "@web/core/utils/patch"; |
||||
|
import { browser } from "@web/core/browser/browser"; |
||||
|
import { useService } from "@web/core/utils/hooks"; |
||||
|
const {onMounted} = owl; |
||||
|
|
||||
|
/** |
||||
|
* Patched function to toggle record selection and add a CSS class to selected records. |
||||
|
* |
||||
|
* @param {Object} record - The record to toggle selection for. |
||||
|
*/ |
||||
|
patch(ListRenderer.prototype, 'custom_list_view/static/src/js/list_renderer.js', { |
||||
|
toggleRecordSelection(record) { |
||||
|
var self = this; |
||||
|
this._super.apply(this, arguments); |
||||
|
var selectedRecord = $(event.target).closest('tr') |
||||
|
if ($(event.target).prop('checked')) { |
||||
|
selectedRecord.addClass('selected_record'); |
||||
|
} else { |
||||
|
selectedRecord.removeClass('selected_record') |
||||
|
} |
||||
|
} |
||||
|
}); |
@ -1,34 +0,0 @@ |
|||||
/** @odoo-module **/ |
|
||||
import { session } from "@web/session"; |
|
||||
import { ListRenderer } from "@web/views/list/list_renderer"; |
|
||||
import { patch } from "@web/core/utils/patch"; |
|
||||
import { browser } from "@web/core/browser/browser"; |
|
||||
import { useService } from "@web/core/utils/hooks"; |
|
||||
const {onMounted} = owl; |
|
||||
|
|
||||
patch(ListRenderer.prototype, 'custom_list_view/static/src/js/record_highlight.js', { |
|
||||
setup(){ |
|
||||
this._super(...arguments) |
|
||||
onMounted(() => { |
|
||||
var tdElement = document.createElement('td'); |
|
||||
var thElement = document.createElement('th'); |
|
||||
thElement.innerText = "Sl No" |
|
||||
thElement.style.width = "60px" |
|
||||
var firstRow = $(this.__owl__.bdom.parentEl.querySelectorAll('.o_list_table')).find('thead tr').first(); |
|
||||
var secondRow = $(this.__owl__.bdom.parentEl.querySelectorAll('.o_list_footer')).find('tr').first(); |
|
||||
firstRow.prepend(thElement); |
|
||||
secondRow.prepend(tdElement); |
|
||||
}); |
|
||||
}, |
|
||||
|
|
||||
toggleRecordSelection(record) { |
|
||||
var self = this; |
|
||||
this._super.apply(this, arguments); |
|
||||
var selectedRecord = $(event.target).closest('tr') |
|
||||
if($(event.target).prop('checked')){ |
|
||||
selectedRecord.addClass('selected_record'); |
|
||||
} else { |
|
||||
selectedRecord.removeClass('selected_record') |
|
||||
} |
|
||||
} |
|
||||
}) |
|
@ -0,0 +1,41 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<templates xml:space="preserve"> |
||||
|
<!-- Extension template for adding buttons in the listview --> |
||||
|
<t t-inherit="web.ListView.Buttons" t-inherit-mode="extension"> |
||||
|
<!-- Add buttons after the 'Export Excel' button --> |
||||
|
<xpath expr="//*[@class='btn btn-secondary fa fa-download o_list_export_xlsx']" |
||||
|
position="after"> |
||||
|
<!-- Print PDF button --> |
||||
|
<button type="button" class="btn btn-secondary " |
||||
|
t-on-click="_onClickPDF" data-tooltip="Print PDF" >PDF</button> |
||||
|
<!-- Print Excel button --> |
||||
|
<button type="button" class="btn btn-secondary" |
||||
|
t-on-click="_onClickExcel" data-tooltip="Print Excel" >Excel</button> |
||||
|
<!-- Print CSV button --> |
||||
|
<button type="button" class="btn btn-secondary" |
||||
|
t-on-click="_onClickCSV" data-tooltip="Print CSV" >CSV</button> |
||||
|
<!-- Copy to Clipboard button --> |
||||
|
<button type="button" class="btn btn-secondary fa fa-clipboard" |
||||
|
t-on-click="_onClickCopy" data-tooltip="Copy to Clipboard"/> |
||||
|
</xpath> |
||||
|
</t> |
||||
|
<!-- Extension template for adding buttons in the invoice listview --> |
||||
|
<t t-inherit="account.ListView.Buttons" t-inherit-mode="extension"> |
||||
|
<!-- Add buttons after the 'Export Excel' button --> |
||||
|
<xpath expr="//*[@class='btn btn-secondary fa fa-download o_list_export_xlsx']" |
||||
|
position="after"> |
||||
|
<!-- Print PDF button --> |
||||
|
<button type="button" class="btn btn-secondary" |
||||
|
t-on-click="_onClickPDF" data-tooltip="Print PDF">PDF</button> |
||||
|
<!-- Print Excel button --> |
||||
|
<button type="button" class="btn btn-secondary" |
||||
|
t-on-click="_onClickExcel" data-tooltip="Print Excel">Excel</button> |
||||
|
<!-- Print CSV button --> |
||||
|
<button type="button" class="btn btn-secondary" |
||||
|
t-on-click="_onClickCSV" data-tooltip="Print CSV">CSV</button> |
||||
|
<!-- Copy to Clipboard button --> |
||||
|
<button type="button" class="btn btn-secondary fa fa-clipboard" |
||||
|
t-on-click="_onClickCopy" data-tooltip="Copy to Clipboard"/> |
||||
|
</xpath> |
||||
|
</t> |
||||
|
</templates> |
@ -0,0 +1,65 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<!-- XML template for rendering lists with pagination information --> |
||||
|
<templates xml:space="preserve"> |
||||
|
<t t-inherit="web.ListRenderer" t-inherit-mode="extension"> |
||||
|
<xpath expr="//*[@class='o_list_renderer o_renderer table-responsive']" |
||||
|
position="after"> |
||||
|
<!-- Pagination in lists --> |
||||
|
<div class="o_list_pagination" style=" text-align: end;"> |
||||
|
Showing from |
||||
|
<t t-if="this.props.list.groups"> |
||||
|
<t t-esc="this.env.config.pagerProps.offset+1"/> - |
||||
|
|
||||
|
<t t-esc="this.env.config.pagerProps.offset + this.props.list.groups.length"/></t> |
||||
|
<t t-else=""> |
||||
|
<t t-esc="this.env.config.pagerProps.offset+1"/> - |
||||
|
|
||||
|
<t t-esc="this.env.config.pagerProps.offset+this.props.list.records.length"/></t> |
||||
|
of |
||||
|
|
||||
|
<t t-esc="this.props.list.count"/> |
||||
|
Records |
||||
|
</div> |
||||
|
</xpath> |
||||
|
<xpath expr="//th[@t-if='hasSelectors']" position="before"> |
||||
|
<th style="width: 60px">Sl No</th> |
||||
|
<t t-set="RowNumber" t-value="1" /> |
||||
|
</xpath> |
||||
|
</t> |
||||
|
<t t-inherit="account.ListRenderer" t-inherit-mode="extension"> |
||||
|
<xpath expr="//*[@class='o_list_renderer o_renderer table-responsive']" |
||||
|
position="after"> |
||||
|
<!-- Pagination in invoice list --> |
||||
|
<div class="o_list_pagination" style=" text-align: end;"> |
||||
|
Showing from |
||||
|
<t t-if="this.props.list.groups"> |
||||
|
<t t-esc="this.env.config.pagerProps.offset+1"/> - |
||||
|
|
||||
|
<t t-esc="this.env.config.pagerProps.offset + this.props.list.groups.length"/></t> |
||||
|
<t t-else=""> |
||||
|
<t t-esc="this.env.config.pagerProps.offset+1"/> - |
||||
|
|
||||
|
<t t-esc="this.env.config.pagerProps.offset+this.props.list.records.length"/></t> |
||||
|
of |
||||
|
|
||||
|
<t t-esc="this.props.list.count"/> |
||||
|
Records |
||||
|
</div> |
||||
|
</xpath> |
||||
|
</t> |
||||
|
<t t-inherit="web.ListRenderer.Rows" t-inherit-mode="extension" owl="1"> |
||||
|
<xpath expr="//t[@t-foreach='list.records']" position="before"> |
||||
|
<t t-set="RowNumber" t-value="1" /> |
||||
|
</xpath> |
||||
|
<xpath expr="//t[@t-call='{{ constructor.recordRowTemplate }}']" position="after"> |
||||
|
<t t-set="RowNumber" t-value="RowNumber+1" /> |
||||
|
</xpath> |
||||
|
</t> |
||||
|
<t t-inherit="web.ListRenderer.RecordRow" t-inherit-mode="extension" owl="1"> |
||||
|
<xpath expr="//td[@class='o_list_record_selector']" position="before"> |
||||
|
<td tabindex="-1"> |
||||
|
<span t-esc="RowNumber" /> |
||||
|
</td> |
||||
|
</xpath> |
||||
|
</t> |
||||
|
</templates> |
@ -1,18 +0,0 @@ |
|||||
<templates id="template" xml:space="preserve"> |
|
||||
<t t-name="custom_list_view.add_number" t-inherit="web.ListRenderer.Rows" t-inherit-mode="extension" owl="1"> |
|
||||
<xpath expr="//t[@t-foreach='list.records']" position="before"> |
|
||||
<t t-set="RowNumber" t-value="1" /> |
|
||||
</xpath> |
|
||||
<xpath expr="//t[@t-call='{{ constructor.recordRowTemplate }}']" position="after"> |
|
||||
<t t-set="RowNumber" t-value="RowNumber+1" /> |
|
||||
</xpath> |
|
||||
</t> |
|
||||
|
|
||||
<t t-name="rowno_in_tree.ListRenderer.RecordRowNumber" t-inherit="web.ListRenderer.RecordRow" t-inherit-mode="extension" owl="1"> |
|
||||
<xpath expr="//td[@class='o_list_record_selector']" position="before"> |
|
||||
<td tabindex="-1"> |
|
||||
<span t-esc="RowNumber" /> |
|
||||
</td> |
|
||||
</xpath> |
|
||||
</t> |
|
||||
</templates> |
|