智能工厂接口新增相关字段
This commit is contained in:
@@ -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': [
|
||||
|
||||
@@ -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': [
|
||||
],
|
||||
|
||||
@@ -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']
|
||||
})
|
||||
@@ -1,2 +0,0 @@
|
||||
from . import sf_process_order
|
||||
|
||||
@@ -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='业务平台订单')
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -1,18 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
<data>
|
||||
<record model="ir.ui.view" id="view_sf_form_inherit">
|
||||
<field name="model">sale.order</field>
|
||||
<field name="inherit_id" ref="sale.view_order_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//page[@name='Customer Signature']" position="before">
|
||||
<page string="Bfm Line">
|
||||
<group>
|
||||
<field name="bfm_process_order_ids"/>
|
||||
</group>
|
||||
</page>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</data>
|
||||
</odoo>
|
||||
3
sf_bpm_api/__init__.py
Normal file
3
sf_bpm_api/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
||||
# -*-coding:utf-8-*-
|
||||
# from . import controllers
|
||||
from . import models
|
||||
25
sf_bpm_api/__manifest__.py
Normal file
25
sf_bpm_api/__manifest__.py
Normal file
@@ -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,
|
||||
}
|
||||
32
sf_bpm_api/controllers/controllers.py
Normal file
32
sf_bpm_api/controllers/controllers.py
Normal file
@@ -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'])
|
||||
|
||||
4
sf_bpm_api/models/__init__.py
Normal file
4
sf_bpm_api/models/__init__.py
Normal file
@@ -0,0 +1,4 @@
|
||||
from . import sale_order
|
||||
from . import product_template
|
||||
|
||||
|
||||
35
sf_bpm_api/models/product_template.py
Normal file
35
sf_bpm_api/models/product_template.py
Normal file
@@ -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']
|
||||
})
|
||||
14
sf_bpm_api/models/sale_order.py
Normal file
14
sf_bpm_api/models/sale_order.py
Normal file
@@ -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']
|
||||
})
|
||||
5
sf_bpm_api/security/ir.model.access.csv
Normal file
5
sf_bpm_api/security/ir.model.access.csv
Normal file
@@ -0,0 +1,5 @@
|
||||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
||||
|
||||
|
||||
|
||||
|
||||
|
20
sf_bpm_api/views/product_template_view.xml
Normal file
20
sf_bpm_api/views/product_template_view.xml
Normal file
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
<data>
|
||||
<record model="ir.ui.view" id="view_product_template_form_inherit_sf">
|
||||
<field name="name">product.template.form.inherit.sf</field>
|
||||
<field name="model">product.template</field>
|
||||
<field name="inherit_id" ref="product.product_template_only_form_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="uom_po_id" position="after">
|
||||
<field name="long"/>
|
||||
<field name="width"/>
|
||||
<field name="height"/>
|
||||
<field name="volume"/>
|
||||
<field name="precision"/>
|
||||
<field name="materials_id"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
</data>
|
||||
</odoo>
|
||||
15
sf_bpm_api/views/sale_order_view.xml
Normal file
15
sf_bpm_api/views/sale_order_view.xml
Normal file
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
<data>
|
||||
<record model="ir.ui.view" id="view_sale_order_form_inherit_sf">
|
||||
<field name="name">sale.order.form.inherit.sf</field>
|
||||
<field name="model">sale.order</field>
|
||||
<field name="inherit_id" ref="sale.view_order_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="payment_term_id" position="after">
|
||||
<field name="deadline_of_delivery"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
</data>
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user