<commit_before># -*- coding: utf-8 -*-
##############################################################################
#
#    Sales Channels
#    © 2016 - 1200 WebDevelopment <http://1200wd.com/>
#
#    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/>.
#
##############################################################################
import logging
from openerp import models, fields, api, _


_logger = logging.getLogger(__name__)


class StockPicking(models.Model):
    _inherit = "stock.picking"

    @api.model
    def _get_invoice_vals(self, key, inv_type, journal_id, move):
        """Create invoice from stock.picking.
        
        Include customer sales channel and customer pricelist
        """
        inv_vals = super(StockPicking, self)._get_invoice_vals(
            key, inv_type, journal_id, move
        )
        if 'partner_id' in inv_vals:
            partner = self.env['res.partner'].browse(inv_vals['partner_id'])
            if partner and partner.sales_channel_id:
                _logger.debug(
                    "1200wd - sale_channel - Create invoice from"
                    " stock.picking, use customer %s sales channel %s" %
                    (partner.id, partner.sales_channel_id.id)
                )
                inv_vals.update({
                    'sales_channel_id': partner.sales_channel_id.id,
                    'pricelist_id':
                    partner.sales_channel_id.property_product_pricelist.id,
                })
            else:
                _logger.warning(
                    "1200wd - sale_channel - Could not update sales channel,"
                    " partner has no sales channel defined. Vals %s" %
                    inv_vals
                )
        else:
            _logger.warning(
                "1200wd - sale_channel - Could not update sales channel,"
                " partner not found. Vals %s" %
                inv_vals
            )
        return inv_vals<commit_msg>[FIX] Use info message instead of warning in log to prevent test failures.<commit_after># -*- coding: utf-8 -*-
##############################################################################
#
#    Sales Channels
#    © 2016 - 1200 WebDevelopment <http://1200wd.com/>
#
#    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/>.
#
##############################################################################
import logging
from openerp import models, fields, api, _


_logger = logging.getLogger(__name__)


class StockPicking(models.Model):
    _inherit = "stock.picking"

    @api.model
    def _get_invoice_vals(self, key, inv_type, journal_id, move):
        """Create invoice from stock.picking.
        
        Include customer sales channel and customer pricelist
        """
        inv_vals = super(StockPicking, self)._get_invoice_vals(
            key, inv_type, journal_id, move
        )
        if 'partner_id' in inv_vals:
            partner = self.env['res.partner'].browse(inv_vals['partner_id'])
            if partner and partner.sales_channel_id:
                _logger.debug(
                    "1200wd - sale_channel - Create invoice from"
                    " stock.picking, use customer %s sales channel %s" %
                    (partner.id, partner.sales_channel_id.id)
                )
                # TODO (consider taking values from SO if available!)
                inv_vals.update({
                    'sales_channel_id': partner.sales_channel_id.id,
                    'pricelist_id':
                    partner.sales_channel_id.property_product_pricelist.id,
                })
            else:
                _logger.info(
                    "1200wd - sale_channel - Could not update sales channel,"
                    " partner has no sales channel defined. Vals %s" %
                    inv_vals
                )
        else:
            _logger.info(
                "1200wd - sale_channel - Could not update sales channel,"
                " partner not found. Vals %s" %
                inv_vals
            )
        return inv_vals
{'fraction_non_alphanumeric': 0.13081121776773952, 'fraction_numerical': 0.009787314135140222, 'mean_word_length': 2.098542274052478, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4984030', 'n_tokens_mistral': 1444, 'n_tokens_neox': 1308, 'n_words': 451}