mirror of
https://github.com/OCA/bank-statement-import.git
synced 2025-01-20 12:37:43 +02:00
[10.0][FIX] prevent assigning parner with default ref
This commit is contained in:
committed by
Iryna Vyshnevska
parent
f4a620de47
commit
176d598741
@@ -1,3 +1,5 @@
|
|||||||
from . import parser
|
from . import parser
|
||||||
from . import account_bank_statement_import
|
from . import account_bank_statement_import
|
||||||
from . import account_journal
|
from . import account_journal
|
||||||
|
from . import bank_statement
|
||||||
|
from . import account_bank_statement_line
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
# 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
|
||||||
|
"""
|
||||||
|
if (
|
||||||
|
self.env.context.get('no_reassign_empty_name')
|
||||||
|
and len(self) == 1
|
||||||
|
and len(vals.keys()) == 1
|
||||||
|
and 'partner_id' in vals
|
||||||
|
and self.name == '/'
|
||||||
|
):
|
||||||
|
return True
|
||||||
|
return super(AccountBankStatementLine, self).write(vals)
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
# 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_name=True)).reconciliation_widget_preprocess()
|
||||||
@@ -3,3 +3,4 @@
|
|||||||
* Ronald Portier <rportier@therp.nl>
|
* Ronald Portier <rportier@therp.nl>
|
||||||
* Andrea Stirpe <a.stirpe@onestein.nl>
|
* Andrea Stirpe <a.stirpe@onestein.nl>
|
||||||
* Maxence Groine <mgroine@fiefmanage.ch>
|
* Maxence Groine <mgroine@fiefmanage.ch>
|
||||||
|
* Iryna Vyshnevska <i.vyshnevska@mobilunity.com>
|
||||||
|
|||||||
Reference in New Issue
Block a user