# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. import base64 from collections import OrderedDict from datetime import datetime from odoo import http from odoo.exceptions import AccessError, MissingError from odoo.http import request, Response from odoo.tools import image_process from odoo.tools.translate import _ from odoo.addons.portal.controllers import portal from odoo.addons.portal.controllers.portal import pager as portal_pager from odoo import http from odoo.http import request, serialize_exception from odoo import api, SUPERUSER_ID class SapbotUpload(http.Controller): @http.route('/sapbot/', auth='user', type='http', csrf=False) # @serialize_exception def sapbot_upload(self, file, filetype): file.save(r'D:\www\odoo\data\1.xlsx') return request.render('sapbot.thanks')
<form class="needs-validation" action="/sapbot/" target="_blank" method="POST" name="sapbot" id="sapbot" enctype="multipart/form-data"> <!-- <input type="hidden" name="csrf_token" t-att-value="request.csrf_token()"/>--> <div class="row g-3"> <div class="col-md-6"> <label class="form-label">选择文件:</label> <input type="file" class="form-control" id="file" name="file" /> </div> <div class="col-md-2"> <label class="form-label">任务类别</label> <select class="form-select" id="filetype" name="filetype"> <option>MM_Auto</option> <option>MM</option> <option>BOM(暂未开通)</option> <option>其他(暂未开通)</option> </select> </div> <hr class="my-4" /> </div> <input type="submit" class="w-40 btn btn-primary btn-lg" value="提交" /> </form>
标签:sapbot,via,http,controller,fileupload,portal,file,odoo,import From: https://www.cnblogs.com/pythonClub/p/17787021.html