Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
1646 มุมมอง

i want to generate emp code sequentially with company name, year and number like "CSM19001" .  how it is please let me know.

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

You need to create ir.sequence for that but you will have to enter the company name manually.

Sequence:

Prefix: CSM%(year)s 
Padding: 3
Code: hr.employee

Create sequence with the given prefix and padding and call it from the create / write method as follow.

vals['code'] = self.env['ir.sequence'].next_by_code('hr.employee') or '-'


อวตาร
ละทิ้ง