I currently have an onchange function that works every time I change the user but I wondering if it is possible that this function can work on 2 fields using an OR? for example: add text to description field if user OR status is changed in the ticket.
@api.onchange('responsible_id' or 'state')
def _update_resolution(self):
fmt = "%Y-%m-%d %H:%M:%S %Z%z" #datetime format
user = self.env.user
context_tz = pytz.utc
if (user.partner_id.tz):
context_tz = pytz.timezone(user.partner_id.tz)
now_utc = datetime.datetime.now(pytz.utc)
now_user_dt = now_utc.astimezone(context_tz)
resolution = ""
resolution_format = "** {0:s}: {1:s}:-\n{2:s}"
if (self.resolution):
resolution = self.resolution
resolution_format = "** {0:s}: {1:s}:-\n\n\n{2:s}"
self.resolution = resolution_format.format(user.name, str(now_user_dt.strftime(fmt)), resolution)
Not getting any error but it is not working as I expected
Try following,