Avoid permuation of relation type when writing on reverse relation

The relation type must also be permutated.

issue4262
review12641003

--HG--
extra : rebase_source : 280a85d62f2744c45340c02ec647a3f46c3f7b29
Add test when writing type on reverse relation

issue4262
review12641003

--HG--
extra : rebase_source : dba396e269b27667eefedffa37336fb6ec5fe700