Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

1

How do I change the information that "Home address" displays in HR/Employees/Personal Information?

By
Bill Ennals
on 5/7/13, 2:15 AM 2,244 views

Currently both the 'Home Address' data in the Personal Information tab and the 'Working Address' data in the Public Information tab draw their data from the address fields in the matching 'Contact' form (which is I gather from the table 'res_partner').

I want the two fields to show different data - location of our business in 'Working Address' and the employees own private address in 'Home Address'. Is this possible? I can create new fields (x_privateemployeeaddress for example) and include them in the employee form, but is this the only way?

Thanks,

Bill.

I would suggest you should create custom module and in that module inherit employee object and view.

Sudhir Arya (SA)
on 5/7/13, 2:24 AM

Thanks Sudhir. Unfortunately I'm not advanced enough to be creating custom modules yet. I thought there might be an easy way (no coding that is) to change where that field pulls its data from.

Bill Ennals
on 5/7/13, 4:21 AM
0
duan yuanping
On 12/9/13, 11:54 PM

Hi Bill,

    you can specify different formats for different countries by change the field: **address_format** in the model: **res.country**.

Cheers.

0
arif
On 5/7/13, 3:08 AM

In order to hide Employee addresses from Customer and Supplier list, you can Uncheck 'Customer' and 'Supplier' from Partner form.

I solved with following code

class hr_employee(osv.osv):
    _inherit = "hr.employee"

    def create(self, cr, uid, data, context=None):
        if 'address_id' in data and data['address_id']:
            partner_ids = [data['address_id']]
            if 'address_home_id' in data and data['address_home_id']:
                partner_ids.append(data['address_home_id'])

            self.pool.get('res.partner').write(cr, uid, partner_ids, {'customer': False, 'supplier':False}, context=context)
        return super(hr_employee, self).create(cr, uid, data, context=context)

    def write(self, cr, uid, ids, data, context=None):
        if 'address_id' in data and data['address_id']:
            partner_ids = [data['address_id']]
            if 'address_home_id' in data and data['address_home_id']:
                partner_ids.append(data['address_home_id'])

            self.pool.get('res.partner').write(cr, uid, partner_ids, {'customer': False, 'supplier':False}, context=context)
        return super(hr_employee, self).write(cr, uid, ids, data, context=context)

So that whenever you create new employee, that addresses of employee does treat as neither customer nor supplier. You have to manually correct for existing employee addresses.

Thanks for your answer Arif. Would I be right in assuming that this code is inserted into an existing file in the OpenERP installation? It might be out of my league if that is the case.

Bill Ennals
on 5/7/13, 4:19 AM

Better to keep it in your own module instead of adding in existing file. You can find easily many documents and community answers on how to create custom module.

Otherwise you have to manually edit (Un check Customer ) for all employees contacts.

arif
on 5/7/13, 6:24 AM

Your Answer

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

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 5/7/13, 2:15 AM
Seen: 2244 times
Last updated: 3/16/15, 8:10 AM