1
0
forked from erp-dev/erp

fix: added new field into purchase and stock cancelled or red flush

This commit is contained in:
2026-02-04 17:51:30 +08:00
parent d0379d615c
commit 21f1d1ba27
5 changed files with 98 additions and 1 deletions

View File

@@ -133,6 +133,21 @@ class StockChangeRecord(ModelBase):
self.details.count()
return self.details.count()
@property
def is_offset(self) -> bool:
"""是否为红冲记录(用于冲抵其他记录)"""
return self.stock_snapshots.filter(offset_to__isnull=False).exists()
@property
def is_reversed(self) -> bool:
"""是否已被红冲"""
return self.stock_snapshots.filter(cancelled=True).exists()
@property
def cancelled(self) -> bool:
"""兼容字段:是否已被红冲"""
return self.is_reversed
@property
def delta_num_of_rolls(self) -> int:
"""计算库存变动的匹数增减"""