修改接口方法
This commit is contained in:
@@ -4,6 +4,9 @@ import logging
|
||||
import base64
|
||||
import qrcode
|
||||
import io
|
||||
|
||||
import requests
|
||||
|
||||
from odoo import api, fields, models, _
|
||||
from odoo.osv import expression
|
||||
from odoo.exceptions import UserError
|
||||
@@ -383,6 +386,26 @@ class ShelfLocation(models.Model):
|
||||
record.product_id = False
|
||||
record.location_status = '空闲'
|
||||
|
||||
#调取获取货位信息接口
|
||||
def get_sf_shelf_location_info(self):
|
||||
# sf_sync_config = self.env['res.config.settings'].get_values()
|
||||
# token = sf_sync_config['token']
|
||||
# sf_secret_key = sf_sync_config['sf_secret_key']
|
||||
# headers = Common.get_headers(self, token, sf_secret_key)
|
||||
# strurl = sf_sync_config['sf_url'] + self.crea_url
|
||||
headers = {'Authorization': 'Ba F2CF5DCC-1A00-4234-9E95-65603F70CC8A'}
|
||||
crea_url = 'https://x24467i973.zicp.fun/AutoDeviceApi/GetLocationInfos'
|
||||
# objs_all = self.env['maintenance.equipment'].search([('id', '=', self.id)])
|
||||
# machine_tool_list = []
|
||||
params = {'DeviceId': 'Cabinet-AL'}
|
||||
r = requests.get(crea_url, params=params,headers=headers)
|
||||
ret = r.json()
|
||||
print(ret)
|
||||
if ret['Succeed'] == True:
|
||||
return '获取库位信息成功'
|
||||
else:
|
||||
raise UserError("该库位无产品")
|
||||
|
||||
|
||||
class Sf_stock_move_line(models.Model):
|
||||
_inherit = 'stock.move.line'
|
||||
|
||||
Reference in New Issue
Block a user