Internal Reference - Auto Increment field
<p><a href="http://i.stack.imgur.com/PuAv9.png" rel="nofollow">enter image description here</a></p>

<p>Hello to all,</p>

<p>I need to know how to change the type of the field 'ref' (Internal Reference) from char to Auto Sequence. You can see on the picture the field. Everytime i create a new Contact, internal reference should auto increment by 1. For example first contact, Internal Reference  1 and so on.</p>

<p>Thank you,
Igor</p>

<p>Crreate a sequence and write it value to <code>ref</code>  </p>

<p><em>XML code</em>:  </p>

<pre><code>    &lt;record id="Your_sequence_type_id" model="ir.sequence.type"&gt;
        &lt;field name="name"&gt;Reference&lt;/field&gt;
        &lt;field name="code"&gt;Your_code&lt;/field&gt;
    &lt;/record&gt;

    &lt;record id="your_sequence_id" model="ir.sequence"&gt;
        &lt;field name="name"&gt;Reference&lt;/field&gt;
        &lt;field name="padding"&gt;3&lt;/field&gt;
        &lt;field name="code"&gt;Your_code&lt;/field&gt;
    &lt;/record&gt; 
</code></pre>

<p><em>Python code</em>: </p>

<pre><code>    ref = self.env['ir.sequence'].get(Your_code)
</code></pre>

python xml auto-increment odoo-9