Skip to content

Commit

Permalink
Merge pull request #1 from fenix-es/11.0-fix-account_invoice_sequence
Browse files Browse the repository at this point in the history
[11.0][FIX] l10n_es_account_invoice_sequence: Compute correct next number of sequence
  • Loading branch information
jffernandez committed Apr 10, 2019
2 parents 500f763 + d6bc1b0 commit 5e8e0af
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions l10n_es_account_invoice_sequence/models/account_journal.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
# Copyright 2011 NaN Projectes de Programari Lliure, S.L.
# Copyright 2013-2017 Pedro M. Baeza
# Copyright 2019 Jose F. Fernandez

from odoo import _, api, fields, exceptions, models

Expand Down Expand Up @@ -57,3 +58,18 @@ def _get_invoice_types(self):
'sale',
'purchase',
]

@api.multi
@api.depends('sequence_id.use_date_range', 'sequence_id.number_next_actual')
def _compute_seq_number_next(self):
for journal in self:
if journal.sequence_id:
sequence = journal.sequence_id._get_current_sequence()
journal.sequence_number_next = sequence.number_next_actual
else:
if journal.company_id and journal.company_id.chart_template_id.is_spanish_chart():
other_journal = self.search([('company_id', '=', journal.company_id.id)], limit=1)
if other_journal:
journal.sequence_number_next = other_journal.sequence_number_next
else:
journal.sequence_number_next = 1

0 comments on commit 5e8e0af

Please sign in to comment.