From f66ff6339dd45124b0deff795c1761f618797f9c Mon Sep 17 00:00:00 2001 From: hyyy <123@qq.com> Date: Fri, 14 Mar 2025 10:52:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/js/quality.check.measures.line.js | 76 ------------------- .../views/quality.check.measures.line.xml | 10 +-- quality_control/views/quality_views.xml | 2 +- 3 files changed, 6 insertions(+), 82 deletions(-) delete mode 100644 quality_control/static/src/js/quality.check.measures.line.js diff --git a/quality_control/static/src/js/quality.check.measures.line.js b/quality_control/static/src/js/quality.check.measures.line.js deleted file mode 100644 index b64f3feb..00000000 --- a/quality_control/static/src/js/quality.check.measures.line.js +++ /dev/null @@ -1,76 +0,0 @@ -/** @odoo-module **/ - -import { patch } from "@web/core/utils/patch"; -import { ListRenderer } from "@web/views/list/list_renderer"; -import { X2ManyField } from '@web/views/fields/x2many/x2many_field'; -import { registry } from '@web/core/registry'; - - -export class QualityCheckMeasureLineTree extends X2ManyField { - setup() { - super.setup(); - } - - get rendererProps() { - const props = super.rendererProps; - return props; - } -} - -patch(ListRenderer.prototype, 'custom_measure_line_tree_patch', { - setup() { - this._super.apply(this, arguments); - owl.onMounted(() => { - $(this.__owl__.bdom.el).find('tfoot').hide() - }) - - owl.onRendered(() => { - setTimeout(() => { - const $dom = $(this.__owl__?.bdom?.el) - if(!$dom || !$dom.length) return - const $thead = $dom.find('thead').find('th'); - if(!this.props.list.records || this.props.list.records.length == 0) return - const $total_qty = this.props.list.records[0].data.column_nums; - const hideKey = [] - const width = $dom.find('[data-name=measure_value1]').width(); - $thead.each(function () { - const key = $(this).attr('data-name'); - if (key && key.indexOf('measure_value') >= 0) { - const keyNum = Number(key.replace('measure_value', '')); - if (keyNum > $total_qty) { - hideKey.push(key); - } - } - }); - $dom.find(':hidden').show().css('width', width); - const hideDom = hideKey.map(_ => { - return `[data-name="${_}"],[name="${_}"]` - }) - $dom.find(hideDom.join(',')).hide() - const $cloNum = $dom.find('.o_data_row').eq(0).children('td:visible').length; - $dom.find('.o_data_row').siblings('tr:not(.o_data_row)').children('td').prop('colspan', $cloNum); - $dom.find('tfoot').hide() - }, 50); - }) - - }, - - - // get hasSelectors() { - // return this.withSelectorColumn || (this.props.allowSelectors && !this.env.isSmall); - // }, - - - _renderRow(list) { - console.log('list', list); - // if(!this.__owl__.bdom || !this.__owl__.bdom.el) return; - // const $row = $(this.__owl__.bdom.el).find('tbody').children('tr'); - return ''; - }, - - getContext() { - return this.context; - }, -}) - -registry.category('fields').add('custom_measure_line_tree', QualityCheckMeasureLineTree); \ No newline at end of file diff --git a/quality_control/views/quality.check.measures.line.xml b/quality_control/views/quality.check.measures.line.xml index a69c8b98..185591a0 100644 --- a/quality_control/views/quality.check.measures.line.xml +++ b/quality_control/views/quality.check.measures.line.xml @@ -8,11 +8,11 @@ - - - - - + + + + +