[12.0][ADD] - Add new addon: contract_forecast

This commit is contained in:
sbejaoui
2019-03-07 12:32:06 +01:00
parent 3d8144d413
commit ea2e793c59
20 changed files with 1049 additions and 0 deletions

View 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()