Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into develop
This commit is contained in:
@@ -5,9 +5,44 @@ import {patch} from '@web/core/utils/patch';
|
|||||||
import {_t} from "@web/core/l10n/translation";
|
import {_t} from "@web/core/l10n/translation";
|
||||||
import {FormStatusIndicator} from "@web/views/form/form_status_indicator/form_status_indicator";
|
import {FormStatusIndicator} from "@web/views/form/form_status_indicator/form_status_indicator";
|
||||||
|
|
||||||
|
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") 这句话也行
|
||||||
|
const filedRequiredList = {
|
||||||
|
// 设备大模块
|
||||||
|
'control_system_id': { multiple: false, noLabel: false },
|
||||||
|
'workbench_L': { multiple: true, noLabel: false },
|
||||||
|
'number_of_axles': { multiple: true, noLabel: false },
|
||||||
|
'x_axis': { multiple: true, noLabel: false },
|
||||||
|
'number_of_knife_library': { multiple: false, noLabel: false },
|
||||||
|
'brand_id': { multiple: false, noLabel: false },
|
||||||
|
'type_id': { multiple: false, noLabel: false },
|
||||||
|
'taper_type_id': { multiple: false, noLabel: false },
|
||||||
|
'eq_maintenance_id': { multiple: false, noLabel: false },
|
||||||
|
'overhaul_id': { multiple: false, noLabel: false },
|
||||||
|
'overhaul_period': { multiple: false, noLabel: false },
|
||||||
|
'maintenance_equipment_category_id': { multiple: false, noLabel: false },
|
||||||
|
'maintenance_type': { multiple: false, noLabel: false },
|
||||||
|
|
||||||
|
// 销售大模块
|
||||||
|
'partner_id': { multiple: false, noLabel: false },
|
||||||
|
'validity_date': { multiple: false, noLabel: false },
|
||||||
|
'vat': { multiple: false, noLabel: false },
|
||||||
|
'phone': { multiple: false, noLabel: false },
|
||||||
|
'mobile': { multiple: false, noLabel: false },
|
||||||
|
'email': { multiple: false, noLabel: false },
|
||||||
|
'category_id': { multiple: false, noLabel: false },
|
||||||
|
'radio_field_1_person': { multiple: false, noLabel: true },
|
||||||
|
|
||||||
|
// 采购大模块
|
||||||
|
'date_order': { multiple: false, noLabel: false },
|
||||||
|
'picking_type_id': { multiple: false, noLabel: false },
|
||||||
|
|
||||||
|
// 制造大模块
|
||||||
|
'production_line_id': { multiple: false, noLabel: false },
|
||||||
|
'date_approve': { multiple: false, noLabel: false },
|
||||||
|
}
|
||||||
patch(FormStatusIndicator.prototype, 'jikimo_frontend.FormStatusIndicator', {
|
patch(FormStatusIndicator.prototype, 'jikimo_frontend.FormStatusIndicator', {
|
||||||
// 你可以重写或者添加一些方法和属性
|
// 你可以重写或者添加一些方法和属性
|
||||||
async _onDiscardChanges() {
|
async _onDiscardChanges() {
|
||||||
@@ -46,6 +81,38 @@ patch(FormStatusIndicator.prototype, 'jikimo_frontend.FormStatusIndicator', {
|
|||||||
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
patch(Field.prototype, 'jikimo_frontend.Field', {
|
||||||
|
setup() {
|
||||||
|
this.FieldComponent = this.props.fieldInfo.FieldComponent;
|
||||||
|
if (!this.FieldComponent) {
|
||||||
|
const fieldType = this.props.record.fields[this.props.name].type;
|
||||||
|
this.FieldComponent = getFieldClassFromRegistry(fieldType, this.props.type);
|
||||||
|
}
|
||||||
|
owl.onMounted(this.setRequired);
|
||||||
|
},
|
||||||
|
setRequired() {
|
||||||
|
const id = this.props.id
|
||||||
|
const isRequired = filedRequiredList[id]
|
||||||
|
if(id == 'number_of_axles') {
|
||||||
|
console.log(isRequired)
|
||||||
|
}
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
$(function () {
|
$(function () {
|
||||||
document.addEventListener('click', function () {
|
document.addEventListener('click', function () {
|
||||||
@@ -82,7 +149,7 @@ $(function () {
|
|||||||
dom.each(function () {
|
dom.each(function () {
|
||||||
const requiredDom = $(this).parent().prev().find('label')
|
const requiredDom = $(this).parent().prev().find('label')
|
||||||
let t = requiredDom.html()
|
let t = requiredDom.html()
|
||||||
if (t.indexOf('c*') < 0) {
|
if (t && t.indexOf('c*') < 0) {
|
||||||
t = '<i class="c*" style="color: red;margin-left: -4px">*</i>' + t
|
t = '<i class="c*" style="color: red;margin-left: -4px">*</i>' + t
|
||||||
}
|
}
|
||||||
requiredDom.html(t)
|
requiredDom.html(t)
|
||||||
@@ -104,16 +171,7 @@ $(function () {
|
|||||||
const lint = $('.o_form_view_container')
|
const lint = $('.o_form_view_container')
|
||||||
if (lint.length) {
|
if (lint.length) {
|
||||||
clearInterval(domTimer)
|
clearInterval(domTimer)
|
||||||
const {label, table} = dom
|
const { table} = dom
|
||||||
if (label.length) {
|
|
||||||
$(dom.label.join(',')).each(function () {
|
|
||||||
let t = $(this).html()
|
|
||||||
if (t.indexOf('c*') < 0) {
|
|
||||||
t = '<i class="c*" style="color: red;margin-left: -6px;margin-right: 2px">*</i>' + t
|
|
||||||
}
|
|
||||||
$(this).html(t)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
if (table.length) {
|
if (table.length) {
|
||||||
table.forEach(_ => {
|
table.forEach(_ => {
|
||||||
@@ -133,8 +191,7 @@ $(function () {
|
|||||||
|
|
||||||
var currentUrl = location.href
|
var currentUrl = location.href
|
||||||
const customRequiredDom = {
|
const customRequiredDom = {
|
||||||
label: ['label[for=production_line_id]','label[for=date_approve]','label[for=partner_id]', 'label[for=validity_date]', '.o_horizontal[role=radiogroup][aria-label="公司类别"]', 'label[for=vat]', 'label[for=phone]', 'label[for=mobile]', 'label[for=email]', 'label[for=category_id]','label[for=date_order]','label[for=picking_type_id]'],
|
table: ['product_template_id', 'product_uom_qty', 'price_unit','product_id','product_qty', 'name', 'fault_type', 'maintenance_standards', 'Period']
|
||||||
table: ['product_template_id', 'product_uom_qty', 'price_unit','product_id','product_qty']
|
|
||||||
}
|
}
|
||||||
const listenerUrl = setInterval(() => {
|
const listenerUrl = setInterval(() => {
|
||||||
const isChange = currentUrl != location.href
|
const isChange = currentUrl != location.href
|
||||||
@@ -143,9 +200,6 @@ $(function () {
|
|||||||
customRequired()
|
customRequired()
|
||||||
setRequired(customRequiredDom)
|
setRequired(customRequiredDom)
|
||||||
}
|
}
|
||||||
if($('label[for=production_line_id]')) {
|
|
||||||
setRequired({table: [], label: ['label[for=production_line_id]']})
|
|
||||||
}
|
|
||||||
}, 500)
|
}, 500)
|
||||||
customRequired()
|
customRequired()
|
||||||
setRequired(customRequiredDom)
|
setRequired(customRequiredDom)
|
||||||
|
|||||||
@@ -12,14 +12,14 @@
|
|||||||
<group>
|
<group>
|
||||||
<field name="code" readonly="1" force_save="1"/>
|
<field name="code" readonly="1" force_save="1"/>
|
||||||
<field name="name" readonly="1" force_save="1"/>
|
<field name="name" readonly="1" force_save="1"/>
|
||||||
<field name="maintenance_equipment_category_id" required="1" class="custom_required"/>
|
<field name="maintenance_equipment_category_id" required="1" />
|
||||||
<field name="eq_maintenance_ids" invisible='1'/>
|
<field name="eq_maintenance_ids" invisible='1'/>
|
||||||
<field name="overhaul_ids" invisible='1'/>
|
<field name="overhaul_ids" invisible='1'/>
|
||||||
|
|
||||||
|
|
||||||
</group>
|
</group>
|
||||||
<group>
|
<group>
|
||||||
<field name="maintenance_type" required="1" class="custom_required"/>
|
<field name="maintenance_type" required="1"/>
|
||||||
<field name="created_user_id"/>
|
<field name="created_user_id"/>
|
||||||
<field name="remark"/>
|
<field name="remark"/>
|
||||||
</group>
|
</group>
|
||||||
@@ -32,11 +32,11 @@
|
|||||||
<page string="维保项目">
|
<page string="维保项目">
|
||||||
|
|
||||||
<field name="maintenance_standards_ids" delete="1">
|
<field name="maintenance_standards_ids" delete="1">
|
||||||
<tree editable="bottom">
|
<tree editable="bottom" >
|
||||||
<field name="name" class="table_custom_required"/>
|
<field name="name" />
|
||||||
<field name="fault_type" class="table_custom_required"/>
|
<field name="fault_type" />
|
||||||
<field name="maintenance_standards" class="table_custom_required"/>
|
<field name="maintenance_standards" />
|
||||||
<field name="Period" class="table_custom_required"/>
|
<field name="Period" />
|
||||||
</tree>
|
</tree>
|
||||||
</field>
|
</field>
|
||||||
</page>
|
</page>
|
||||||
|
|||||||
@@ -60,9 +60,9 @@
|
|||||||
<field name="function_type"/>
|
<field name="function_type"/>
|
||||||
<field name="code" readonly="1"/>
|
<field name="code" readonly="1"/>
|
||||||
<field name="equipment_type" invisible="1"/>
|
<field name="equipment_type" invisible="1"/>
|
||||||
<field name="brand_id" force_save="1" class="custom_required"/>
|
<field name="brand_id" force_save="1" />
|
||||||
<field name="type_id" attrs="{'required': [('equipment_type', '=', '机床')]}"
|
<field name="type_id" attrs="{'required': [('equipment_type', '=', '机床')]}"
|
||||||
domain="[('brand_id', '=', brand_id)]" class="custom_required"/>
|
domain="[('brand_id', '=', brand_id)]" />
|
||||||
<field name="machine_tool_category" readonly="1" attrs="{'invisible': [('type_id', '=', False)]}"
|
<field name="machine_tool_category" readonly="1" attrs="{'invisible': [('type_id', '=', False)]}"
|
||||||
force_save="1"/>
|
force_save="1"/>
|
||||||
<field name="run_time" force_save="1"/>
|
<field name="run_time" force_save="1"/>
|
||||||
@@ -73,9 +73,9 @@
|
|||||||
<group>
|
<group>
|
||||||
<group string="基础参数">
|
<group string="基础参数">
|
||||||
<field name="control_system_id" attrs="{'required': [('equipment_type', '=', '机床')]}"
|
<field name="control_system_id" attrs="{'required': [('equipment_type', '=', '机床')]}"
|
||||||
options="{'no_create': True}" class="custom_required"/>
|
options="{'no_create': True}" />
|
||||||
<label for="workbench_L" string="工作台尺寸(mm)"/>
|
<label for="workbench_L" string="工作台尺寸(mm)"/>
|
||||||
<div class="test_model custom_required">
|
<div class="test_model">
|
||||||
<label for="workbench_L" string="长"/>
|
<label for="workbench_L" string="长"/>
|
||||||
<field name="workbench_L" class="o_address_zip"
|
<field name="workbench_L" class="o_address_zip"
|
||||||
attrs="{'required': [('equipment_type', '=', '机床')]}"
|
attrs="{'required': [('equipment_type', '=', '机床')]}"
|
||||||
@@ -134,7 +134,7 @@
|
|||||||
<!-- <field name="guide_rail" required="1"/>-->
|
<!-- <field name="guide_rail" required="1"/>-->
|
||||||
<field name="number_of_axles" attrs="{'required': [('equipment_type', '=', '机床')]}"
|
<field name="number_of_axles" attrs="{'required': [('equipment_type', '=', '机床')]}"
|
||||||
widget="radio"
|
widget="radio"
|
||||||
options="{'horizontal': true}" class="custom_required"/>
|
options="{'horizontal': true}" />
|
||||||
<label for="x_axis" string="加工行程(mm)"
|
<label for="x_axis" string="加工行程(mm)"
|
||||||
attrs="{'invisible': [('number_of_axles', '=', False)]}"/>
|
attrs="{'invisible': [('number_of_axles', '=', False)]}"/>
|
||||||
<div class="test_model"
|
<div class="test_model"
|
||||||
@@ -177,8 +177,7 @@
|
|||||||
<group string="刀具">
|
<group string="刀具">
|
||||||
<!-- <field name="knife_type" required="1"/>-->
|
<!-- <field name="knife_type" required="1"/>-->
|
||||||
<field name="number_of_knife_library"
|
<field name="number_of_knife_library"
|
||||||
attrs="{'required': [('equipment_type', '=', '机床')]}"
|
attrs="{'required': [('equipment_type', '=', '机床')]}"/>
|
||||||
class="custom_required"/>
|
|
||||||
<!-- <field name="tool_speed" required="1"/>-->
|
<!-- <field name="tool_speed" required="1"/>-->
|
||||||
<field name="tool_full_diameter_max"/>
|
<field name="tool_full_diameter_max"/>
|
||||||
<field name="tool_perimeter_diameter_max"/>
|
<field name="tool_perimeter_diameter_max"/>
|
||||||
@@ -198,7 +197,7 @@
|
|||||||
<field name="C_tool_time"/>
|
<field name="C_tool_time"/>
|
||||||
</group>
|
</group>
|
||||||
<group string="主轴">
|
<group string="主轴">
|
||||||
<field name="taper_type_id" attrs="{'required': [('equipment_type', '=', '机床')]}" class="custom_required"/>
|
<field name="taper_type_id" attrs="{'required': [('equipment_type', '=', '机床')]}" />
|
||||||
<label for="distance_min" string="主轴端面-工作台距离(mm)"/>
|
<label for="distance_min" string="主轴端面-工作台距离(mm)"/>
|
||||||
<div class="test_model">
|
<div class="test_model">
|
||||||
<label for="distance_min" string="最小(min)"/>
|
<label for="distance_min" string="最小(min)"/>
|
||||||
@@ -982,16 +981,16 @@
|
|||||||
|
|
||||||
<xpath expr="//field[@name='next_action_date']" position="before">
|
<xpath expr="//field[@name='next_action_date']" position="before">
|
||||||
|
|
||||||
<field name='eq_maintenance_id' force_save="1" widget="many2one" class="custom_required"/>
|
<field name='eq_maintenance_id' force_save="1" widget="many2one"/>
|
||||||
|
|
||||||
</xpath>
|
</xpath>
|
||||||
|
|
||||||
<xpath expr="//div[hasclass('o_row')][field[@name='maintenance_duration']]" position="after">
|
<xpath expr="//div[hasclass('o_row')][field[@name='maintenance_duration']]" position="after">
|
||||||
|
|
||||||
|
|
||||||
<field name='overhaul_id' class="custom_required"/>
|
<field name='overhaul_id'/>
|
||||||
<field name="overhaul_date" string="下次预防检修"/>
|
<field name="overhaul_date" string="下次预防检修"/>
|
||||||
<label for="overhaul_period" string="预防检修频次" class="custom_required"/>
|
<label for="overhaul_period" string="预防检修频次"/>
|
||||||
<div class="o_row">
|
<div class="o_row">
|
||||||
<field name="overhaul_period"/>
|
<field name="overhaul_period"/>
|
||||||
days
|
days
|
||||||
|
|||||||
Reference in New Issue
Block a user