Odoo Help

Welcome!

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.

0

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

By
Odoo
on 4/29/16, 6:11 AM 574 views

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

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

Martin Trigaux (mat)

--Martin Trigaux (mat)--
1775
| 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

https://www.odoo.com/documentation/9.0/reference/orm.html#openerp.models.Model.with_context

# 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)

Stats

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