合并销售订单列,修改必填*展示方法,
This commit is contained in:
@@ -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': [
|
||||
|
||||
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="is_incoming_material" readonly="1"/>
|
||||
</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">
|
||||
<attribute name="attrs">{'readonly': [('state', 'in', ['cancel','sale'])]}</attribute>
|
||||
</field>
|
||||
|
||||
Reference in New Issue
Block a user