<commit_before>from odoo import models, fields, api, exceptions, _


class KitchenCustomizationWizard(models.TransientModel):
    _name = 'kitchen.customization.wizard'

    user = fields.Char(required=1)

    date_planned = fields.Datetime(string='Date Planned', required=1)

    def mark_received_action(self):
        customization_id = self.env.context.get('active_ids')
        customization = self.env['kitchen.customization'].browse(customization_id)
        customization.write({'state': 'in_progress', 'date_planned': self.date_planned, 'user': self.user})
        picking = customization.customization_line[0].move_ids.filtered(lambda m: m.state != 'cancel')[0].picking_id
        if picking:
            notes = picking.internal_notes or ""
            picking_mssg = self.env['ir.config_parameter'].sudo().get_param('kitchen.picking.message')
            notes += "%s \n" % picking_mssg
            picking.write({'internal_notes': notes, 'not_sync': False})
<commit_msg>[FIX] kitchen: corregido error para que se pueda iniciar una personalización sin pedido asociado<commit_after>from odoo import models, fields, api, exceptions, _


class KitchenCustomizationWizard(models.TransientModel):
    _name = 'kitchen.customization.wizard'

    user = fields.Char(required=1)

    date_planned = fields.Datetime(string='Date Planned', required=1)

    def mark_received_action(self):
        customization_id = self.env.context.get('active_ids')
        customization = self.env['kitchen.customization'].browse(customization_id)
        customization.write({'state': 'in_progress', 'date_planned': self.date_planned, 'user': self.user})
        if customization.customization_line and customization.customization_line[0].move_ids.filtered(lambda m: m.state != 'cancel'):
            picking = customization.customization_line[0].move_ids.filtered(lambda m: m.state != 'cancel')[0].picking_id
            if picking:
                notes = picking.internal_notes or ""
                picking_mssg = self.env['ir.config_parameter'].sudo().get_param('kitchen.picking.message')
                notes += "%s \n" % picking_mssg
                picking.write({'internal_notes': notes, 'not_sync': False})

{'fraction_non_alphanumeric': 0.12505663797009514, 'fraction_numerical': 0.0040779338468509285, 'mean_word_length': 3.8315098468271334, 'pattern_counts': {'":': 0, '<': 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': '1884515', 'n_tokens_mistral': 674, 'n_tokens_neox': 649, 'n_words': 118}