There's more...

If you want to schedule an activity automatically, you can use the activity_schedule() method of the mail.activity.mixin model. This will create the activity on a given due date. You can schedule the activity manually with the activity_schedule() method, as follows:

@api.model
def create(self, vals):
res = super(LibraryBookRent, self).create(vals)
if res.return_date:
res.activity_schedule('mail.mail_activity_data_call',
date_deadline=res.return_date)

return res

This example will schedule call activity for the librarian whenever someone borrows a book. The deadline of the activity will be set as the return date of the book, so the librarian can make a call to the borrower on that date.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset