<commit_before># -*- coding: utf-8 -*-
# (c) 2016 <NAME> - AvanzOSC
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from openerp import models, fields, api, _
from datetime import datetime
from dateutil.relativedelta import relativedelta
import pytz


class ProjectProject(models.Model):
    _inherit = 'project.project'

    @api.multi
    def _calc_num_sessions(self):
        for task in self:
            task.num_sessions = len(task.sessions)

    @api.multi
    def write(self, vals):
        if (self.env.context.get('sale_order_create_event', False) and
                vals.get('date', False)):
            vals.pop('date')
        return super(ProjectProject, self).write(vals)


class ProjectTask(models.Model):
    _inherit = 'project.task'

    @api.multi
    def _calc_num_sessions(self):
        for task in self:
            task.num_sessions = len(task.sessions)

    sessions = fields.Many2many(
        comodel_name="event.track", relation="task_session_project_relation",
        column1="task_id", column2="track_id", copy=False, string="Sessions")
    num_sessions = fields.Integer(
        string='# Session', compute='_calc_num_sessions')
    recurring_service = fields.Boolean(
        'Recurring Service',
        related='service_project_sale_line.recurring_service')
    january = fields.Boolean(
        'January', related='service_project_sale_line.january')<commit_msg>[FIX] sale_order_create_event: Remove function "_calc_num_sessions" of Projects.<commit_after># -*- coding: utf-8 -*-
# (c) 2016 <NAME> - AvanzOSC
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from openerp import models, fields, api, _
from datetime import datetime
from dateutil.relativedelta import relativedelta
import pytz


class ProjectProject(models.Model):
    _inherit = 'project.project'

    @api.multi
    def write(self, vals):
        if (self.env.context.get('sale_order_create_event', False) and
                vals.get('date', False)):
            vals.pop('date')
        return super(ProjectProject, self).write(vals)


class ProjectTask(models.Model):
    _inherit = 'project.task'

    @api.multi
    def _calc_num_sessions(self):
        for task in self:
            task.num_sessions = len(task.sessions)

    sessions = fields.Many2many(
        comodel_name="event.track", relation="task_session_project_relation",
        column1="task_id", column2="track_id", copy=False, string="Sessions")
    num_sessions = fields.Integer(
        string='# Session', compute='_calc_num_sessions')
    recurring_service = fields.Boolean(
        'Recurring Service',
        related='service_project_sale_line.recurring_service')
    january = fields.Boolean(
        'January', related='service_project_sale_line.january')
{'fraction_non_alphanumeric': 0.11860129776496034, 'fraction_numerical': 0.007930785868781542, 'mean_word_length': 3.3908227848101267, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6707585', 'n_tokens_mistral': 891, 'n_tokens_neox': 857, 'n_words': 174}