<commit_before># -*- coding: utf-8 -*-
# (c) 2015 <NAME> - AvanzOSC
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html

from openerp import api, fields, models


class CrmPhonecall2phonecall(models.TransientModel):
    _inherit = 'crm.phonecall2phonecall'

    claim_id = fields.Many2one(comodel_name='crm.claim', string='Claim')

    @api.multi
    def action_schedule(self):
        res = super(CrmPhonecall2phonecall, self).action_schedule()
        phonecall = self.env['crm.phonecall'].browse(res['res_id'])
        for this in self:
            if this.claim_id:
                phonecall.write({'claim_id': this.claim_id.id})
        return phonecall.redirect_phonecall_view(phonecall)

    @api.model
    def default_get(self, fields):
        res = super(CrmPhonecall2phonecall, self).default_get(fields)
        context = self.env.context
        active_id = context and context.get('active_id', False) or False
        if active_id:
            phonecall = self.env['crm.phonecall'].browse(active_id)
            if phonecall.claim_id:
                res.update({'claim_id': phonecall.claim_id and
                            phonecall.claim_id.id or False})
        return res<commit_msg>[MOD] crm_claim_phonecall: improve function<commit_after># -*- coding: utf-8 -*-
# (c) 2015 <NAME> - AvanzOSC
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html

from openerp import api, fields, models


class CrmPhonecall2phonecall(models.TransientModel):
    _inherit = 'crm.phonecall2phonecall'

    claim_id = fields.Many2one(comodel_name='crm.claim', string='Claim')

    @api.multi
    def action_schedule(self):
        self.ensure_one()
        res = super(CrmPhonecall2phonecall, self).action_schedule()
        phonecall = self.env['crm.phonecall'].browse(res['res_id'])
        phonecall.write({'claim_id': self.claim_id.id})
        return phonecall.redirect_phonecall_view(phonecall)

    @api.model
    def default_get(self, fields):
        res = super(CrmPhonecall2phonecall, self).default_get(fields)
        context = self.env.context
        active_id = context and context.get('active_id', False) or False
        if active_id:
            phonecall = self.env['crm.phonecall'].browse(active_id)
            res.update({'claim_id': phonecall.claim_id.id})
        return res
{'fraction_non_alphanumeric': 0.12225570383125269, 'fraction_numerical': 0.011192423590185106, 'mean_word_length': 3.0, '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': '6267034', 'n_tokens_mistral': 769, 'n_tokens_neox': 743, 'n_words': 135}