diff --git a/sf_bf_connect/__init__.py b/sf_bf_connect/__init__.py index 50ed18aa..f719d7e8 100644 --- a/sf_bf_connect/__init__.py +++ b/sf_bf_connect/__init__.py @@ -1 +1,3 @@ # -*-coding:utf-8-*- +from . import models +from . import controllers diff --git a/sf_bf_connect/__manifest__.py b/sf_bf_connect/__manifest__.py new file mode 100644 index 00000000..612bc615 --- /dev/null +++ b/sf_bf_connect/__manifest__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. +{ + 'name': '机企猫智能工厂 同步模块', + 'version': '1.0', + 'summary': '智能工厂同步模块', + 'sequence': 1, + 'description': """ +在本模块,同步资源库 + """, + 'category': 'YZ', + 'website': 'https://www.sf.cs.jikimo.com', + 'depends': ['account', 'sf_base', 'base', 'sale'], + 'data': [ + 'views/sale_process_order_view.xml' + ], + 'demo': [ + ], + 'qweb': [ + ], + 'installable': True, + 'application': False, + 'auto_install': False, +} diff --git a/sf_bf_connect/controllers/__init__.py b/sf_bf_connect/controllers/__init__.py new file mode 100644 index 00000000..4644261c --- /dev/null +++ b/sf_bf_connect/controllers/__init__.py @@ -0,0 +1 @@ +from .import controllers diff --git a/sf_bf_connect/controllers/controllers.py b/sf_bf_connect/controllers/controllers.py new file mode 100644 index 00000000..91304469 --- /dev/null +++ b/sf_bf_connect/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 +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 new file mode 100644 index 00000000..b6c1e8a8 --- /dev/null +++ b/sf_bf_connect/models/__init__.py @@ -0,0 +1,2 @@ +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 new file mode 100644 index 00000000..e3947692 --- /dev/null +++ b/sf_bf_connect/models/sf_process_order.py @@ -0,0 +1,34 @@ +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/views/sale_process_order_view.xml b/sf_bf_connect/views/sale_process_order_view.xml new file mode 100644 index 00000000..898ade1b --- /dev/null +++ b/sf_bf_connect/views/sale_process_order_view.xml @@ -0,0 +1,18 @@ + + + + + sale.order + + + + + + + + + + + + + \ No newline at end of file