Files
contract/contract/migrations/12.0.2.0.0/pre-migration.py
sbejaoui aefa12ab9e [IMP] - store last_date_invoiced on contract_line
Improve CRITERIA_ALLOWED_DICT

[IMP] - code improvement

[IMP] - Use last_date_invoiced to set marker in invoice description

[IMP] - add migration script to init last_day_invoiced and some other improvement

[FIX] - a contract line suspended should start a day after the suspension end
2019-09-14 14:34:02 +02:00

25 lines
729 B
Python

# Copyright 2018 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
import logging
from odoo import SUPERUSER_ID, api
_logger = logging.getLogger(__name__)
def migrate(cr, version):
"""
set recurring_next_date to false for finished contract
"""
_logger.info("order all contract line")
with api.Environment(cr, SUPERUSER_ID, {}) as env:
contracts = env["account.analytic.account"].search([])
finished_contract = contracts.filtered(
lambda c: not c.create_invoice_visibility
)
cr.execute(
"UPDATE account_analytic_account set recurring_next_date=null where id in (%)"
% ','.join(finished_contract.ids)
)