From c0b759aa9d88b3a14a35ff649b26c9102f4d2d0b Mon Sep 17 00:00:00 2001
From: mgw <1392924357@qq.com>
Date: Wed, 8 Nov 2023 11:24:05 +0800
Subject: [PATCH 01/10] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sf_plan/models/custom_plan.py | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/sf_plan/models/custom_plan.py b/sf_plan/models/custom_plan.py
index 9c94fa22..858b1036 100644
--- a/sf_plan/models/custom_plan.py
+++ b/sf_plan/models/custom_plan.py
@@ -102,12 +102,6 @@ class sf_production_plan(models.Model):
self.date_planned_finished = None
self.state = 'draft'
- # @api.model
- # def create(self, vals):
- # if 'sequence' not in vals:
- # vals['sequence'] = self.env['sf.production.plan'].search_count([]) + 1
- # return super().create(vals)
-
def unlink(self):
sequence_to_reorder = self.mapped('sequence')
res = super().unlink()
@@ -169,6 +163,9 @@ class sf_production_plan(models.Model):
# 当不设置计划结束时间时,增加计算计划结束时间的方法,根据采购周期加缓冲期两个值来算就可以了
def do_production_schedule(self):
+ """
+ 排程方法
+ """
if not self.production_line_id:
raise ValidationError("未选择生产线")
else:
From 523f7a0942651587b327f799091f351ba0d26a08 Mon Sep 17 00:00:00 2001
From: mgw <1392924357@qq.com>
Date: Thu, 9 Nov 2023 16:20:26 +0800
Subject: [PATCH 02/10] =?UTF-8?q?=E6=A2=B3=E7=90=86=E8=AE=A1=E5=88=92?=
=?UTF-8?q?=E6=A8=A1=E5=9D=97=E7=BB=93=E6=9E=84?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sf_plan/__manifest__.py | 1 -
sf_plan/controllers/__init__.py | 2 --
sf_plan/controllers/controllers.py | 17 ----------
sf_plan/models/__init__.py | 1 -
sf_plan/models/duration.py | 25 --------------
sf_plan/views/duration_view.xml | 52 ------------------------------
6 files changed, 98 deletions(-)
delete mode 100644 sf_plan/controllers/__init__.py
delete mode 100644 sf_plan/controllers/controllers.py
delete mode 100644 sf_plan/models/duration.py
delete mode 100644 sf_plan/views/duration_view.xml
diff --git a/sf_plan/__manifest__.py b/sf_plan/__manifest__.py
index 09f2fdc4..40b36882 100644
--- a/sf_plan/__manifest__.py
+++ b/sf_plan/__manifest__.py
@@ -17,7 +17,6 @@
'data': [
'security/ir.model.access.csv',
'views/view.xml',
- # 'views/duration_view.xml'
],
'assets': {
diff --git a/sf_plan/controllers/__init__.py b/sf_plan/controllers/__init__.py
deleted file mode 100644
index 6d07f482..00000000
--- a/sf_plan/controllers/__init__.py
+++ /dev/null
@@ -1,2 +0,0 @@
-from .import controllers
-
diff --git a/sf_plan/controllers/controllers.py b/sf_plan/controllers/controllers.py
deleted file mode 100644
index c600d76a..00000000
--- a/sf_plan/controllers/controllers.py
+++ /dev/null
@@ -1,17 +0,0 @@
-# -*- coding: utf-8 -*-
-import json
-import logging
-from odoo import http
-from odoo.http import request
-
-
-class ProductionPlan(http.Controller):
-
- @http.route('/api/production/plan', type='http', auth='none', methods=['GET', 'POST'], csrf=False,
- cors="*")
- def schedule_orders(self, **kw):
- """
- 排程订单
- """
- logging.info('schedule_orders', kw)
-
diff --git a/sf_plan/models/__init__.py b/sf_plan/models/__init__.py
index 5fa8cee6..c47d4ff3 100644
--- a/sf_plan/models/__init__.py
+++ b/sf_plan/models/__init__.py
@@ -2,4 +2,3 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import custom_plan
-# from . import duration
diff --git a/sf_plan/models/duration.py b/sf_plan/models/duration.py
deleted file mode 100644
index 6fbe34e2..00000000
--- a/sf_plan/models/duration.py
+++ /dev/null
@@ -1,25 +0,0 @@
-# -*- coding: utf-8 -*-
-import base64
-import json, requests
-from odoo import models, fields, api, _
-from datetime import datetime, timedelta
-from odoo.exceptions import UserError, ValidationError
-
-
-class HoleDuration(models.Model):
- _name = 'hole.duration'
- _description = 'Hole Duration'
-
- hole_diameter = fields.Selection([('3', '≤¢3'), ('6', '≤¢6'), ('10', '≤¢10'), ('12', '≤¢12'), ('16', '≤¢16'), ('25', '≤¢25')], string='孔径', required=True)
- name = fields.Char(string='名称', required=True, default='钻孔')
- hole_depth = fields.Selection([
- ('10', '≤10'),
- ('30', '≤30'),
- ('50', '≤50'),
- ('70', '≤70'),
- ('90', '≤90'),
- ('100', '≤100'),
- ('120', '≤120'),
- ('150', '≤150')], string='深度', required=True)
- working_hours = fields.Float(string='工时', required=True)
- hole_expansion = fields.Float(string='扩孔', required=True, default=0.6)
diff --git a/sf_plan/views/duration_view.xml b/sf_plan/views/duration_view.xml
deleted file mode 100644
index c592fae3..00000000
--- a/sf_plan/views/duration_view.xml
+++ /dev/null
@@ -1,52 +0,0 @@
-
-
-
-
- hole.duration.tree
- hole.duration
-
-
-
-
-
-
-
-
-
-
-
-
- hole.duration.form
- hole.duration
-
-
-
-
-
-
- 孔加工
- ir.actions.act_window
- hole.duration
- tree,form
-
-
-
-
-
-
From dbfd75b139e99b119fe5d04d6e02dc70937d6777 Mon Sep 17 00:00:00 2001
From: "jinling.yang"
Date: Thu, 9 Nov 2023 16:30:05 +0800
Subject: [PATCH 03/10] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=8D=95=E4=B8=80?=
=?UTF-8?q?=E5=88=B6=E9=80=A0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sf_dlm/data/product_data.xml | 8 ++++----
sf_dlm/models/product_supplierinfo.py | 2 +-
.../views/product_template_management_view.xml | 3 ++-
3 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/sf_dlm/data/product_data.xml b/sf_dlm/data/product_data.xml
index f5d1904e..3cc92912 100644
--- a/sf_dlm/data/product_data.xml
+++ b/sf_dlm/data/product_data.xml
@@ -63,7 +63,7 @@
true
serial
- false
+ true
坯料自加工模板
@@ -79,7 +79,7 @@
true
serial
- false
+ true
@@ -95,7 +95,7 @@
serial
- false
+ true
坯料采购模板
@@ -110,7 +110,7 @@
serial
- false
+ true
\ No newline at end of file
diff --git a/sf_dlm/models/product_supplierinfo.py b/sf_dlm/models/product_supplierinfo.py
index a5ef52ae..f8055e1a 100644
--- a/sf_dlm/models/product_supplierinfo.py
+++ b/sf_dlm/models/product_supplierinfo.py
@@ -21,7 +21,7 @@ class ResProductProduct(models.Model):
class ResProducTemplate(models.Model):
_inherit = 'product.template'
- single_manufacturing = fields.Binary('模型文件')
+ single_manufacturing = fields.Boolean(string="单个制造")
class ResMrpBomMo(models.Model):
diff --git a/sf_dlm_management/views/product_template_management_view.xml b/sf_dlm_management/views/product_template_management_view.xml
index f2bfb732..692756da 100644
--- a/sf_dlm_management/views/product_template_management_view.xml
+++ b/sf_dlm_management/views/product_template_management_view.xml
@@ -8,10 +8,11 @@
+
+ attrs="{'invisible': ['|', '|',('categ_type', '!=', '成品'),('categ_type', '=', False),('is_bfm','=', True)]}"/>
From 93731a4777a2d608a08ec8b5cf30b81c7ddac666 Mon Sep 17 00:00:00 2001
From: mgw <1392924357@qq.com>
Date: Fri, 10 Nov 2023 16:20:48 +0800
Subject: [PATCH 04/10] =?UTF-8?q?=E5=9B=BE=E6=96=87=E9=A1=B9=E7=9B=AE?=
=?UTF-8?q?=E5=8D=95=E9=80=89=E5=8A=9F=E8=83=BD=E6=9C=AC=E5=9C=B0=E5=BC=80?=
=?UTF-8?q?=E5=8F=91=E6=B5=8B=E8=AF=95=E5=AE=8C=E6=88=90=EF=BC=8C=E6=8E=A8?=
=?UTF-8?q?=E9=80=81=E7=BA=BF=E4=B8=8A=E6=B5=8B=E8=AF=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
jikimo_frontend/__manifest__.py | 1 +
.../many2one_radio_field.css | 3 +
.../many2one_radio_field.js | 56 +++++++++++++++++++
.../many2one_radio_field.xml | 35 ++++++++++++
4 files changed, 95 insertions(+)
create mode 100644 jikimo_frontend/static/src/fields/Many2OneRadioField/many2one_radio_field.css
create mode 100644 jikimo_frontend/static/src/fields/Many2OneRadioField/many2one_radio_field.js
create mode 100644 jikimo_frontend/static/src/fields/Many2OneRadioField/many2one_radio_field.xml
diff --git a/jikimo_frontend/__manifest__.py b/jikimo_frontend/__manifest__.py
index a90a374e..d9885897 100644
--- a/jikimo_frontend/__manifest__.py
+++ b/jikimo_frontend/__manifest__.py
@@ -22,6 +22,7 @@
],
'web.assets_backend': [
'jikimo_frontend/static/src/fields/custom_many2many_checkboxes/*',
+ 'jikimo_frontend/static/src/fields/Many2OneRadioField/*',
'jikimo_frontend/static/src/scss/custom_style.scss',
# 'jikimo_frontend/static/src/views/list_nums/list_nbCols.js',
'jikimo_frontend/static/src/views/list_nums/list_nums.xml',
diff --git a/jikimo_frontend/static/src/fields/Many2OneRadioField/many2one_radio_field.css b/jikimo_frontend/static/src/fields/Many2OneRadioField/many2one_radio_field.css
new file mode 100644
index 00000000..72d877a0
--- /dev/null
+++ b/jikimo_frontend/static/src/fields/Many2OneRadioField/many2one_radio_field.css
@@ -0,0 +1,3 @@
+.many2one_radio_field {
+ display: inline-block;
+}
\ No newline at end of file
diff --git a/jikimo_frontend/static/src/fields/Many2OneRadioField/many2one_radio_field.js b/jikimo_frontend/static/src/fields/Many2OneRadioField/many2one_radio_field.js
new file mode 100644
index 00000000..836ee6d8
--- /dev/null
+++ b/jikimo_frontend/static/src/fields/Many2OneRadioField/many2one_radio_field.js
@@ -0,0 +1,56 @@
+/** @odoo-module **/
+
+import { RadioField } from "@web/views/fields/radio/radio_field"; // 导入单选按钮组件
+import { registry } from "@web/core/registry";
+
+export class Many2OneRadioField extends RadioField {
+ // 你可以重写或者添加一些方法和属性
+ // 例如,你可以重写setup方法来添加一些事件监听器或者初始化一些变量
+ setup() {
+ super.setup(); // 调用父类的setup方法
+ // 你自己的代码
+ }
+
+
+ onImageClick(event) {
+ // 放大图片逻辑
+ // 获取图片元素
+ const img = event.target;
+ const close = img.nextSibling
+
+ // 实现放大图片逻辑
+ // 比如使用 CSS 放大
+ img.parentElement.classList.add('zoomed');
+ close.classList.add('img_close')
+ }
+
+ onCloseClick(event) {
+ const close = event.target;
+ const img = close.previousSibling
+ img.parentElement.classList.remove('zoomed')
+ close.classList.remove('img_close')
+ }
+
+ get items() {
+ return Many2OneRadioField.getItems(this.props.name, this.props.record);
+ }
+
+ static getItems(fieldName, record) {
+ switch (record.fields[fieldName].type) {
+ case "selection":
+ return record.fields[fieldName].selection;
+ case "many2one": {
+ const value = record.preloadedData[fieldName] || [];
+ return value.map((item) => [item.id, item.display_name, item.image]);
+ }
+ default:
+ return [];
+ }
+ }
+
+}
+
+Many2OneRadioField.template = "jikimo_frontend.Many2OneRadioField"
+// MyCustomWidget.supportedTypes = ['many2many'];
+
+registry.category("fields").add("many2one_radio", Many2OneRadioField);
diff --git a/jikimo_frontend/static/src/fields/Many2OneRadioField/many2one_radio_field.xml b/jikimo_frontend/static/src/fields/Many2OneRadioField/many2one_radio_field.xml
new file mode 100644
index 00000000..3d797eb0
--- /dev/null
+++ b/jikimo_frontend/static/src/fields/Many2OneRadioField/many2one_radio_field.xml
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+
From 3845041f7f947f479ca37f79500de4e41dba398a Mon Sep 17 00:00:00 2001
From: mgw <1392924357@qq.com>
Date: Fri, 10 Nov 2023 16:28:06 +0800
Subject: [PATCH 05/10] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E9=81=97=E6=BC=8F?=
=?UTF-8?q?=E4=BB=A3=E7=A0=81=E9=94=99=E8=AF=AF?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sf_plan/__init__.py | 1 -
1 file changed, 1 deletion(-)
diff --git a/sf_plan/__init__.py b/sf_plan/__init__.py
index 23795ba3..8134f974 100644
--- a/sf_plan/__init__.py
+++ b/sf_plan/__init__.py
@@ -2,4 +2,3 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import models
-from . import controllers
From a97ce9b0a7a4555d63b05d06542ea2c4e7fddec8 Mon Sep 17 00:00:00 2001
From: mgw <1392924357@qq.com>
Date: Fri, 10 Nov 2023 18:06:21 +0800
Subject: [PATCH 06/10] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=AE=A2=E5=8D=95?=
=?UTF-8?q?=E7=8A=B6=E6=80=81=E5=9B=9E=E4=BC=A0=E7=9A=84=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sf_bf_connect/models/process_status.py | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/sf_bf_connect/models/process_status.py b/sf_bf_connect/models/process_status.py
index b5a1cc19..0a18096b 100644
--- a/sf_bf_connect/models/process_status.py
+++ b/sf_bf_connect/models/process_status.py
@@ -33,8 +33,8 @@ class StatusChange(models.Model):
'process_start_time': process_start_time,
},
}
- # url1 = config['bfm_url'] + '/api/get/state/get_order'
- # requests.post(url1, json=json1, data=None)
+ url1 = config['bfm_url'] + '/api/get/state/get_order'
+ requests.post(url1, json=json1, data=None)
logging.info('接口已经执行=============')
return res
@@ -57,8 +57,8 @@ class StatusChange(models.Model):
'state': '待派单',
},
}
- # url1 = config['bfm_url'] + '/api/get/state/cancel_order'
- # requests.post(url1, json=json1, data=None)
+ url1 = config['bfm_url'] + '/api/get/state/cancel_order'
+ requests.post(url1, json=json1, data=None)
return res
From 913780bc2b7a6b2fd9ab8448f1a1cb17b5a75858 Mon Sep 17 00:00:00 2001
From: mgw <1392924357@qq.com>
Date: Mon, 13 Nov 2023 15:07:50 +0800
Subject: [PATCH 07/10] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dgantt=E5=9B=BE=E4=BF=AE?=
=?UTF-8?q?=E6=94=B9=E6=97=A5=E8=A7=86=E5=9B=BE=E5=90=8E=E5=85=B6=E4=BB=96?=
=?UTF-8?q?=E8=A7=86=E5=9B=BE=E7=9A=84pill=E5=B7=A6=E7=A7=BB=E7=9A=84bug?=
=?UTF-8?q?=E3=80=82=E4=BC=98=E5=8C=96=E5=AD=97=E6=AE=B5=E9=BB=98=E8=AE=A4?=
=?UTF-8?q?=E5=AE=BD=E5=BA=A6=E7=9A=84=E9=80=BB=E8=BE=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../static/src/list/custom_width.js | 18 ++++++++++++------
web_gantt/static/src/js/gantt_row.js | 9 ++++++++-
2 files changed, 20 insertions(+), 7 deletions(-)
diff --git a/jikimo_frontend/static/src/list/custom_width.js b/jikimo_frontend/static/src/list/custom_width.js
index 512abc44..63da7fdd 100644
--- a/jikimo_frontend/static/src/list/custom_width.js
+++ b/jikimo_frontend/static/src/list/custom_width.js
@@ -44,11 +44,11 @@ patch(ListRenderer.prototype, 'jikimo_frontend.ListRenderer', {
},
setDefaultColumnWidths(column_num) {
- const bbb = this.state.columns[0].name
+ // const bbb = this.state.columns[0].name
const widths = this.state.columns.map((col) => this.calculateColumnWidth(col));
- const sumOfRelativeWidths = (widths
- .filter(({ type }) => type === "relative")
- .reduce((sum, { value }) => sum + value, 0));
+ // const sumOfRelativeWidths = (widths
+ // .filter(({ type }) => type === "relative")
+ // .reduce((sum, { value }) => sum + value, 0));
// 获取数组的最后一项
const lastItem = widths[widths.length - 1];
@@ -60,10 +60,16 @@ patch(ListRenderer.prototype, 'jikimo_frontend.ListRenderer', {
widths.push(newItem);
// 判断销售的sequence
- if (this.state.columns[0].name === "sequence") {
- widths[1] = { type: "relative", value: 0.1 };
+ // if (this.state.columns[0].name === "sequence") {
+ // widths[1] = { type: "relative", value: 0.1 };
+ // }
+
+ // 判断 this.state.columns 是否存在且长度大于零
+ if (this.state.columns && this.state.columns.length > 0 && this.state.columns[0].name === "sequence") {
+ widths[1] = { type: "relative", value: 0.1 };
}
+
// 1 because nth-child selectors are 1-indexed, 2 when the first column contains
// the checkboxes to select records.
const columnOffset = this.hasSelectors ? 2 : 1;
diff --git a/web_gantt/static/src/js/gantt_row.js b/web_gantt/static/src/js/gantt_row.js
index efff4af2..2867188c 100644
--- a/web_gantt/static/src/js/gantt_row.js
+++ b/web_gantt/static/src/js/gantt_row.js
@@ -774,7 +774,14 @@ var GanttRow = Widget.extend({
let index = 0;
for (const date of this.viewInfo.slots) {
const slotStart = date;
- const slotStop = date.clone().add(8, interval);
+ // const slotStop = date.clone().add(8, interval);
+ let slotStop;
+
+ if (interval === "hour") {
+ slotStop = date.clone().add(8, "hour");
+ } else {
+ slotStop = date.clone().add(1, interval);
+ }
const isToday = date.isSame(new Date(), 'day') && this.state.scale !== 'day';
let slotStyle = '';
From daeae46820db03a635933441884c25dd9c63ba12 Mon Sep 17 00:00:00 2001
From: mgw <1392924357@qq.com>
Date: Tue, 14 Nov 2023 12:21:08 +0800
Subject: [PATCH 08/10] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AE=A2=E5=8D=95?=
=?UTF-8?q?=E6=8E=92=E7=A8=8B=E5=8A=9F=E8=83=BD=E4=B8=BA=E9=80=9A=E7=94=A8?=
=?UTF-8?q?=E6=96=B9=E6=B3=95=EF=BC=8C=E5=90=8C=E6=97=B6=E5=A2=9E=E5=8A=A0?=
=?UTF-8?q?=E5=8A=A8=E6=80=81=E5=88=A4=E6=96=AD=E8=AE=A1=E5=88=92=E6=97=B6?=
=?UTF-8?q?=E9=97=B4=E6=98=AF=E5=90=A6=E4=B8=8E=E8=8E=B7=E5=8F=96cnc?=
=?UTF-8?q?=E7=A8=8B=E5=BA=8F=E7=9A=84=E6=97=B6=E9=97=B4=E5=86=B2=E7=AA=81?=
=?UTF-8?q?=E5=8A=9F=E8=83=BD=EF=BC=8C=E5=A6=82=E6=9E=9C=E5=86=B2=E7=AA=81?=
=?UTF-8?q?=EF=BC=8C=E6=97=B6=E9=97=B4=E8=87=AA=E5=8A=A8=E5=BB=B6=E5=90=8E?=
=?UTF-8?q?1h;=E4=BC=98=E5=8C=96gantt=E6=98=BE=E7=A4=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sf_dlm/models/product_supplierinfo.py | 2 +-
sf_plan/models/custom_plan.py | 214 ++++++++++++++++---------
web_gantt/static/src/xml/web_gantt.xml | 6 +-
3 files changed, 144 insertions(+), 78 deletions(-)
diff --git a/sf_dlm/models/product_supplierinfo.py b/sf_dlm/models/product_supplierinfo.py
index f8055e1a..0e04c1d2 100644
--- a/sf_dlm/models/product_supplierinfo.py
+++ b/sf_dlm/models/product_supplierinfo.py
@@ -95,7 +95,7 @@ class ResMrpBomMo(models.Model):
limit=1,
order='volume desc'
)
- logging.info('get_bom-vals:%s' % embryo_has)
+ # logging.info('get_bom-vals:%s' % embryo_has)
if embryo_has:
rate_of_waste = ((embryo_has.volume - product.model_volume) % embryo_has.volume) * 100
if rate_of_waste <= 20:
diff --git a/sf_plan/models/custom_plan.py b/sf_plan/models/custom_plan.py
index 858b1036..7603b4fd 100644
--- a/sf_plan/models/custom_plan.py
+++ b/sf_plan/models/custom_plan.py
@@ -162,6 +162,86 @@ class sf_production_plan(models.Model):
# delivery_date = fields.Datetime(string='交货日期', related='plan_end_time', readonly=False, store=True)
# 当不设置计划结束时间时,增加计算计划结束时间的方法,根据采购周期加缓冲期两个值来算就可以了
+ # def do_production_schedule(self):
+ # """
+ # 排程方法
+ # """
+ # if not self.production_line_id:
+ # raise ValidationError("未选择生产线")
+ # else:
+ # aa = self.env['mrp.production'].sudo().search([('name', '=', self.name)])
+ # workorder_time = 0
+ # workorder_id_list = self.production_id.workorder_ids.ids
+ # print(workorder_id_list)
+ # print(type(self.production_id.workorder_ids))
+ # if self.production_id.workorder_ids:
+ # for item in self.production_id.workorder_ids:
+ # if item.name == 'CNC加工':
+ # item.date_planned_start = self.date_planned_start
+ # item.date_planned_finished = item.date_planned_start + timedelta(
+ # minutes=self.env['mrp.routing.workcenter'].sudo().search(
+ # [('name', '=', 'CNC加工')]).time_cycle)
+ # item.duration_expected = self.env['mrp.routing.workcenter'].sudo().search(
+ # [('name', '=', 'CNC加工')]).time_cycle
+ # # print(item.id)
+ # sequence = workorder_id_list.index(item.id) - 1
+ # # print('sequence', sequence)
+ # # print('total', len(workorder_id_list))
+ # # 计算CNC加工之前工单的开始结束时间
+ # for i in range(sequence):
+ # current_workorder_id = (item.id - (i + 1))
+ # current_workorder_obj = self.env['mrp.workorder'].sudo().search(
+ # [('id', '=', current_workorder_id)])
+ # old_workorder_obj = self.env['mrp.workorder'].sudo().search(
+ # [('id', '=', (current_workorder_id + 1))])
+ # work_order = self.env['mrp.workorder'].sudo().search(
+ # [('production_id', '=', self.production_id.id), ('id', '=', current_workorder_id)])
+ # work_order.date_planned_finished = old_workorder_obj.date_planned_start
+ # work_order.date_planned_start = old_workorder_obj.date_planned_start - timedelta(
+ # minutes=self.env['mrp.routing.workcenter'].sudo().search(
+ # [('name', '=', current_workorder_obj.name)]).time_cycle)
+ # work_order.duration_expected = self.env['mrp.routing.workcenter'].sudo().search(
+ # [('name', '=', current_workorder_obj.name)]).time_cycle
+ # # 计算CNC加工之后工单的开始结束时间
+ # for j in range(len(workorder_id_list) - sequence - 2):
+ # current_workorder_id = (item.id + (j + 1))
+ # current_workorder_obj = self.env['mrp.workorder'].sudo().search(
+ # [('id', '=', current_workorder_id)])
+ # old_workorder_obj = self.env['mrp.workorder'].sudo().search(
+ # [('id', '=', (current_workorder_id - 1))])
+ # work_order = self.env['mrp.workorder'].sudo().search(
+ # [('production_id', '=', self.production_id.id), ('id', '=', current_workorder_id)])
+ # try:
+ # work_order.date_planned_start = old_workorder_obj.date_planned_finished
+ # print('work_order.data_start', work_order.date_planned_start)
+ # work_order.date_planned_finished = old_workorder_obj.date_planned_finished + timedelta(
+ # minutes=self.env['mrp.routing.workcenter'].sudo().search(
+ # [('name', '=', current_workorder_obj.name)]).time_cycle)
+ # work_order.duration_expected = self.env['mrp.routing.workcenter'].sudo().search(
+ # [('name', '=', current_workorder_obj.name)]).time_cycle
+ # except ValueError as e:
+ # print('时间设置失败,请检查是否为工序分配工作中心,%s' % e)
+ #
+ # current_workorder = self.env['mrp.workorder'].sudo().search([('id', '=', item.id)])
+ # workorder_time += current_workorder.duration_expected
+ # print('workorder_time', workorder_time)
+ # self.date_planned_finished = self.date_planned_start + timedelta(minutes=workorder_time)
+ # self.state = 'done'
+ # self.production_id.schedule_state = '已排'
+ # # self.production_id.date_planned_start = self.date_planned_start
+ # # self.production_id.date_planned_finished = self.date_planned_finished
+ # else:
+ # raise ValidationError("未找到工单")
+ # # self.date_planned_finished = self.date_planned_start + timedelta(days=3)
+ # # self.state = 'done'
+ # return {
+ # 'name': '排程甘特图',
+ # 'type': 'ir.actions.act_window',
+ # 'res_model': 'sf.production.plan', # 要跳转的模型名称
+ # 'view_mode': 'gantt,tree,form', # 要显示的视图类型,可以是'form', 'tree', 'kanban', 'graph', 'calendar', 'pivot'等
+ # 'target': 'current', # 跳转的目标窗口,可以是'current'或'new'
+ # }
+
def do_production_schedule(self):
"""
排程方法
@@ -169,60 +249,20 @@ class sf_production_plan(models.Model):
if not self.production_line_id:
raise ValidationError("未选择生产线")
else:
- aa = self.env['mrp.production'].sudo().search([('name', '=', self.name)])
- workorder_time = 0
workorder_id_list = self.production_id.workorder_ids.ids
- print(workorder_id_list)
- print(type(self.production_id.workorder_ids))
if self.production_id.workorder_ids:
for item in self.production_id.workorder_ids:
if item.name == 'CNC加工':
+ item.date_planned_finished = datetime.now() + timedelta(days=100)
item.date_planned_start = self.date_planned_start
item.date_planned_finished = item.date_planned_start + timedelta(
minutes=self.env['mrp.routing.workcenter'].sudo().search(
[('name', '=', 'CNC加工')]).time_cycle)
item.duration_expected = self.env['mrp.routing.workcenter'].sudo().search(
[('name', '=', 'CNC加工')]).time_cycle
- # print(item.id)
- sequence = workorder_id_list.index(item.id) - 1
- # print('sequence', sequence)
- # print('total', len(workorder_id_list))
- # 计算CNC加工之前工单的开始结束时间
- for i in range(sequence):
- current_workorder_id = (item.id - (i + 1))
- current_workorder_obj = self.env['mrp.workorder'].sudo().search(
- [('id', '=', current_workorder_id)])
- old_workorder_obj = self.env['mrp.workorder'].sudo().search(
- [('id', '=', (current_workorder_id + 1))])
- work_order = self.env['mrp.workorder'].sudo().search(
- [('production_id', '=', self.production_id.id), ('id', '=', current_workorder_id)])
- work_order.date_planned_finished = old_workorder_obj.date_planned_start
- work_order.date_planned_start = old_workorder_obj.date_planned_start - timedelta(
- minutes=self.env['mrp.routing.workcenter'].sudo().search(
- [('name', '=', current_workorder_obj.name)]).time_cycle)
- # work_order.duration_expected = self.env['mrp.routing.workcenter'].sudo().search([('name', '=', current_workorder_obj.name)]).time_cycle
- # 计算CNC加工之后工单的开始结束时间
- for j in range(len(workorder_id_list) - sequence - 2):
- current_workorder_id = (item.id + (j + 1))
- current_workorder_obj = self.env['mrp.workorder'].sudo().search(
- [('id', '=', current_workorder_id)])
- old_workorder_obj = self.env['mrp.workorder'].sudo().search(
- [('id', '=', (current_workorder_id - 1))])
- work_order = self.env['mrp.workorder'].sudo().search(
- [('production_id', '=', self.production_id.id), ('id', '=', current_workorder_id)])
- try:
- work_order.date_planned_start = old_workorder_obj.date_planned_finished
- print('work_order.data_start', work_order.date_planned_start)
- work_order.date_planned_finished = old_workorder_obj.date_planned_finished + timedelta(
- minutes=self.env['mrp.routing.workcenter'].sudo().search(
- [('name', '=', current_workorder_obj.name)]).time_cycle)
- except ValueError as e:
- print('时间设置失败,请检查是否为工序分配工作中心,%s' % e)
-
- current_workorder = self.env['mrp.workorder'].sudo().search([('id', '=', item.id)])
- workorder_time += current_workorder.duration_expected
- print('workorder_time', workorder_time)
- self.date_planned_finished = self.date_planned_start + timedelta(minutes=workorder_time)
+ self.calculate_plan_time_before(item, workorder_id_list)
+ self.calculate_plan_time_after(item, workorder_id_list)
+ self.date_planned_start, self.date_planned_finished = item.date_planned_start, item.date_planned_finished
self.state = 'done'
self.production_id.schedule_state = '已排'
# self.production_id.date_planned_start = self.date_planned_start
@@ -238,36 +278,62 @@ class sf_production_plan(models.Model):
'view_mode': 'gantt,tree,form', # 要显示的视图类型,可以是'form', 'tree', 'kanban', 'graph', 'calendar', 'pivot'等
'target': 'current', # 跳转的目标窗口,可以是'current'或'new'
}
- # if self.production_line_id:
- # if self.plan_start_time and self.plan_end_time:
- # return None
- # elif self.plan_start_time and not self.plan_end_time:
- # # 如果没有给出计划结束时间,则计划结束时间为计划开始时间+采购周期+缓冲期
- # # 采购周期
- # purchase_cycle = 3
- # # 缓冲期
- # buffer_period = 1
- # # 计划结束时间 = 计划开始时间 + 采购周期 + 缓冲期
- # self.plan_end_time = self.plan_start_time + timedelta(days=purchase_cycle) + timedelta(
- # days=buffer_period)
- # self.state = 'produce'
- # return self.plan_end_time
- # else:
- # return None
- # # 后面要补充计划开始时间的计算方法
- # # # 坯料预制时间
- # # # pl_time = 0.5
- # # # 采购周期
- # # purchase_cycle = 3
- # # # 缓冲期
- # # buffer_period = 1
- # # # 计划结束时间 = 计划开始时间 + 坯料预制时间 + 采购周期 + 缓冲期
- # # # plan_end_time = plan_start_time + pl_time + purchase_cycle + buffer_period
- # # # 计划结束时间 = 计划开始时间(是一个datatime) + 采购周期(Float) + 缓冲期(Float)
- # # self.plan_end_time = self.plan_start_time + timedelta(days=purchase_cycle) + timedelta(days=buffer_period)
- # # return self.plan_end_time
- # else:
- # raise ValidationError('生产线为空!')
+
+ def calculate_plan_time_before(self, item, workorder_id_list):
+ """
+ 根据CNC工单的时间去计算之前的其他工单的开始结束时间
+ """
+ sequence = workorder_id_list.index(item.id) - 1
+ # 计算CNC加工之前工单的开始结束时间
+ for i in range(sequence):
+ current_workorder_id = (item.id - (i + 1))
+ current_workorder_obj = self.env['mrp.workorder'].sudo().search(
+ [('id', '=', current_workorder_id)])
+ old_workorder_obj = self.env['mrp.workorder'].sudo().search(
+ [('id', '=', (current_workorder_id + 1))])
+ work_order = self.env['mrp.workorder'].sudo().search(
+ [('production_id', '=', self.production_id.id), ('id', '=', current_workorder_id)])
+ work_order.date_planned_finished = datetime.now() + timedelta(days=100)
+ work_order.date_planned_start = old_workorder_obj.date_planned_start - timedelta(
+ minutes=self.env['mrp.routing.workcenter'].sudo().search(
+ [('name', '=', current_workorder_obj.name)]).time_cycle)
+ work_order.date_planned_finished = old_workorder_obj.date_planned_start
+ work_order.duration_expected = self.env['mrp.routing.workcenter'].sudo().search(
+ [('name', '=', current_workorder_obj.name)]).time_cycle
+ first_workorder = self.env['mrp.workorder'].sudo().search([('id', '=', workorder_id_list[0])])
+ second_workorder = self.env['mrp.workorder'].sudo().search([('id', '=', workorder_id_list[1])])
+ if second_workorder.date_planned_start < first_workorder.date_planned_finished:
+ item.date_planned_start += timedelta(minutes=60)
+ item.date_planned_finished += timedelta(minutes=60)
+ item.duration_expected = self.env['mrp.routing.workcenter'].sudo().search(
+ [('name', '=', 'CNC加工')]).time_cycle
+ self.calculate_plan_time_before(item, workorder_id_list)
+
+ def calculate_plan_time_after(self, item, workorder_id_list):
+ """
+ 计算CNC加工之后工单的开始结束时间
+ """
+ sequence = workorder_id_list.index(item.id) - 1
+ # 计算CNC加工之后工单的开始结束时间
+ for j in range(len(workorder_id_list) - sequence - 2):
+ current_workorder_id = (item.id + (j + 1))
+ current_workorder_obj = self.env['mrp.workorder'].sudo().search(
+ [('id', '=', current_workorder_id)])
+ old_workorder_obj = self.env['mrp.workorder'].sudo().search(
+ [('id', '=', (current_workorder_id - 1))])
+ work_order = self.env['mrp.workorder'].sudo().search(
+ [('production_id', '=', self.production_id.id), ('id', '=', current_workorder_id)])
+ try:
+ work_order.date_planned_finished = datetime.now() + timedelta(days=100)
+ work_order.date_planned_start = old_workorder_obj.date_planned_finished
+ print('work_order.data_start', work_order.date_planned_start)
+ work_order.date_planned_finished = old_workorder_obj.date_planned_finished + timedelta(
+ minutes=self.env['mrp.routing.workcenter'].sudo().search(
+ [('name', '=', current_workorder_obj.name)]).time_cycle)
+ work_order.duration_expected = self.env['mrp.routing.workcenter'].sudo().search(
+ [('name', '=', current_workorder_obj.name)]).time_cycle
+ except ValueError as e:
+ print('时间设置失败,请检查是否为工序分配工作中心,%s' % e)
def cancel_production_schedule(self):
self.date_planned_finished = False
diff --git a/web_gantt/static/src/xml/web_gantt.xml b/web_gantt/static/src/xml/web_gantt.xml
index 5af631a8..76910940 100644
--- a/web_gantt/static/src/xml/web_gantt.xml
+++ b/web_gantt/static/src/xml/web_gantt.xml
@@ -77,13 +77,13 @@
- 夜班
+ 夜班(00:00-08:00)
- 早班
+ 早班(08:00-16:00)
- 晚班
+ 晚班(16:00-00:00)
From acccb4b6f9ff99fb4396423f33a72dff5b25a8bc Mon Sep 17 00:00:00 2001
From: mgw <1392924357@qq.com>
Date: Tue, 14 Nov 2023 15:42:54 +0800
Subject: [PATCH 09/10] =?UTF-8?q?=E5=8E=BB=E6=8E=89sf=5Fplan=E6=A8=A1?=
=?UTF-8?q?=E5=9D=97=E4=B8=AD=E7=9A=84=20=20=E5=B7=A5=E4=BD=9C=E4=B8=AD?=
=?UTF-8?q?=E5=BF=83=E8=AE=A1=E5=88=92=20=20=E8=8F=9C=E5=8D=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sf_plan_management/views/operations_rename_menu.xml | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/sf_plan_management/views/operations_rename_menu.xml b/sf_plan_management/views/operations_rename_menu.xml
index 1af2ba72..0795d658 100644
--- a/sf_plan_management/views/operations_rename_menu.xml
+++ b/sf_plan_management/views/operations_rename_menu.xml
@@ -10,8 +10,9 @@
From 2a964bc30ebe93e60faa8c99032cab6cc3d007c7 Mon Sep 17 00:00:00 2001
From: yuxianghui <3437689193@qq.com>
Date: Tue, 14 Nov 2023 16:48:11 +0800
Subject: [PATCH 10/10] =?UTF-8?q?=E5=8A=9F=E8=83=BD=E5=88=80=E5=85=B7?=
=?UTF-8?q?=E7=BB=84=E8=A3=85=E5=88=80=E5=85=B7=E7=89=A9=E6=96=99=E5=9E=8B?=
=?UTF-8?q?=E5=8F=B7=E5=AD=97=E6=AE=B5=E7=BB=91=E5=AE=9A=E5=AF=B9=E8=B1=A1?=
=?UTF-8?q?=E6=9B=B4=E6=94=B9=E4=B8=BA=E5=88=80=E5=85=B7=E6=A0=87=E5=87=86?=
=?UTF-8?q?=E5=BA=93=EF=BC=8C=E5=B9=B6=E4=BC=98=E5=8C=96=E7=BB=84=E8=A3=85?=
=?UTF-8?q?=E7=A1=AE=E8=AE=A4=E5=8A=9F=E8=83=BD=E3=80=82?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sf_tool_management/models/base.py | 37 ++++++++++---------
sf_tool_management/views/tool_base_views.xml | 2 +-
sf_tool_management/wizard/wizard.py | 39 ++++++++++----------
3 files changed, 40 insertions(+), 38 deletions(-)
diff --git a/sf_tool_management/models/base.py b/sf_tool_management/models/base.py
index 4b9edfe6..1fb775c3 100644
--- a/sf_tool_management/models/base.py
+++ b/sf_tool_management/models/base.py
@@ -688,45 +688,46 @@ class FunctionalToolAssembly(models.Model):
# 整体式刀具型号
integral_code_id = fields.Many2one('stock.lot', string='整体式刀具序列号', readonly=True)
- cutting_tool_integral_model_id = fields.Many2one('sf.cutting.tool.material', string='整体式刀具型号', readonly=True)
- integral_name = fields.Char('整体式刀具名称', readonly=True)
+ cutting_tool_integral_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='整体式刀具型号', readonly=True)
+ integral_name = fields.Char('整体式刀具名称', readonly=True, compute='_compute_auto_fill')
sf_tool_brand_id_1 = fields.Many2one('sf.machine.brand', string='整体式刀具品牌', readonly=True)
# 刀片型号
blade_code_id = fields.Many2one('stock.lot', '刀片序列号', readonly=True)
- cutting_tool_blade_model_id = fields.Many2one('sf.cutting.tool.material', string='刀片型号', readonly=True)
- blade_name = fields.Char('刀片名称', readonly=True)
+ cutting_tool_blade_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀片型号', readonly=True)
+ blade_name = fields.Char('刀片名称', readonly=True, compute='_compute_auto_fill')
sf_tool_brand_id_2 = fields.Many2one('sf.machine.brand', '刀片品牌', readonly=True)
# 刀杆型号
bar_code_id = fields.Many2one('stock.lot', '刀杆序列号', readonly=True)
- cutting_tool_cutterbar_model_id = fields.Many2one('sf.cutting.tool.material', string='刀杆型号', readonly=True)
- bar_name = fields.Char('刀杆名称', readonly=True)
+ cutting_tool_cutterbar_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀杆型号', readonly=True)
+ bar_name = fields.Char('刀杆名称', readonly=True, compute='_compute_auto_fill')
sf_tool_brand_id_3 = fields.Many2one('sf.machine.brand', '刀杆品牌', readonly=True)
# 刀盘型号
pad_code_id = fields.Many2one('stock.lot', '刀盘序列号', readonly=True)
- cutting_tool_cutterpad_model_id = fields.Many2one('sf.cutting.tool.material', string='刀盘型号', readonly=True)
- pad_name = fields.Char('刀盘名称', readonly=True)
+ cutting_tool_cutterpad_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀盘型号', readonly=True)
+ pad_name = fields.Char('刀盘名称', readonly=True, compute='_compute_auto_fill')
sf_tool_brand_id_4 = fields.Many2one('sf.machine.brand', '刀盘品牌', readonly=True)
# 刀柄型号
handle_code_id = fields.Many2one('stock.lot', '刀柄序列号', readonly=True)
- cutting_tool_cutterhandle_model_id = fields.Many2one('sf.cutting.tool.material', string='刀柄型号', readonly=True)
- handle_name = fields.Char('刀柄名称', readonly=True)
+ cutting_tool_cutterhandle_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀柄型号', readonly=True)
+ handle_name = fields.Char('刀柄名称', readonly=True, compute='_compute_auto_fill')
sf_tool_brand_id_5 = fields.Many2one('sf.machine.brand', '刀柄品牌', readonly=True)
# 夹头型号
chuck_code_id = fields.Many2one('stock.lot', '夹头序列号', readonly=True)
- cutting_tool_cutterhead_model_id = fields.Many2one('sf.cutting.tool.material', string='夹头型号', readonly=True)
- chuck_name = fields.Char('夹头名称', readonly=True)
+ cutting_tool_cutterhead_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='夹头型号', readonly=True)
+ chuck_name = fields.Char('夹头名称', readonly=True, compute='_compute_auto_fill')
sf_tool_brand_id_6 = fields.Many2one('sf.machine.brand', '夹头品牌', readonly=True)
@api.depends('integral_code_id', 'blade_code_id', 'bar_code_id', 'pad_code_id', 'handle_code_id', 'chuck_code_id')
def _compute_auto_fill(self):
for record in self:
if record.integral_code_id:
- record.cutting_tool_integral_model_id = record.integral_code_id.product_id.cutting_tool_material_id.id
+ print(record.integral_code_id.product_id)
+ record.cutting_tool_integral_model_id = record.integral_code_id.product_id.cutting_tool_model_id.id
record.integral_name = record.integral_code_id.product_id.name
record.sf_tool_brand_id_1 = record.integral_code_id.product_id.brand_id.id
else:
@@ -734,7 +735,7 @@ class FunctionalToolAssembly(models.Model):
record.integral_name = None
record.sf_tool_brand_id_1 = None
if record.blade_code_id:
- record.cutting_tool_blade_model_id = record.blade_code_id.product_id.cutting_tool_material_id.id
+ record.cutting_tool_blade_model_id = record.blade_code_id.product_id.cutting_tool_model_id.id
record.blade_name = record.blade_code_id.product_id.name
record.sf_tool_brand_id_2 = record.blade_code_id.product_id.brand_id.id
else:
@@ -742,7 +743,7 @@ class FunctionalToolAssembly(models.Model):
record.blade_name = None
record.sf_tool_brand_id_2 = None
if record.bar_code_id:
- record.cutting_tool_cutterbar_model_id = record.bar_code_id.product_id.cutting_tool_material_id.id
+ record.cutting_tool_cutterbar_model_id = record.bar_code_id.product_id.cutting_tool_model_id.id
record.bar_name = record.bar_code_id.product_id.name
record.sf_tool_brand_id_3 = record.bar_code_id.product_id.brand_id.id
else:
@@ -750,7 +751,7 @@ class FunctionalToolAssembly(models.Model):
record.bar_name = None
record.sf_tool_brand_id_3 = None
if record.pad_code_id:
- record.cutting_tool_cutterpad_model_id = record.pad_code_id.product_id.cutting_tool_material_id.id
+ record.cutting_tool_cutterpad_model_id = record.pad_code_id.product_id.cutting_tool_model_id.id
record.pad_name = record.pad_code_id.product_id.name
record.sf_tool_brand_id_4 = record.pad_code_id.product_id.brand_id.id
else:
@@ -758,7 +759,7 @@ class FunctionalToolAssembly(models.Model):
record.pad_name = None
record.sf_tool_brand_id_4 = None
if record.handle_code_id:
- record.cutting_tool_cutterhandle_model_id = record.handle_code_id.product_id.cutting_tool_material_id.id
+ record.cutting_tool_cutterhandle_model_id = record.handle_code_id.product_id.cutting_tool_model_id.id
record.handle_name = record.handle_code_id.product_id.name
record.sf_tool_brand_id_5 = record.handle_code_id.product_id.brand_id.id
else:
@@ -766,7 +767,7 @@ class FunctionalToolAssembly(models.Model):
record.handle_name = None
record.sf_tool_brand_id_5 = None
if record.chuck_code_id:
- record.cutting_tool_cutterhead_model_id = record.chuck_code_id.product_id.cutting_tool_material_id.id
+ record.cutting_tool_cutterhead_model_id = record.chuck_code_id.product_id.cutting_tool_model_id.id
record.chuck_name = record.chuck_code_id.product_id.name
record.sf_tool_brand_id_6 = record.chuck_code_id.product_id.brand_id.id
else:
diff --git a/sf_tool_management/views/tool_base_views.xml b/sf_tool_management/views/tool_base_views.xml
index c1495df7..a63e650f 100644
--- a/sf_tool_management/views/tool_base_views.xml
+++ b/sf_tool_management/views/tool_base_views.xml
@@ -796,7 +796,7 @@
-
+
diff --git a/sf_tool_management/wizard/wizard.py b/sf_tool_management/wizard/wizard.py
index 0c554ca9..53d7f28a 100644
--- a/sf_tool_management/wizard/wizard.py
+++ b/sf_tool_management/wizard/wizard.py
@@ -17,7 +17,8 @@ class ToolChangeRequirementInformation(models.TransientModel):
functional_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model', string='功能刀具类型', readonly=True)
# replacement_tool_code = fields.Char(string='待换功能刀具编码', readonly=True)
- replacement_tool_name_id = fields.Many2one('product.product', string='待换功能刀具名称', )
+ replacement_tool_name_id = fields.Many2one('product.product', string='待换功能刀具名称',
+ domain=[('name', '=', '功能刀具')])
replacement_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model', string='待换功能刀具类型')
replacement_tool_coarse_middle_thin = fields.Selection([("1", "粗"), ('2', '中'), ('3', '精')],
string='粗/中/精')
@@ -139,42 +140,42 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
# 整体式刀具型号
integral_code_id = fields.Many2one('stock.lot', string='整体式刀具序列号',
domain=[('product_id.cutting_tool_material_id.name', '=', '整体式刀具')])
- cutting_tool_integral_model_id = fields.Many2one('sf.cutting.tool.material', string='整体式刀具型号', readonly=True)
+ cutting_tool_integral_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='整体式刀具型号', readonly=True)
integral_name = fields.Char('整体式刀具名称', readonly=True)
sf_tool_brand_id_1 = fields.Many2one('sf.machine.brand', string='整体式刀具品牌', readonly=True)
# 刀片型号
blade_code_id = fields.Many2one('stock.lot', '刀片序列号',
domain=[('product_id.cutting_tool_material_id.name', '=', '刀片')])
- cutting_tool_blade_model_id = fields.Many2one('sf.cutting.tool.material', string='刀片型号', readonly=True)
+ cutting_tool_blade_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀片型号', readonly=True)
blade_name = fields.Char('刀片名称', readonly=True)
sf_tool_brand_id_2 = fields.Many2one('sf.machine.brand', '刀片品牌', readonly=True)
# 刀杆型号
bar_code_id = fields.Many2one('stock.lot', '刀杆序列号',
domain=[('product_id.cutting_tool_material_id.name', '=', '刀杆')])
- cutting_tool_cutterbar_model_id = fields.Many2one('sf.cutting.tool.material', string='刀杆型号', readonly=True)
+ cutting_tool_cutterbar_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀杆型号', readonly=True)
bar_name = fields.Char('刀杆名称', readonly=True)
sf_tool_brand_id_3 = fields.Many2one('sf.machine.brand', '刀杆品牌', readonly=True)
# 刀盘型号
pad_code_id = fields.Many2one('stock.lot', '刀盘序列号',
domain=[('product_id.cutting_tool_material_id.name', '=', '刀盘')])
- cutting_tool_cutterpad_model_id = fields.Many2one('sf.cutting.tool.material', string='刀盘型号', readonly=True)
+ cutting_tool_cutterpad_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀盘型号', readonly=True)
pad_name = fields.Char('刀盘名称', readonly=True)
sf_tool_brand_id_4 = fields.Many2one('sf.machine.brand', '刀盘品牌', readonly=True)
# 刀柄型号
handle_code_id = fields.Many2one('stock.lot', '刀柄序列号',
domain=[('product_id.cutting_tool_material_id.name', '=', '刀柄')])
- cutting_tool_cutterhandle_model_id = fields.Many2one('sf.cutting.tool.material', string='刀柄型号', readonly=True)
+ cutting_tool_cutterhandle_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀柄型号', readonly=True)
handle_name = fields.Char('刀柄名称', readonly=True)
sf_tool_brand_id_5 = fields.Many2one('sf.machine.brand', '刀柄品牌', readonly=True)
# 夹头型号
chuck_code_id = fields.Many2one('stock.lot', '夹头序列号',
domain=[('product_id.cutting_tool_material_id.name', '=', '夹头')])
- cutting_tool_cutterhead_model_id = fields.Many2one('sf.cutting.tool.material', string='夹头型号', readonly=True)
+ cutting_tool_cutterhead_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='夹头型号', readonly=True)
chuck_name = fields.Char('夹头名称', readonly=True, compute='_compute_auto_fill')
sf_tool_brand_id_6 = fields.Many2one('sf.machine.brand', '夹头品牌', readonly=True)
@@ -207,7 +208,7 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
def _compute_auto_fill(self):
for record in self:
if record.integral_code_id:
- record.cutting_tool_integral_model_id = record.integral_code_id.product_id.cutting_tool_material_id.id
+ record.cutting_tool_integral_model_id = record.integral_code_id.product_id.cutting_tool_model_id.id
record.integral_name = record.integral_code_id.product_id.name
record.sf_tool_brand_id_1 = record.integral_code_id.product_id.brand_id.id
else:
@@ -215,7 +216,7 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
record.integral_name = None
record.sf_tool_brand_id_1 = None
if record.blade_code_id:
- record.cutting_tool_blade_model_id = record.blade_code_id.product_id.cutting_tool_material_id.id
+ record.cutting_tool_blade_model_id = record.blade_code_id.product_id.cutting_tool_model_id.id
record.blade_name = record.blade_code_id.product_id.name
record.sf_tool_brand_id_2 = record.blade_code_id.product_id.brand_id.id
else:
@@ -223,7 +224,7 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
record.blade_name = None
record.sf_tool_brand_id_2 = None
if record.bar_code_id:
- record.cutting_tool_cutterbar_model_id = record.bar_code_id.product_id.cutting_tool_material_id.id
+ record.cutting_tool_cutterbar_model_id = record.bar_code_id.product_id.cutting_tool_model_id.id
record.bar_name = record.bar_code_id.product_id.name
record.sf_tool_brand_id_3 = record.bar_code_id.product_id.brand_id.id
else:
@@ -231,7 +232,7 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
record.bar_name = None
record.sf_tool_brand_id_3 = None
if record.pad_code_id:
- record.cutting_tool_cutterpad_model_id = record.pad_code_id.product_id.cutting_tool_material_id.id
+ record.cutting_tool_cutterpad_model_id = record.pad_code_id.product_id.cutting_tool_model_id.id
record.pad_name = record.pad_code_id.product_id.name
record.sf_tool_brand_id_4 = record.pad_code_id.product_id.brand_id.id
else:
@@ -239,7 +240,7 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
record.pad_name = None
record.sf_tool_brand_id_4 = None
if record.handle_code_id:
- record.cutting_tool_cutterhandle_model_id = record.handle_code_id.product_id.cutting_tool_material_id.id
+ record.cutting_tool_cutterhandle_model_id = record.handle_code_id.product_id.cutting_tool_model_id.id
record.handle_name = record.handle_code_id.product_id.name
record.sf_tool_brand_id_5 = record.handle_code_id.product_id.brand_id.id
else:
@@ -247,7 +248,7 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
record.handle_name = None
record.sf_tool_brand_id_5 = None
if record.chuck_code_id:
- record.cutting_tool_cutterhead_model_id = record.chuck_code_id.product_id.cutting_tool_material_id.id
+ record.cutting_tool_cutterhead_model_id = record.chuck_code_id.product_id.cutting_tool_model_id.id
record.chuck_name = record.chuck_code_id.product_id.name
record.sf_tool_brand_id_6 = record.chuck_code_id.product_id.brand_id.id
else:
@@ -302,12 +303,12 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
'barcode_id': stock_lot.id,
'functional_tool_name_id': self.functional_tool_name_id.id,
'mrs_cutting_tool_type_id': self.functional_tool_type_id.id,
- 'cutting_tool_integral_model_id': self.cutting_tool_integral_model_id.id,
- 'cutting_tool_blade_model_id': self.cutting_tool_blade_model_id.id,
- 'cutting_tool_cutterbar_model_id': self.cutting_tool_cutterbar_model_id.id,
- 'cutting_tool_cutterpad_model_id': self.cutting_tool_cutterpad_model_id.id,
- 'cutting_tool_cutterhandle_model_id': self.cutting_tool_cutterhandle_model_id.id,
- 'cutting_tool_cutterhead_model_id': self.cutting_tool_cutterhead_model_id.id,
+ 'cutting_tool_integral_model_id': self.integral_code_id.product_id.id,
+ 'cutting_tool_blade_model_id': self.blade_code_id.product_id.id,
+ 'cutting_tool_cutterbar_model_id': self.bar_code_id.product_id.id,
+ 'cutting_tool_cutterpad_model_id': self.pad_code_id.product_id.id,
+ 'cutting_tool_cutterhandle_model_id': self.handle_code_id.product_id.id,
+ 'cutting_tool_cutterhead_model_id': self.chuck_code_id.product_id.id,
'diameter': self.functional_tool_diameter,
'tool_grade': None,
'machining_accuracy': None,