This patch fixes issue #3258

I rebase my PR on oca/ocb!