def consume_allocation(self, quantity): """ Consume a previous allocation This is used when an item is shipped. We remove the original allocation and adjust the number in stock accordingly """ if not self.is_allocation_consumption_possible(quantity): raise InvalidStockAdjustment('Invalid stock consumption request') self.num_allocated -= quantity self.num_in_stock -= quantity self.save()
def consume_allocation(self, quantity): """ 以前の割り当てを消費する。 商品が出荷されるときに使用されるメソッド。元の配分を削除し、それに応じて在庫数を調整する。 """ if not self.can_track_allocations: return if not self.is_allocation_consumption_possible(quantity): raise InvalidStockAdjustment( _('Invalid stock consumption request')) self.num_allocated -= quantity self.num_in_stock -= quantity self.save()
def consume_allocation(self, quantity): """ Consume a previous allocation This is used when an item is shipped. We remove the original allocation and adjust the number in stock accordingly 消耗先前的分配 这是在物品发货时使用的。 我们删除原始分配并相应调整库存数量 """ if not self.can_track_allocations: return if not self.is_allocation_consumption_possible(quantity): raise InvalidStockAdjustment( _('Invalid stock consumption request')) self.num_allocated -= quantity self.num_in_stock -= quantity self.save()