水电表

This commit is contained in:
pengyuthon
2025-10-02 18:48:35 +08:00
parent 53a85da88e
commit 965713e2e6
55 changed files with 108 additions and 0 deletions
@@ -0,0 +1,18 @@
{
'name': 'Listview Group Selector',
'summary': 'Add Selector to Group row in Listview',
'author': 'Hoang Minh Hieu',
'version': '17.0.1.0.0',
'license': 'LGPL-3',
'support ': 'hieuhoangminh1996@gmail.com',
'depends': ['web'],
'data': [
],
'assets': {
'web.assets_backend': [
'web_listview_group_selector/static/src/list_renderer.xml',
'web_listview_group_selector/static/src/list_renderer.js',
],
},
'images': ['static/description/main_screenshot.png'],
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

@@ -0,0 +1,37 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Listview Group Selector</title>
</head>
<body>
<section class="mb64">
<h2 class="text-info">
Add Selector to Group row in Listview
</h2>
</section>
<section class="mb64">
<h3>Screenshots</h3>
<img src="preview.png" class="w-50"/>
<img src="preview2.png" class="w-50"/>
<img src="main_screenshot.png" class="w-50"/>
</section>
<section class="mb64">
<h2 class="">
Contact me
</h2>
<p>
Skype: <a
href="skype:live:hieuhoangminh1996">live:hieuhoangminh1996</a>
<br>
Email: <a href="mailto:hieuhoangminh1996@gmail.com">hieuhoangminh1996@gmail.com</a>
<br>
<br>
Email subject should begin with
<span class="text-info font-weight-bold">[Odoo Module]</span>
</p>
</section>
</body>
</html>
Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

@@ -0,0 +1,27 @@
/** @odoo-module */
import {ListRenderer} from '@web/views/list/list_renderer';
import {patch} from '@web/core/utils/patch';
patch(ListRenderer.prototype, {
getGroupNameCellColSpan(group) {
let colspan = super.getGroupNameCellColSpan(group);
if (this.hasSelectors) {
colspan--;
}
return colspan
},
toggleGroupSelection(group) {
if (!this.canSelectRecord) {
return;
}
group.list.toggleSelection();
},
isGroupSelected(group) {
return !group.isFolded && group.list.selection.length === group.list.records.length;
}
})
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates xml:space="preserve">
<t t-name="web_listview_group_selector.ListRenderer.GroupRow"
t-inherit="web.ListRenderer.GroupRow"
t-inherit-mode="extension"
>
<xpath expr="//tr/th" position="before">
<th t-if="hasSelectors"
class="o_list_record_selector o_list_controller align-middle pe-1 cursor-pointer"
tabindex="-1"
t-on-keydown="(ev) => this.onCellKeydown(ev)"
t-on-click.stop="() => this.toggleGroupSelection(group)"
>
<CheckBox disabled="!canSelectRecord"
value="isGroupSelected(group)"
className="'d-flex m-0'"
onChange.bind="() => this.toggleGroupSelection(group)"
/>
</th>
</xpath>
</t>
</templates>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.