修复出库时候找不到名称等问题

This commit is contained in:
dxc
2026-02-10 11:13:07 +08:00
parent bccbeaadce
commit e876505a1b
7 changed files with 49 additions and 40 deletions

View File

@ -32,14 +32,14 @@ class MaterialBase(db.Model):
# 关联关系区域
# ============================================================
# 1. 关联采购库存 (StockBuy)
stock_buys = db.relationship('StockBuy', back_populates='material', lazy='dynamic')
# 1. 关联采购库存 (StockBuy) - 修改 back_populates 为 'base'
stock_buys = db.relationship('StockBuy', back_populates='base', lazy='dynamic')
# 2. 关联半成品库存 (StockSemi)
stock_semis = db.relationship('StockSemi', back_populates='material', lazy='dynamic')
# 2. 关联半成品库存 (StockSemi) - 修改 back_populates 为 'base'
stock_semis = db.relationship('StockSemi', back_populates='base', lazy='dynamic')
# 3. 关联成品库存 (StockProduct)
stock_products = db.relationship('StockProduct', back_populates='material', lazy='dynamic')
# 3. 关联成品库存 (StockProduct) - 修改 back_populates 为 'base'
stock_products = db.relationship('StockProduct', back_populates='base', lazy='dynamic')
def to_dict(self):
"""