<commit_before># Copyright 2017 Eficent Business and IT Consulting Services, S.L.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).

from odoo import api, fields, models, _
from odoo.exceptions import UserError, ValidationError
from odoo.addons import decimal_precision as dp
from odoo.tools import float_compare

REQUEST_STATES = [
    ('draft', _('Draft')),
    ('open', _('In progress')),
    ('done', _('Done')),
    ('cancel', _('Cancelled'))]


class StockRequest(models.Model):
    _name = "stock.request"
    _description = "Stock Request"
    _inherit = 'stock.request.abstract'
    _order = 'id desc'

    def __get_request_states(self):
        return REQUEST_STATES

    def _get_request_states(self):
        return self.__get_request_states()

    def _get_default_requested_by(self):
        return self.env['res.users'].browse(self.env.uid)

    @staticmethod
    def _get_expected_date():
        return fields.Datetime.now()

    def _get_default_expected_date(self):
        if self.order_id:
            res = self.order_id.expected_date
        else:
            res = self._get_expected_date()<commit_msg>[FIX] stock_request<commit_after># Copyright 2017 Eficent Business and IT Consulting Services, S.L.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).

from odoo import api, fields, models, _
from odoo.exceptions import UserError, ValidationError
from odoo.addons import decimal_precision as dp
from odoo.tools import float_compare

REQUEST_STATES = [
    ('draft', 'Draft'),
    ('open', 'In progress'),
    ('done', 'Done'),
    ('cancel', 'Cancelled')]


class StockRequest(models.Model):
    _name = "stock.request"
    _description = "Stock Request"
    _inherit = 'stock.request.abstract'
    _order = 'id desc'

    def __get_request_states(self):
        return REQUEST_STATES

    def _get_request_states(self):
        return self.__get_request_states()

    def _get_default_requested_by(self):
        return self.env['res.users'].browse(self.env.uid)

    @staticmethod
    def _get_expected_date():
        return fields.Datetime.now()

    def _get_default_expected_date(self):
        if self.order_id:
            res = self.order_id.expected_date
        else:
            res = self._get_expected_date()
{'fraction_non_alphanumeric': 0.11363636363636363, 'fraction_numerical': 0.005244755244755245, 'mean_word_length': 3.368320610687023, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '3503614', 'n_tokens_mistral': 753, 'n_tokens_neox': 723, 'n_words': 168}