This question has been flagged
1 Reply
4098 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>

</record>


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>

</record>


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

Avatar
Discard
Best Answer

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

Avatar
Discard
Author

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.

Hello,

Could you explain the path to change this.
Did not find ticket_number in v15.

Thanks for help.

Regards