diff --git a/sf_base/__manifest__.py b/sf_base/__manifest__.py
index 2352c3a6..41d98d4a 100644
--- a/sf_base/__manifest__.py
+++ b/sf_base/__manifest__.py
@@ -16,7 +16,7 @@
'security/ir.model.access.csv',
'views/mrs_base_view.xml',
'views/mrs_common_view.xml',
- "views/menu_view.xml"
+ # 'views/menu_view.xml'
],
'demo': [
diff --git a/sf_bf_connect/__manifest__.py b/sf_bf_connect/__manifest__.py
index 612bc615..ac357826 100644
--- a/sf_bf_connect/__manifest__.py
+++ b/sf_bf_connect/__manifest__.py
@@ -10,9 +10,8 @@
""",
'category': 'YZ',
'website': 'https://www.sf.cs.jikimo.com',
- 'depends': ['account', 'sf_base', 'base', 'sale'],
+ 'depends': [],
'data': [
- 'views/sale_process_order_view.xml'
],
'demo': [
],
diff --git a/sf_bf_connect/controllers/controllers.py b/sf_bf_connect/controllers/controllers.py
deleted file mode 100644
index 91304469..00000000
--- a/sf_bf_connect/controllers/controllers.py
+++ /dev/null
@@ -1,32 +0,0 @@
-# -*- coding: utf-8 -*-
-import json
-import logging
-from datetime import date, timedelta
-from odoo import http
-from odoo.http import request
-from odoo.addons.mrs_gateway_api.models.common import Common
-from odoo.addons.mrs_gateway_api.models.basicdata_str import BasicDataStr
-
-
-class Sf_Bf_Connect(http.Controller):
-
- @http.route('/api/bfm_process_order/list', type='json', auth='none', methods=['GET', 'POST'], csrf=False,
- cors="*")
- def get_bfm_process_order_list(self, **kw):
- """
- 获取业务平台传送来的业务平台订单
- :param kw:
- :return:
- """
- result = json.loads('bfm_process_order_list')
- for item in result:
- self.env['mrs.production.process'].create({
- "id": item['id'],
- "model_file": item['model_file'],
- "model_name": item['model_name'],
- "type": item['type'],
- "surface_technics": item['surface_technics'],
- "unit_price": item['unit_price'],
- "amount": item['amount'],
- "money": item['money']
- })
diff --git a/sf_bf_connect/models/__init__.py b/sf_bf_connect/models/__init__.py
deleted file mode 100644
index b6c1e8a8..00000000
--- a/sf_bf_connect/models/__init__.py
+++ /dev/null
@@ -1,2 +0,0 @@
-from . import sf_process_order
-
diff --git a/sf_bf_connect/models/sf_process_order.py b/sf_bf_connect/models/sf_process_order.py
deleted file mode 100644
index e3947692..00000000
--- a/sf_bf_connect/models/sf_process_order.py
+++ /dev/null
@@ -1,34 +0,0 @@
-from odoo import models,fields
-from odoo.exceptions import ValidationError
-
-
-class bfmOrderLine(models.Model):
- _name = 'sf.bfm.order.line'
- _description = '业务平台订单'
-
- model_file = fields.Binary('模型文件', attachment=False)
- model_name = fields.char('模型名称')
- type = fields.Many2one('mrs.materials.model', '型号')
- surface_technics = fields.Many2one('mrs.production.process', string='表面工艺')
- # technological_parameter = fields.Many2one('',string='工艺参数')
- unit_price = fields.Float('单价')
- amount = fields.Integer('数量')
- money = fields.Float('金额')
-
-
-class sale(models.Model):
- _inherit = 'sale.order'
-
- bfm_process_order_ids = fields.Many2one('sf.bfm.order.line', string='业务平台订单')
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/sf_bf_connect/security/ir.model.access.csv b/sf_bf_connect/security/ir.model.access.csv
deleted file mode 100644
index c46fb717..00000000
--- a/sf_bf_connect/security/ir.model.access.csv
+++ /dev/null
@@ -1,6 +0,0 @@
-id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
-access_sf_bfm_order_line,sf_bfm_order_line,model_sf_bfm_order_line,base.group_user,1,1,1,1
-
-
-
-
diff --git a/sf_bf_connect/views/sale_process_order_view.xml b/sf_bf_connect/views/sale_process_order_view.xml
deleted file mode 100644
index 898ade1b..00000000
--- a/sf_bf_connect/views/sale_process_order_view.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
- sale.order
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/sf_bpm_api/__init__.py b/sf_bpm_api/__init__.py
new file mode 100644
index 00000000..f9944209
--- /dev/null
+++ b/sf_bpm_api/__init__.py
@@ -0,0 +1,3 @@
+# -*-coding:utf-8-*-
+# from . import controllers
+from . import models
diff --git a/sf_bpm_api/__manifest__.py b/sf_bpm_api/__manifest__.py
new file mode 100644
index 00000000..d95561e9
--- /dev/null
+++ b/sf_bpm_api/__manifest__.py
@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+# Part of Odoo. See LICENSE file for full copyright and licensing details.
+{
+ 'name': '机企猫智能工厂 API模块',
+ 'version': '1.0',
+ 'summary': '智能工厂API模块',
+ 'sequence': 1,
+ 'description': """
+ 在本模块,接收业务平台订单
+ """,
+ 'category': 'sf',
+ 'website': 'https://www.sf.cs.jikimo.com',
+ 'depends': ['sale', 'product'],
+ 'data': [
+ 'views/product_template_view.xml',
+ 'views/sale_order_view.xml',
+ ],
+ 'demo': [
+ ],
+ 'qweb': [
+ ],
+ 'installable': True,
+ 'application': False,
+ 'auto_install': False,
+}
diff --git a/sf_bf_connect/controllers/__init__.py b/sf_bpm_api/controllers/__init__.py
similarity index 100%
rename from sf_bf_connect/controllers/__init__.py
rename to sf_bpm_api/controllers/__init__.py
diff --git a/sf_bpm_api/controllers/controllers.py b/sf_bpm_api/controllers/controllers.py
new file mode 100644
index 00000000..57bea8bf
--- /dev/null
+++ b/sf_bpm_api/controllers/controllers.py
@@ -0,0 +1,32 @@
+# -*- coding: utf-8 -*-
+import json
+import logging
+from datetime import date, timedelta
+from odoo import http
+from odoo.http import request
+
+
+class Sf_Bf_Connect(http.Controller):
+
+ @http.route('/api/bfm_process_order/list', type='json', auth='none', methods=['GET', 'POST'], csrf=False,
+ cors="*")
+ def get_bfm_process_order_list(self, **kw):
+ """
+ 获取业务平台传送来的订单
+ :param kw:
+ :return:
+ """
+ result = json.loads('result')
+ order_line_ids = []
+ for item in result['bfm_process_order_list']:
+ order_line_ids.append({
+ "long": item['model_length'],
+ "width": item['model_width'],
+ "height": item['model_height'],
+ "volume": item['model_volume'],
+ "materials_id": item['texture_id'],
+ "unit_price": item['unit_price']
+ # "barcode": item['barcode']
+ })
+ self.env['sale.order'].sudo().sale_order_create(result['result'])
+
diff --git a/sf_bpm_api/models/__init__.py b/sf_bpm_api/models/__init__.py
new file mode 100644
index 00000000..e843bf92
--- /dev/null
+++ b/sf_bpm_api/models/__init__.py
@@ -0,0 +1,4 @@
+from . import sale_order
+from . import product_template
+
+
diff --git a/sf_bpm_api/models/product_template.py b/sf_bpm_api/models/product_template.py
new file mode 100644
index 00000000..177351df
--- /dev/null
+++ b/sf_bpm_api/models/product_template.py
@@ -0,0 +1,35 @@
+from odoo import models, fields
+from odoo.exceptions import ValidationError
+
+
+class ResProductTemplate(models.Model):
+ _inherit = 'product.template'
+
+ purchase_ok = fields.Boolean(default=False)
+ detailed_type = fields.Selection(default='product')
+ list_price = fields.Float(digits=(16, 3))
+ invoice_policy = fields.Selection(default='delivery')
+ long = fields.Float('长[mm]', digits=(16, 3))
+ width = fields.Float('宽[mm]', digits=(16, 3))
+ height = fields.Float('高[mm]', digits=(16, 3))
+ volume = fields.Float('体积[mm³]', digits=(16, 3))
+ precision = fields.Float('精度要求', digits=(16, 3))
+ materials_id = fields.Many2one('mrs.production.materials', string='材料')
+ # materials_type_id = fields.Many2one('mrs.materials.model', string='型号')
+ # surface_technics_id = fields.Many2one('mrs.production.process', string='表面工艺')
+ # technological_parameter_id = fields.Char('工艺参数')
+ unit_price = fields.Float('单价')
+ amount = fields.Integer('数量')
+
+ # 业务平台分配工厂时调用该方法创建产品,(调用该方法时用prototype)
+ def product_create(self, products):
+ self.env['product.template'].create({
+ 'name': products['order_number'],
+ 'length': products['length'],
+ 'width': products['width'],
+ 'height': products['height'],
+ 'volume': products['volume'],
+ 'materials_id': products['materials_id'],
+ 'unit_price': products['unit_price'],
+ 'amount': products['amount']
+ })
diff --git a/sf_bpm_api/models/sale_order.py b/sf_bpm_api/models/sale_order.py
new file mode 100644
index 00000000..7faba3f0
--- /dev/null
+++ b/sf_bpm_api/models/sale_order.py
@@ -0,0 +1,14 @@
+from odoo import models, fields
+from odoo.exceptions import ValidationError
+
+
+class ReSaleOrder(models.Model):
+ _inherit = 'sale.order'
+
+ deadline_of_delivery = fields.Date('交货截止日期')
+
+ # 业务平台分配工厂时调用该方法先创建销售订单(调用该方法时用prototype)
+ def sale_order_create(self, order):
+ self.env['sale.order'].create({
+ 'deadline_of_delivery': order['deadline_of_delivery']
+ })
diff --git a/sf_bf_connect/security/group_security.xml b/sf_bpm_api/security/group_security.xml
similarity index 100%
rename from sf_bf_connect/security/group_security.xml
rename to sf_bpm_api/security/group_security.xml
diff --git a/sf_bpm_api/security/ir.model.access.csv b/sf_bpm_api/security/ir.model.access.csv
new file mode 100644
index 00000000..963679d4
--- /dev/null
+++ b/sf_bpm_api/security/ir.model.access.csv
@@ -0,0 +1,5 @@
+id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
+
+
+
+
diff --git a/sf_bpm_api/views/product_template_view.xml b/sf_bpm_api/views/product_template_view.xml
new file mode 100644
index 00000000..9754f938
--- /dev/null
+++ b/sf_bpm_api/views/product_template_view.xml
@@ -0,0 +1,20 @@
+
+
+
+
+ product.template.form.inherit.sf
+ product.template
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ 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
new file mode 100644
index 00000000..58abd5be
--- /dev/null
+++ b/sf_bpm_api/views/sale_order_view.xml
@@ -0,0 +1,15 @@
+
+
+
+
+ sale.order.form.inherit.sf
+ sale.order
+
+
+
+
+
+
+
+
+
\ No newline at end of file