Exemplo n.º 1
0
 def update_stock(self, product_id):
     supplier_id = self.supplier.pk
     # TODO: Consider whether this should be done without a cache table
     values = get_current_stock_value(supplier_id=supplier_id, product_id=product_id)
     sv, _ = StockCount.objects.get_or_create(supplier_id=supplier_id, product_id=product_id)
     sv.logical_count = values["logical_count"]
     sv.physical_count = values["physical_count"]
     sv.save(update_fields=("logical_count", "physical_count"))
Exemplo n.º 2
0
 def update_stock(self, product_id):
     supplier_id = self.supplier.pk
     # TODO: Consider whether this should be done without a cache table
     values = get_current_stock_value(supplier_id=supplier_id,
                                      product_id=product_id)
     sv, _ = StockCount.objects.get_or_create(supplier_id=supplier_id,
                                              product_id=product_id)
     sv.logical_count = values["logical_count"]
     sv.physical_count = values["physical_count"]
     sv.save(update_fields=("logical_count", "physical_count"))
Exemplo n.º 3
0
 def update_stock(self, product_id):
     supplier_id = self.supplier.pk
     # TODO: Consider whether this should be done without a cache table
     values = get_current_stock_value(supplier_id=supplier_id, product_id=product_id)
     sv, _ = StockCount.objects.get_or_create(supplier_id=supplier_id, product_id=product_id)
     sv.logical_count = values["logical_count"]
     sv.physical_count = values["physical_count"]
     latest_event = StockAdjustment.objects.filter(
         supplier=supplier_id, product=product_id).order_by("-created_on").first()
     if latest_event:
         sv.stock_value_value = latest_event.purchase_price_value * sv.logical_count
     sv.save(update_fields=("logical_count", "physical_count", "stock_value_value"))
Exemplo n.º 4
0
 def update_stock(self, product_id):
     supplier_id = self.supplier.pk
     # TODO: Consider whether this should be done without a cache table
     values = get_current_stock_value(supplier_id=supplier_id,
                                      product_id=product_id)
     sv, _ = StockCount.objects.get_or_create(supplier_id=supplier_id,
                                              product_id=product_id)
     sv.logical_count = values["logical_count"]
     sv.physical_count = values["physical_count"]
     latest_event = StockAdjustment.objects.filter(
         supplier=supplier_id,
         product=product_id).order_by("-created_on").first()
     if latest_event:
         sv.stock_value_value = latest_event.purchase_price_value * sv.logical_count
     sv.save(update_fields=("logical_count", "physical_count",
                            "stock_value_value"))