<commit_before>from odoo import api, models, fields, _
from odoo.tools.safe_eval import safe_eval
import json


class CrmClaim(models.Model):
    _inherit = 'crm.claim'

    location = fields.Char('Location')

    @api.multi
    def find_claim_by_number_using_barcode(self, barcode):
        barcode = barcode.replace("-", "/")
        barcode = barcode.replace("'", "-")

        next_is_location = False

        if barcode.startswith('RMA'):
            claim = self.search([('number', '=', barcode)], limit=1)
            if claim:
                if claim.stage_id.with_context({'lang': 'es_ES'}).name != "Pendiente de recibir":
                    message = _("The {} is already received").format(claim.number)
                    self.env.user.notify_warning(message=message, sticky=True)
                    next_is_location = True
                else:
                    claim.message_post(body="RMA scanned")
                    claim.stage_id = self.env["crm.claim.stage"].search([('name', '=', 'Recibido')])
                    claim.date_received = fields.Date.today()
                    message = _("{} received").format(claim.number)
                    self.env.user.notify_info(title="RMA scanned", message=message)<commit_msg>[IMP]rma_scanner: se añade la sede configurada en la ficha del usuario a la hora de recibir un rma con el escáner<commit_after>from odoo import api, models, fields, _
from odoo.tools.safe_eval import safe_eval
import json


class CrmClaim(models.Model):
    _inherit = 'crm.claim'

    location = fields.Char('Location')

    @api.multi
    def find_claim_by_number_using_barcode(self, barcode):
        barcode = barcode.replace("-", "/")
        barcode = barcode.replace("'", "-")

        next_is_location = False

        if barcode.startswith('RMA'):
            claim = self.search([('number', '=', barcode)], limit=1)
            if claim:
                if claim.stage_id.with_context({'lang': 'es_ES'}).name != "Pendiente de recibir":
                    message = _("The {} is already received").format(claim.number)
                    self.env.user.notify_warning(message=message, sticky=True)
                    next_is_location = True
                else:
                    claim.message_post(body="RMA scanned")
                    claim.warehouse_location = self.env.user.warehouse_location
                    claim.stage_id = self.env["crm.claim.stage"].search([('name', '=', 'Recibido')])
                    claim.date_received = fields.Date.today()
                    message = _("{} received").format(claim.number)
                    self.env.user.notify_info(title="RMA scanned", message=message)
{'fraction_non_alphanumeric': 0.13089005235602094, 'fraction_numerical': 0.0007479431563201197, 'mean_word_length': 2.2542579075425793, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '2881998', 'n_tokens_mistral': 807, 'n_tokens_neox': 770, 'n_words': 149}