Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
2948 Lượt xem

What is the use of qcontext?and how to use it.


Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi,

In Odoo, the qcontext variable is a dictionary that allows you to pass additional context data to a template from a controller method. It stands for "quick context" and is used to provide specific data or variables to the template rendering process.

The qcontext variable can be used to define variables that are not part of the default context, allowing you to customize the behavior or appearance of a template. It is commonly used to pass additional information to the template that is derived from the controller method.

Here's an example of how to use qcontext in Odoo:

    qcontext = {
    'custom_variable': custom_variable,
    }

    return http.request.render('my_module.my_template', qcontext)


    Thanks

    Ảnh đại diện
    Huỷ bỏ
    Tác giả

    Like for example i am passing values website shop if i want to modify it looks and if i am adding extra fields to the website i need to pass these values using q context in the conroller , so it the qcontext is only used in Website module?

    Câu trả lời hay nhất

    Hi,

    Q Context helps to get the values returned from the original controller and to modify the value. The Controllers are the frontend modules and they can be integrated with backend modules which will help to render the requests to the web_browser. 

    for more information refer the blog:

    https://www.cybrosys.com/blog/how-q-context-works-in-odoo-16

    Hope it helps

    Ảnh đại diện
    Huỷ bỏ
    Bài viết liên quan Trả lời Lượt xem Hoạt động
    2
    thg 8 23
    2074
    1
    thg 4 25
    1543
    1
    thg 5 24
    2548
    Odoo App Đã xử lý
    1
    thg 11 23
    2138
    0
    thg 5 24
    1864