openerp - res.partner: default value depending on company type
<p>When creating a new contact, I would like to set "Customer" to True and "supplier" to False if the contact is "Individual" and vice versa: if the contact is Company : Set "customer" to False and "supplier" to True. </p>

<p>I've tried to make some changes in xml file so far but nothing happns..</p>

<pre><code>&lt;field name="supplier"&gt;{[('is_company','=', True)],'default_customer': 0,'default_supplier': 1} &lt;/field&gt;
</code></pre>

<p>Any suggestions?</p>

<p>Thank you in advance</p>

<p>Hereafter my .py</p>

<pre><code># -*- coding: utf-8 -*-
from openerp.osv import fields, osv
import time
import datetime
from datetime import datetime, date, time
from openerp import api 


class mypartner_custom(osv.osv):
    _inherit = 'res.partner'

    _columns = {

            'plafond_credit' : fields.float(string = 'Plafond Crédit',digits=(6,2)),
            'cin' : fields.char(string = 'CIN', size=15),


            }
mypartner_custom()

@api.onchange('is_company')
def change_company_type(self):
   if self.is_company == True:
      self.customer = False
      self.supplier = True
   else :
      self.customer = True
      self.supplier = False
</code></pre>