Public release from ruodoo-project: 19.0 - 2026-11-01 22:52:25 UTC

This commit is contained in:
CI Publish Bot
2026-11-01 22:54:30 +00:00
commit 26250aa580
2492 changed files with 664277 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
import logging
from odoo import api, models
from odoo.addons.directive_layer.models.directive_constants import (
STAGE_DRAFT,
STAGE_PLANNED,
STAGE_IN_PROGRESS,
STAGE_DONE,
)
_logger = logging.getLogger(__name__)
class Directive(models.Model):
_inherit = "directive.directive"
@api.model
def _cron_simulate_system_agents(self):
"""
Этот метод имитирует работу внешних систем (WMS, Банк, AI).
Запускается раз в минуту.
"""
system_directives = self.search([
('executor_type', 'in', ['software', 'machine']),
('stage_code', 'in', [STAGE_DRAFT, STAGE_PLANNED, STAGE_IN_PROGRESS]),
('stage_code', '!=', STAGE_DONE)
], limit=50)
for d in system_directives:
if d.stage_code == STAGE_PLANNED:
d._set_stage(STAGE_IN_PROGRESS)
_logger.info("Agent started directive %s", d.id)
elif d.stage_code == STAGE_IN_PROGRESS:
d.action_done()
_logger.info("Agent finished directive %s", d.id)