Merge lp://staging/~openerp-community/openobject-server/contact-id-solution-for-v7-contact-management into lp://staging/openobject-server/7.0

Proposed by Raphaël Valyi - http://www.akretion.com
Status: Needs review
Proposed branch: lp://staging/~openerp-community/openobject-server/contact-id-solution-for-v7-contact-management
Merge into: lp://staging/openobject-server/7.0
Diff against target: 205 lines (+157/-0) (has conflicts)
2 files modified
openerp/addons/base/res/res_partner.py (+152/-0)
openerp/addons/base/res/res_security.xml (+5/-0)
Text conflict in openerp/addons/base/res/res_partner.py
To merge this branch: bzr merge lp://staging/~openerp-community/openobject-server/contact-id-solution-for-v7-contact-management
Reviewer Review Type Date Requested Status
Olivier Dony (Odoo) Disapprove
Review via email: mp+159316@code.staging.launchpad.net

Description of the change

See commit messages and bug comments please.

To post a comment you must log in.
Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote :
Download full text (8.5 KiB)

On a functional point of view
-----------------------------
Frustrations aside, I understand that you want to restore the semantics of the old 6.1 partner_id field because you're afraid of possible impacts on modules where this semantic change was not properly considered during the migration. So you want to hide the new model to them or delay it until the next version. However hiding the new model introduces dangerous inconsistencies and could be worse than really fixing the affected modules.

The rationale for the new model is presented here: http://bit.ly/17eMp8F (and will be updated with more technical details)

The change of semantics of the "partner_id" field is the *main part* of it. In the 7.0 model the partner_id field is the main and only reference to the person and business to which a document is related, and it carries the full information: contact + company. It is essential to realize this, and as important to deal with it properly when migrating modules to 7.0 as to deal with the removal of 'res.partner.address'.
Not many third-party modules have been migrated to v7.0 yet, and even in those that were, dealing with this fact properly is better and more future-proof than trying to partially hide the new model and delay the proper migration of the code to the next version.

By hiding the new model partially you instead create more (hidden) inconsistencies:

1. You mix different semantics in the models.
On some documents the "partner_id" field will carry the contact information, while on others it will only carry the company info and a second field has to be accessed for the contact. The only case where the "partner_id" really must point to the company information exclusively is the Journal Entries/Items, and this must be managed transparently by the core accounting module. Everywhere else in 7.0 the "partner_id" field should refer to the real "contact + company" pair, and there is no loss of information.
Yes there may be cases where reports need to aggregate data by company rather than contact, and this can be done easily as part of the migration: either join the right table in SQL directly or (for better performance) denormalize the company reference as an extra column in the documents directly. In the latter case the extra column must *not* be exposed and alterable by the user, it is an implementation detail of the reporting and must be automatically maintained by the system.
This is what we propose to do in the account_report_company module for invoices: an extra denormalized field "partner_commercial_id" is added to invoices in order to provide per-company Invoice reports without performance penalty. This field *must not* replace the main "partner_id" reference, it is a technical detail and not the main reference! It is *not* a simple name swap! It must *not* be alterable by the user!

2. You now have to manually deal with the propagation of the contact information.
As you've seen you now have to manually deal with contact info propagation, otherwise this information is simply lost. By hiding the new model on several models you will now force any custom module that alters the main workflows to deal with the contact propagation m...

Read more...

review: Disapprove
4945. By Sébastien BEAU - http://www.akretion.com

[IMP] add the possibility to group_by on contact

4946. By Sébastien BEAU - http://www.akretion.com

[IMP] mixin should also add the contact_id

4947. By Sébastien BEAU - http://www.akretion.com

[FIX] Removing the contact if it's used is not posible anymore

4948. By Raphaël Valyi - http://www.akretion.com

[FIX] fixed syntax error from previous commit

4949. By Raphaël Valyi - http://www.akretion.com

[IMP] splitted contact mixin into res.contact.mixin inherit res.contact.mixin.methods. Object inheriting from res.contact.mixin works the same, but now, in objects like project.project that inheritS from an object having the mixin can now inherit from just res.contact.mixin.methods so they get the right mixin methods, but without getting a redundant contact_id table. Seems to work great.

Unmerged revisions

4949. By Raphaël Valyi - http://www.akretion.com

[IMP] splitted contact mixin into res.contact.mixin inherit res.contact.mixin.methods. Object inheriting from res.contact.mixin works the same, but now, in objects like project.project that inheritS from an object having the mixin can now inherit from just res.contact.mixin.methods so they get the right mixin methods, but without getting a redundant contact_id table. Seems to work great.

4948. By Raphaël Valyi - http://www.akretion.com

[FIX] fixed syntax error from previous commit

4947. By Sébastien BEAU - http://www.akretion.com

[FIX] Removing the contact if it's used is not posible anymore

4946. By Sébastien BEAU - http://www.akretion.com

[IMP] mixin should also add the contact_id

4945. By Sébastien BEAU - http://www.akretion.com

[IMP] add the possibility to group_by on contact

4944. By Raphaël Valyi - http://www.akretion.com

[FIX] fixed reading single record, added advanced contact group to see both contact_id and partner_id, renamed a few methods to fake political correctness

4943. By Raphaël Valyi - http://www.akretion.com

[FIX] added mixin to be able to easily 'decorate' a v7 object having a partner_id field with a new contact_id field; this is what I consider a sane alternative to the other solution based on data duplication and semantic permutation of company and contact compared to v6.1

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.