Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
2092 Weergaven

I inject messages to Contacts using the API every night using a script, these messages come from another (legacy) system.  The messages injected through the API are not correctly sorted in time in the Odoo UI.  How to correctly timestamp (or sort?) the mail.message message?


Example code below


I played with create_date, write_date, date, ... and any other combination... the messages show up in the contact notes (including correct timestamps!) however not sorted... How can I inject in mail.message so that messages correctly sort in the Odoo UI?


All suggestions welcome!

code snippet that injects the message:

newid = self.dump_models.execute_kw(self.dump_db, self.dump_uid, self.dump_password, 'mail.message', 'create', [{

'model': 'res.partner',

'res_id': ids[0]["id"],

'body': note,

'author_id': authorid,

'create_date': '2020-12-11 20:14:12', 'date': '2020-12-11 20:14:12', 'write_date': '2020-12-11 20:14:12'

}])

feedback = "PASS - note added".format(ids[0]["email"])

print("PASS - note added id {}".format(newid))

#results = self.dump_models.execute_kw(self.dump_db, self.dump_uid, self.dump_password,

# 'mail.message', 'write', [[newid], {'create_date': '2020-12-11 20:14:12', 'date': '2020-12-11 20:14:12', 'write_date': '2020-12-11 20:14:12' } ] )

#print(" datechanged {} {}\n".format(len(results),results))

Avatar
Annuleer