[fixes] accounts, stock changes

This commit is contained in:
Rushabh Mehta 2015-02-18 20:22:59 +05:30
parent 614e7ab757
commit 8bb6e530c7
2 changed files with 8 additions and 7 deletions

View File

@ -371,14 +371,14 @@ class calculate_taxes_and_totals(object):
return grand_total_for_discount_amount
def calculate_total_advance(self, parenttype, advance_parentfield):
if self.docstatus < 2:
def calculate_total_advance(self):
if self.doc.docstatus < 2:
sum_of_allocated_amount = sum([flt(adv.allocated_amount, self.doc.precision("allocated_amount", adv))
for adv in self.doc.get("advances")])
self.doc.total_advance = flt(sum_of_allocated_amount, self.doc.precision("total_advance"))
if self.docstatus == 0:
if self.doc.docstatus == 0:
self.calculate_outstanding_amount()
def calculate_outstanding_amount(self):

View File

@ -151,19 +151,19 @@ class update_entries_after(object):
if sle.serial_no:
self.valuation_rate = self.get_serialized_values(sle)
self.qty_after_transaction += flt(sle.actual_qty)
self.stock_value = self.qty_after_transaction * self.valuation_rate
self.stock_value = flt(self.qty_after_transaction) * flt(self.valuation_rate)
else:
if sle.voucher_type=="Stock Reconciliation":
# assert
self.valuation_rate = sle.valuation_rate
self.qty_after_transaction = sle.qty_after_transaction
self.stock_queue = [[self.qty_after_transaction, self.valuation_rate]]
self.stock_value = self.qty_after_transaction * self.valuation_rate
self.stock_value = flt(self.qty_after_transaction) * flt(self.valuation_rate)
else:
if self.valuation_method == "Moving Average":
self.get_moving_average_values(sle)
self.qty_after_transaction += flt(sle.actual_qty)
self.stock_value = self.qty_after_transaction * self.valuation_rate
self.stock_value = flt(self.qty_after_transaction) * flt(self.valuation_rate)
else:
self.get_fifo_values(sle)
self.qty_after_transaction += flt(sle.actual_qty)
@ -181,7 +181,8 @@ class update_entries_after(object):
sle.valuation_rate = self.valuation_rate
sle.stock_queue = json.dumps(self.stock_queue)
sle.stock_value_difference = stock_value_difference
sle.save()
sle.doctype="Stock Ledger Entry"
frappe.get_doc(sle).db_update()
def validate_negative_stock(self, sle):
"""