Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX] account_invoice_line_number: compute lines
Now the line numbers are computed correctly when displaying the invoice
- Loading branch information
Showing
5 changed files
with
29 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
############################################################################## | ||
# For copyright and license notices, see __manifest__.py file in module root | ||
# directory | ||
############################################################################## | ||
from odoo import models, fields | ||
|
||
class AccountMove(models.Model): | ||
_inherit = 'account.move' | ||
|
||
number_lines = fields.Char(compute='_compute_number_lines') | ||
|
||
def _compute_number_lines(self): | ||
self.number_lines = False | ||
if self and not isinstance(self[0].id, int): | ||
return | ||
for move in self: | ||
number_line_map = {} | ||
for number, line in enumerate(move.invoice_line_ids.sorted("sequence"), 1): | ||
number_line_map.update({line.id: number}) | ||
|
||
move.number_lines = number_line_map |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters