[13.0][FIX] account_mass_reoncile, mass reoncile only posted entry

This commit is contained in:
Kitti U
2022-02-12 19:21:53 +07:00
committed by Kitti U
parent 6b25e57a95
commit e72f59cb3c
2 changed files with 12 additions and 3 deletions

View File

@@ -70,7 +70,8 @@ class MassReconcileBase(models.AbstractModel):
self.ensure_one()
where = (
"WHERE account_move_line.account_id = %s "
"AND NOT account_move_line.reconciled"
"AND NOT account_move_line.reconciled "
"AND parent_state = 'posted'"
)
# it would be great to use dict for params
# but as we use _where_calc in _get_filter

View File

@@ -95,7 +95,11 @@ class AccountMassReconcile(models.Model):
obj_move_line = self.env["account.move.line"]
for rec in self:
rec.unreconciled_count = obj_move_line.search_count(
[("account_id", "=", rec.account.id), ("reconciled", "=", False)]
[
("account_id", "=", rec.account.id),
("reconciled", "=", False),
("parent_state", "=", "posted"),
]
)
@api.depends("history_ids")
@@ -240,7 +244,11 @@ class AccountMassReconcile(models.Model):
self.ensure_one()
obj_move_line = self.env["account.move.line"]
lines = obj_move_line.search(
[("account_id", "=", self.account.id), ("reconciled", "=", False)]
[
("account_id", "=", self.account.id),
("reconciled", "=", False),
("parent_state", "=", "posted"),
]
)
name = _("Unreconciled items")
return self._open_move_line_list(lines.ids or [], name)