Skip to content

Commit

Permalink
[FIX] *_account_export: use orm for move line count
Browse files Browse the repository at this point in the history
  • Loading branch information
NL66278 committed Feb 22, 2023
1 parent b74fa68 commit 7c12194
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions l10n_nl_xaf_auditfile_export/models/xaf_auditfile_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,16 +296,14 @@ def get_ob_lines(self):

def get_move_line_count(self):
"""return amount of move lines"""
self.env.cr.execute(
"select count(*) from account_move_line "
"where date >= %s "
"and date <= %s "
"and parent_state = 'posted' "
"and display_type NOT IN ('line_section', 'line_note') "
"and company_id=%s",
(self.date_start, self.date_end, self.company_id.id),
)
return self.env.cr.fetchall()[0][0]
domain = [
("date", ">=", self.date_start),
("date", "<=", self.date_end),
("parent_state", "=", "posted"),
("display_type", "not in", ("line_section", "line_note")),
("company_id", "=", self.company_id.id),
]
return self.env["account.move.line"].search_count(domain)

def get_move_line_total_debit(self):
"""return total debit of move lines"""
Expand Down

0 comments on commit 7c12194

Please sign in to comment.