本文整理汇总了Python中odoo.http.route方法的典型用法代码示例。如果您正苦于以下问题:Python http.route方法的具体用法?Python http.route怎么用?Python http.route使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类odoo.http
的用法示例。
在下文中一共展示了http.route方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: pos_web
# 需要导入模块: from odoo import http [as 别名]
# 或者: from odoo.http import route [as 别名]
def pos_web(self, debug=False, **k):
pos_sessions = request.env['pos.session'].search([
('state', '=', 'opened'),
('user_id', '=', request.session.uid),
('name', 'not like', '(RESCUE FOR')])
if not pos_sessions:
return werkzeug.utils.redirect('/web#action=gooderp_pos.action_client_pos_menu')
pos_sessions.login()
context = {
'session_info': json.dumps(request.env['ir.http'].session_info())
}
return request.render('gooderp_pos.index', qcontext=context)
# @http.route('/pos/sale_details_report', type='http', auth='user')
# def print_sale_details(self, date_start=False, date_stop=False, **kw):
# r = request.env['report.gooderp_pos.report_saledetails']
# pdf = request.env['report'].with_context(date_start=date_start, date_stop=date_stop).get_pdf(r, 'gooderp_pos.report_saledetails')
# pdfhttpheaders = [('Content-Type', 'application/pdf'), ('Content-Length', len(pdf))]
# return request.make_response(pdf, headers=pdfhttpheaders)
示例2: test1
# 需要导入模块: from odoo import http [as 别名]
# 或者: from odoo.http import route [as 别名]
def test1(self):
result = ''
openacademy_course = http.request.env['openacademy.course']
result += openacademy_course.search([]).__str__() + '<br/>'
result += openacademy_course.search([], limit=1).name.__str__() + '<br/>'
# result += openacademy_course.create({'name': "new_course1"}).__str__() + '<br/>'
result += openacademy_course.browse([1]).name.__str__() + '<br/>'
result += openacademy_course.search_count([]).__str__() + '<br/>'
# result += openacademy_course.search([('name', '=', 'new_course1')])\
# .write({'name': 'new_course11'}).__str__() + '<br/>'
# result += openacademy_course.search([('name', '=', 'new_course11')]).unlink().__str__() + '<br/>'
# result += openacademy_course.search([]).__str__() + '<br/>'
return result
# class CrudTest(http.Controller):
# @http.route('/crud_test/crud_test/', auth='public')
# def index(self, **kw):
# return "Hello, world"
# @http.route('/crud_test/crud_test/objects/', auth='public')
# def list(self, **kw):
# return http.request.render('crud_test.listing', {
# 'root': '/crud_test/crud_test',
# 'objects': http.request.env['crud_test.crud_test'].search([]),
# })
# @http.route('/crud_test/crud_test/objects/<model("crud_test.crud_test"):obj>/', auth='public')
# def object(self, obj, **kw):
# return http.request.render('crud_test.object', {
# 'object': obj
# })