Siirry sisältöön
Menu
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Tämä kysymys on merkitty
1 Vastaa
5075 Näkymät

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
Hylkää
Paras vastaus

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
Hylkää
Tekijä

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

Aiheeseen liittyviä artikkeleita Vastaukset Näkymät Toimenpide
2
kesäk. 15
4925
2
jouluk. 22
15011
1
marrask. 21
5142
3
lokak. 21
24388
0
tammik. 21
2427