From 439dceebd868be0e3eae9e52c22ec7990986e1f4 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 13 Mar 2014 16:31:30 +0530 Subject: [PATCH] minor fix in landed cost wizard --- .../doctype/landed_cost_wizard/landed_cost_wizard.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/erpnext/stock/doctype/landed_cost_wizard/landed_cost_wizard.py b/erpnext/stock/doctype/landed_cost_wizard/landed_cost_wizard.py index f310744133..c52c820be9 100644 --- a/erpnext/stock/doctype/landed_cost_wizard/landed_cost_wizard.py +++ b/erpnext/stock/doctype/landed_cost_wizard/landed_cost_wizard.py @@ -3,10 +3,8 @@ from __future__ import unicode_literals import frappe -from frappe.utils import cint, cstr, flt +from frappe.utils import flt from frappe.model.doc import addchild -from frappe.model.bean import getlist -from frappe.model.code import get_obj from frappe import msgprint, _ class DocType: @@ -39,7 +37,8 @@ class DocType: for pr in purchase_receipts: pr_bean = frappe.bean('Purchase Receipt', pr) - idx = max([d.idx for d in pr_bean.doclist.get({"parentfield": "other_charges"})]) + pr_items = pr_bean.doclist.get({"parentfield": "purchase_tax_details"}) + idx = max([d.idx for d in pr_items]) if pr_items else 0 for lc in self.doclist.get({"parentfield": "landed_cost_details"}): amt = flt(lc.amount) * flt(pr_bean.doc.net_total)/ flt(total_amt) @@ -63,7 +62,7 @@ class DocType: ch.rate = amt ch.tax_amount = amt ch.docstatus = 1 - ch.idx = idx + ch.idx = idx + 1 ch.save(1) idx += 1 else: # overwrite if exists