Don't compute it for public user that can have thousand of SO Improve request to find the last one. 'Sent' state should be included, but in case of wire transfer, state is sent, while we should not be able to update this order. -> to imp in master Courtesy of @nseinlet that spotted this issue and propose similar fix This commit closes #27779 #28158 closes odoo/odoo#28164