<commit_before># -*- coding: utf-8 -*-
##############################################################################
#
#    stock_scanner module for OpenERP, Allows managing barcode readers with simple scenarios
#    Copyright (C) 2011 SYLEAM Info Services (<http://www.Syleam.fr/>)
#              <NAME> <<EMAIL>>
#
#    This file is a part of stock_scanner
#
#    stock_scanner is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    stock_scanner 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 General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################

from osv import osv
from osv import fields
from tools.translate import _
from tools.misc import ustr
from tools.misc import logged
from threading import Semaphore
import logging
import uuid
import netsvc

logger = logging.getLogger('stock_scanner')


class scanner_scenario(osv.osv):
    _name = 'scanner.scenario'
    _description = 'Scenario for scanner'

    _columns = {
        'name': fields.char('Name', size=64, required=True, help='Appear on barcode reader screen'),
        'sequence': fields.integer('Sequence', help='Sequence order'),
        'active': fields.boolean('Active', help='If check, this object is always available'),
        'model_id': fields.many2one('ir.model', 'Model', help='Model used for this scenario'),
        'step_ids': fields.one2many('scanner.scenario.step', 'scenario_id', 'Scenario', ondelete='cascade', help='Step of the current running scenario'),
        'warehouse_ids': fields.many2many('stock.warehouse', 'scanner_scenario_warehouse_rel', 'scenario_id', 'warehouse_id', 'Warehouses', help='Warehouses for this scenario'),
        'notes': fields.text('Notes', help='Store different notes, date and title for modification, etc...'),
        'reference_res_id': fields.char('Rerefence ID', size=64, readonly=True, help='Used by export/import scenario'),
        'shared_custom': fields.boolean('Shared Custom', help='Allows to share the custom values with a shared scanner in the same warehouse'),
        'parent_id': fields.many2one('scanner.scenario', 'Parent', help='Parent scenario, used to create menus'),
        'type': fields.selection([('scenario', 'Scenario'), ('menu', 'Menu'), ('shortcut', 'Shortcut')], 'Type', required=True, help='Defines if this scenario is a menu or an executable scenario'),
    }

    _order = 'parent_id, sequence'

    _defaults = {
        'type': 'scenario',
    }

    _sql_constraints = [
        ('reference_res_id_uniq', 'unique (reference_res_id)', 'The reference ID of the scenario must be unique !'),
    ]<commit_msg>[FIX] Fixed default order for scenarios<commit_after># -*- coding: utf-8 -*-
##############################################################################
#
#    stock_scanner module for OpenERP, Allows managing barcode readers with simple scenarios
#    Copyright (C) 2011 SYLEAM Info Services (<http://www.Syleam.fr/>)
#              <NAME> <<EMAIL>>
#
#    This file is a part of stock_scanner
#
#    stock_scanner is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    stock_scanner 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 General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################

from osv import osv
from osv import fields
from tools.translate import _
from tools.misc import ustr
from tools.misc import logged
from threading import Semaphore
import logging
import uuid
import netsvc

logger = logging.getLogger('stock_scanner')


class scanner_scenario(osv.osv):
    _name = 'scanner.scenario'
    _description = 'Scenario for scanner'

    _columns = {
        'name': fields.char('Name', size=64, required=True, help='Appear on barcode reader screen'),
        'sequence': fields.integer('Sequence', help='Sequence order'),
        'active': fields.boolean('Active', help='If check, this object is always available'),
        'model_id': fields.many2one('ir.model', 'Model', help='Model used for this scenario'),
        'step_ids': fields.one2many('scanner.scenario.step', 'scenario_id', 'Scenario', ondelete='cascade', help='Step of the current running scenario'),
        'warehouse_ids': fields.many2many('stock.warehouse', 'scanner_scenario_warehouse_rel', 'scenario_id', 'warehouse_id', 'Warehouses', help='Warehouses for this scenario'),
        'notes': fields.text('Notes', help='Store different notes, date and title for modification, etc...'),
        'reference_res_id': fields.char('Rerefence ID', size=64, readonly=True, help='Used by export/import scenario'),
        'shared_custom': fields.boolean('Shared Custom', help='Allows to share the custom values with a shared scanner in the same warehouse'),
        'parent_id': fields.many2one('scanner.scenario', 'Parent', help='Parent scenario, used to create menus'),
        'type': fields.selection([('scenario', 'Scenario'), ('menu', 'Menu'), ('shortcut', 'Shortcut')], 'Type', required=True, help='Defines if this scenario is a menu or an executable scenario'),
    }

    _order = 'sequence'

    _defaults = {
        'type': 'scenario',
    }

    _sql_constraints = [
        ('reference_res_id_uniq', 'unique (reference_res_id)', 'The reference ID of the scenario must be unique !'),
    ]
{'fraction_non_alphanumeric': 0.16104269950423797, 'fraction_numerical': 0.004477850631696785, 'mean_word_length': 4.2687447346251055, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, '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': '62176', 'n_tokens_mistral': 1735, 'n_tokens_neox': 1677, 'n_words': 610}