minor fixes
This commit is contained in:
parent
7854779c22
commit
22af7deadd
@ -10,7 +10,7 @@ from frappe.model.document import Document
|
|||||||
class QualityInspection(Document):
|
class QualityInspection(Document):
|
||||||
def get_item_specification_details(self):
|
def get_item_specification_details(self):
|
||||||
self.set('readings', [])
|
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:
|
if variant_of:
|
||||||
specification = frappe.db.sql("select specification, value from `tabItem Quality Inspection Parameter` \
|
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))
|
where parent in (%s, %s) order by idx", (self.item_code, variant_of))
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import frappe
|
import frappe
|
||||||
from frappe import _
|
from frappe import _
|
||||||
from frappe.utils import flt, cint
|
from frappe.utils import flt, cint, getdate
|
||||||
|
|
||||||
def execute(filters=None):
|
def execute(filters=None):
|
||||||
if not filters: filters = {}
|
if not filters: filters = {}
|
||||||
@ -61,16 +61,19 @@ def get_item_warehouse_batch_map(filters):
|
|||||||
sle = get_stock_ledger_entries(filters)
|
sle = get_stock_ledger_entries(filters)
|
||||||
iwb_map = {}
|
iwb_map = {}
|
||||||
|
|
||||||
|
from_date = getdate(filters["from_date"])
|
||||||
|
to_date = getdate(filters["to_date"])
|
||||||
|
|
||||||
for d in sle:
|
for d in sle:
|
||||||
iwb_map.setdefault(d.item_code, {}).setdefault(d.warehouse, {})\
|
iwb_map.setdefault(d.item_code, {}).setdefault(d.warehouse, {})\
|
||||||
.setdefault(d.batch_no, frappe._dict({
|
.setdefault(d.batch_no, frappe._dict({
|
||||||
"opening_qty": 0.0, "in_qty": 0.0, "out_qty": 0.0, "bal_qty": 0.0
|
"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]
|
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) \
|
qty_dict.opening_qty = flt(qty_dict.opening_qty, float_precision) \
|
||||||
+ flt(d.actual_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:
|
if flt(d.actual_qty) > 0:
|
||||||
qty_dict.in_qty = flt(qty_dict.in_qty, float_precision) + flt(d.actual_qty, float_precision)
|
qty_dict.in_qty = flt(qty_dict.in_qty, float_precision) + flt(d.actual_qty, float_precision)
|
||||||
else:
|
else:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user