mirror of
https://github.com/OCA/contract.git
synced 2025-02-13 17:57:24 +02:00
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
25 lines
729 B
Python
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)
|
|
)
|