Add to ability of a many2many relation to link the same field.

Registered by Nicolas DS

Many2many can:
- Link a table field, to another table field.
- Link in a table a field to another field of the same table. Parents <=> Childs

This blueprint:
- Link in a table a field to the same field: Example: equal <=> equal relation.

So it's a special case of many2many where:
class my_obj(osv.osv):
    _name = 'my_module.my_obj'
    _columns = {
        'link': fields.many2many('my_module.my_obj', 'my_module_my_obj_2_my_module_my_obj', 'my_obj', 'Linked ressources')
    }

Notice: col1 = col2

Why a special case of Many2many and not a new type (equal2equal) ?
 - Widgets don't need modification.

Blueprint information

Status:
Started
Approver:
None
Priority:
Undefined
Drafter:
None
Direction:
Needs approval
Assignee:
Nicolas DS
Definition:
Pending Approval
Series goal:
Proposed for trunk
Implementation:
Deployment
Milestone target:
None
Started by
Nicolas DS

Whiteboard

- It must be a check to avoid recursion, on write and read.
The main difficulty is the fact that col1 and col2 in the many2many relation table reflects the same object.
Example:

Equal2equal:
==========
many2many relation table is:
col1, col2
1, 2
4, 3
4, 1
2, 4

so:
many2many of
- 1 is 2, 4
- 2 is 1, 4
- 3 is 4
- 4 is 1, 2, 3

No Equal2equal m2m:
=================
The table for this relation is:
col1, col2
1, 2
4, 3
4, 1
2, 4
+
2, 1
3, 4
1, 4
4, 2

In a normal many2many you need twice of data to reach the same result.

(?)

Work Items

Dependency tree

* Blueprints in grey have been implemented.

This blueprint contains Public information 
Everyone can see this information.