I'm working on the project.task module. I extended the model with a datetime field and extended the view so that I set the attribute required to true. Now I need a to fill this fields with a button so the user can "take" the task.
But when the button is pressed I get the red popup "The following fields are invalid".
def take_over_task(self): uid = self._context.get('uid') now = datetime.now(pytz.timezone('Europe/Ljubljana')) self.sudo().task_start = datetime.strftime(now, DEFAULT_SERVER_DATETIME_FORMAT) self.sudo().date_deadline = datetime.strftime((now + timedelta(days=1)), DEFAULT_SERVER_DATETIME_FORMAT) self.sudo().user_id = uid
I know I could just execute a SQL and write this fields directly into the DB, but would like to do this a better correct way.