Hi All,
Is there a way to auto confirm draft po's to confirm at lets say 15:00 hour?
and how can we do this?
Kind Regards,
Chris
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
Hi All,
Is there a way to auto confirm draft po's to confirm at lets say 15:00 hour?
and how can we do this?
Kind Regards,
Chris
Hi,
Your requirement is possible using scheduled action.
You can set up a scheduled action to initially run at 15:00 hours using
the Next Execution Date and then use 1 Day interval. Under the python
code section, you can call the python function, which is to confirm
purchase order.
It should look something like this:
from odoo import models, fields
class PurchaseOrder(models.Model):
_name = 'purchase.order'
def action_confirm(self):
for rec in self:
if rec.state == 'draft' or rec.state == 'sent':
rec.button_confirm()
You can read more about scheduled actions in this blog:https://www.cybrosys.com/blog/how-to-configure-scheduled-actions-in-odoo-15
Hope it helps
Hi,
By creating a scheduled action in the database, you can achieve this.
Scheduled action: https://www.youtube.com/watch?v=_P_AVSNr6uU
Thanks
Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.
Inscribirse
Hi,
Thanks for your reply. When i enter the code i get this error?
forbidden opcode(s) in "# Available variables:\n# - env: Odoo Environment on which the action is triggered\n# - model: Odoo Model of the record on which the action is triggered; is a void recordset\n# - record: record on which the action is triggered; may be void\n# - records: recordset of all records on which the action is triggered in multi-mode; may be void\n# - time, datetime, dateutil, timezone: useful Python libraries\n# - float_compare: Odoo function to compare floats based on specific precisions\n# - log: log(message, level='info'): logging function to record debug information in ir.logging table\n# - UserError: Warning Exception to use with raise\n# - Command: x2Many commands namespace\n# To return an action, assign: action = {...}\nfrom odoo import models, fields\nclass PurchaseOrder(models.Model):\n _name = 'purchase.order'\n def action_confirm(self):\n for rec in self:\n if rec.state == 'draft' or rec.state == 'sent':\n rec.button_confirm()": IMPORT_NAME, IMPORT_FROM, LOAD_BUILD_CLASS