要使用超级方法来覆盖方法

时间:2020-02-27 07:52:30

标签: python odoo

@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;

我想继承此方法,并在odoo中使用super在此方法中添加(AND act.done = False)。

0 个答案:

没有答案