[FIX] hr: fix badge generation for cashier

Open Employees>[DEMO]. Go to HR Settings and generate badge id
Now go to POS Settings, enable "Login with Employees". Now open
the session and login by scanning the [DEMO] employee badge.

The badge will not be recognized, this is caused by the fact that the
badge is 8 digits randomly generated, while the parser recognize
cashiers only if the barcode has a prefix of 041.

Fixed the badge id generation, and adjusted the length to other barcodes
in the system

opw-2151942

closes odoo/odoo#43228

X-original-commit: 90bcda64ba6058169b48ff8214e7c2a98eb9a0f8
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit is contained in:
Andrea Grazioso (agr-odoo)
2020-01-13 15:52:04 +00:00
parent 56588d126f
commit ba69b1d534
+1 -1
View File
@@ -291,7 +291,7 @@ class HrEmployeePrivate(models.Model):
def generate_random_barcode(self):
for employee in self:
employee.barcode = "".join(choice(digits) for i in range(8))
employee.barcode = '041'+"".join(choice(digits) for i in range(9))
@api.depends('address_home_id.parent_id')
def _compute_is_address_home_a_company(self):