Odoo Help


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

on 4/29/16, 6:11 AM 661 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)--
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 platform 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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


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