Skip to content

Commit

Permalink
Fixed error when running cron job
Browse files Browse the repository at this point in the history
  • Loading branch information
ozoromo committed Apr 26, 2024
1 parent 4d0963a commit 02cb306
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions abandoned_carts/wizard/customer.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def set_fix_customer(self):
system_user_filter = ""
if system_user:
system_user_filter = "and p.create_uid=" + str(system_user.id)
qry = """
qry = f"""
SELECT p.id
FROM res_partner p
left join res_users ru on ru.partner_id=p.id
Expand All @@ -73,24 +73,23 @@ def set_fix_customer(self):
NOT EXISTS (SELECT 1 FROM account_move_line line WHERE line.partner_id = p.id) and
NOT EXISTS (SELECT 1 FROM project_task task WHERE task.partner_id = p.id) and
(SELECT count(*) from res_groups_users_rel where
gid = (select id from res_groups where id=%d) and uid=ru.id)=0 and
gid = (select id from res_groups where id=%s) and uid=ru.id)=0 and
(SELECT count(*) from res_groups_users_rel where
gid = (select id from res_groups where id=%d) and uid=ru.id)=0 and
gid = (select id from res_groups where id=%s) and uid=ru.id)=0 and
p.parent_id is NULL and
p.is_company = False and
p.id not in (select partner_id from res_users union all select partner_id
from res_company order by partner_id)
%s
{system_user_filter}
order by p.id desc
limit %d
limit %s
"""

self._cr.execute(
qry,
(
user,
user_internal,
system_user_filter,
max_delete_batch_limit,
),
)
Expand Down

0 comments on commit 02cb306

Please sign in to comment.