The problem is that you're getting in self
a new recordset (odoo.models.NewId object at 0x7fe0c05717d0). Therefore, you're trying to get the write_date
of a record which has not been created yet. If the record has never been updated (even not created), it's not going to have a value in write_date
.
Remember that write_date
stores the latest date in which the record was updated.
So, first, at least, you must create the record, and then, you will be able to apply this: variable = self.write_date
.
But take a look at this:
What's happening with these transient models' IDs?
May be you get the write_date
without creating the record, give a try to this: variable = self._origin.write_date
.