<commit_before># -*- coding: utf-8 -*-

from openerp import api, fields, models, _
from openerp.exceptions import ValidationError, UserError

class CheckResourceWizard(models.TransientModel):
    _name = "check.resource.availabilities.wizard"
    
    date_start = fields.Datetime(string="Date Start", required=True)
    date_end = fields.Datetime(string="Date end", required=True)
    multi_resource_category_id = fields.Many2many('resource.category', string="Resource Category")
    location = fields.Many2one('resource.location', string="Location", required=True)
    

    @api.multi
    def check_resource_availabilities(self):
        res = []
        self.env['resource.resource'].check_dates(self.date_start, self.date_end)
        
        for category in self.multi_resource_category_id:<commit_msg>[IMP] force to select at least one resource category<commit_after># -*- coding: utf-8 -*-

from openerp import api, fields, models, _
from openerp.exceptions import ValidationError, UserError

class CheckResourceWizard(models.TransientModel):
    _name = "check.resource.availabilities.wizard"
    
    date_start = fields.Datetime(string="Date Start", required=True)
    date_end = fields.Datetime(string="Date end", required=True)
    multi_resource_category_id = fields.Many2many('resource.category', string="Resource Category")
    location = fields.Many2one('resource.location', string="Location", required=True)
    

    @api.multi
    def check_resource_availabilities(self):
        res = []
        if not self.multi_resource_category_id:
            raise ValidationError((_("Please choose at least one category")))

        self.env['resource.resource'].check_dates(self.date_start, self.date_end)
        
        for category in self.multi_resource_category_id:
{'fraction_non_alphanumeric': 0.10874439461883408, 'fraction_numerical': 0.0033632286995515697, 'mean_word_length': 4.234604105571847, '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': '6035771', 'n_tokens_mistral': 513, 'n_tokens_neox': 501, 'n_words': 105}