Merge PR #1022 into 14.0

Signed-off-by pedrobaeza
This commit is contained in:
OCA-git-bot
2023-02-10 13:39:58 +00:00
3 changed files with 18 additions and 0 deletions

View File

@@ -1,3 +1,4 @@
from .hooks import pre_init_hook
from . import models
from . import report
from . import wizard

View File

@@ -38,4 +38,5 @@
],
"demo": ["demo/payment_demo.xml"],
"installable": True,
"pre_init_hook": "pre_init_hook",
}

View File

@@ -0,0 +1,16 @@
from odoo.tools import sql
def pre_init_hook(cr):
"""Prepare new partner_bank_id computed field.
Add column to avoid MemoryError on an existing Odoo instance
with lots of data.
partner_bank_id on account.move.line requires payment_order_ok to be True
which it won't be as it's newly introduced - nothing to compute.
(see AccountMoveLine._compute_partner_bank_id() in models/account_move_line.py
and AccountMove._compute_payment_order_ok() in models/account_move.py)
"""
if not sql.column_exists(cr, "account_move_line", "partner_bank_id"):
sql.create_column(cr, "account_move_line", "partner_bank_id", "int4")