minor fixes

This commit is contained in:
Anand Doshi 2015-04-05 17:18:07 +05:30
parent 7854779c22
commit 22af7deadd
2 changed files with 7 additions and 4 deletions

View File

@ -10,7 +10,7 @@ from frappe.model.document import Document
class QualityInspection(Document):
def get_item_specification_details(self):
self.set('readings', [])
variant_of = frappe.db.get_query("Item", self.item_code, "variant_of")
variant_of = frappe.db.get_value("Item", self.item_code, "variant_of")
if variant_of:
specification = frappe.db.sql("select specification, value from `tabItem Quality Inspection Parameter` \
where parent in (%s, %s) order by idx", (self.item_code, variant_of))

View File

@ -4,7 +4,7 @@
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.utils import flt, cint
from frappe.utils import flt, cint, getdate
def execute(filters=None):
if not filters: filters = {}
@ -61,16 +61,19 @@ def get_item_warehouse_batch_map(filters):
sle = get_stock_ledger_entries(filters)
iwb_map = {}
from_date = getdate(filters["from_date"])
to_date = getdate(filters["to_date"])
for d in sle:
iwb_map.setdefault(d.item_code, {}).setdefault(d.warehouse, {})\
.setdefault(d.batch_no, frappe._dict({
"opening_qty": 0.0, "in_qty": 0.0, "out_qty": 0.0, "bal_qty": 0.0
}))
qty_dict = iwb_map[d.item_code][d.warehouse][d.batch_no]
if d.posting_date < filters["from_date"]:
if d.posting_date < from_date:
qty_dict.opening_qty = flt(qty_dict.opening_qty, float_precision) \
+ flt(d.actual_qty, float_precision)
elif d.posting_date >= filters["from_date"] and d.posting_date <= filters["to_date"]:
elif d.posting_date >= from_date and d.posting_date <= to_date:
if flt(d.actual_qty) > 0:
qty_dict.in_qty = flt(qty_dict.in_qty, float_precision) + flt(d.actual_qty, float_precision)
else: