<commit_before># -*- coding: utf-8 -*-
# Copyright 2016 Stein & Gabelgaard ApS
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from openerp import api, fields, models, _


class SaleOrder(models.Model):

    _inherit = 'sale.order'
    
    @api.multi
    def reset_lines(self, price=False):
        """
        Reset lines according informations on products and price list
        :param price: boolean to indicate if we are resetting price or
                      descriptions
        """
        for line in self.mapped('order_line'):
            order = line.order_id
            res = line.product_id_change(
                order.pricelist_id.id, line.product_id.id,
                qty=line.product_uom_qty, uom=line.product_uom.id,
                qty_uos=line.product_uos_qty, uos=line.product_uos.id,
                name=line.name, partner_id=order.partner_id.id, lang=False,
                update_tax=True, date_order=order.date_order, packaging=False,
                fiscal_position=order.fiscal_position.id, flag=price)
            if price:
                line.write(res['value'])
            else:
                if 'name' in res['value']:
                    line.write({'name': res['value']['name']})
        return True
    
    @api.multi
    def confirm_orders(self):
        for order in self:
            order.reset_lines(price=True)
            order.action_button_confirm()
        return True
            
    <commit_msg>Overwrite sales order line name<commit_after># -*- coding: utf-8 -*-
# Copyright 2016 Stein & Gabelgaard ApS
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from openerp import api, fields, models, _


class SaleOrder(models.Model):

    _inherit = 'sale.order'
    
    @api.multi
    def reset_lines(self, price=False):
        """
        Reset lines according informations on products and price list
        :param price: boolean to indicate if we are resetting price or
                      descriptions
        """
        for line in self.mapped('order_line'):
            order = line.order_id
            res = line.product_id_change(
                order.pricelist_id.id, line.product_id.id,
                qty=line.product_uom_qty, uom=line.product_uom.id,
                qty_uos=line.product_uos_qty, uos=line.product_uos.id,
                name='', partner_id=order.partner_id.id, lang=False,
                update_tax=True, date_order=order.date_order, packaging=False,
                fiscal_position=order.fiscal_position.id, flag=price)
            if price:
                line.write(res['value'])
                if 'name' in res['value']:
                    line.write({'name': res['value']['name']})
        return True
    
    @api.multi
    def confirm_orders(self):
        for order in self:
            order.reset_lines(price=True)
            order.action_button_confirm()
        return True
            
    
{'fraction_non_alphanumeric': 0.10289608177172062, 'fraction_numerical': 0.004770017035775128, 'mean_word_length': 1.9507537688442211, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1345598', 'n_tokens_mistral': 893, 'n_tokens_neox': 856, 'n_words': 189}