From a3a5625c6abf6745ece62d17a256cf2cdaf39c94 Mon Sep 17 00:00:00 2001 From: Juan Jose Scarafia Date: Wed, 2 Oct 2019 10:34:47 +0000 Subject: [PATCH] [IMP] l10n_latam_invoice_document: refund sequence on journals On l10n_latam_invoice_document, if a sales/purchase journal use documents, then the journal sequences are not used, with this improvement the user don't see fields that are no needed (Credit Notes Next Number) and also it avoids the creation of the refunds sequences that is not going to be used closes odoo/odoo#38335 X-original-commit: 1b647b8ead1fc70c18223914c96619c7f9a21b6e Signed-off-by: Josse Colpaert --- .../l10n_latam_invoice_document/models/account_journal.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/addons/l10n_latam_invoice_document/models/account_journal.py b/addons/l10n_latam_invoice_document/models/account_journal.py index a87fdb87f43..f75f9e8ea4a 100644 --- a/addons/l10n_latam_invoice_document/models/account_journal.py +++ b/addons/l10n_latam_invoice_document/models/account_journal.py @@ -31,3 +31,10 @@ class AccountJournal(models.Model): if rec.env['account.move'].search([('journal_id', '=', rec.id), ('state', '!=', 'draft')]): raise ValidationError(_( 'You can not modify the field "Use Documents?" if there are validated invoices in this journal!')) + + @api.onchange('type', 'l10n_latam_use_documents') + def _onchange_type(self): + res = super()._onchange_type() + if self.l10n_latam_use_documents: + self.refund_sequence = False + return res