Test case fixed for multiple uom in selling

This commit is contained in:
Nabin Hait 2017-03-06 16:32:57 +05:30
parent e68f32cf19
commit fe876c0805
5 changed files with 18 additions and 2 deletions

View File

@ -21,6 +21,8 @@
"parentfield": "items",
"qty": 1.0,
"rate": 500.0,
"uom": "_Test UOM",
"conversion_factor": 1,
"stock_uom": "_Test UOM"
}
],
@ -91,6 +93,8 @@
"parentfield": "items",
"price_list_rate": 500.0,
"qty": 1.0,
"uom": "_Test UOM",
"conversion_factor": 1,
"stock_uom": "_Test UOM"
}
],
@ -143,6 +147,8 @@
"price_list_rate": 50,
"qty": 10,
"rate": 50,
"uom": "_Test UOM",
"conversion_factor": 1,
"stock_uom": "_Test UOM"
},
{
@ -155,6 +161,8 @@
"parentfield": "items",
"price_list_rate": 150,
"qty": 5,
"uom": "_Test UOM",
"conversion_factor": 1,
"rate": 150,
"stock_uom": "_Test UOM"
}
@ -265,6 +273,8 @@
"parentfield": "items",
"price_list_rate": 62.5,
"qty": 10,
"uom": "_Test UOM",
"conversion_factor": 1,
"stock_uom": "_Test UOM"
},
@ -278,6 +288,8 @@
"parentfield": "items",
"price_list_rate": 190.66,
"qty": 5,
"uom": "_Test UOM",
"conversion_factor": 1,
"stock_uom": "_Test UOM"
}
],

View File

@ -23,6 +23,7 @@
"parentfield": "items",
"qty": 10.0,
"rate": 100.0,
"uom": "_Test UOM",
"stock_uom": "_Test UOM",
"conversion_factor": 1.0
}

View File

@ -28,7 +28,8 @@
"rate": 100.0,
"warehouse": "_Test Warehouse - _TC",
"stock_uom": "_Test UOM",
"conversion_factor": 1.0
"conversion_factor": 1.0,
"uom": "_Test UOM"
}
],
"selling_price_list": "_Test Price List",

View File

@ -18,6 +18,8 @@
"parentfield": "items",
"qty": 1.0,
"rate": 100.0,
"uom": "_Test UOM",
"conversion_factor": 1,
"stock_uom": "_Test UOM",
"warehouse": "_Test Warehouse - _TC"
}

View File

@ -510,7 +510,7 @@ def get_valuation_rate(item_code, warehouse=None):
["valuation_rate"], as_dict=True) or {"valuation_rate": 0}
elif not item.is_stock_item:
valuation_rate =frappe.db.sql("""select sum(base_net_amount) / sum(stock_qty)
valuation_rate =frappe.db.sql("""select sum(base_net_amount) / sum(qty*conversion_factor)
from `tabPurchase Invoice Item`
where item_code = %s and docstatus=1""", item_code)