| Server IP : 65.108.144.40 / Your IP : 216.73.217.165 Web Server : Apache/2.4.52 (Ubuntu) System : Linux ubuntu-8gb-hel1-1 5.15.0-173-generic #183-Ubuntu SMP Fri Mar 6 13:29:34 UTC 2026 x86_64 User : dev ( 1000) PHP Version : 8.2.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/erp/asset/__pycache__/ |
Upload File : |
o
hͦh � @ s� d Z ddlZddlmZmZ ddlmZ ddlmZ ddl m
Z
dd� Zd d
� Ze
dd� d
D ��sJe� Zejeddd� ejeddd� e�� dS dS )z?
scheduler.py
This module is used to register scheduled tasks
� N)�date� timedelta)�BackgroundScheduler)�reverse)�notifyc
C s� ddl m} ddlm} t�� }|j�� }| jjdd�� � }|D ]T}|j
rt|j
}|t|jd� }||krtt
j||jjd|j� d|j� d �d
|j� d|j� d�d
|j� d|j� d�d|j� d|j� d�d|j� d|j� d�td�ddd�
q dS )zV
Finds all Expiring Assets and send a notification on the notify_before date.
r ��User)�Asset�Horilla Bot��username��dayszThe Asset ' � ' expires in z daysu% تنتهي صلاحية الأصل ' u ' خلال u% من الأيامz
Das Asset u läuft in z! Tagen ab.z
El activo z caduca en u días.zL'actif z
expire dans z jours.�asset-category-view�System�information� � recipient�verb�verb_ar�verb_de�verb_es�verb_fr�redirect�label�iconN)�django.contrib.auth.modelsr �asset.modelsr r �today�objects�all�filter�first�expiry_dater �
notify_beforer �send�owner�employee_user_id�
asset_namer )r r r �assets�bot�assetr$ �notify_date� r. �/var/www/erp/asset/scheduler.py�notify_expiring_assets s0
���r0 c
C s� ddl m} ddlm} t�� }|j�� }| jjdd�� � }|D ][}|j
r{|j
}|t|jd� }||krtt
j||jjd|j� d|j� d �d
|j� d|j� d�d
|j� d|j� d�d|j� d|j� d�d|j� d|j� d�td�ddd�
||kr{d|_q dS )zY
Finds all Expiring Documents and send a notification on the notify_before date.
r r )�Documentr
r r
zThe document ' r z daysu( تنتهي صلاحية المستند 'u ' خلال u يومzDas Dokument 'u ' läuft in z! Tagen ab.zEl documento 'z' caduca en u díasz
Le document 'z' expire dans z joursr r r r FN)r r �horilla_documents.modelsr1 r r r r! r"