forked from erp-dev/erp
feat: all the business models supported human_id now but it wont change statements api. Added new field 'order_quantity' into sales_order model (integer, allow null).
This commit is contained in:
@@ -133,6 +133,17 @@ class PurchaseOrder(OrderItemsAggregationMixin, OrderDirectionMixin, OrderCounte
|
||||
def __str__(self):
|
||||
return f'采购订单 {self.id} - {self.supplier.name}'
|
||||
|
||||
@property
|
||||
def human_id(self) -> str:
|
||||
"""
|
||||
人类可读编号(虚拟编号,不落库)。
|
||||
|
||||
规则与 printing.PrintingOrder.human_id / SalesOrder.human_id 保持一致:YYYYMMDD{6位id}
|
||||
"""
|
||||
if self.id is None or self.created_at is None:
|
||||
return ""
|
||||
return f"{self.created_at.year}{self.created_at.month:02d}{self.created_at.day:02d}{self.id:06d}"
|
||||
|
||||
class Meta:
|
||||
verbose_name = '采购单'
|
||||
verbose_name_plural = '采购单'
|
||||
@@ -252,6 +263,7 @@ class SalesOrder(OrderItemsAggregationMixin, OrderDirectionMixin, OrderCounterpa
|
||||
default=SalesOrderStatusEnum.PENDING,
|
||||
verbose_name='状态',
|
||||
)
|
||||
order_quantity = models.IntegerField(null=True, blank=True, verbose_name='下单数量')
|
||||
remarks = models.TextField(blank=True, null=True, verbose_name='备注')
|
||||
|
||||
def __str__(self):
|
||||
@@ -405,6 +417,17 @@ class PurchaseReturnOrder(OrderItemsAggregationMixin, OrderDirectionMixin, Order
|
||||
def __str__(self):
|
||||
return f'采购退货 {self.id} - {self.supplier.name}'
|
||||
|
||||
@property
|
||||
def human_id(self) -> str:
|
||||
"""
|
||||
人类可读编号(虚拟编号,不落库)。
|
||||
|
||||
规则与 printing.PrintingOrder.human_id / SalesOrder.human_id 保持一致:YYYYMMDD{6位id}
|
||||
"""
|
||||
if self.id is None or self.created_at is None:
|
||||
return ""
|
||||
return f"{self.created_at.year}{self.created_at.month:02d}{self.created_at.day:02d}{self.id:06d}"
|
||||
|
||||
def get_direction(self) -> int:
|
||||
return -1
|
||||
|
||||
@@ -519,6 +542,17 @@ class SalesReturnOrder(OrderItemsAggregationMixin, OrderDirectionMixin, OrderCou
|
||||
def __str__(self):
|
||||
return f'销售退货 {self.id} - {self.customer.name}'
|
||||
|
||||
@property
|
||||
def human_id(self) -> str:
|
||||
"""
|
||||
人类可读编号(虚拟编号,不落库)。
|
||||
|
||||
规则与 printing.PrintingOrder.human_id / SalesOrder.human_id 保持一致:YYYYMMDD{6位id}
|
||||
"""
|
||||
if self.id is None or self.created_at is None:
|
||||
return ""
|
||||
return f"{self.created_at.year}{self.created_at.month:02d}{self.created_at.day:02d}{self.id:06d}"
|
||||
|
||||
def get_direction(self) -> int:
|
||||
return 1
|
||||
|
||||
|
||||
Reference in New Issue
Block a user