| 1 | from odoo import api, models, _ |
| 2 | from odoo.exceptions import UserError |
| 3 | |
| 4 | |
| 5 | class AccountCashRounding(models.Model): |
| 6 | _inherit = 'account.cash.rounding' |
| 7 | |
| 8 | @api.ondelete(at_uninstall=False) |
| 9 | def _unlink_except_pos_config(self): |
| 10 | if self.env['pos.config'].search_count([('rounding_method', 'in', self.ids)], limit=1): |
| 11 | raise UserError(_('You cannot delete a rounding method that is used in a Point of Sale configuration.')) |