[FIX] core: do not flush() with an environment using RequestUID
[FIX] core: do not flush() with an environment using RequestUID

When routing an HTTP request, the dispatcher uses an environment with a
placeholder for the user (the object `RequestUID`).  This environment is
not supposed to be used after routing has been done.  However, the
flushing function takes any environment with a given cursor, and it
crashes when this environment is chosen (`psycopg2` cannot adapt the
type `RequestUID` for `write_uid`), and simply does not make sense.

closes odoo/odoo#48495

X-original-commit: da61a64bf6731a08557d23680eabf4d910035ebd
Signed-off-by: Raphael Collet (rco) <fcee45b878db1f337818c5c606c1542797080a40@openerp.com>

ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo