Odoo Help


[Solved] Ticket increment with a dynamic field: is this possible? - Odoo8

on 6/9/15, 5:10 AM 1,010 views

Thanks to earlier help I was able to get a ticket to increment at a number of my choice using this code:

<record id="seq_res_code_inh2" model="ir.sequence">

<field name="name">ticketnumber</field>

<field name="code">helpdesk.ticket</field>

<field name="padding">9</field>

<field name="number_next">20151000</field>

<field name="number_increment">1</field>


However, I need the number_next to be dynamic. mainly consisting of year, month and then 3 digits so I wrote this code:

currentyear = datetime.now().year

currentmonth = datetime.now().month

ticketinc = int(str(currentyear) + str(currentmonth) + "000")

When I try to use ticketinc instead of a number I get error message:

ParseError: "invalid literal for int() with base 10: 'ticketinc'" while parsing /home/vagrant/addons/helpdesk/helpdesk_view.xml:211, near

<record id="seq_res_code_inh2" model="ir.sequence">

<field name="name">ticketnumber</field>

<field name="code">helpdesk.ticket</field>

<field name="padding">9</field>

<field name="number_next">ticketinc</field>

<field name="number_increment">1</field>


Is there anyway to use this code so that I have a dynamic number instead of a static one?

Ankit Gauri
On 6/9/15, 5:55 AM

hello siobhan 

i am not sure it works or not but you can check this following url :

1 https://www.odoo.com/forum/help-1/question/changing-invoice-sequence-numbering-to-include-customer-reference-17213

2) https://www.odoo.com/forum/help-1/question/how-to-create-dynamic-number-of-users-in-odoo-8-75145

Thank You

Thank you so much Ankit... the first link worked.. instead of adding the information in Odoo, I used %(year)s/%(month)s in my code as a prefix and it worked perfectly.

on 6/10/15, 1:55 AM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 6/9/15, 5:10 AM
Seen: 1010 times
Last updated: 6/10/15, 1:55 AM