Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
6876 Lượt xem

Hello

I want to increment a ticket number field every time a new ticket is created. I have looked on this site and found the following code for EPR7


.xml

<record model="ir.sequence.type" id="seq_type_emp_id">

<field name="name">Employee Number</field>

<field name="code">hr.employee</field>

</record>

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

<field name="name">Employee Number</field>

<field name="code">hr.employee</field>

<field name="prefix"></field>

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

</record>

.py

my_sequence = self.pool['ir.sequence'].get(cr, uid, seq_obj_name)

self.write(cr, uid, [picking.id], {'ur_emp_no_field': my_sequence})


My questions:

It this the same for Odoo8?

Can it be used for just one field?

Is there additional things I need to do to get this to work?

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

it is the same for odoo8.


yes. change to your model name.

Ảnh đại diện
Huỷ bỏ
Tác giả

Do I just change "hr.employee" with my module name?

Câu trả lời hay nhất

I looked all over and the only tutorial or explanation that was in any way helpful is this excellent YouTube video from Odoo Mates, which completely solved the problem of adding auto-incrementing behaviour to a field

https://www.youtube.com/watch?v=Cz5eM5FDmTE

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 8 25
3282
1
thg 7 25
1464
1
thg 8 25
1152
0
thg 5 25
1811
2
thg 4 25
4073