[FIX] account: don't allow unlinking payment method lines used on non-accessible payments
In case of the user have no access to all account.payment, the record can be deleted. closes odoo/odoo#135415 X-original-commit: 5086b39e44230a14a6c1c65bde4851f062f10e38 Signed-off-by: Olivier Colson (oco) <oco@odoo.com>
This commit is contained in:
@@ -161,7 +161,7 @@ class AccountPaymentMethodLine(models.Model):
|
||||
"""
|
||||
unused_payment_method_lines = self
|
||||
for line in self:
|
||||
payment_count = self.env['account.payment'].search_count([('payment_method_line_id', '=', line.id)])
|
||||
payment_count = self.env['account.payment'].sudo().search_count([('payment_method_line_id', '=', line.id)])
|
||||
if payment_count > 0:
|
||||
unused_payment_method_lines -= line
|
||||
|
||||
|
||||
Reference in New Issue
Block a user