[FIX] account: link bank to partner

Changes to a bank account should not be happening without approval and
not in an in-transparent way. In some cases, a third party can pay an
invoice for another account

opw-1817138
This commit is contained in:
Nicolas Martinelli
2018-02-27 11:31:09 +01:00
committed by Nicolas Martinelli
parent 1f8835568b
commit aff954bd63
@@ -338,7 +338,7 @@ class AccountBankStatement(models.Model):
def link_bank_to_partner(self):
for statement in self:
for st_line in statement.line_ids:
if st_line.bank_account_id and st_line.partner_id and st_line.bank_account_id.partner_id != st_line.partner_id:
if st_line.bank_account_id and st_line.partner_id and not st_line.bank_account_id.partner_id:
st_line.bank_account_id.partner_id = st_line.partner_id