Odoo Help


This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


What is with_context in Odoo ?Which case I can Use with_context ?

on 4/29/16, 6:11 AM 459 views

Class pos_category(models.Model):
    _inherit = 'pos.category'

    def create(self, data):
        r = super(pos_category,self).with_context(is_pos=True).create(data)

Martin Trigaux (mat)

--Martin Trigaux (mat)--
| 6 4 7
Grand Rosiere, Belgium
--Martin Trigaux (mat)--

Community manager: help with the code and translations contributions from the community on GitHub and Transifex.

Developed the gamification module and is also now responsible of the documentation and Point of Sale.

Martin Trigaux (mat)
On 4/29/16, 7:33 AM

You may want to check the following doc page


# current context is {'key1': True}
r2 = records.with_context({}, key2=True)
# -> r2._context is {'key2': True}
r2 = records.with_context(key2=True)
# -> r2._context is {'key1': True, 'key2': True}

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)


Asked: 4/29/16, 6:11 AM
Seen: 459 times
Last updated: 4/29/16, 8:32 AM