修改智能工厂接收业务平台订单接口
This commit is contained in:
@@ -16,3 +16,8 @@ access_mrs_processing_technology,mrs_processing_technology,model_mrs_processing_
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -10,7 +10,7 @@
|
||||
""",
|
||||
'category': 'YZ',
|
||||
'website': 'https://www.sf.cs.jikimo.com',
|
||||
'depends': ['account', 'sf_base', 'base', 'sale'],
|
||||
'depends': ['sf_base', 'sale'],
|
||||
'data': [
|
||||
'views/sale_process_order_view.xml'
|
||||
],
|
||||
|
||||
@@ -4,8 +4,6 @@ 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):
|
||||
@@ -14,19 +12,30 @@ class Sf_Bf_Connect(http.Controller):
|
||||
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'],
|
||||
result = json.loads('result')
|
||||
order_line_ids = []
|
||||
for item in result['bfm_process_order_list']:
|
||||
order_line_ids.append({
|
||||
"model_file": item['model_file'],
|
||||
"model_name": item['model_name'],
|
||||
"type": item['type'],
|
||||
"surface_technics": item['surface_technics'],
|
||||
"model_length": item['model_length'],
|
||||
"model_width": item['model_width'],
|
||||
"model_height": item['model_height'],
|
||||
"model_volume": item['model_volume'],
|
||||
"materials_id": item['texture_id'],
|
||||
"materials_type_id": item['texture_item_id'],
|
||||
"surface_technics_id": item['surface_id'],
|
||||
"technological_parameter_id": item['surface_item_id'],
|
||||
"unit_price": item['unit_price'],
|
||||
"amount": item['amount'],
|
||||
"money": item['money']
|
||||
})
|
||||
self.env['sf.bfm.order'].create({
|
||||
'order_number': result['order_number'],
|
||||
'deadline_of_delivery': result['delivery_end_date'],
|
||||
'order_line_ids': order_line_ids
|
||||
})
|
||||
|
||||
@@ -1,25 +1,52 @@
|
||||
from odoo import models,fields
|
||||
from odoo import models, fields
|
||||
from odoo.exceptions import ValidationError
|
||||
|
||||
|
||||
class bfmOrder(models.Model):
|
||||
_name = 'sf.bfm.order'
|
||||
_description = '业务平台订单'
|
||||
|
||||
order_number = fields.Char('订单号')
|
||||
deadline_of_delivery = fields.Date('交货截止日期')
|
||||
order_line_ids = fields.One2many('sf.bfm.order.line', 'order_id', string='订单明细')
|
||||
|
||||
|
||||
class bfmOrderLine(models.Model):
|
||||
_name = 'sf.bfm.order.line'
|
||||
_description = '业务平台订单'
|
||||
_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='工艺参数')
|
||||
# model_file = fields.Binary('模型文件')
|
||||
model_name = fields.Char('模型名称')
|
||||
model_length = 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))
|
||||
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.Many2one('sf.surface.process.item', string='工艺参数')
|
||||
unit_price = fields.Float('单价')
|
||||
amount = fields.Integer('数量')
|
||||
money = fields.Float('金额')
|
||||
order_id = fields.Many2one('sf.bfm.order', string='业务平台订单')
|
||||
# sale_order_id = fields.Many2one('sale.order')
|
||||
|
||||
|
||||
class SurfaceProcessItem(models.Model):
|
||||
_name = 'sf.surface.process.item'
|
||||
_description = '表面工艺参数'
|
||||
|
||||
sequence = fields.Integer('排序', default=99)
|
||||
name = fields.Char('名称', index=True)
|
||||
surface_id = fields.Many2one('mrs.production.process', string='表面工艺')
|
||||
remark = fields.Text('说明')
|
||||
active = fields.Boolean('有效', default=True)
|
||||
|
||||
|
||||
class sale(models.Model):
|
||||
_inherit = 'sale.order'
|
||||
|
||||
bfm_process_order_ids = fields.Many2one('sf.bfm.order.line', string='业务平台订单')
|
||||
bfm_process_order_ids = fields.One2many('sf.bfm.order', 'sale_order_id', string='业务平台订单')
|
||||
|
||||
|
||||
|
||||
|
||||
5
sf_bf_connect/security/group_security.xml
Normal file
5
sf_bf_connect/security/group_security.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<odoo>
|
||||
<data>
|
||||
|
||||
</data>
|
||||
</odoo>
|
||||
6
sf_bf_connect/security/ir.model.access.csv
Normal file
6
sf_bf_connect/security/ir.model.access.csv
Normal file
@@ -0,0 +1,6 @@
|
||||
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
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -2,13 +2,14 @@
|
||||
<odoo>
|
||||
<data>
|
||||
<record model="ir.ui.view" id="view_sf_form_inherit">
|
||||
<field name="name">sale.order.form.inherit.bfm.item</field>
|
||||
<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">
|
||||
<xpath expr="//page[@name='customer_signature']" position="before">
|
||||
<page string="业务平台订单">
|
||||
<group>
|
||||
<field name="bfm_process_order_ids"/>
|
||||
<field name="bfm_process_order_ids" />
|
||||
</group>
|
||||
</page>
|
||||
</xpath>
|
||||
|
||||
Reference in New Issue
Block a user