工作中心看板视图标签页的动态添加并实现点击筛选
This commit is contained in:
@@ -15,8 +15,32 @@ class CustomKanbanController extends KanbanController {
|
||||
this.workOrders = await this.getAllWorkOrders();
|
||||
console.log('lines', this.workOrders);
|
||||
}
|
||||
buttonClick(ev) {
|
||||
const button = ev.currentTarget;
|
||||
const id = button.getAttribute('data-id');
|
||||
|
||||
console.log('true_id', id);
|
||||
const context = {production_line_show: 'shengchanxian1'}
|
||||
this.env.services.rpc('/web/dataset/call_kw', {
|
||||
model: 'mrp.workcenter',
|
||||
method: 'search_read',
|
||||
args: [[], ['id']],
|
||||
kwargs: {}
|
||||
}).then((records) => {
|
||||
const ids = records.map(record => record.id);
|
||||
const context = {production_line_show: id};
|
||||
this.env.services.rpc('/web/dataset/call_kw', {
|
||||
model: 'mrp.workcenter',
|
||||
method: 'write',
|
||||
args: [ids, context],
|
||||
kwargs: {}
|
||||
}).then((response) => {
|
||||
console.log('response', response);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
async getAllWorkOrders() {
|
||||
const response = await this.env.services.rpc('/web/dataset/call_kw',{
|
||||
model: 'sf.production.line',
|
||||
@@ -24,7 +48,14 @@ class CustomKanbanController extends KanbanController {
|
||||
args: [],
|
||||
kwargs: {},
|
||||
});
|
||||
// const response1 = await this.env.services.rpc('/web/dataset/call_kw',{
|
||||
// model: 'mrp.workcenter',
|
||||
// method: 'search_read',
|
||||
// args: [],
|
||||
// kwargs: {},
|
||||
// });
|
||||
console.log('response', response);
|
||||
// console.log('response1', response1);
|
||||
// 你可以在这里处理响应,例如将其存储在控制器的状态中
|
||||
return response;
|
||||
}
|
||||
|
||||
@@ -1,18 +1,13 @@
|
||||
.alerts {
|
||||
.choosekanban {
|
||||
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;
|
||||
.choosekanban>button {
|
||||
width: 5vw !important;
|
||||
height: 2vw !important;
|
||||
border: none !important;
|
||||
margin-left: 16px !important;
|
||||
margin-top: 1vw !important;
|
||||
}
|
||||
|
||||
.alerts>div:nth-child(1) {
|
||||
margin-left: 0 !important;
|
||||
}
|
||||
@@ -1,18 +1,13 @@
|
||||
<?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"> -->
|
||||
<div class="choosekanban">
|
||||
<!-- <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>
|
||||
<button t-on-click="buttonClick" t-att-data-id="i.name">
|
||||
<t t-esc="i.name"></t>
|
||||
</div>
|
||||
</button>
|
||||
</t>
|
||||
</div>
|
||||
</xpath>
|
||||
|
||||
Reference in New Issue
Block a user