加工中代码测试完成
This commit is contained in:
@@ -8,7 +8,7 @@ from odoo.http import request
|
||||
|
||||
class Sf_Bf_Connect(http.Controller):
|
||||
|
||||
@http.route('/api/bfm_process_order/list', type='http', auth='none', methods=['GET', 'POST'], csrf=False,
|
||||
@http.route('/api/bfm_process_order/list', type='http', auth='sf_token', methods=['GET', 'POST'], csrf=False,
|
||||
cors="*")
|
||||
def get_bfm_process_order_list(self, **kw):
|
||||
"""
|
||||
@@ -19,6 +19,9 @@ class Sf_Bf_Connect(http.Controller):
|
||||
res = {'status': 1, 'factory_order_no': ''}
|
||||
logging.info('get_bfm_process_order_list:%s' % kw)
|
||||
try:
|
||||
logging.info('get_bfm_process_order_list===================================:%s' % kw['order_number'])
|
||||
# aa = request.env['sale.order'].sudo().get_default_code(kw['order_number'])
|
||||
|
||||
# datas = request.httprequest.data
|
||||
# ret = json.loads(datas)
|
||||
# ret = json.loads(ret['result'])
|
||||
@@ -44,9 +47,7 @@ class Sf_Bf_Connect(http.Controller):
|
||||
# else:
|
||||
product = request.env['product.template'].sudo().product_create(product_id, item, order_id,
|
||||
kw['order_number'], i)
|
||||
# order_id.with_user(request.env.ref("base.user_admin")).sale_order_create_line(product, item)
|
||||
logging.info('order_id:%s' % order_id)
|
||||
logging.info('product:%s' % product)
|
||||
i += 1
|
||||
bom_data = request.env['mrp.bom'].with_user(request.env.ref("base.user_admin")).get_bom(product)
|
||||
logging.info('bom_data:%s' % bom_data)
|
||||
if bom_data:
|
||||
@@ -102,8 +103,12 @@ class Sf_Bf_Connect(http.Controller):
|
||||
product_bom_purchase.with_user(request.env.ref("base.user_admin")).bom_create_line_has(
|
||||
purchase_embryo)
|
||||
order_id.with_user(request.env.ref("base.user_admin")).sale_order_create_line(product, item)
|
||||
i += 1
|
||||
res['factory_order_no'] = order_id.name
|
||||
aa = request.env['sale.order'].sudo().search([('name', '=', order_id.name)])
|
||||
logging.info('get_bfm_process_or===================================:%s' % order_id.name)
|
||||
aa.default_code = kw['order_number']
|
||||
logging.info('get_bfm_process_order_listaaaaaaaaaaaaaaaaaaaaaaaaaaaa================:%s' % aa.default_code)
|
||||
|
||||
except Exception as e:
|
||||
logging.info('get_bfm_process_order_list error:%s' % e)
|
||||
res['status'] = -1
|
||||
|
||||
Reference in New Issue
Block a user