forked from erp-dev/erp
fix: added new field into purchase and stock cancelled or red flush
This commit is contained in:
@@ -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:
|
||||
"""计算库存变动的匹数增减"""
|
||||
|
||||
Reference in New Issue
Block a user