Delaying unlink or write on a model whose method was replaced raises AttributeError at enqueue time
Mantenedores costumam responder em até 1 dia
Um pull request relacionado já foi integrado.
- #998 de @akarazhev — integrado
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 35/100
Direção de pesquisa
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.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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.
- Linguagem predominante
- Python
- Estrelas
- 271
- Forks
- 602
- Merge médio
- 4d 4h
- PRs com merge (30d)
- 6
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Sem modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de OCA/queue
-
enhancement
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 30/100
Mantenedores costumam responder em até 1 dia
-
Migration to version 20.0Abertahelp wanted no stale work in progress
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 35/100
OCA/queue#1002 · 2 comentários ·
Mantenedores costumam responder em até 1 dia
-
[19.0] queue_job: Jobs stay pending after the jobrunner's database connection is silently droppedTalvez já em andamento @HoloborodkoBohdan assumiu há 32 dias. Abertabug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 25/100
OCA/queue#984 · 1 comentário · 1 reação ·
Mantenedores costumam responder em até 1 dia
-
enhancement
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 35/100
Mantenedores costumam responder em até 1 dia
-
enhancement
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 35/100
OCA/queue#964 · 1 comentário · 1 reação ·
Mantenedores costumam responder em até 1 dia
Issues semelhantes
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 86/100
NousResearch/hermes-agent#147104 ·
Mantenedores costumam responder em até 1 dia
-
[oblt-aw][autodoc] Document new required `shared-org-key` input for `obs-aw-dependency-review`Talvez já em andamento @github-actions assumiu hoje. Aberta
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 90/100
Mantenedores costumam responder em até 1 dia
-
bot-triaged module: inductor oncall: pt2 topic: fuzzer triaged
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
Mantenedores costumam responder em até 1 dia
-
getchaintips leaves out the active tip once a header is staged on it, where Core always lists itAberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 88/100
btclib-org/btclib-node#2158 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
patrick-hudson/put.gd-desktop#979 · 1 comentário ·
Mantenedores costumam responder em até 1 dia