Odoo Help

0

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

By
Odoo
on 4/29/16, 6:11 AM 727 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}

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.

Register

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)

Stats

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