[MIG] contract_payment_mode: Migration to 17.0

This commit is contained in:
sygel
2024-08-11 16:23:26 +02:00
parent 922b0da56a
commit 3f7ba23a4b
8 changed files with 35 additions and 27 deletions

View File

@@ -3,14 +3,11 @@
import logging
from odoo import SUPERUSER_ID, api
_logger = logging.getLogger(__name__)
def post_init_hook(cr, registry):
def post_init_hook(env):
"""Copy payment mode from partner to the new field at contract."""
env = api.Environment(cr, SUPERUSER_ID, {})
m_contract = env["contract.contract"]
contracts = m_contract.search([("payment_mode_id", "=", False)])
if contracts: