mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-13 18:21:22 +00:00
minor fix in landed cost wizard
This commit is contained in:
@@ -3,10 +3,8 @@
|
|||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import frappe
|
import frappe
|
||||||
from frappe.utils import cint, cstr, flt
|
from frappe.utils import flt
|
||||||
from frappe.model.doc import addchild
|
from frappe.model.doc import addchild
|
||||||
from frappe.model.bean import getlist
|
|
||||||
from frappe.model.code import get_obj
|
|
||||||
from frappe import msgprint, _
|
from frappe import msgprint, _
|
||||||
|
|
||||||
class DocType:
|
class DocType:
|
||||||
@@ -39,7 +37,8 @@ class DocType:
|
|||||||
|
|
||||||
for pr in purchase_receipts:
|
for pr in purchase_receipts:
|
||||||
pr_bean = frappe.bean('Purchase Receipt', pr)
|
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"}):
|
for lc in self.doclist.get({"parentfield": "landed_cost_details"}):
|
||||||
amt = flt(lc.amount) * flt(pr_bean.doc.net_total)/ flt(total_amt)
|
amt = flt(lc.amount) * flt(pr_bean.doc.net_total)/ flt(total_amt)
|
||||||
@@ -63,7 +62,7 @@ class DocType:
|
|||||||
ch.rate = amt
|
ch.rate = amt
|
||||||
ch.tax_amount = amt
|
ch.tax_amount = amt
|
||||||
ch.docstatus = 1
|
ch.docstatus = 1
|
||||||
ch.idx = idx
|
ch.idx = idx + 1
|
||||||
ch.save(1)
|
ch.save(1)
|
||||||
idx += 1
|
idx += 1
|
||||||
else: # overwrite if exists
|
else: # overwrite if exists
|
||||||
|
|||||||
Reference in New Issue
Block a user