diff options
| author | Bruno Zanotti (ADHOC) <bz@adhoc.com.ar> | 2020-09-16 13:39:19 +0000 |
|---|---|---|
| committer | Bruno Zanotti (ADHOC) <bz@adhoc.com.ar> | 2020-09-22 14:45:26 +0000 |
| commit | ea29901a9fbcdc91b9462ee99445177e0f36e94f (patch) | |
| tree | a6d44dd24942aa327e33a49aeaee8a45c132af4e /addons/l10n_latam_invoice_document | |
| parent | 8fe1b1c356c804bb153bb69876dc30848a46803c (diff) | |
[FIX] l10n_latam_invoice_document: journal configuration constraint
Fix l10n_latam constraint that was allowing to change journal configuration
with already posted invoices if they where sended back to draft.
closes odoo/odoo#56959
Signed-off-by: Josse Colpaert <jco@openerp.com>
Diffstat (limited to 'addons/l10n_latam_invoice_document')
| -rw-r--r-- | addons/l10n_latam_invoice_document/models/account_journal.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/addons/l10n_latam_invoice_document/models/account_journal.py b/addons/l10n_latam_invoice_document/models/account_journal.py index 015119d0a17..9ed4e43bb5f 100644 --- a/addons/l10n_latam_invoice_document/models/account_journal.py +++ b/addons/l10n_latam_invoice_document/models/account_journal.py @@ -26,7 +26,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')], limit=1): + if rec.env['account.move'].search([('journal_id', '=', rec.id), ('posted_before', '=', True)], limit=1): raise ValidationError(_( 'You can not modify the field "Use Documents?" if there are validated invoices in this journal!')) |
