diff options
| author | Juan Jose Scarafia <jjs@adhoc.com.ar> | 2019-10-02 10:34:47 +0000 |
|---|---|---|
| committer | fw-bot <otis@odoo.com> | 2019-10-10 06:34:31 +0000 |
| commit | a3a5625c6abf6745ece62d17a256cf2cdaf39c94 (patch) | |
| tree | baba31f8ec3067f541ed059b8e70366a12eb43e4 /addons | |
| parent | 20c48953f85a00dafb8c23feda84b7ebf58036e3 (diff) | |
[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>
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/l10n_latam_invoice_document/models/account_journal.py | 7 |
1 files changed, 7 insertions, 0 deletions
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 |
