From cca6460e65ceac1001ceed2faf085c35392d297a Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Tue, 19 Aug 2014 16:05:54 +0530 Subject: [PATCH] [fix] Error Reports --- erpnext/accounts/doctype/pricing_rule/pricing_rule.py | 6 ++++-- .../production_planning_tool/production_planning_tool.py | 2 +- erpnext/stock/doctype/material_request/material_request.js | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/erpnext/accounts/doctype/pricing_rule/pricing_rule.py b/erpnext/accounts/doctype/pricing_rule/pricing_rule.py index 9a3b3121f4..076cccc179 100644 --- a/erpnext/accounts/doctype/pricing_rule/pricing_rule.py +++ b/erpnext/accounts/doctype/pricing_rule/pricing_rule.py @@ -135,8 +135,10 @@ def get_pricing_rule_for_item(args): frappe.throw(_("Item Group not mentioned in item master for item {0}").format(args.item_code)) if args.customer and not (args.customer_group and args.territory): - args.customer_group, args.territory = frappe.db.get_value("Customer", args.customer, - ["customer_group", "territory"]) + customer = frappe.db.get_value("Customer", args.customer, ["customer_group", "territory"]) + if customer: + args.customer_group, args.territory = customer + elif args.supplier and not args.supplier_type: args.supplier_type = frappe.db.get_value("Supplier", args.supplier, "supplier_type") diff --git a/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py b/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py index 14418a8b41..0d55f8bb5e 100644 --- a/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py +++ b/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py @@ -324,7 +324,7 @@ class ProductionPlanningTool(Document): total_qty = sum([flt(d[0]) for d in so_item_qty]) if total_qty > item_projected_qty.get(item, 0): # shortage - requested_qty = total_qty - item_projected_qty.get(item, 0) + requested_qty = total_qty - flt(item_projected_qty.get(item)) # consider minimum order qty requested_qty = requested_qty > flt(so_item_qty[0][3]) and \ requested_qty or flt(so_item_qty[0][3]) diff --git a/erpnext/stock/doctype/material_request/material_request.js b/erpnext/stock/doctype/material_request/material_request.js index e592f8df4d..3729b55c7e 100644 --- a/erpnext/stock/doctype/material_request/material_request.js +++ b/erpnext/stock/doctype/material_request/material_request.js @@ -96,7 +96,7 @@ erpnext.buying.MaterialRequestController = erpnext.buying.BuyingController.exten title: __("Get Items from BOM"), fields: [ {"fieldname":"bom", "fieldtype":"Link", "label":__("BOM"), - options:"BOM"}, + options:"BOM", reqd: 1}, {"fieldname":"fetch_exploded", "fieldtype":"Check", "label":__("Fetch exploded BOM (including sub-assemblies)"), "default":1}, {fieldname:"fetch", "label":__("Get Items from BOM"), "fieldtype":"Button"}