Skip to content
Snippets Groups Projects
Commit c4f50075 authored by Carlos Lopez's avatar Carlos Lopez
Browse files

closes odoo/odoo#39217


Fix: no read all records, poor performance on big database
Signed-off-by: default avatarJosse Colpaert <jco@openerp.com>
parent 7676269b
No related branches found
No related tags found
No related merge requests found
......@@ -28,7 +28,7 @@ class AccountJournal(models.Model):
@api.constrains('l10n_latam_use_documents')
def check_use_document(self):
for rec in self:
if rec.env['account.move'].search([('journal_id', '=', rec.id), ('state', '!=', 'draft')]):
if rec.env['account.move'].search([('journal_id', '=', rec.id), ('state', '!=', 'draft')], limit=1):
raise ValidationError(_(
'You can not modify the field "Use Documents?" if there are validated invoices in this journal!'))
......
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