From 5a28ec75799ebf6c58d156221aee4855ae37551b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?WEB=E8=AE=B8=E4=BD=95=E5=93=B2=5Cxuhez?= Date: Mon, 7 Aug 2023 14:48:55 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=A5=E4=BD=9C=E4=B8=AD=E5=BF=83=E7=9C=8B?= =?UTF-8?q?=E6=9D=BF=E8=A7=86=E5=9B=BE=E6=A0=87=E7=AD=BE=E9=A1=B5=E7=9A=84?= =?UTF-8?q?=E5=8A=A8=E6=80=81=E6=B7=BB=E5=8A=A0=E5=B9=B6=E5=AE=9E=E7=8E=B0?= =?UTF-8?q?=E7=82=B9=E5=87=BB=E7=AD=9B=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/mrp_workcenter.py | 3 + .../static/src/js/kanban_change.js | 31 +++ .../static/src/scss/kanban_change.scss | 19 +- .../static/src/xml/kanban_change.xml | 13 +- .../views/mrp_workcenter_views.xml | 197 ++++++++++++++++-- 5 files changed, 230 insertions(+), 33 deletions(-) diff --git a/sf_manufacturing/models/mrp_workcenter.py b/sf_manufacturing/models/mrp_workcenter.py index 7483d188..525c2f54 100644 --- a/sf_manufacturing/models/mrp_workcenter.py +++ b/sf_manufacturing/models/mrp_workcenter.py @@ -6,6 +6,9 @@ from odoo.addons.resource.models.resource import Intervals class ResWorkcenter(models.Model): _inherit = "mrp.workcenter" + + # 生产线显示 + production_line_show = fields.Char(string='生产线') equipment_id = fields.Many2one('maintenance.equipment', string='设备') machine_tool_id = fields.Many2one('sf.machine_tool', string='机床') production_line_id = fields.Many2one('sf.production.line', string='生产线') diff --git a/sf_manufacturing/static/src/js/kanban_change.js b/sf_manufacturing/static/src/js/kanban_change.js index b60a84a4..64963d18 100644 --- a/sf_manufacturing/static/src/js/kanban_change.js +++ b/sf_manufacturing/static/src/js/kanban_change.js @@ -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; } diff --git a/sf_manufacturing/static/src/scss/kanban_change.scss b/sf_manufacturing/static/src/scss/kanban_change.scss index 82e31b87..fe4dfca4 100644 --- a/sf_manufacturing/static/src/scss/kanban_change.scss +++ b/sf_manufacturing/static/src/scss/kanban_change.scss @@ -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; -} \ No newline at end of file diff --git a/sf_manufacturing/static/src/xml/kanban_change.xml b/sf_manufacturing/static/src/xml/kanban_change.xml index c18fc103..ccd8fb21 100644 --- a/sf_manufacturing/static/src/xml/kanban_change.xml +++ b/sf_manufacturing/static/src/xml/kanban_change.xml @@ -1,18 +1,13 @@ - - - - - -
- +
+ -
+
+
diff --git a/sf_manufacturing/views/mrp_workcenter_views.xml b/sf_manufacturing/views/mrp_workcenter_views.xml index 8e360993..dee39525 100644 --- a/sf_manufacturing/views/mrp_workcenter_views.xml +++ b/sf_manufacturing/views/mrp_workcenter_views.xml @@ -94,6 +94,7 @@ + @@ -101,18 +102,175 @@ - - mrp.workcenter.view.kanban.inherit.maintenance - mrp.workcenter - - - - - - - + + + + + + + + + + + + + + + mrp.workcenter.kanban.inherit + mrp.workcenter + + + + + + + + + + + + +
+ +
+
+
+
+ + + + +
+
+ +
+
+
+
+
+
+ + + + + + +
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ + + % + + +
+
+
+
+ +
+
+
+
+
+
+
+
@@ -140,6 +298,21 @@ + + + mrp.workcenter.inherit + mrp.workcenter + + + + + + + +