Fixed again

This commit is contained in:
Tanshu
2013-05-18 12:18:02 +05:30
parent 6e6113436b
commit 8985f1213a

View File

@ -9,6 +9,7 @@ from brewman.models.voucher import Voucher, VoucherType, Batch, Inventory, Journ
__author__ = 'tanshu' __author__ = 'tanshu'
def purchase_return_create_voucher(json, user): def purchase_return_create_voucher(json, user):
dt = datetime.datetime.strptime(json['Date'], '%d-%b-%Y') dt = datetime.datetime.strptime(json['Date'], '%d-%b-%Y')
voucher = Voucher(date=dt, narration=json['Narration'], user_id=user.id, type=VoucherType.by_name(json['Type'])) voucher = Voucher(date=dt, narration=json['Narration'], user_id=user.id, type=VoucherType.by_name(json['Type']))
@ -50,7 +51,7 @@ def purchase_return_create_journals(inventories, ledgerID):
ledger = Product.by_id(item.product_id).ledger ledger = Product.by_id(item.product_id).ledger
amount += round(item.amount, 2) amount += round(item.amount, 2)
if ledger.id in journals: if ledger.id in journals:
journals[ledger.id].amount += amount journals[ledger.id].amount += round(item.amount, 2)
else: else:
journals[ledger.id] = Journal(debit=-1, cost_center_id=ledger.costcenter_id, ledger_id=ledger.id, journals[ledger.id] = Journal(debit=-1, cost_center_id=ledger.costcenter_id, ledger_id=ledger.id,
amount=item.amount) amount=item.amount)