'Read/Write RPC access to restricted field should be forbidden'

@mute_logger('odoo.models')
def test_field_crud_restriction(self):

    partner = self.env['res.partner'].browse(1).sudo(self.demo_user)
    has_group_system = self.demo_user.has_group(GROUP_SYSTEM)
    self.assertFalse(has_group_system, '`demo`    user    should    not    belong    to    the    restricted    group')
    self.assert_(partner.read(['bank_ids']))
    self.assert_(partner.write({'bank_ids': []}))
    self._set_field_groups(partner, 'bank_ids', GROUP_SYSTEM)
    with self.assertRaises(AccessError):
        partner.read(['bank_ids'])
    with self.assertRaises(AccessError):
        partner.write({'bank_ids': []})
    self.erp_system_group.users += self.demo_user
    has_group_system = self.demo_user.has_group(GROUP_SYSTEM)
    self.assertTrue(has_group_system, '`demo`    user    should    now    belong    to    the    restricted    group')
    self.assert_(partner.read(['bank_ids']))
    self.assert_(partner.write({'bank_ids': []}))
