forked from erp-dev/erp
fix: added merchant_id to printing_order and plate_order
This commit is contained in:
@@ -1,8 +1,14 @@
|
||||
from __future__ import annotations
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from django.db import models
|
||||
from django.contrib.auth import get_user_model
|
||||
from flower.common import ModelBase
|
||||
from basic_info import models as basic_models
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from printing.models import PrintingJob
|
||||
|
||||
User = get_user_model()
|
||||
|
||||
|
||||
@@ -138,7 +144,7 @@ class SalesItem(ModelBase):
|
||||
def __str__(self):
|
||||
return f'{self.name} x {self.quantity} {self.get_unit_display()}'
|
||||
|
||||
def get_printing_job(self):
|
||||
def get_printing_job(self) -> PrintingJob | None:
|
||||
"""
|
||||
获取关联的 PrintingJob 实例
|
||||
|
||||
@@ -150,10 +156,10 @@ class SalesItem(ModelBase):
|
||||
try:
|
||||
from printing.models import PrintingJob
|
||||
return PrintingJob.objects.get(id=self.printing_job_id)
|
||||
except Exception:
|
||||
except PrintingJob.DoesNotExist:
|
||||
return None
|
||||
|
||||
def get_customer(self):
|
||||
def get_customer(self) -> basic_models.Customer | None:
|
||||
"""
|
||||
获取关联的 Customer 实例
|
||||
|
||||
|
||||
Reference in New Issue
Block a user