[FIX] point_of_sale: prevent traceback while creating new pos category

When user create a pos category from 'restaurant.printer' model in
'pos_restaurant' module. it will give an error with the
 message -

'sequence item 0: expected str instance, bool found'

Steps to Produce:-

1. Install 'pos_restaurant' module
2. Go to 'point_of_sale' module
3. Go to 'Configuration' -> 'Order Printers'
4. Click on any printer or create new
5. Under 'Printed Product Categories' click 'Add a line'
6. Click 'New'

Trace-back will be generated.

Applying these changes will resolve this issue.

sentry - 4072172292

closes odoo/odoo#123247

X-original-commit: c99090d4b70f293d3784c19511d0a1f3078e3d9c
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
Signed-off-by: Preksha Chouhan (prec) <prec@odoo.com>
This commit is contained in:
Preksha Chouhan
2023-06-01 16:09:39 +02:00
parent 8aed28bafb
commit ab8615eed5
+1 -1
View File
@@ -31,7 +31,7 @@ class PosCategory(models.Model):
res.append(cat.name)
cat = cat.parent_id
return res
return [(cat.id, " / ".join(reversed(get_names(cat)))) for cat in self]
return [(cat.id, " / ".join(reversed(get_names(cat)))) for cat in self if cat.name]
@api.ondelete(at_uninstall=False)
def _unlink_except_session_open(self):