Skip to content

Commit

Permalink
Fix some weird bugs when trying to sync stockstate
Browse files Browse the repository at this point in the history
  • Loading branch information
twymer committed Jan 27, 2014
1 parent a768cf5 commit 79b7511
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion casexml/apps/stock/consumption.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def _to_consumption_tx(txn):
db_transactions = StockTransaction.objects.filter(
case_id=case_id, product_id=product_id,
report__date__gt=window_start,
report__date__lte=window_end,
report__date__lte=datetime(window_end.year, window_end.month, window_end.day),
section_id=section_id,
).order_by('report__date', 'pk')

Expand Down
2 changes: 1 addition & 1 deletion casexml/apps/stock/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def create_reconciliation_transaction(sender, instance, *args, **kwargs):
previous_transaction = instance.get_previous_transaction()
# only soh reports that have changed the stock create inferred transactions
if previous_transaction and previous_transaction.stock_on_hand != instance.stock_on_hand:
amt = instance.stock_on_hand - previous_transaction.stock_on_hand
amt = instance.stock_on_hand - Decimal(previous_transaction.stock_on_hand)
StockTransaction.objects.create(
report=instance.report,
case_id=instance.case_id,
Expand Down

0 comments on commit 79b7511

Please sign in to comment.