删除多余代码
This commit is contained in:
@@ -9,7 +9,6 @@ import {ListRenderer} from "@web/views/list/list_renderer";
|
|||||||
import {FormLabel} from "@web/views/form/form_label";
|
import {FormLabel} from "@web/views/form/form_label";
|
||||||
import { fieldVisualFeedback } from "@web/views/fields/field";
|
import { fieldVisualFeedback } from "@web/views/fields/field";
|
||||||
|
|
||||||
import {Field} from "@web/views/fields/field";
|
|
||||||
|
|
||||||
var Dialog = require('web.Dialog');
|
var Dialog = require('web.Dialog');
|
||||||
// var {patch} = require("web.utils") 这句话也行
|
// var {patch} = require("web.utils") 这句话也行
|
||||||
@@ -53,7 +52,6 @@ const tableRequiredList = [
|
|||||||
'product_template_id', 'product_uom_qty', 'price_unit','product_id','product_qty',
|
'product_template_id', 'product_uom_qty', 'price_unit','product_id','product_qty',
|
||||||
'name', 'fault_type', 'maintenance_standards', 'Period'
|
'name', 'fault_type', 'maintenance_standards', 'Period'
|
||||||
]
|
]
|
||||||
|
|
||||||
patch(FormStatusIndicator.prototype, 'jikimo_frontend.FormStatusIndicator', {
|
patch(FormStatusIndicator.prototype, 'jikimo_frontend.FormStatusIndicator', {
|
||||||
setup() {
|
setup() {
|
||||||
owl.onMounted(() => {
|
owl.onMounted(() => {
|
||||||
@@ -109,30 +107,7 @@ patch(FormStatusIndicator.prototype, 'jikimo_frontend.FormStatusIndicator', {
|
|||||||
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
patch(Field.prototype, 'jikimo_frontend.Field', {
|
|
||||||
setup() {
|
|
||||||
owl.onMounted(this.setRequired);
|
|
||||||
return this._super(...arguments);
|
|
||||||
},
|
|
||||||
setRequired() {
|
|
||||||
const id = this.props.id
|
|
||||||
const isRequired = filedRequiredList[id]
|
|
||||||
if(isRequired) {
|
|
||||||
let dom;
|
|
||||||
dom = $(`label[for=${id}]`)
|
|
||||||
if(isRequired.multiple && dom.length > 1) {
|
|
||||||
dom = dom.eq(-1)
|
|
||||||
dom = dom.parent().parent().next().find('label')
|
|
||||||
}
|
|
||||||
if(isRequired.noLabel) {
|
|
||||||
dom = dom.parent().parent()
|
|
||||||
}
|
|
||||||
let t = dom.html()
|
|
||||||
t = '<i class="c* r" style="color: red;margin-left: -4px">*</i>' + t
|
|
||||||
dom.html(t)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
patch(ListRenderer.prototype, 'jikimo_frontend.ListRenderer', {
|
patch(ListRenderer.prototype, 'jikimo_frontend.ListRenderer', {
|
||||||
setup(){
|
setup(){
|
||||||
owl.onMounted(() => {
|
owl.onMounted(() => {
|
||||||
@@ -200,7 +175,9 @@ patch(FormLabel.prototype, 'jikimo_frontend.FormLabel', {
|
|||||||
this.props.fieldInfo
|
this.props.fieldInfo
|
||||||
);
|
);
|
||||||
const classes = this.props.className ? [this.props.className] : [];
|
const classes = this.props.className ? [this.props.className] : [];
|
||||||
if(this.props.fieldInfo?.rawAttrs?.class?.indexOf('custom_required') >= 0) {
|
const otherRequired = filedRequiredList[this.props.fieldName]
|
||||||
|
|
||||||
|
if(this.props.fieldInfo?.rawAttrs?.class?.indexOf('custom_required') >= 0 || otherRequired) {
|
||||||
classes.push('custom_required_add')
|
classes.push('custom_required_add')
|
||||||
}
|
}
|
||||||
if (invalid) {
|
if (invalid) {
|
||||||
|
|||||||
Reference in New Issue
Block a user