Odoo Help

Welcome!

This community 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.

0

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

By
Siobhan
on 6/9/15, 5:10 AM 402 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?

2
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.

Siobhan
on 6/10/15, 1:55 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

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