mirror of
https://gitlab.com/flectra-community/bank-payment.git
synced 2024-11-24 22:52:05 +00:00
23 lines
812 B
Python
23 lines
812 B
Python
import logging
|
|
|
|
from flectra.tools import sql
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
def pre_init_hook(env):
|
|
"""Prepare new payment_mode fields.
|
|
|
|
Add columns to avoid Memory error on an existing Flectra instance
|
|
with lots of data.
|
|
|
|
The payment_mode_id fields are introduced by this module and computed only
|
|
from each other or the also newly introduced supplier_payment_mode_id and
|
|
customer_payment_mode_id on res.partner, so they can stay NULL, nothing
|
|
to compute.
|
|
"""
|
|
if not sql.column_exists(env.cr, "account_move", "payment_mode_id"):
|
|
sql.create_column(env.cr, "account_move", "payment_mode_id", "int4")
|
|
if not sql.column_exists(env.cr, "account_move_line", "payment_mode_id"):
|
|
sql.create_column(env.cr, "account_move_line", "payment_mode_id", "int4")
|