Fix code that clashes with the new API in several places, and merge from odoo/master