工作中心看板视图动态添加标签页
This commit is contained in:
@@ -23,8 +23,21 @@
|
|||||||
'views/production_line_view.xml',
|
'views/production_line_view.xml',
|
||||||
'views/tray_view.xml',
|
'views/tray_view.xml',
|
||||||
'views/model_type_view.xml',
|
'views/model_type_view.xml',
|
||||||
|
# 'views/kanban_change.xml'
|
||||||
|
|
||||||
],
|
],
|
||||||
|
'assets': {
|
||||||
|
|
||||||
|
'web.assets_qweb': [
|
||||||
|
],
|
||||||
|
|
||||||
|
'web.assets_backend': [
|
||||||
|
'sf_manufacturing/static/src/xml/kanban_change.xml',
|
||||||
|
'sf_manufacturing/static/src/js/kanban_change.js',
|
||||||
|
'sf_manufacturing/static/src/scss/kanban_change.scss'
|
||||||
|
]
|
||||||
|
|
||||||
|
},
|
||||||
'demo': [
|
'demo': [
|
||||||
],
|
],
|
||||||
'qweb': [
|
'qweb': [
|
||||||
|
|||||||
43
sf_manufacturing/static/src/js/kanban_change.js
Normal file
43
sf_manufacturing/static/src/js/kanban_change.js
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
/** @odoo-module */
|
||||||
|
|
||||||
|
import { KanbanController } from "@web/views/kanban/kanban_controller";
|
||||||
|
import { kanbanView } from "@web/views/kanban/kanban_view";
|
||||||
|
import { registry } from "@web/core/registry";
|
||||||
|
|
||||||
|
// the controller usually contains the Layout and the renderer.
|
||||||
|
class CustomKanbanController extends KanbanController {
|
||||||
|
// Your logic here, override or insert new methods...
|
||||||
|
// if you override setup(), don't forget to call super.setup()
|
||||||
|
|
||||||
|
async setup() {
|
||||||
|
super.setup();
|
||||||
|
console.log('99999999111');
|
||||||
|
this.workOrders = await this.getAllWorkOrders();
|
||||||
|
console.log('lines', this.workOrders);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
async getAllWorkOrders() {
|
||||||
|
const response = await this.env.services.rpc('/web/dataset/call_kw',{
|
||||||
|
model: 'sf.production.line',
|
||||||
|
method: 'search_read',
|
||||||
|
args: [],
|
||||||
|
kwargs: {},
|
||||||
|
});
|
||||||
|
console.log('response', response);
|
||||||
|
// 你可以在这里处理响应,例如将其存储在控制器的状态中
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CustomKanbanController.template = "sf_manufacturing.CustomKanbanView1";
|
||||||
|
|
||||||
|
export const customKanbanView = {
|
||||||
|
...kanbanView, // contains the default Renderer/Controller/Model
|
||||||
|
Controller: CustomKanbanController,
|
||||||
|
};
|
||||||
|
|
||||||
|
// Register it to the views registry
|
||||||
|
registry.category("views").add("custom_kanban1", customKanbanView);
|
||||||
18
sf_manufacturing/static/src/scss/kanban_change.scss
Normal file
18
sf_manufacturing/static/src/scss/kanban_change.scss
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
.alerts {
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-start;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.alerts>div {
|
||||||
|
width: 3vw;
|
||||||
|
height: 1.5vw;
|
||||||
|
border: 1px solid grey;
|
||||||
|
border-radius: 5px;
|
||||||
|
margin: 0 0.5vw;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.alerts>div:nth-child(1) {
|
||||||
|
margin-left: 0 !important;
|
||||||
|
}
|
||||||
21
sf_manufacturing/static/src/xml/kanban_change.xml
Normal file
21
sf_manufacturing/static/src/xml/kanban_change.xml
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<templates>
|
||||||
|
<t t-name="sf_manufacturing.CustomKanbanView1" t-inherit="web.KanbanView" owl="1">
|
||||||
|
<!-- <xpath expr="//Layout" position="before"> -->
|
||||||
|
<!-- <div> -->
|
||||||
|
<!-- Hello world ! -->
|
||||||
|
<!-- </div> -->
|
||||||
|
<!-- </xpath> -->
|
||||||
|
<xpath expr="//t[@t-component='props.Renderer']" position="before">
|
||||||
|
<div class="alerts">
|
||||||
|
<!-- <t t-foreach="env['mrp.workcenter'].get_dynamic_data()" t-as="i" t-key="i"> -->
|
||||||
|
<t t-foreach="workOrders" t-as="i" t-key="i">
|
||||||
|
<div>
|
||||||
|
<t t-esc="i.name"></t>
|
||||||
|
</div>
|
||||||
|
</t>
|
||||||
|
</div>
|
||||||
|
</xpath>
|
||||||
|
|
||||||
|
</t>
|
||||||
|
</templates>
|
||||||
Reference in New Issue
Block a user