<commit_before># -*- coding: utf-8 -*-
##############################################################################
#
#    Authors: <NAME>
#    Copyright (c) 2014 Acsone SA/NV (http://www.acsone.eu)
#    All Rights Reserved
#
#    WARNING: This program as such is intended to be used by professional
#    programmers who take the whole responsibility of assessing all potential
#    consequences resulting from its eventual inadequacies and bugs.
#    End users who are looking for a ready-to-use solution with commercial
#    guarantees and support are strongly advised to contact a Free Software
#    Service Company.
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU Affero General Public License as
#    published by the Free Software Foundation, either version 3 of the
#    License, or (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU Affero General Public License for more details.
#
#    You should have received a copy of the GNU Affero General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from openerp.osv import orm, fields
from openerp.tools.translate import _

MSG_OK = _("<p>Unsubscribe done successfully.</p>")
MSG_KO = _("<p>The link you use to unsubscribe is no longer operational.<br/>"
           "Have you perhaps already unsubscribed?<br/>In any case, please "
           "use the link available in the next email.</p>")


class MassMailing(orm.Model):

    _inherit = 'mail.mass_mailing'

    _columns = {
        'distribution_list_id': fields.many2one('distribution.list',
                                                'Distribution List')
    }

    def on_change_model_and_list(self, cr, uid, ids, mailing_model, list_ids,
                                 context=None):
        res = super(MassMailing, self).on_change_model_and_list(
            cr, uid, ids, mailing_model, list_ids, context=context)
        res['value']['distribution_list_id'] = False

        return res

    def try_update_opt(self, cr, uid, mailing_id, res_id, context=None):
        '''
        Try to find a distribution list and call `update_opt` with the passed
        `res_id` as `partner_id`
        '''
        mailing_ids = self.exists(
            cr, uid, [mailing_id], context=context)
        if mailing_ids:
            mailing = self.browse(cr, uid, mailing_ids[0], context=context)<commit_msg>[mass_mailing_distribution_list][CHG] no translation just as odoo do it<commit_after># -*- coding: utf-8 -*-
##############################################################################
#
#    Authors: <NAME>
#    Copyright (c) 2014 Acsone SA/NV (http://www.acsone.eu)
#    All Rights Reserved
#
#    WARNING: This program as such is intended to be used by professional
#    programmers who take the whole responsibility of assessing all potential
#    consequences resulting from its eventual inadequacies and bugs.
#    End users who are looking for a ready-to-use solution with commercial
#    guarantees and support are strongly advised to contact a Free Software
#    Service Company.
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU Affero General Public License as
#    published by the Free Software Foundation, either version 3 of the
#    License, or (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU Affero General Public License for more details.
#
#    You should have received a copy of the GNU Affero General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from openerp.osv import orm, fields

MSG_OK = "<p>Unsubscribe done successfully.</p>"
MSG_KO = "<p>The link you use to unsubscribe is no longer operational.<br/>" +\
    "Have you perhaps already unsubscribed?<br/>In any case, please " +\
    "use the link available in the next email.</p>"


class MassMailing(orm.Model):

    _inherit = 'mail.mass_mailing'

    _columns = {
        'distribution_list_id': fields.many2one('distribution.list',
                                                'Distribution List')
    }

    def on_change_model_and_list(self, cr, uid, ids, mailing_model, list_ids,
                                 context=None):
        res = super(MassMailing, self).on_change_model_and_list(
            cr, uid, ids, mailing_model, list_ids, context=context)
        res['value']['distribution_list_id'] = False

        return res

    def try_update_opt(self, cr, uid, mailing_id, res_id, context=None):
        '''
        Try to find a distribution list and call `update_opt` with the passed
        `res_id` as `partner_id`
        '''
        mailing_ids = self.exists(
            cr, uid, [mailing_id], context=context)
        if mailing_ids:
            mailing = self.browse(cr, uid, mailing_ids[0], context=context)
{'fraction_non_alphanumeric': 0.13710273466371029, 'fraction_numerical': 0.0029563932002956393, 'mean_word_length': 3.094553706505295, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6880062', 'n_tokens_mistral': 1468, 'n_tokens_neox': 1405, 'n_words': 551}