feat: 新增 Redis 缓存同步相关模块与控制器

This commit is contained in:
陈赓
2025-07-15 11:29:18 +08:00
parent cdbc277a94
commit 8e8f5eb8be
3 changed files with 66 additions and 0 deletions

View 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'}