From 1b89be0c6679072f2981703aa41acd5c864430a0 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 30 Nov 2017 15:59:56 +0530 Subject: [PATCH] Fixed rounding issue in subcontracting (#11802) --- erpnext/controllers/buying_controller.py | 3 ++- erpnext/domains/retail.py | 3 --- erpnext/stock/doctype/stock_entry/stock_entry.py | 10 +++++----- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/erpnext/controllers/buying_controller.py b/erpnext/controllers/buying_controller.py index 9aff1181b6..fcf6a809f0 100644 --- a/erpnext/controllers/buying_controller.py +++ b/erpnext/controllers/buying_controller.py @@ -202,7 +202,8 @@ class BuyingController(StockController): if not exists: rm = self.append(raw_material_table, {}) - required_qty = flt(bom_item.qty_consumed_per_unit) * flt(item.qty) * flt(item.conversion_factor) + required_qty = flt(flt(bom_item.qty_consumed_per_unit) * flt(item.qty) * + flt(item.conversion_factor), rm.precision("required_qty")) rm.reference_name = item.name rm.bom_detail_no = bom_item.name rm.main_item_code = item.item_code diff --git a/erpnext/domains/retail.py b/erpnext/domains/retail.py index 897c4d9e40..07b2e2781e 100644 --- a/erpnext/domains/retail.py +++ b/erpnext/domains/retail.py @@ -9,9 +9,6 @@ data = { 'Task', 'ToDo' ], - 'properties': [ - {'doctype': 'Item', 'fieldname': 'manufacturing', 'property': 'hidden', 'value': 1} - ], 'set_value': [ ['Stock Settings', None, 'show_barcode_field', 1] ], diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py index 4d79e13d74..368e869b64 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/stock_entry.py @@ -356,7 +356,7 @@ class StockEntry(StockController): if not total_allowed: frappe.throw(_("Item {0} not found in 'Raw Materials Supplied' table in Purchase Order {1}") .format(se_item.item_code, self.purchase_order)) - total_supplied = frappe.db.sql("""select sum(qty) + total_supplied = frappe.db.sql("""select sum(transfer_qty) from `tabStock Entry Detail`, `tabStock Entry` where `tabStock Entry`.purchase_order = %s and `tabStock Entry`.docstatus = 1 @@ -365,8 +365,8 @@ class StockEntry(StockController): (self.purchase_order, se_item.item_code))[0][0] if total_supplied > total_allowed: - frappe.throw(_("Not allowed to tranfer more {0} than {1} against Purchase Order {2}").format(se_item.item_code, - total_allowed, self.purchase_order)) + frappe.throw(_("Row {0}# Item {1} cannot be transferred more than {2} against Purchase Order {3}") + .format(se_item.idx, se_item.item_code, total_allowed, self.purchase_order)) def validate_bom(self): for d in self.get('items'): @@ -767,7 +767,7 @@ class StockEntry(StockController): se_child.description = item_dict[d]["description"] se_child.uom = stock_uom se_child.stock_uom = stock_uom - se_child.qty = flt(item_dict[d]["qty"]) + se_child.qty = flt(item_dict[d]["qty"], se_child.precision("qty")) se_child.expense_account = item_dict[d].get("expense_account") or expense_account se_child.cost_center = item_dict[d].get("cost_center") or cost_center @@ -777,7 +777,7 @@ class StockEntry(StockController): se_child.t_warehouse = self.to_warehouse # in stock uom - se_child.transfer_qty = flt(item_dict[d]["qty"]) + se_child.transfer_qty = flt(item_dict[d]["qty"], se_child.precision("qty")) se_child.conversion_factor = 1.00 # to be assigned for finished item