Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/制造功能优化
This commit is contained in:
@@ -1,3 +1,8 @@
|
|||||||
.o_list_renderer .o_list_table tbody > tr > td:not(.o_list_record_selector):not(.o_handle_cell):not(.o_list_button):not(.o_list_record_remove){
|
.o_list_renderer .o_list_table tbody > tr > td:not(.o_list_record_selector):not(.o_handle_cell):not(.o_list_button):not(.o_list_record_remove){
|
||||||
border:1px solid #dee2e6 !important;
|
border:1px solid #dee2e6 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom_required_add::before{
|
||||||
|
content: '*';
|
||||||
|
color: red;
|
||||||
}
|
}
|
||||||
@@ -6,6 +6,8 @@ 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 {ListRenderer} from "@web/views/list/list_renderer";
|
import {ListRenderer} from "@web/views/list/list_renderer";
|
||||||
// import {StatusBarField} from "@web/views/fields/statusbar/statusbar_field";
|
// import {StatusBarField} from "@web/views/fields/statusbar/statusbar_field";
|
||||||
|
import {FormLabel} from "@web/views/form/form_label";
|
||||||
|
import { fieldVisualFeedback } from "@web/views/fields/field";
|
||||||
|
|
||||||
import {Field} from "@web/views/fields/field";
|
import {Field} from "@web/views/fields/field";
|
||||||
|
|
||||||
@@ -115,9 +117,6 @@ patch(Field.prototype, 'jikimo_frontend.Field', {
|
|||||||
setRequired() {
|
setRequired() {
|
||||||
const id = this.props.id
|
const id = this.props.id
|
||||||
const isRequired = filedRequiredList[id]
|
const isRequired = filedRequiredList[id]
|
||||||
if(id == 'number_of_axles') {
|
|
||||||
console.log(isRequired)
|
|
||||||
}
|
|
||||||
if(isRequired) {
|
if(isRequired) {
|
||||||
let dom;
|
let dom;
|
||||||
dom = $(`label[for=${id}]`)
|
dom = $(`label[for=${id}]`)
|
||||||
@@ -191,7 +190,31 @@ patch(ListRenderer.prototype, 'jikimo_frontend.ListRenderer', {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
patch(FormLabel.prototype, 'jikimo_frontend.FormLabel', {
|
||||||
|
get className() {
|
||||||
|
|
||||||
|
const { invalid, empty, readonly } = fieldVisualFeedback(
|
||||||
|
this.props.fieldInfo.FieldComponent,
|
||||||
|
this.props.record,
|
||||||
|
this.props.fieldName,
|
||||||
|
this.props.fieldInfo
|
||||||
|
);
|
||||||
|
const classes = this.props.className ? [this.props.className] : [];
|
||||||
|
if(this.props.fieldInfo?.rawAttrs?.class?.indexOf('custom_required') >= 0) {
|
||||||
|
classes.push('custom_required_add')
|
||||||
|
}
|
||||||
|
if (invalid) {
|
||||||
|
classes.push("o_field_invalid");
|
||||||
|
}
|
||||||
|
if (empty) {
|
||||||
|
classes.push("o_form_label_empty");
|
||||||
|
}
|
||||||
|
if (readonly) {
|
||||||
|
classes.push("o_form_label_readonly");
|
||||||
|
}
|
||||||
|
return classes.join(" ");
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
// 根据进度条设置水印
|
// 根据进度条设置水印
|
||||||
// const statusbar_params = {
|
// const statusbar_params = {
|
||||||
@@ -231,7 +254,6 @@ $(function () {
|
|||||||
clearInterval(timer)
|
clearInterval(timer)
|
||||||
timer = setInterval(() => {
|
timer = setInterval(() => {
|
||||||
timer_count++
|
timer_count++
|
||||||
const dom = $('.custom_required')
|
|
||||||
let tableDom = $('.table_custom_required')
|
let tableDom = $('.table_custom_required')
|
||||||
if (tableDom.length) {
|
if (tableDom.length) {
|
||||||
tableDom = tableDom.eq(0).parents('tr').children('.table_custom_required')
|
tableDom = tableDom.eq(0).parents('tr').children('.table_custom_required')
|
||||||
@@ -243,17 +265,6 @@ $(function () {
|
|||||||
})
|
})
|
||||||
clearInterval(timer)
|
clearInterval(timer)
|
||||||
}
|
}
|
||||||
if (dom.length) {
|
|
||||||
dom.each(function () {
|
|
||||||
const requiredDom = $(this).parent().prev().find('label')
|
|
||||||
let t = requiredDom.html()
|
|
||||||
if (t && t.indexOf('c*') < 0) {
|
|
||||||
t = '<i class="c*" style="color: red;margin-left: -4px">*</i>' + t
|
|
||||||
}
|
|
||||||
requiredDom.html(t)
|
|
||||||
})
|
|
||||||
clearInterval(timer)
|
|
||||||
}
|
|
||||||
if (timer_count == 20) {
|
if (timer_count == 20) {
|
||||||
clearInterval(timer)
|
clearInterval(timer)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
'web.assets_backend': [
|
'web.assets_backend': [
|
||||||
'sf_sale/static/js/setTableWidth.js',
|
'sf_sale/static/js/setTableWidth.js',
|
||||||
'sf_sale/static/src/css/purchase_list.css',
|
'sf_sale/static/src/css/purchase_list.css',
|
||||||
|
'sf_sale/static/lib/*',
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
'demo': [
|
'demo': [
|
||||||
|
|||||||
18
sf_sale/static/lib/merge_field.js
Normal file
18
sf_sale/static/lib/merge_field.js
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
/** @odoo-module */
|
||||||
|
|
||||||
|
import { Component } from "@odoo/owl";
|
||||||
|
import { registry } from "@web/core/registry";
|
||||||
|
|
||||||
|
|
||||||
|
export class MergeField extends Component {
|
||||||
|
get mergeValue() {
|
||||||
|
const data = this.props.record.data;
|
||||||
|
|
||||||
|
const v = data?.product_uom_qty
|
||||||
|
const unit = data?.product_uom[1]
|
||||||
|
return `${v} ${unit}`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
MergeField.template = "jikimo_sf.MergeField";
|
||||||
|
|
||||||
|
registry.category("fields").add("merge_field", MergeField);
|
||||||
8
sf_sale/static/lib/merge_field.xml
Normal file
8
sf_sale/static/lib/merge_field.xml
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<templates xml:space="preserve">
|
||||||
|
|
||||||
|
<t t-name="jikimo_sf.MergeField" owl="1">
|
||||||
|
<span t-esc="mergeValue"/>
|
||||||
|
</t>
|
||||||
|
|
||||||
|
</templates>
|
||||||
@@ -123,6 +123,13 @@
|
|||||||
<field name="manual_quotation" readonly="1"/>
|
<field name="manual_quotation" readonly="1"/>
|
||||||
<field name="is_incoming_material" readonly="1"/>
|
<field name="is_incoming_material" readonly="1"/>
|
||||||
</xpath>
|
</xpath>
|
||||||
|
|
||||||
|
<xpath expr="//field[@name='order_line']/tree/field[@name='product_uom_qty']" position="replace">
|
||||||
|
<field name="product_uom_qty" string="数量" widget="merge_field" optional="show" />
|
||||||
|
</xpath>
|
||||||
|
<xpath expr="//field[@name='order_line']/tree/field[@name='product_uom']" position="attributes">
|
||||||
|
<attribute name="optional">hide</attribute>
|
||||||
|
</xpath>
|
||||||
<field name="user_id" position="attributes">
|
<field name="user_id" position="attributes">
|
||||||
<attribute name="attrs">{'readonly': [('state', 'in', ['cancel','sale'])]}</attribute>
|
<attribute name="attrs">{'readonly': [('state', 'in', ['cancel','sale'])]}</attribute>
|
||||||
</field>
|
</field>
|
||||||
|
|||||||
Reference in New Issue
Block a user