When doing a quote on a sale, there’s a decorator to set the employee who did the quotation (Sale quoted by …) and a reset decorator to remove the employee when sale is draft.
To update a date on a move created when quoting a sale (custom code), we reset the sale to ‘draft’ state and then we set the sale in ‘quoting’ state to recreate the move with the correct date.
We’ve created a daily cron to do such operation to update outdated moves on quoted sales. As the cron is executed by root, we noticed that the field “Quoted by” is now empty for the sales that were processed because there’s no current employee linked to root user.
- Is there a way to keep the field “Quoted by” unchanged ?
- Could I bypass decorators “set_employee” and “reset_employee” when doing “draft” and “quote” on the sale?
- Or should I store in a variable the value of the field “quoted_by” before processing then writing the value in the field after processing ?
Thanks for help