Skip to Content
Menu
This question has been flagged
1765 Views


I need to filter a content of 2 relational fields 

My case is I have Person that have enemy list and only one best friend.

It is required that one person can not be a friend and an enemy of another.

So I need if person is in the enemy list to not be shown in the best friend selection and

the opposite if a person is best friend to not be shown in enemy selection

Also that a person can not be best friend and enemy to it self.


Avatar
Discard
Author

example code: person.py # -*- coding: utf-8 -*- from openerp import models, fields, api class person(models.Model): _name = 'Person' _description = 'Person is a human being with a name’ name = fields.Char('Name') enemyRecordset = fields.Many2many(comodel_name='person', relation='person_rel', column1='person1_id', column2='person2_id', string='Enemy') bestFriendRecordset = fields.Many2one('person', 'Best Friend’) person_view.xml name="groupLeft">