I'm looking for a possibility to add multiple emails, phone numbers and addresses to one customer/company. I know it is possible by adding another contact in a 'contact' tab, but - honestly - I'd prefer not to, as it creates another contacts in the customer views (which becomes overwhelming eventually). Ideally, the customer view should have a button to add another address/phone/email and store that data in the database. Also, I'd love to assign one persona-partner to multiple company-partner, hence create many2many relationship in res.partner's parent_id. Now it's only a one-way ticket.
I am wondering here if such a module(s) giving these abilities is somewhere around (I had no luck trying to find one... :( ). If not, I imagine that can be achieved by altering the res.parner's table structure. Adding additional fields, like x_phone2, x_email2 etc. seems to be the easiest solution, but I don't know how much e.g. emails I will have to store in the db. Hence my another question: what would be a rule of thumb to transfer the given fields into the arrays, resize them, and accessing if needed? :)
I can provide you with more details if something is unclear or too blurry. ^^
There are a few options here. By default you won't be able to add multiple addresses, emails, phone numbers, .. to a customer but you could add this by code.
One option would be, as you said, to add new fields to the res.partner table and show these fields in the view. The problem here however is that you do not need how many you need and this option is not dynamic.
Your second option, and I believe the best if I understand you correct, is to add a new tab and program a many2many relation in your model. Create a many2many from the table res.partner and then show this new field in the view.
Your code would look something like this..
.py (model) file:
'x_extra_addresses': fields.many2many('res.partner', 'custom_model_name, 'field_name_1', 'field_name2', string="Extra addresses"),
.xml (view) file:
<page string="Extra addresses">
<label for="x_extra_addresses" string="Externe personen betrokken bij dit project"/>
Which would give you a new tab that looks something along these lines:
Note: this code should fully work but I did not test this, this is just a sample and you will probably still need to tweak some minor things. It is just a concept, or a possible way.
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!
About This Community
|Asked: 10/25/13, 7:25 AM|
|Seen: 6327 times|
|Last updated: 4/18/16, 11:02 AM|