This question has been flagged
2 Replies
3431 Views

Hi friends,

When we create a customer it should be stored in the table res_partner

But when we create a user it stored in res_user and res_partner..

What is the logic behind it??

Avatar
Discard

...?

Best Answer

A res.users class inherits from res.partner. The partner model is used to store the data related to the partner: lang, name, address. The user model is now dedicated to technical data.

Avatar
Discard

Ddnt understand,,,

Best Answer

The reason behind creating partner of that user and relating that with user table, is that from OpenERP 7 onwards, as they have given feature of messaging, it uses related partner for following particular record, sending message, and other messaging feature. And also any customer can also log a note into related invoice, and so on. So to make that central development, rather than creating different method to send messages from users, they have created a partner for related users and managing messaging from that user. Also if you notice, it is creating partner for company as well !

Avatar
Discard

Ok,But how can i filter the customers only when i use a many2one function from res_partners(Now it also displays the usersr also,bt i didnt need that)

There are 3 boolean fields that are available in res.partner that you can use for filtering. They are Customer (field name customer), Supplier (supplier), and Employee (employee). Any partner can have none (a very rare case), one, two, or all three fields checks, but basically if you are creating a Sale Order, the Customer field will filter res.partner that has Customer field checked. So, if you have a many2one field and you want to let user select only partners that are Customers, you can put a domain to that field: [('customer', '=', True)]

There is a field 'customer' in the res_partner model which is of type boolean you can always use that. This field doesn't get checked when partner is created for the user.