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)
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
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)
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}
As this post has been a while. Here is the link for V15: https://www.odoo.com/documentation/15.0/developer/reference/backend/orm.html#altering-the-environment
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng ký
1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.