hi,
Kindly advise how to create auto number in helpdesk? I need to have an ID everytime i create help desk.
Thanks.
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
hi,
Kindly advise how to create auto number in helpdesk? I need to have an ID everytime i create help desk.
Thanks.
Hi,
If you are looking to add sequence number for your model, what you have to do is that,
In the xml,
<record id="seq_sample_name" model="ir.sequence">
<field name="name">Sample Name</field>
<field name="code">model_name</field>
<field name="prefix">PRE</field>
<field name="padding">3</field>
<field name="company_id" eval="False"/>
</record>
Then in the Python inside the corresponding model, you can override the create method and assign the sequence number,
@api.model
def create(self, vals):
if vals.get('name', _('New')) == _('New'):
vals['name'] = self.env['ir.sequence'].next_by_code('model_name') or _('New')
res = super(ClassName, self).create(vals)
return res
Also define a field to assign the sequence,
name = fields.Char(string='Order Reference', required=True, copy=False, readonly=True,
index=True, default=lambda self: _('New'))
Thanks
Hi Cybrosys,
Thank you for your response. But can i do it on UI only?
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign up