Skip to content

Instantly share code, notes, and snippets.

@rvalyi
Created July 16, 2020 16:57
Show Gist options
  • Save rvalyi/550b731a8ebb8659a2cee0c5cac6bb7b to your computer and use it in GitHub Desktop.
Save rvalyi/550b731a8ebb8659a2cee0c5cac6bb7b to your computer and use it in GitHub Desktop.
diff --git a/account_usability/account.py b/account_usability/account.py
index cb322ad..3d51cf8 100644
--- a/account_usability/account.py
+++ b/account_usability/account.py
@@ -676,15 +676,23 @@ class AccountReconciliation(models.AbstractModel):
return str_domain
@api.model
- def _domain_move_lines_for_reconciliation(
+ def _domain_move_lines_for_reconciliation_FIXME( # FIXME
self, st_line, aml_accounts, partner_id,
excluded_ids=None, search_str=False):
domain = super()._domain_move_lines_for_reconciliation(
st_line, aml_accounts, partner_id,
excluded_ids=excluded_ids, search_str=search_str)
# We want to replace a domain item by another one
- position = domain.index(('payment_id', '<>', False))
- domain[position] = ['journal_id', '=', st_line.journal_id.id]
+ if ('payment_id', '<>', False) in domain:
+ # True on official v12:
+ # https://github.com/odoo/odoo/blob/12.0/addons/account/models/reconciliation_widget.py#L490
+ position = domain.index(('payment_id', '<>', False))
+ domain[position] = ['journal_id', '=', st_line.journal_id.id]
+ else:
+ # OCB which has backport fixes from v13
+ # https://github.com/OCA/OCB/blob/12.0/addons/account/models/reconciliation_widget.py#L486
+ domain = expression.AND([domain, [('journal_id', '=', st_line.journal_id.id)]])
+
return domain
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment