Hello !
I need your advice to populate field barcode in model employee with concatenation of field location_number in model work_location_id and sequence generated by automated action in odoo 15 ?
I want to automatically generate in the number field an identifier with this particular formatting (such as XX-YYYY-AAAAAAA) where X is generated from the number assigned instead of taking office of the employee since it is a company with several sites, Y is generated from the current year and A is generated from the number of files created
What did I do wrong in my code below ?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Accounting
- Inventory
- PoS
- Project management
- MRP
This question has been flagged
1049
Views
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign up
if not record.barcode:
xx = env['work.location.id'].get('location.number')
yyyy_aaaaaaa = env['ir.sequence'].next_by_code('matricule_')
record.write({
'barcode': xx + yyyy_aaaaaaa,
})
Hi, did you manage to figure this out?