<commit_before># Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>)
# Copyright 2016-2017 <NAME> <https://it-projects.info/team/yelizariev>
# Copyright 2016 <NAME>
# Copyright 2017 <NAME>
# Copyright 2018 <NAME> <https://it-projects.info/team/KolushovAlexandr>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).

from odoo import models, api, fields


class StockMoveLine(models.Model):
    _inherit = "stock.move.line"

    product_barcode = fields.Char('Barcode', related='product_id.product_tmpl_id.barcode')


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

    @api.multi
    def process_barcode_from_ui(self, barcode_str, visible_op_ids):
        """This function is called each time there barcode scanner reads an input"""
        self.ensure_one()
        lot_obj = self.env['stock.production.lot']
        package_obj = self.env['stock.quant.package']
        product_obj = self.env['product.product']
        pack_op = self.env['stock.move.line'].search(
            [('picking_id', '=', self.id)])
        stock_location_obj = self.env['stock.location']
        answer = {'filter_loc': False, 'operation_id': False}
        # check if the barcode correspond to a location
        matching_location_ids = stock_location_obj.search([('barcode', '=', barcode_str)])
        if matching_location_ids:
            # if we have a location, return immediatly with the location name<commit_msg>:ambulance: correct barcodes for product variants<commit_after># Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>)
# Copyright 2016-2017 <NAME> <https://it-projects.info/team/yelizariev>
# Copyright 2016 <NAME>
# Copyright 2017 <NAME>
# Copyright 2018 <NAME> <https://it-projects.info/team/KolushovAlexandr>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).

from odoo import models, api, fields


class StockMoveLine(models.Model):
    _inherit = "stock.move.line"

    product_barcode = fields.Char('Barcode', related='product_id.barcode')


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

    @api.multi
    def process_barcode_from_ui(self, barcode_str, visible_op_ids):
        """This function is called each time there barcode scanner reads an input"""
        self.ensure_one()
        lot_obj = self.env['stock.production.lot']
        package_obj = self.env['stock.quant.package']
        product_obj = self.env['product.product']
        pack_op = self.env['stock.move.line'].search(
            [('picking_id', '=', self.id)])
        stock_location_obj = self.env['stock.location']
        answer = {'filter_loc': False, 'operation_id': False}
        # check if the barcode correspond to a location
        matching_location_ids = stock_location_obj.search([('barcode', '=', barcode_str)])
        if matching_location_ids:
            # if we have a location, return immediatly with the location name
{'fraction_non_alphanumeric': 0.13114186851211074, 'fraction_numerical': 0.020761245674740483, 'mean_word_length': 3.5961844197138313, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 4, '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': '3844871', 'n_tokens_mistral': 958, 'n_tokens_neox': 887, 'n_words': 208}