From 628d42ab4f5e09153a4416449c8d4509103cc65d Mon Sep 17 00:00:00 2001 From: 7nimor <7nimor@gmail.com> Date: Tue, 3 Feb 2026 11:28:34 +0330 Subject: [PATCH] update hatching --- app/models.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/models.py b/app/models.py index 619461e..0539a13 100644 --- a/app/models.py +++ b/app/models.py @@ -234,10 +234,11 @@ class Hatching(BaseModel): if hasattr(self, 'PedigreeName') and self.PedigreeName in correction_dict: self.PedigreeName = correction_dict[self.PedigreeName] try: - date1 = AllProductsTransport.objects.filter(hatching__id=self.id, trash=False, product='جوجه یک روزه گوشتی').order_by('date').first().date - date = datetime.datetime(year=date1.year, month=date1.month, day=date1.day, hour=10, - minute=1, - second=1) + date1 = AllProductsTransport.objects.filter(hatching__id=self.id, trash=False, product='جوجه یک روزه گوشتی').order_by('date').first() + if date1: + date = datetime.datetime(year=date1.date.year, month=date1.date.month, day=date1.date.day, hour=10, + minute=1, + second=1) except: hatching_date = self.SendDateFa.split('/') date = convert_to_miladi(