تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
28236 أدوات العرض

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}
الصورة الرمزية
إهمال