Python odoo.http.request.render() Examples

The following are 30 code examples of odoo.http.request.render(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module odoo.http.request , or try the search function .
Example #1
Source File: main.py    From odoo-dingtalk-connector with GNU General Public License v3.0 5 votes vote down vote up
def qrcode(self, **kw):
        """
        钉钉扫码登陆页面
        """
        config = request.env['ir.config_parameter'].sudo()
        data = {
            'app_id': config.get_param('dingtalk_sns_app_id'),
            'redirect_url': request.httprequest.host_url + 'dingtalk/auth'
        }
        return request.render('dingtalk_connector.qrcode_login', data) 
Example #2
Source File: hello.py    From Odoo-12-Development-Essentials-Fourth-Edition with MIT License 5 votes vote down vote up
def hellocms(self, page, **kwargs):
        return http.request.render(page) 
Example #3
Source File: main.py    From Odoo-12-Development-Essentials-Fourth-Edition with MIT License 5 votes vote down vote up
def checkouts(self, **kwargs):
        Checkout = request.env['library.checkout']
        checkouts = Checkout.search([])
        return request.render(
            'library_website.index',
            {'docs': checkouts}) 
Example #4
Source File: main.py    From Odoo-12-Development-Essentials-Fourth-Edition with MIT License 5 votes vote down vote up
def checkout(self, doc, **kwargs):
        return http.request.render(
            'library_website.checkout',
            {'doc': doc}) 
Example #5
Source File: main.py    From Odoo-12-Development-Essentials-Fourth-Edition with MIT License 5 votes vote down vote up
def checkout_create(self, **kwargs):
        books = request.env['library.book'].search([])
        member = request.env['library.member'].search(
            [('partner_id', '=', request.env.user.partner_id.id)],
            limit=1)
        return request.render(
            'library_website.checkout_create',
            {'books': books, 'member': member}) 
Example #6
Source File: hello.py    From Odoo-12-Development-Essentials-Fourth-Edition with MIT License 5 votes vote down vote up
def hellocms(self, page, **kwargs):
        return http.request.render(page) 
Example #7
Source File: main.py    From Odoo-12-Development-Essentials-Fourth-Edition with MIT License 5 votes vote down vote up
def checkouts(self, **kwargs):
        Checkout = request.env['library.checkout']
        checkouts = Checkout.search([])
        return request.render(
            'library_website.index',
            {'docs': checkouts}) 
Example #8
Source File: main.py    From Odoo-12-Development-Essentials-Fourth-Edition with MIT License 5 votes vote down vote up
def checkout(self, doc, **kwargs):
        return http.request.render(
            'library_website.checkout',
            {'doc': doc}) 
Example #9
Source File: main.py    From Odoo-12-Development-Essentials-Fourth-Edition with MIT License 5 votes vote down vote up
def checkout_create(self, **kwargs):
        books = request.env['library.book'].search([])
        member = request.env['library.member'].search(
            [('partner_id', '=', request.env.user.partner_id.id)],
            limit=1)
        return request.render(
            'library_website.checkout_create',
            {'books': books, 'member': member}) 
Example #10
Source File: controllers.py    From weodoo with MIT License 5 votes vote down vote up
def wx_bind(self, **kw):
        qr_id = kw.get('qr_id')
        redirect = kw.get('redirect', '')
        redirect = base64.urlsafe_b64decode(redirect.encode('utf-8')).decode('utf-8')
        _info = QR_DICT[qr_id]['data']

        values = request.params.copy()
        if redirect:
            values['login_url'] = '/web/login?qr_id=%s&redirect=%s'%(qr_id, redirect)
        else:
            values['login_url'] = '/web/login?qr_id=%s'%qr_id
        values['avatar'] = _info['avatar']
        values['name'] = _info['name']
        request.session['qr_id'] = qr_id
        return request.render('weodoo.wx_bind', values) 
Example #11
Source File: main.py    From odoo-dingtalk-connector with GNU General Public License v3.0 5 votes vote down vote up
def sign_in(self, **kw):
        """
        钉钉免登入口
        """
        config = request.env['ir.config_parameter'].sudo()
        data = {
            'corp_id': config.get_param('dingtalk_corp_id')
        }
        return request.render('dingtalk_connector.sign_in', data) 
Example #12
Source File: hello.py    From Odoo-12-Development-Essentials-Fourth-Edition with MIT License 5 votes vote down vote up
def helloworld(self):
        # return('<h1>Hello World!</h1>')
        return request.render('library_website.helloworld') 
Example #13
Source File: main.py    From Odoo-10-Development-Essentials with MIT License 5 votes vote down vote up
def hello(self, **kwargs):
        """
        Hello World using a QWeb template
        Also used for the controller extension example
        """
        return request.render('todo_website.hello') 
Example #14
Source File: main.py    From Odoo-10-Development-Essentials with MIT License 5 votes vote down vote up
def hellocms(self, page, **kwargs):
        """
        Very simple CMS example
        """
        return request.render(page) 
Example #15
Source File: main.py    From Odoo-10-Development-Essentials with MIT License 5 votes vote down vote up
def index(self, **kwargs):
        """
        Todo list page
        """
        TodoTask = request.env['todo.task']
        tasks =  TodoTask.search([])
        return request.render(
            'todo_website.index', {'tasks': tasks}) 
Example #16
Source File: main.py    From Odoo-10-Development-Essentials with MIT License 5 votes vote down vote up
def detail(self, task, **kwargs):
        """
        Todo detail page
        """
        return request.render(
            'todo_website.detail', {'task': task}) 
Example #17
Source File: main.py    From Odoo-10-Development-Essentials with MIT License 5 votes vote down vote up
def add(self, **kwargs):
        """
        Form to add a new Todo Task
        """
        users = request.env['res.users'].search([])
        return request.render(
            'todo_website.add', {'users': users}) 
Example #18
Source File: main.py    From Odoo-11-Development-Essentials-Third-Edition with MIT License 5 votes vote down vote up
def hello(self, **kwargs):
        """
        Hello World using a QWeb template
        Also used for the controller extension example
        """
        return request.render('todo_website.hello') 
Example #19
Source File: main.py    From Odoo-11-Development-Essentials-Third-Edition with MIT License 5 votes vote down vote up
def hellocms(self, page, **kwargs):
        """
        Very simple CMS example
        """
        return request.render(page) 
Example #20
Source File: main.py    From Odoo-11-Development-Essentials-Third-Edition with MIT License 5 votes vote down vote up
def index(self, **kwargs):
        """
        Todo list page
        """
        TodoTask = request.env['todo.task']
        tasks = TodoTask.search([])
        return request.render(
            'todo_website.index', {'tasks': tasks}) 
Example #21
Source File: main.py    From Odoo-11-Development-Essentials-Third-Edition with MIT License 5 votes vote down vote up
def detail(self, task, **kwargs):
        """
        Todo detail page
        """
        return request.render(
            'todo_website.detail', {'task': task}) 
Example #22
Source File: main.py    From Odoo-11-Development-Essentials-Third-Edition with MIT License 5 votes vote down vote up
def add(self, **kwargs):
        """
        Form to add a new Todo Task
        """
        users = request.env['res.users'].search([])
        return request.render(
            'todo_website.add', {'users': users}) 
Example #23
Source File: main.py    From Odoo-12-Development-Cookbook-Third-Edition with MIT License 5 votes vote down vote up
def library_books(self):
        return request.render(
            'my_library.books', {
                'books': request.env['library.book'].search([]),
            }) 
Example #24
Source File: main.py    From Odoo-Python-ERP- with GNU General Public License v3.0 5 votes vote down vote up
def index(self, **kwargs):
        Bugs = request.env['bm.bug']
        bugs = Bugs.search([])
        return request.render(
            'bug-website.index',
            {'bugs': bugs}) 
Example #25
Source File: main.py    From Odoo-Python-ERP- with GNU General Public License v3.0 5 votes vote down vote up
def detail(self, bug, **kwargs):
        return http.request.render(
            'bug-website.detail',
            {'bug': bug}) 
Example #26
Source File: main.py    From Odoo-Python-ERP- with GNU General Public License v3.0 5 votes vote down vote up
def add(self, **kwargs):
        users = request.env['res.users'].search([])
        return request.render(
            'bug-website.add', {'users': users}) 
Example #27
Source File: main.py    From Odoo-12-Development-Cookbook-Third-Edition with MIT License 5 votes vote down vote up
def library_books(self):
        country_id = False
        country_code = request.session.geoip and request.session.geoip.get('country_code') or False
        if country_code:
            country_ids = request.env['res.country'].sudo().search([('code', '=', country_code)])
            if country_ids:
                country_id = country_ids[0].id
        domain = ['|', ('restrict_country_ids', '=', False), ('restrict_country_ids', 'not in', [country_id])]
        return request.render(
            'my_library.books', {
                'books': request.env['library.book'].search(domain),
            }) 
Example #28
Source File: main.py    From Odoo-12-Development-Cookbook-Third-Edition with MIT License 5 votes vote down vote up
def library_book_detail(self, book):
        return request.render(
            'my_library.book_detail', {
                'book': book,
                'main_object': book
            }) 
Example #29
Source File: main.py    From Odoo-12-Development-Cookbook-Third-Edition with MIT License 5 votes vote down vote up
def books_issues(self, **post):
        if post.get('book_id'):
            book_id = int(post.get('book_id'))
            issue_description = post.get('issue_description')
            request.env['book.issue'].sudo().create({
                'book_id': book_id,
                'issue_description': issue_description,
                'submitted_by': request.env.user.id
            })
            return request.redirect('/books/submit_issues?submitted=1')

        return request.render('my_library.books_issue_form', {
            'books': request.env['library.book'].search([]),
            'submitted': post.get('submitted', False)
        }) 
Example #30
Source File: main.py    From Odoo-12-Development-Cookbook-Third-Edition with MIT License 5 votes vote down vote up
def library_books(self):
        return request.render(
            'my_library.books', {
                'books': request.env['library.book'].search([]),
            })