Hi,
You can have better understanding with an example:
in your xml file, you can define the sequence with the prefix or suffix you need:
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="1">
<record id="seq_invoice_code" model="ir.sequence.type">
<field name="name">Invoice</field>
<field name="code">account.invoice</field>
</record>
<record id="seq_invoice" model="ir.sequence">
<field name="name">Invoice</field>
<field name="code">account.invoice</field>
<field name="padding">5</field>
<field name="prefix">fact</field>
<field name="suffix">A</field>
</record>
</data>
</openerp>
in your .py file, you can define the readonly field and override the create() to get the sequence on that field:
class account_invoice(models.Model):
_inherit = "account.invoice"
inv_code = fields.Char(string='Code', readonly=True)
@api.v7
def create(self, cr, uid, vals, context=None):
vals['inv_code'] = self.pool.get('ir.sequence').get(cr, uid,'account.invoice')
return super(account_invoice, self).create(cr, uid, vals, context=context)
You can then call this field in the form view wherever you want, by inheriting the corresponding form view.
And you may also check all the sequences available in your current database and can also modify from here:
Settings >> Technical >> Sequences & identifiers >> Sequences
Hope this helps!
ok thanks you, I will try it and I will comment the result :)
try this: https://learnopenerp.blogspot.com/2020/08/generate-create-sequence-number-odoo.html