c2c-oerpscenario team mailing list archive
-
c2c-oerpscenario team
-
Mailing list archive
-
Message #28985
[Bug 813375] Re: [Feature Request] Support m2m throught a custom object
** Changed in: openobject-server
Importance: Undecided => Wishlist
** Changed in: openobject-server
Status: New => Confirmed
** Changed in: openobject-server
Assignee: (unassigned) => OpenERP's Framework R&D (openerp-dev-framework)
--
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.
https://bugs.launchpad.net/bugs/813375
Title:
[Feature Request] Support m2m throught a custom object
Status in OpenERP Server:
Confirmed
Bug description:
Hi,
I would like to propose an improvement for the many2many fields in the
future 6.1. Currently, OpenERP automatically create and fille a
relation table containing two columns, to make a link between objects
of a m2m relation.
The problem is that you can't add extra column to this table easily.
An workaround is to define a "link object" by yourself, like this :
class PartnerAddressRelation(osv.osv):
_name = 'partner_address_rel'
_columns = {
'partner_id' : fields.many2one('res.partner'),
'address_id' : fields.many2one('res.partner'),
'...' : ... other columns ...
}
By doing this, we loose all the m2m advantages : the widget in client
(instead, we see the relational table, not the related object). This
is a really missing feature, because sometimes you have to store
information "When this client subscribed this contract". And the table
which links clients to contracts is the good place to store this.
Implementation proposal :
I think fields.many2many should support a "throught" argument, to
specify the object which do the link. We could either use the old
system, or pass a "throught" argument (which would ignore others m2m
arguments). Example :
class Partner(osv.osv):
_name = 'res.partner'
_columns = {
'contracts' : fields.many2many('Contracts', throught='partner_contracts_rel')
}
class PartnerContractsRelation(osv.osv):
_name = 'partner_contracts_rel'
_columns = {
'partner_id' : fields.many2one('res.partner'),
'contract_id' : fields.many2one('contract'),
'subscription_datetime' : fields.datetime('Subscribed'),
}
When displaying the 'contracts' field in the res.partner form view,
OpenERP should display a m2m widget, with "extra" relational columns :
subscription_datetime, and related objects columns (contracts objects
columns).
We should also support a way to modify the extra fields into the
relational table easily.
What do you think about this ? Thanks to propose your ideas :-)
To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-server/+bug/813375/+subscriptions
References