-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[IMP] Add possibility to handle multiple addresses, emails and phones per partner #1
Comments
👍 |
I think this is the way it should have been done from the beginning. However, it is also important to be as backward compatible as possible because in addition to the standard modules there are many public and private modules that assume the current address model. Changing the data model to possibility 1 will effectively make it impossible to for those module to work "out of the box" with your module. In light of this I am in favor of possibility 2. |
Take a look at: tko_partner_multiple_phones and tko_partner_multiple_emails in https://github.com/thinkopensolutions/tkobr-addons |
It's much more simple. Wishing this helps... |
Hi, I have another approach to simplify the code structure, no need to create new models res.partner.address, res.partner.email, res.partner.phone but still ensure our expected result. We just use the existing res.partner model with field parent_id and child_ids, but need to do some adjustments. Assumptions:
Company Partner (res.partner with is_company=True):
Contact Partner (res.partner with is_company=False):
Set default values:
Just an idea, not sure it will work perfectly. |
Thanks for the participation so far. One more thing (don't know why I forgot it): we already use a customized company / partner / address / email handling in one of our customer projects. We need the structure described in the issue above and we thought it is time to cleanup our project implementation and provide a more general solution with a complete separation of addresses, emails and phones. And cause we already worked with OpenERP v6.1 in the past we thought it would be a good try to solve this "issue" like it was done in v6.1. Another reason for the separation of the addresses at least: Currently we have 38760 addresses in our customer project and it will be more and more. We store them as res.partner objects (total count of res.partner entries is 92243 now), like @lehi3u1989 also suggested. We also extend res.partner with custom fields which results in 83 fields which will be stored for each res.partner entry. But we only want to store real address data like street, street2, zip, city, state_id, country etc., lets say 10 fields per address entry (for email and phone it should be far less data to store). Now we store the whole 83 fields for each address which is an unnecessary overhead in my opinion. @anajuaristi This was our first solution in the beginning of the project but it wasn't manageable in a proper way for our customer and their needs. @mtelahun, @lehi3u1989 Like mentioned above we already have a customized handling. But I will look at your suggestions / modules because it sounds similar to our approach. Maybe this kind of address, email and phone separation is to specific to provide it as general solution, I don't know. Also a good point from @mtelahun is the backward compatibility to avoid rewriting each custom module which uses res.partner in some way. More ideas, suggestions, discussions are welcome. |
You might be interested in this old thread: https://bugs.launchpad.net/openobject-server/+bug/1151947 |
Judging by your two cases I would go with case 2. If you would choose for option 1 you would have to write a lot of |
Internally we also think what solution 2 is the best way to go. We just wanted to get some more information so we may did not oversaw some outcomes. |
We solved the need of customer with solution similar to one suggested by @lehi3u1989 on v8 and it works fine for now. |
@rruebner can you maybe check. Thanks |
We want to add the possibility to handle multiple addresses, emails and phones per partner. Based on OpenERP v6.1 we want to add new models to store address (res.partner.address), email (res.partner.email) and phone (res.partner.phone) data. The partner views will also be updated to illustrate the new handling. For the beginning we concentrate on odoo v8 but it is intended to do it also for v9.
The structure should look like
The more interesting (and difficult) part is which other code parts we have to change. We end up in two possibilities.
Possibility 1
Like in v6.1 we check all res.partner relation fields and replace the needed relations with res.partner.address. In addition we have to update a lot of code and template parts to use the new relation in a correct way. We have to do it in a similar way for res.partner.email and res.partner.phone (replace the email and phone fields in res.partner).
Possibility 2
Instead of replacing the res.partner fields we use related fields to match the address fields. Therefore we add a new preferred field for address, lets call it preferred_address, which is related to res.partner.address. Now we change the res.partner street field to a related field which points to the res.partner.address street field and do that with all other address data (type, street2, city, zip, state_id, country_id). res.partner.address has also a preferred field (boolean) which controls which address is used in the res.partner preferred_address field.
We use another approach for email and phone fields. I will show the approach only for email because it is the same like for phone. The new model res.partner.email contains the fields type (private, business etc.), email (the email address) and preferred (boolean). The preferred field controls which email is used in the res.partner email field.
The advantage is that we don't need to update much code parts because we continue to use odoo res.partner fields like street, city, email etc. One disadvantage is that we are limited to the preferred selection, means that we can't change the used address in sale orders for example.
What do you think?
Is someone already working on it?
Does somebody knows if odoo plans to add multiple address, email and phone handling?
Do you have better ideas / approches / solutions?
The text was updated successfully, but these errors were encountered: