mirror of
https://github.com/OCA/contract.git
synced 2025-02-13 17:57:24 +02:00
[12.0][ADD] - Add new addon: contract_forecast
This commit is contained in:
26
contract_forecast/hooks.py
Normal file
26
contract_forecast/hooks.py
Normal file
@@ -0,0 +1,26 @@
|
||||
# Copyright 2019 ACSONE SA/NV
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
import logging
|
||||
|
||||
from odoo import api
|
||||
from odoo.tools import SUPERUSER_ID
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def post_init_hook(cr, registry):
|
||||
"""
|
||||
Generate contract line forecast periods
|
||||
"""
|
||||
_logger.info(
|
||||
"Post init hook for module post_init_hook: "
|
||||
"Generate contract line forecast periods"
|
||||
)
|
||||
with api.Environment.manage():
|
||||
env = api.Environment(cr, SUPERUSER_ID, {})
|
||||
contract_lines = env["account.analytic.invoice.line"].search(
|
||||
[('is_canceled', '=', False)]
|
||||
)
|
||||
for contract_line in contract_lines:
|
||||
contract_line.with_delay()._generate_forecast_periods()
|
||||
Reference in New Issue
Block a user