From c1d6a24cd99ffa5312ff9b7045ddf488db87829b Mon Sep 17 00:00:00 2001
From: "jinling.yang"
Date: Tue, 8 Nov 2022 10:01:53 +0800
Subject: [PATCH 1/2] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E9=9D=9E=E7=9B=B8?=
=?UTF-8?q?=E5=85=B3=E4=BB=A3=E7=A0=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sf_base/__manifest__.py | 7 +-
sf_base/models/process.py | 13 +--
sf_base/views/menu_view.xml | 14 +--
sf_base/views/mrs_base_view.xml | 66 +++++++++++++-
sf_base/views/mrs_common_view.xml | 27 ------
sf_bpm_api/__manifest__.py | 4 +-
sf_bpm_api/models/__init__.py | 2 -
sf_bpm_api/models/product_template.py | 86 -------------------
sf_bpm_api/models/sale_order.py | 34 --------
sf_bpm_api/views/product_template_view.xml | 69 ---------------
sf_bpm_api/views/sale_order_view.xml | 15 ----
.../models/mrp_workorder.py | 8 ++
.../models/sf_production.py | 1 +
13 files changed, 91 insertions(+), 255 deletions(-)
delete mode 100644 sf_bpm_api/models/product_template.py
delete mode 100644 sf_bpm_api/models/sale_order.py
delete mode 100644 sf_bpm_api/views/product_template_view.xml
delete mode 100644 sf_bpm_api/views/sale_order_view.xml
diff --git a/sf_base/__manifest__.py b/sf_base/__manifest__.py
index 77165cde..c7eea0c9 100644
--- a/sf_base/__manifest__.py
+++ b/sf_base/__manifest__.py
@@ -10,13 +10,16 @@
""",
'category': 'YZ',
'website': 'https://www.sf.jikimo.com',
- 'depends': ['account', 'base', 'mrp'],
+ 'depends': ['account', 'base', 'mrp','sale','sf_manufacturing_orders'],
'data': [
'security/group_security.xml',
'security/ir.model.access.csv',
'views/mrs_base_view.xml',
'views/mrs_common_view.xml',
- "views/menu_view.xml"
+ "views/menu_view.xml",
+ 'views/mrp_routing_workcenter_view.xml',
+ 'views/sale_order_view.xml',
+ 'views/product_template_view.xml',
],
'demo': [
diff --git a/sf_base/models/process.py b/sf_base/models/process.py
index ede17d15..3f669dd6 100644
--- a/sf_base/models/process.py
+++ b/sf_base/models/process.py
@@ -13,12 +13,13 @@ class ResMrpRoutingWorkcenter(models.Model):
_inherit = 'mrp.routing.workcenter'
routing_type = fields.Selection([
- ('装夹', '装夹'),
- ('前置三元定位检测', '前置三元定位检测'),
- ('CNC加工', 'CNC加工'),
- ('置三元质量检测', '置三元质量检测'),
- ('解除装夹', '解除装夹'),
- ], string="工序类型")
+ ('获取CNC加工程序', '获取CNC加工程序'),
+ ('装夹', '装夹'),
+ ('前置三元定位检测', '前置三元定位检测'),
+ ('CNC加工', 'CNC加工'),
+ ('置三元质量检测', '置三元质量检测'),
+ ('解除装夹', '解除装夹'),
+ ], string="工序类型")
is_repeat = fields.Boolean('重复', default=False)
workcenter_id = fields.Many2one('mrp.workcenter', required=False)
workcenter_ids = fields.Many2many('mrp.workcenter', 'rel_workcenter_route', required=True)
diff --git a/sf_base/views/menu_view.xml b/sf_base/views/menu_view.xml
index 42c9602c..4babedb1 100644
--- a/sf_base/views/menu_view.xml
+++ b/sf_base/views/menu_view.xml
@@ -142,13 +142,13 @@
action="action_mrs_machine_control_system"/>
-
-
-
-
-
-
-
+
diff --git a/sf_base/views/mrs_base_view.xml b/sf_base/views/mrs_base_view.xml
index 1d6aeaf3..b7f61d4f 100644
--- a/sf_base/views/mrs_base_view.xml
+++ b/sf_base/views/mrs_base_view.xml
@@ -355,11 +355,11 @@
+
+ #------------------模型类型------------------
+
+
+ search.sf.model.type
+ sf.model.type
+
+
+
+
+
+
+
+
+ tree.sf.model.type
+ sf.model.type
+
+
+
+
+
+
+
+
+ form.sf.model.type
+ sf.model.type
+
+
+
+
+
+
+ 模型类型
+ ir.actions.act_window
+ sf.model.type
+ tree,form
+
+
+ [模型类型] 还没有哦!点左上角的[创建]按钮,沙发归你了!
+
+
+
+
+
\ No newline at end of file
diff --git a/sf_base/views/mrs_common_view.xml b/sf_base/views/mrs_common_view.xml
index 966bccec..c5ab6744 100644
--- a/sf_base/views/mrs_common_view.xml
+++ b/sf_base/views/mrs_common_view.xml
@@ -293,24 +293,10 @@
sf.tray.search
sf.tray
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -347,18 +333,5 @@
-
- 托盘
- ir.actions.act_window
- sf.tray
- tree,form
-
-
- 创建托盘吧
-
-
-
-
-
\ No newline at end of file
diff --git a/sf_bpm_api/__manifest__.py b/sf_bpm_api/__manifest__.py
index b659bd14..daea8057 100644
--- a/sf_bpm_api/__manifest__.py
+++ b/sf_bpm_api/__manifest__.py
@@ -12,9 +12,7 @@
'website': 'https://www.sf.cs.jikimo.com',
'depends': ['sale', 'sf_base'],
'data': [
- 'data/product_data.xml',
- 'views/product_template_view.xml',
- 'views/sale_order_view.xml'
+
],
'demo': [
],
diff --git a/sf_bpm_api/models/__init__.py b/sf_bpm_api/models/__init__.py
index 4c183668..1b8cfb6d 100644
--- a/sf_bpm_api/models/__init__.py
+++ b/sf_bpm_api/models/__init__.py
@@ -1,5 +1,3 @@
-from . import sale_order
-from . import product_template
from . import http
from . import models
diff --git a/sf_bpm_api/models/product_template.py b/sf_bpm_api/models/product_template.py
deleted file mode 100644
index 08f2237c..00000000
--- a/sf_bpm_api/models/product_template.py
+++ /dev/null
@@ -1,86 +0,0 @@
-from odoo import models, fields
-from odoo.exceptions import ValidationError
-
-
-class ResProductTemplate(models.Model):
- _inherit = 'product.template'
-
- # 模型的长,宽,高,体积,精度,材料
- model_long = fields.Float('长[mm]', digits=(16, 3))
- model_width = fields.Float('宽[mm]', digits=(16, 3))
- model_height = fields.Float('高[mm]', digits=(16, 3))
- model_volume = fields.Float('体积[mm³]', digits=(16, 3))
- model_precision = fields.Float('精度要求', digits=(16, 3))
- model_materials_id = fields.Many2one('mrs.production.materials', string='材料')
- model_materials_type_id = fields.Many2one('mrs.materials.model', string='型号')
- # 胚料的长,宽,高
- embryo_long = fields.Float('长[mm]', digits=(16, 3))
- embryo_width = fields.Float('宽[mm]', digits=(16, 3))
- embryo_height = fields.Float('高[mm]', digits=(16, 3))
- embryo_materials_id = fields.Many2one('mrs.production.materials', string='材料')
- embryo_materials_type_id = fields.Many2one('mrs.materials.model', string='型号')
-
- # 业务平台分配工厂后在智能工厂先创建销售订单再创建该产品
- def product_create(self, product_id, item, order_id, order_number, i):
- copy_product_id = product_id.with_user(self.env.ref("base.user_admin")).copy()
- copy_product_id.product_tmpl_id.active = True
- vals = {
- 'name': '%s-%s' % (order_id.name, i),
- 'model_long': item['model_long'],
- 'model_width': item['model_width'],
- 'model_height': item['model_height'],
- 'model_volume': item['model_volume'],
- 'list_price': item['price'],
- 'model_materials_id': self.env['mrs.production.materials'].search(
- [('materials_no', '=', item['texture_code'])]).id,
- 'model_materials_type_id': self.env['mrs.materials.model'].search(
- [('materials_no', '=', item['texture_type_code'])]).id,
- 'default_code': '%s-%s' % (order_number, i),
- 'barcode': item['barcode'],
- 'active': True
- }
- copy_product_id.sudo().write(vals)
- return copy_product_id
-
-
-class ResProductCategory(models.Model):
- _inherit = "product.category"
-
- is_embryo = fields.Boolean('胚料')
-
-
-class ResMrpBom(models.Model):
- _inherit = 'mrp.bom'
-
- # 业务平台分配工厂后在智能工厂先创建销售订单再创建该产品后再次进行创建bom
- def bom_create(self, product):
- bom_id = self.env['mrp.bom'].create({
- 'product_tmpl_id': product.product_tmpl_id.id,
- 'type': 'normal',
- 'product_qty': 1,
- 'product_uom_id': 1
- })
- return bom_id
-
- # 生成产品BOM匹配胚料,胚料的匹配规则:
- # 一、匹配的胚料类别需要带有胚料的标签;
- # 二、胚料的材料型号与生成产品的材料型号一致;
- # 三、胚料的长宽高均要大于模型的长宽高;
- # 四、如果匹配成功多个胚料,则选取体积最小的胚料;
- def bom_create_Line(self, product):
- embryo = self.env['product.product'].search(
- [('categ_id.is_embryo', '=', True), ('embryo_materials_type_id', '=', product.model_materials_type_id.id),
- ('embryo_long', '>', product.model_long), ('embryo_width', '>', product.model_width),
- ('embryo_height', '>', product.model_height)
- ],
- limit=1,
- order='volume desc'
- )
- vals = {
- 'bom_id': self.id,
- 'product_id': embryo.id,
- 'product_tmpl_id': embryo.product_tmpl_id.id,
- 'product_qty': 1,
- 'product_uom_id': 1
- }
- return self.env['mrp.bom.line'].create(vals)
diff --git a/sf_bpm_api/models/sale_order.py b/sf_bpm_api/models/sale_order.py
deleted file mode 100644
index 1618a4e3..00000000
--- a/sf_bpm_api/models/sale_order.py
+++ /dev/null
@@ -1,34 +0,0 @@
-from odoo import models, fields
-from odoo.exceptions import ValidationError
-import datetime
-
-
-class ReSaleOrder(models.Model):
- _inherit = 'sale.order'
-
- deadline_of_delivery = fields.Date('交货截止日期')
-
- # 业务平台分配工厂后在智能工厂先创建销售订单
- def sale_order_create(self, deadline_of_delivery, company_id):
- now_time = datetime.datetime.now()
- order_id = self.env['sale.order'].sudo().create({
- 'company_id': company_id.id,
- 'date_order': now_time,
- 'name': self.env['ir.sequence'].next_by_code('sale.order', sequence_date=now_time),
- 'partner_id': 8,
- 'state': 'sale',
- 'user_id': 6,
- 'deadline_of_delivery': deadline_of_delivery
- })
- return order_id
-
- # 业务平台分配工厂时在创建完产品后再创建销售明细信息
- def sale_order_create_line(self, product, item):
- vals = {
- 'order_id': self.id,
- 'product_id': product.id,
- 'name': '%s/%s/%s/%s/%s' % (item['model_long'], item['model_width'], item['model_height'], item['model_volume'], product.model_materials_id.name),
- 'price_unit': item['price'],
- 'product_uom_qty': item['number']
- }
- return self.env['sale.order.line'].create(vals)
diff --git a/sf_bpm_api/views/product_template_view.xml b/sf_bpm_api/views/product_template_view.xml
deleted file mode 100644
index 406330e3..00000000
--- a/sf_bpm_api/views/product_template_view.xml
+++ /dev/null
@@ -1,69 +0,0 @@
-
-
-
-
- product.template.form.inherit.sf
- product.template
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- product.category.form.inherit.sf
- product.category
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/sf_bpm_api/views/sale_order_view.xml b/sf_bpm_api/views/sale_order_view.xml
deleted file mode 100644
index 58abd5be..00000000
--- a/sf_bpm_api/views/sale_order_view.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
- sale.order.form.inherit.sf
- sale.order
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/sf_manufacturing_orders/models/mrp_workorder.py b/sf_manufacturing_orders/models/mrp_workorder.py
index 7997d82d..efed5ecb 100644
--- a/sf_manufacturing_orders/models/mrp_workorder.py
+++ b/sf_manufacturing_orders/models/mrp_workorder.py
@@ -11,5 +11,13 @@ class ResMrpWorkOrder(models.Model):
workcenter_id = fields.Many2one('mrp.workcenter', required=False)
processing_panel = fields.Char('加工面')
+ routing_type = fields.Selection([
+ ('获取CNC加工程序', '获取CNC加工程序'),
+ ('装夹', '装夹'),
+ ('前置三元定位检测', '前置三元定位检测'),
+ ('CNC加工', 'CNC加工'),
+ ('置三元质量检测', '置三元质量检测'),
+ ('解除装夹', '解除装夹'),
+ ], string="工序类型")
diff --git a/sf_manufacturing_orders/models/sf_production.py b/sf_manufacturing_orders/models/sf_production.py
index c55cac6e..7c8e5dd5 100644
--- a/sf_manufacturing_orders/models/sf_production.py
+++ b/sf_manufacturing_orders/models/sf_production.py
@@ -74,6 +74,7 @@ class MrpProduction(models.Model):
'operation_id': False,
'name': route.route_workcenter_id.name,
'processing_panel': k,
+ 'routing_type': route.route_workcenter_id.routing_type,
'workcenter_id': self.env['mrp.routing.workcenter'].get_workcenter(route.workcenter_ids.ids),
'date_planned_start': False,
'date_planned_finished': False,
From c0d8fe0f6fc50676c452cbb334e0fb0b2aec03af Mon Sep 17 00:00:00 2001
From: "jinling.yang"
Date: Tue, 8 Nov 2022 10:02:41 +0800
Subject: [PATCH 2/2] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=A8=A1=E5=9D=97?=
=?UTF-8?q?=E5=BC=95=E7=94=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sf_base/__manifest__.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sf_base/__manifest__.py b/sf_base/__manifest__.py
index c7eea0c9..5bd1a7b9 100644
--- a/sf_base/__manifest__.py
+++ b/sf_base/__manifest__.py
@@ -10,7 +10,7 @@
""",
'category': 'YZ',
'website': 'https://www.sf.jikimo.com',
- 'depends': ['account', 'base', 'mrp','sale','sf_manufacturing_orders'],
+ 'depends': ['account', 'base', 'mrp', 'sale', 'sf_manufacturing_orders'],
'data': [
'security/group_security.xml',
'security/ir.model.access.csv',