本文整理匯總了Python中odoo.http.Controller方法的典型用法代碼示例。如果您正苦於以下問題:Python http.Controller方法的具體用法?Python http.Controller怎麽用?Python http.Controller使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類odoo.http
的用法示例。
在下文中一共展示了http.Controller方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test1
# 需要導入模塊: from odoo import http [as 別名]
# 或者: from odoo.http import Controller [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
# })