Comment 182 for bug 1160365

Revision history for this message
Fabien (Open ERP) (fp-tinyerp) wrote : Re: [Bug 1160365] Re: [7.0] incorrect handling of contact/companies for invoicing and related purposes

Nicolas,

On 15/04/13 20:57, Fabien (Open ERP) wrote:
>> Some questions:
>> >
>> > - In my modules how do i know when partner_id is a contact or a company
>> > ? I have to check if parent_id exist or if commercial_id existe ? what
>> > is the way you think we should do it ?
> * is_company is checked if it's a company
>
> Please note that*you never need this*. Some data should belong to the
> company (account receivable, fiscal position) other data should come
> from the company (address, phone, email).
>
> If you need:
> - an account receivable: partner_id.commercial_id.account_receivable
> - an email: partner_id.email
>
> This always works for all kind of contacts and hierarchies:
> - subsidiaries of groups
> - single persons
> - main company
> - person representing a company
> - departments
>
> When you implement a module, if you think the pricelist should come from
> the company, you do this partner_id.commercial_id.pricelist or, if you
> think the pricelist belong to the contact, you do this:
> partner_id.pricelist.
>

I am sorry, but I may have created more confusion here. Everything
that's written above is correct, but it's even simpler than that.

You can *always do partner_id.the_field_i_need* and it works; no matter
if it's a company, a person, a representative of a company... The v7
model ensure that every record holds the right data. (e.g. "John Doe,
Acme" has the pricelist of Acme).

So, in your own module, you don't need to worry at all about
commercial_id. That's why community module should work nearly as it.

Fabien