how to create auto increment field in odoo 9
<p>In my model, I want to create auto increment field, I 've tried to follow some tuts unfortunately all tutorials just working in odoo 8 to under.
I just follow instruction from some threat in odoo 9 in this link 
<a href="http://stackoverflow.com/questions/39266106/auto-increment-internal-reference-odoo9">auto increment - internal reference odoo9</a>
It was working by answer of <a href="http://stackoverflow.com/users/3734244/danidee">http://stackoverflow.com/users/3734244/danidee</a>
but still not working for me. Here is my model:</p>

<pre><code>class cashadvance(osv.osv):
    _name = 'comben.cashadvance'
    _columns = {
        'sequence_id': fields.char(string='Sequence ID', help="Auto Generate"),
    }

 @api.model
    def create(self, vals):
        vals['sequence_id'] = self.env['ir.sequence'].get('seq.cashadvance')
        return super(cashadvance, self).create(vals)
</code></pre>

<p>and this is my xml :</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;openerp&gt;
    &lt;data noupdate="1"&gt;
        &lt;record id="cashadvance_seq" model="ir.sequence"&gt;
          &lt;field name="name"&gt;No_PD&lt;/field&gt;
          &lt;field name="padding"&gt;3&lt;/field&gt;
          &lt;field name="code"&gt;seq.cashadvance&lt;/field&gt;
        &lt;/record&gt;
    &lt;/data&gt;
&lt;/openerp&gt;
</code></pre>

<p>the code above showing no error but the sequence_id field keep empty when I click save button.
Help me Please...</p>

<p>Try with following code.</p>

<p>Replace <em>create</em> method with</p>

<pre><code>@api.model
def create(self, vals):
    vals['sequence_id'] = self.env['ir.sequence'].get('comben.cashadvance')
    return super(cashadvance, self).create(vals)
</code></pre>

<p>Replace <em>xml</em> file with</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;openerp&gt;
    &lt;data noupdate="1"&gt;
        &lt;record id="cashadvance_seq" model="ir.sequence"&gt;
          &lt;field name="name"&gt;No_PD&lt;/field&gt;
          &lt;field name="padding"&gt;3&lt;/field&gt;
          &lt;field name="code"&gt;comben.cashadvance&lt;/field&gt;
        &lt;/record&gt;
    &lt;/data&gt;
&lt;/openerp&gt;
</code></pre>

<p>Afterwards restart odoo server and upgrade your module.</p>

<p>NOTE:</p>

<p>When you upgrade module and it has <em>.xml</em> file with <em></em> will not upgrade. So first remove <em>noupdate="1"</em> attribute and upgrade module. Check flow. It should work fine. Don't forget to place again <em>noupdate="1"</em> on sequence view file.</p>

<p>Make sure you have given .xml file in __ <em>openerp</em>__.py file </p>

python python-2.7 openerp odoo-9