From 5dc5602e3de144a110b7aac60e4350b8da798275 Mon Sep 17 00:00:00 2001 From: guanhuan Date: Mon, 10 Feb 2025 09:47:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=88=E7=BB=93=E5=8F=96=E6=B6=88=E8=AE=A2?= =?UTF-8?q?=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_bf_connect/controllers/controllers.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/sf_bf_connect/controllers/controllers.py b/sf_bf_connect/controllers/controllers.py index 70a8d68f..d79e7137 100644 --- a/sf_bf_connect/controllers/controllers.py +++ b/sf_bf_connect/controllers/controllers.py @@ -132,6 +132,26 @@ class Sf_Bf_Connect(http.Controller): request.cr.rollback() return json.JSONEncoder().encode(res) + @http.route('/api/bfm_cancel_order', type='http', auth='sf_token', methods=['GET', 'POST'], csrf=False, + cors="*") + def get_bfm_cancel_order(self, **kw): + """ + 业务平台取消销售订单 + :param kw: + :return: + """ + res = {'status': 1, 'message': '工厂取消销售订单成功'} + logging.info('get_bfm_cancel_order:%s' % kw['order_number']) + try: + sale_order_info = request.env['sale.order'].sudo().search([('name', '=', kw['order_number'])]) + sale_order_info._action_cancel() + return json.JSONEncoder().encode(res) + except Exception as e: + logging.error('get_bfm_cancel_order error: %s' % e) + res['status'] = -1 + res['message'] = '工厂取消销售订单失败,请联系管理员' + return json.JSONEncoder().encode(res) + class jdElcp(http.Controller):