[FIX] account: Holes in sequences warning

The warning should be displayed only on sales journal
Also added the fact that the warning now depends on the lock date, if there is a lock date the warning is displayed for entries post lock date, otherwise it's for all the entries

Same for the color of the name of the entry, it's now red only if it's post lock date

closes odoo/odoo#101442

Task-id: 2993833
X-original-commit: c668d777a5984d1cdcfd45a90ec39e1a5a2e0a55
Signed-off-by: William André (wan) <wan@odoo.com>
Signed-off-by: Maximilien La Barre (malb) <malb@odoo.com>
This commit is contained in:
maximilien(malb)
2022-09-28 17:55:09 +02:00
parent af37445f35
commit c6fa784c43
3 changed files with 5 additions and 1 deletions
@@ -80,8 +80,10 @@ class account_journal(models.Model):
SELECT move.journal_id,
move.sequence_prefix
FROM account_move move
JOIN res_company company ON company.id = move.company_id
WHERE move.journal_id = ANY(%(journal_ids)s)
AND move.state = 'posted'
AND (company.fiscalyear_lock_date IS NULL OR move.date >= company.fiscalyear_lock_date)
GROUP BY move.journal_id, move.sequence_prefix
HAVING COUNT(*) != MAX(move.sequence_number) - MIN(move.sequence_number) + 1
""", {
+2
View File
@@ -745,6 +745,7 @@ class AccountMove(models.Model):
self.env.cr.execute("""
SELECT this.id
FROM account_move this
JOIN res_company company ON company.id = this.company_id
LEFT JOIN account_move other ON this.journal_id = other.journal_id
AND this.sequence_prefix = other.sequence_prefix
AND this.sequence_number = other.sequence_number + 1
@@ -752,6 +753,7 @@ class AccountMove(models.Model):
AND this.sequence_number != 1
AND this.name != '/'
AND this.id = ANY(%(move_ids)s)
AND (company.fiscalyear_lock_date IS NULL OR this.date >= company.fiscalyear_lock_date)
""", {
'move_ids': self.ids,
})
@@ -79,7 +79,7 @@
<t t-name="HasSequenceHoles">
<field name="has_sequence_holes" invisible="1"/>
<a t-if="record.has_sequence_holes.raw_value" name="show_sequence_holes" type="object" class="text-warning">
<a t-if="record.has_sequence_holes.raw_value and journal_type == 'sale'" name="show_sequence_holes" type="object" class="text-warning">
<i class="fa fa-exclamation-triangle"/>
Gaps in the sequence
</a>