Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Delaying unlink or write on a model whose method was replaced raises AttributeError at enqueue time

未关闭
#996 0 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

已经有一个关联 PR 被合并了。

  • #998 来自 @akarazhev —— 已合并

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
停滞
技术栈
python
领域
backend

调研方向

Start by tracing the delayed-call method lookup and job serialization path described in the report, especially queue_job/job.py methods func, description, and _store_values. Reproduce the issue with the provided res.partner.unlink replacement and verify the behavior for both delayable() and with_delay(). Done means the job records and resolves the originally requested method name; an open linked pull request already addresses this issue.

由索引模型根据 Issue 内容生成。

描述

bug

Module

queue_job (18.0.1.3.0).

Describe the bug

A delayed call (delayable() and with_delay()) is recorded by the __name__ of the function that the
attribute lookup happened to return, not by the name that was looked up

 recordset_method = getattr(self.recordset, name)
self._job_method = recordset_method 

This leads to:

  File "queue_job/job.py", in _store_values
      "name": self.description,
  File "queue_job/job.py", in description
      elif self.func.__doc__:
  File "queue_job/job.py", in func
      return getattr(recordset, self.method_name)
  AttributeError: 'res.partner' object has no attribute 'unlink_renamed'

To Reproduce

Affected Versions:
Occured on 18.0 but code is unchanged on newer versions.

  cls = type(env["res.partner"])
  original = cls.unlink

  def unlink_renamed(self):
      return unlink_renamed.origin(self)

  unlink_renamed.origin = original
  cls.unlink = unlink_renamed

  partner = env["res.partner"].create({"name": "test"})
  partner.delayable().unlink().delay()

Expected behavior
The job records the method under the name it was requested with, and resolves
that name again, independent of what the attribute currently points at.

Additional context
Where this shows up in practice

auditlog (https://github.com/OCA/server-tools) installs its replacements as write_full and unlink_full into
the write and unlink slots, so any delayed write or unlink on an
audited model fails this way.

主要语言
Python
星标
271
派生
602
平均合并
5 天 1 小时
30 天内合并 PR
7

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

OCA/queue 的其他 Issue

查看 OCA/queue 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。