优化odoo16工单视图展示问题

This commit is contained in:
gqh
2022-12-12 14:46:54 +08:00
parent 096cd44b9c
commit e0a0b3d411
17 changed files with 228 additions and 196 deletions

View File

@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': '机企猫智能工厂 接业务平台模块',
'name': '机企猫智能工厂 接业务平台',
'version': '1.0',
'summary': '连接业务平台模块',
'sequence': 1,
@@ -10,7 +10,7 @@
""",
'category': 'sf',
'website': 'https://www.sf.cs.jikimo.com',
'depends': ['sf_base'],
'depends': ['sf_base', 'sf_sale', 'sf_dlm'],
'data': [
],

View File

@@ -8,7 +8,7 @@ from odoo.http import request
class Sf_Bf_Connect(http.Controller):
@http.route('/api/bfm_process_order/list', type='json', auth='sf_token', methods=['GET', 'POST'], csrf=False,
@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):
"""
@@ -24,7 +24,9 @@ class Sf_Bf_Connect(http.Controller):
ret = json.loads(ret['result'])
product_id = request.env.ref('sf_dlm.product_template_sf').sudo()
company_id = request.env.ref('base.main_company').sudo()
order_id = request.env['sale.order'].with_user(request.env.ref("base.user_admin")).sale_order_create(ret['delivery_end_date'], company_id)
order_id = request.env['sale.order'].with_user(request.env.ref("base.user_admin")).sale_order_create(
company_id, ret['delivery_name'], ret['delivery_telephone'], ret['delivery_address'],
ret['delivery_end_date'])
i = 1
for item in ret['bfm_process_order_list']:
product = request.env['product.template'].sudo().product_create(product_id, item, order_id,

View File

@@ -4,12 +4,14 @@ import datetime
import time
import hashlib
from odoo import fields, models, api
from odoo.http import request, AuthenticationError
from odoo.http import request
__author__ = 'jinling.yang'
_logger = logging.getLogger(__name__)
class AuthenticationError(Exception):
pass
class Http(models.AbstractModel):
_inherit = 'ir.http'
@@ -23,6 +25,7 @@ class Http(models.AbstractModel):
# 查询密钥
factory_secret = request.env['res.partner'].sudo().search(
[('sf_token', '=', datas['HTTP_TOKEN'])], limit=1)
logging.info('factory_secret:%s' % factory_secret)
if not factory_secret:
raise AuthenticationError('无效的token')
timestamp_str = int(time.time())