openerp-expert-framework team mailing list archive
-
openerp-expert-framework team
-
Mailing list archive
-
Message #00256
Re: many2many: unique constraint
A Dijous, 8 d'abril de 2010, Dukai Gábor va escriure:
> Hi!
> There is a problem with the data integrity of relations stored in many2many
> fields. Currently code in OpenERP assumes that many2many relations doesn't
> have duplicates (object1 is not connected to object2 more than one time).
> However, those tables that store many2many relations allow the same
> object_id pairs get duplicated, and when that happens, code that uses the
> many2many field starts to misbehave.
>
> Examples:
> -Although the client theoretically doesn't allow this, a user managed to
> add the same sales tax to a product two times. The client doesn't display
> the same tax twice but the tax computing method in account.tax computes a
> double amount. You can imagine, with lots of products, how difficult it is
> to spot this kind of problems.
> -Adding relations one-at-a-time to a many2many field with [(4, object_id)]
> doesn't check if that relation has already been added or not.
>
> IMHO if the ORM set unique(object1_id,object2_id) for the relation tables
> would ensure that we are free from this kind of errors. I wonder why this
> check hasn't been added to OpenERP so far.
>
> What is the opinion of the experts on this matter?
I suggest you post a bug report. I think this should be fixed in stable
version.
>
>
> Regards,
> Gábor Dukai
>
> _______________________________________________
> Mailing list: https://launchpad.net/~openerp-expert-framework
> Post to : openerp-expert-framework@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~openerp-expert-framework
> More help : https://help.launchpad.net/ListHelp
>
--
Albert Cervera i Areny
http://www.NaN-tic.com
OpenERP Partner
Mòbil: +34 669 40 40 18
Follow ups
References