Auto Number Generate in OpenERP
Simply just create a new file .xml
lib.resource = table name
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="1">
<!-- Sequences for lib.resource -->
<record id="seq_type_library_sub_ resource" model="ir.sequence.type">
<field name="name">Library Resource</field>
<field name="code">lib.sub.resource</ field>
</record>
<record id="seq_library_sub_resource" model="ir.sequence">
<field name="name">Library Resource</field>
<field name="code">lib.sub.resource</ field>
<field name="prefix">BC</field>
<field name="padding">10</field>
</record>
</data>
</openerp>
Or
simply write below code in your view.xml file
<record id="seq_type_library_sub_ resource" model="ir.sequence.type">
<field name="name">Library Resource</field>
<field name="code">lib.sub.resource</ field>
</record>
<record id="seq_library_sub_resource" model="ir.sequence">
<field name="name">Library Resource</field>
<field name="code">lib.sub.resource</ field>
<field name="prefix">BC</field>
<field name="padding">10</field>
</record>
and in your .py file in _default simply write the below code
_defaults :
{
'number': lambda obj, cr, uid, context: obj.pool.get('ir.sequence'). get(cr, uid, 'lib.resource'),
}
Simply just create a new file .xml
lib.resource = table name
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="1">
<!-- Sequences for lib.resource -->
<record id="seq_type_library_sub_
<field name="name">Library Resource</field>
<field name="code">lib.sub.resource</
</record>
<record id="seq_library_sub_resource" model="ir.sequence">
<field name="name">Library Resource</field>
<field name="code">lib.sub.resource</
<field name="prefix">BC</field>
<field name="padding">10</field>
</record>
</data>
</openerp>
Or
simply write below code in your view.xml file
<record id="seq_type_library_sub_
<field name="name">Library Resource</field>
<field name="code">lib.sub.resource</
</record>
<record id="seq_library_sub_resource" model="ir.sequence">
<field name="name">Library Resource</field>
<field name="code">lib.sub.resource</
<field name="prefix">BC</field>
<field name="padding">10</field>
</record>
and in your .py file in _default simply write the below code
_defaults :
{
'number': lambda obj, cr, uid, context: obj.pool.get('ir.sequence').
}