Skip to Content
Menu
This question has been flagged
1 Reply
3322 Views

How to create leads, Projects, and Project sub-tasks in the Sequence number. example 


for Lead(LEAD001)

for Projects (PR001)

for project Subtaks (PR001/SUB001)


I am using odoo 16.3 enterprise edition.


Can anyone help me with this?

Avatar
Discard
Best Answer

Hi,To create a sequence number in Odoo 16 through XML, you need to define the sequence in an XML file and then load the file into your Odoo module. Here are the steps:
In the XML file, define the sequence using the “ir.sequence” tag. Here’s an example:

<?xml version="1.0" encoding="utf-8"?>
<odoo>
  <data noupdate="1">
    <record id="crm_lead_sequence" model="ir.sequence">
      <field name="name">Crm Lead Sequence</field>
<field name="code">crm_leads_sequence</field>
      <field name="prefix">LEAD</field>
      <field name="padding">5</field>
      <field name="number_next">1</field>
    </record>
  </data>
</odoo>


Save the XML file and include it in your module’s manifest file.
And add function for the sequence as depicted in the following set of code.
@api.model
def create(self, vals):
    vals['name'] = self.env['ir.sequence'].next_by_code('crm_leads_sequence')
    return super(MyModel, self).create(vals)For more reference, you can use this link: https://www.cybrosys.com/blog/how-to-create-sequence-numbers-in-odoo-16


Hope it helps

Avatar
Discard

Hi there, is this possible in a Standard subscription?