-
-
Notifications
You must be signed in to change notification settings - Fork 410
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[10.0][FIX] prevent assigning parner with default ref
- Loading branch information
Iryna Vushnevska
committed
Sep 6, 2019
1 parent
8279ad6
commit f77ef30
Showing
3 changed files
with
45 additions
and
0 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
29 changes: 29 additions & 0 deletions
29
account_bank_statement_import_camt/models/account_bank_statement_line.py
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,29 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2019 Camptocamp SA | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
from odoo import api, models | ||
|
||
|
||
class AccountBankStatementLine(models.Model): | ||
|
||
_inherit = "account.bank.statement.line" | ||
|
||
@api.multi | ||
def write(self, vals): | ||
""" | ||
Purpose of this hook is catch updates for records with name == '/' | ||
In reconciliation_widget_preprocess, there is attempt to assign | ||
partner into statement line, this assignment relies on name, | ||
during import name setup to '/' for records without it | ||
and this makes search results wrong and partner assignment randomly | ||
""" | ||
recordset = self | ||
if self.env.context.get('no_reassign_empty_ref'): | ||
for rec in self: | ||
if (len(vals.keys()) == 1 and 'partner_id' in vals | ||
and rec.name == '/' | ||
): | ||
recordset -= rec | ||
return super(AccountBankStatementLine, recordset).write(vals) | ||
return super(AccountBankStatementLine, self).write(vals) |
14 changes: 14 additions & 0 deletions
14
account_bank_statement_import_camt/models/bank_statement.py
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,14 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2019 Camptocamp SA | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
from odoo import api, models | ||
|
||
|
||
class AccountBankStatement(models.Model): | ||
|
||
_inherit = "account.bank.statement" | ||
|
||
@api.multi | ||
def reconciliation_widget_preprocess(self): | ||
return super(AccountBankStatement, self.with_context( | ||
no_reassign_empty_ref=True)).reconciliation_widget_preprocess() |