oca-payment/odoo-bringout-oca-payment-payment_order/account_payment_order/hooks.py
Ernad Husremovic 7f7e88ab3d Restructure: move packages from packages/ subdirectory to root
Flattened directory structure by moving payment packages from redundant
packages/ subdirectory to the root level of oca-payment repository.

Changes:
- Moved odoo-bringout-oca-payment-* from packages/ to root
- Updated CLAUDE.md to reflect new flat structure
- Removed redundant packages/ directory

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-16 09:10:09 +01:00

16 lines
658 B
Python

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")