Merge branch 'feature/制造功能优化' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/制造功能优化
This commit is contained in:
@@ -204,6 +204,7 @@ class QualityCheck(models.Model):
|
|||||||
], string='发布状态', default='draft')
|
], string='发布状态', default='draft')
|
||||||
|
|
||||||
def add_measure_line(self):
|
def add_measure_line(self):
|
||||||
|
self.total_qty = self.total_qty + 1
|
||||||
"""
|
"""
|
||||||
新增测量值,如果测量值有5列了,则提示“最多只能有5列测量值”
|
新增测量值,如果测量值有5列了,则提示“最多只能有5列测量值”
|
||||||
"""
|
"""
|
||||||
@@ -215,6 +216,7 @@ class QualityCheck(models.Model):
|
|||||||
# })
|
# })
|
||||||
|
|
||||||
def remove_measure_line(self):
|
def remove_measure_line(self):
|
||||||
|
self.total_qty = self.total_qty - 1
|
||||||
"""
|
"""
|
||||||
删除测量值
|
删除测量值
|
||||||
"""
|
"""
|
||||||
|
|||||||
80
quality_control/static/src/js/quality.check.measures.line.js
Normal file
80
quality_control/static/src/js/quality.check.measures.line.js
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
/** @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);
|
||||||
|
console.log('custom_measure_line_tree_patch');
|
||||||
|
console.log(owl);
|
||||||
|
owl.onMounted(() => {
|
||||||
|
console.log($(this.__owl__.bdom.el).find('tfoot'));
|
||||||
|
$(this.__owl__.bdom.el).find('tfoot').hide()
|
||||||
|
})
|
||||||
|
|
||||||
|
owl.onRendered(() => {
|
||||||
|
setTimeout(() => {
|
||||||
|
const $dom = $(this.__owl__.bdom.el)
|
||||||
|
const $thead = $dom.find('thead').find('th');
|
||||||
|
const $total_qty = this.props.list.records[0].data.total_qty;
|
||||||
|
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').children('td:visible').length;
|
||||||
|
$dom.find('.o_data_row').siblings('tr').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;
|
||||||
|
},
|
||||||
|
getContext() {
|
||||||
|
return this.context;
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
registry.category('fields').add('custom_measure_line_tree', QualityCheckMeasureLineTree);
|
||||||
@@ -6,6 +6,7 @@
|
|||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<tree editable="bottom">
|
<tree editable="bottom">
|
||||||
<field name="sequence"/>
|
<field name="sequence"/>
|
||||||
|
<field name="total_qty"/>
|
||||||
<field name="measure_item"/>
|
<field name="measure_item"/>
|
||||||
<field name="measure_value1"/>
|
<field name="measure_value1"/>
|
||||||
<field name="measure_value2"/>
|
<field name="measure_value2"/>
|
||||||
|
|||||||
@@ -340,7 +340,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<br/>
|
<br/>
|
||||||
<div class="o_row">
|
<div class="o_row">
|
||||||
<field name="measure_line_ids" widget="tree"/>
|
<field name="measure_line_ids" widget="custom_measure_line_tree"/>
|
||||||
</div>
|
</div>
|
||||||
</page>
|
</page>
|
||||||
<page string="出厂检验报告" name="out_check" attrs="{'invisible': [('is_out_check', '=', False)]}">
|
<page string="出厂检验报告" name="out_check" attrs="{'invisible': [('is_out_check', '=', False)]}">
|
||||||
|
|||||||
Reference in New Issue
Block a user