Set button decorator of update Peppol status to a different method than the cron
The `ModelView.button` decorator requires to be called with a list of records which the cron does not do. Closes #14972 (grafted from d3bdcee315895e3fc4a636c14dad5ba592912c59) --HG-- branch : 8.0
This commit is contained in:
@@ -239,13 +239,17 @@ class Peppol(Workflow, ModelSQL, ModelView):
|
||||
self.succeed()
|
||||
|
||||
@classmethod
|
||||
@ModelView.button
|
||||
def update_status(cls, documents=None):
|
||||
if documents is None:
|
||||
documents = cls.search([
|
||||
('direction', '=', 'out'),
|
||||
('state', '=', 'processing'),
|
||||
])
|
||||
cls.update_status_button(documents)
|
||||
|
||||
@classmethod
|
||||
@ModelView.button
|
||||
def update_status_button(cls, documents):
|
||||
for document in documents:
|
||||
document._update_status()
|
||||
cls.save(documents)
|
||||
|
||||
Reference in New Issue
Block a user