diff --git a/jikimo_frontend/static/src/css/list_border_styles.css b/jikimo_frontend/static/src/css/list_border_styles.css
index bca5499e..35fc8099 100644
--- a/jikimo_frontend/static/src/css/list_border_styles.css
+++ b/jikimo_frontend/static/src/css/list_border_styles.css
@@ -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){
border:1px solid #dee2e6 !important;
+}
+
+.custom_required_add::before{
+ content: '*';
+ color: red;
}
\ No newline at end of file
diff --git a/jikimo_frontend/static/src/js/custom_form_status_indicator.js b/jikimo_frontend/static/src/js/custom_form_status_indicator.js
index 0b6a6b50..038c2dc0 100644
--- a/jikimo_frontend/static/src/js/custom_form_status_indicator.js
+++ b/jikimo_frontend/static/src/js/custom_form_status_indicator.js
@@ -6,6 +6,8 @@ import {_t} from "@web/core/l10n/translation";
import {FormStatusIndicator} from "@web/views/form/form_status_indicator/form_status_indicator";
import {ListRenderer} from "@web/views/list/list_renderer";
// 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";
@@ -115,9 +117,6 @@ patch(Field.prototype, 'jikimo_frontend.Field', {
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}]`)
@@ -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 = {
@@ -231,7 +254,6 @@ $(function () {
clearInterval(timer)
timer = setInterval(() => {
timer_count++
- const dom = $('.custom_required')
let tableDom = $('.table_custom_required')
if (tableDom.length) {
tableDom = tableDom.eq(0).parents('tr').children('.table_custom_required')
@@ -243,17 +265,6 @@ $(function () {
})
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 = '*' + t
- }
- requiredDom.html(t)
- })
- clearInterval(timer)
- }
if (timer_count == 20) {
clearInterval(timer)
}
diff --git a/sf_sale/__manifest__.py b/sf_sale/__manifest__.py
index e824240e..c12f94fd 100644
--- a/sf_sale/__manifest__.py
+++ b/sf_sale/__manifest__.py
@@ -28,6 +28,7 @@
'web.assets_backend': [
'sf_sale/static/js/setTableWidth.js',
'sf_sale/static/src/css/purchase_list.css',
+ 'sf_sale/static/lib/*',
]
},
'demo': [
diff --git a/sf_sale/static/lib/merge_field.js b/sf_sale/static/lib/merge_field.js
new file mode 100644
index 00000000..6278c36e
--- /dev/null
+++ b/sf_sale/static/lib/merge_field.js
@@ -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);
diff --git a/sf_sale/static/lib/merge_field.xml b/sf_sale/static/lib/merge_field.xml
new file mode 100644
index 00000000..59103fa9
--- /dev/null
+++ b/sf_sale/static/lib/merge_field.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/sf_sale/views/sale_order_view.xml b/sf_sale/views/sale_order_view.xml
index d408e807..185050c0 100644
--- a/sf_sale/views/sale_order_view.xml
+++ b/sf_sale/views/sale_order_view.xml
@@ -123,6 +123,13 @@
+
+
+
+
+
+ hide
+
{'readonly': [('state', 'in', ['cancel','sale'])]}