feat: 新增 Redis 缓存同步相关模块与控制器
This commit is contained in:
22
sf_mrs_connect/controllers/sync_controller.py
Normal file
22
sf_mrs_connect/controllers/sync_controller.py
Normal file
@@ -0,0 +1,22 @@
|
||||
# study/jikimo_sf/sf_mrs_connect/controllers/sync_controller.py
|
||||
from odoo import http
|
||||
from odoo.http import request
|
||||
|
||||
class FixtureSyncController(http.Controller):
|
||||
|
||||
@http.route('/api/fixture_model/sync_from_mrs', type='json', auth='none', csrf=False)
|
||||
def sync_model(self, **kw):
|
||||
code = kw.get('code')
|
||||
if not code:
|
||||
return {'status':'fail','msg':'code missing'}
|
||||
request.env['sf.fixture.model'].sudo().sync_from_mrs(code)
|
||||
return {'status':'success'}
|
||||
|
||||
@http.route('/api/fixture_param/sync_from_mrs', type='json', auth='none', csrf=False)
|
||||
def sync_param(self, **kw):
|
||||
code = kw.get('code')
|
||||
if not code:
|
||||
return {'status':'fail','msg':'code missing'}
|
||||
request.env['sf.fixture.materials.basic.parameters']\
|
||||
.sudo().sync_from_mrs(code)
|
||||
return {'status':'success'}
|
||||
Reference in New Issue
Block a user