[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 <jco@openerp.com>
This commit is contained in:
Juan Jose Scarafia
2019-10-10 06:34:31 +00:00
committed by fw-bot
parent 20c48953f8
commit a3a5625c6a
@@ -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