Skip to content
Snippets Groups Projects
Commit babcbf8a authored by Joseph Caburnay's avatar Joseph Caburnay
Browse files

[FIX] point_of_sale: recursive pos.category error message


Instead of showing a traceback, show a user-friendly error message
to the user to avoid recursive pos.category.

closes odoo/odoo#38769

Signed-off-by: default avatarpimodoo <pimodoo@users.noreply.github.com>
parent 5309c252
No related branches found
No related tags found
No related merge requests found
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models, _
from odoo.exceptions import ValidationError
class PosCategory(models.Model):
......@@ -11,7 +12,7 @@ class PosCategory(models.Model):
@api.constrains('parent_id')
def _check_category_recursion(self):
if not self._check_recursion():
raise ValueError(_('Error ! You cannot create recursive categories.'))
raise ValidationError(_('Error ! You cannot create recursive categories.'))
name = fields.Char(string='Category Name', required=True, translate=True)
parent_id = fields.Many2one('pos.category', string='Parent Category', index=True)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment