In Odoo, incoming contracts are defined as having state == 'draft' and
kanban_state == 'done'.
Currently, the employee contract calendars are synced when incoming
contracts are created, and incoming contracts' calendars are changed.
However, in many cases the incoming contracts are made for the future
and do not reflect the current employee's working schedule. This causes
there to be a calendar mismatch whenever incoming contracts are
created/updated, despite being set only for the future.
This fix checks the contracts_count field on the employee before
syncing the calendar, since the only time an incoming contract should
reflect the *current* calendar is if it's the only contract for the
employee.
closesodoo/odoo#142142
X-original-commit: 885f554c80028539415c294120c379ded33cd9ae
Signed-off-by: Bertrand Dossogne (bedo) <bedo@odoo.com>