Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/356.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 要使用超级方法覆盖该方法吗_Python_Odoo - Fatal编程技术网

Python 要使用超级方法覆盖该方法吗

Python 要使用超级方法覆盖该方法吗,python,odoo,Python,Odoo,我想继承这个方法,并在odoo中使用super在这个方法中添加和act.done=False 此方法中的ready和act.done=False。你是想继承这个方法还是这是一个继承的方法?我已经覆盖了这个方法并添加了我的行,但是现在我想使用超级方法而不是覆盖整个方法。你可以在邮件模块res_user.py文件中看到这个方法superyour_modelname,self.name\u of the_method\u你想\u调用cr,uid,ids,context=context我想这是你要求的!

我想继承这个方法,并在odoo中使用super在这个方法中添加和act.done=False

此方法中的ready和act.done=False。你是想继承这个方法还是这是一个继承的方法?我已经覆盖了这个方法并添加了我的行,但是现在我想使用超级方法而不是覆盖整个方法。你可以在邮件模块res_user.py文件中看到这个方法superyour_modelname,self.name\u of the_method\u你想\u调用cr,uid,ids,context=context我想这是你要求的!您也可以在v13中使用super.writevals,无需提供类名和selfI只想添加和act.done=False,在这里user\u id=%user\u id用于此查询,但不知道如何使用super方法我知道上面的方法,但它对我没有帮助
@api.model
def systray_get_activities(self):
    # Here we totally override the method. Not very nice, but
    # we should perhaps ask Odoo to add a hook here.
    query = """SELECT m.id, count(*), act.res_model as model,
                    CASE
                        WHEN %(today)s::date -
                        act.date_deadline::date = 0 Then 'today'
                        WHEN %(today)s::date -
                        act.date_deadline::date > 0 Then 'overdue'
                        WHEN %(today)s::date -
                        act.date_deadline::date < 0 Then 'planned'
                    END AS states
                FROM mail_activity AS act
                JOIN ir_model AS m ON act.res_model_id = m.id
                WHERE user_id = %(user_id)s
                AND act.done = False
                GROUP BY m.id, states, act.res_model;