diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 1d4e91313a..1799e6b410 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -76,3 +76,4 @@ erpnext.patches.v4_2.toggle_rounded_total #2014-07-30 erpnext.patches.v4_2.fix_account_master_type erpnext.patches.v4_2.update_project_milestones erpnext.patches.v4_2.add_currency_turkish_lira #2014-08-08 +execute:frappe.delete_doc("DocType", "Landed Cost Wizard") diff --git a/erpnext/stock/doctype/landed_cost_wizard/README.md b/erpnext/stock/doctype/landed_cost_wizard/README.md deleted file mode 100644 index 0d2c20d93f..0000000000 --- a/erpnext/stock/doctype/landed_cost_wizard/README.md +++ /dev/null @@ -1 +0,0 @@ -Tool to distribute costs as part of Item value after the Item has been received. This is typically in case where bills related to Items are received much later and for multiple Item. (specially Custom Duty) \ No newline at end of file diff --git a/erpnext/stock/doctype/landed_cost_wizard/__init__.py b/erpnext/stock/doctype/landed_cost_wizard/__init__.py deleted file mode 100644 index baffc48825..0000000000 --- a/erpnext/stock/doctype/landed_cost_wizard/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from __future__ import unicode_literals diff --git a/erpnext/stock/doctype/landed_cost_wizard/landed_cost_wizard.js b/erpnext/stock/doctype/landed_cost_wizard/landed_cost_wizard.js deleted file mode 100644 index 38e8636f8e..0000000000 --- a/erpnext/stock/doctype/landed_cost_wizard/landed_cost_wizard.js +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors -// License: GNU General Public License v3. See license.txt - - -frappe.provide("erpnext.stock"); -frappe.require("assets/erpnext/js/controllers/stock_controller.js"); - -erpnext.stock.LandedCostWizard = erpnext.stock.StockController.extend({ - setup: function() { - var me = this; - this.frm.fields_dict.lc_pr_details.grid.get_field('purchase_receipt').get_query = - function() { - if(!me.frm.doc.company) msgprint(__("Please enter company first")); - return { - filters:[ - ['Purchase Receipt', 'docstatus', '=', '1'], - ['Purchase Receipt', 'company', '=', me.frm.doc.company], - ] - } - }; - - this.frm.fields_dict.landed_cost_details.grid.get_field('account_head').get_query = function() { - if(!me.frm.doc.company) msgprint(__("Please enter company first")); - return { - filters:[ - ['Account', 'group_or_ledger', '=', 'Ledger'], - ['Account', 'account_type', 'in', 'Tax, Chargeable'], - ['Account', 'company', '=', me.frm.doc.company] - ] - } - }, - - this.frm.fields_dict.landed_cost_details.grid.get_field('cost_center').get_query = - function() { - if(!me.frm.doc.company) msgprint(__("Please enter company first")); - return { - filters:[ - ['Cost Center', 'group_or_ledger', '=', 'Ledger'], - ['Cost Center', 'company', '=', me.frm.doc.company] - ] - } - } - } -}); - -cur_frm.script_manager.make(erpnext.stock.LandedCostWizard); \ No newline at end of file diff --git a/erpnext/stock/doctype/landed_cost_wizard/landed_cost_wizard.json b/erpnext/stock/doctype/landed_cost_wizard/landed_cost_wizard.json deleted file mode 100644 index 59c9478125..0000000000 --- a/erpnext/stock/doctype/landed_cost_wizard/landed_cost_wizard.json +++ /dev/null @@ -1,83 +0,0 @@ -{ - "creation": "2013-01-22 16:50:39.000000", - "docstatus": 0, - "doctype": "DocType", - "fields": [ - { - "fieldname": "company", - "fieldtype": "Link", - "label": "Company", - "options": "Company", - "permlevel": 0, - "reqd": 1 - }, - { - "fieldname": "section_break0", - "fieldtype": "Section Break", - "label": "Select Purchase Receipts", - "options": "Simple", - "permlevel": 0 - }, - { - "fieldname": "lc_pr_details", - "fieldtype": "Table", - "label": "Landed Cost Purchase Receipts", - "options": "Landed Cost Purchase Receipt", - "permlevel": 0 - }, - { - "fieldname": "section_break1", - "fieldtype": "Section Break", - "label": "Add Taxes and Charges", - "permlevel": 0 - }, - { - "fieldname": "landed_cost_details", - "fieldtype": "Table", - "label": "Landed Cost Items", - "options": "Landed Cost Item", - "permlevel": 0 - }, - { - "fieldname": "update_landed_cost", - "fieldtype": "Button", - "label": "Update Landed Cost", - "options": "update_landed_cost", - "permlevel": 0 - } - ], - "icon": "icon-magic", - "idx": 1, - "issingle": 1, - "modified": "2013-12-20 19:23:18.000000", - "modified_by": "Administrator", - "module": "Stock", - "name": "Landed Cost Wizard", - "owner": "wasim@webnotestech.com", - "permissions": [ - { - "amend": 0, - "cancel": 0, - "create": 1, - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 0, - "role": "Purchase Manager", - "submit": 0, - "write": 1 - }, - { - "create": 1, - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 0, - "role": "Purchase User", - "submit": 0, - "write": 1 - } - ] -} \ No newline at end of file diff --git a/erpnext/stock/doctype/landed_cost_wizard/landed_cost_wizard.py b/erpnext/stock/doctype/landed_cost_wizard/landed_cost_wizard.py deleted file mode 100644 index c105ecbce4..0000000000 --- a/erpnext/stock/doctype/landed_cost_wizard/landed_cost_wizard.py +++ /dev/null @@ -1,93 +0,0 @@ -# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors -# License: GNU General Public License v3. See license.txt - -from __future__ import unicode_literals -import frappe -from frappe.utils import flt -from frappe import msgprint, _ - -from frappe.model.document import Document - -class LandedCostWizard(Document): - - def update_landed_cost(self): - """ - Add extra cost and recalculate all values in pr, - Recalculate valuation rate in all sle after pr posting date - """ - purchase_receipts = [row.purchase_receipt for row in - self.get("lc_pr_details")] - - self.validate_purchase_receipts(purchase_receipts) - self.cancel_pr(purchase_receipts) - self.add_charges_in_pr(purchase_receipts) - self.submit_pr(purchase_receipts) - msgprint(_("Landed Cost updated successfully")) - - def validate_purchase_receipts(self, purchase_receipts): - for pr in purchase_receipts: - if frappe.db.get_value("Purchase Receipt", pr, "docstatus") != 1: - frappe.throw(_("Purchase Receipt {0} is not submitted").format(pr)) - - def add_charges_in_pr(self, purchase_receipts): - """ Add additional charges in selected pr proportionately""" - total_amt = self.get_total_pr_amt(purchase_receipts) - - for pr in purchase_receipts: - pr_doc = frappe.get_doc('Purchase Receipt', pr) - pr_items = pr_doc.get("purchase_tax_details") - - for lc in self.get("landed_cost_details"): - amt = flt(lc.amount) * flt(pr_doc.net_total)/ flt(total_amt) - - matched_row = pr_doc.get("other_charges", { - "category": "Valuation", - "add_deduct_tax": "Add", - "charge_type": "Actual", - "account_head": lc.account_head - }) - - if not matched_row: # add if not exists - ch = pr_doc.append("other_charges") - ch.category = 'Valuation' - ch.add_deduct_tax = 'Add' - ch.charge_type = 'Actual' - ch.description = lc.description - ch.account_head = lc.account_head - ch.cost_center = lc.cost_center - ch.rate = amt - ch.tax_amount = amt - ch.docstatus = 1 - ch.db_insert() - else: # overwrite if exists - matched_row[0].rate = amt - matched_row[0].tax_amount = amt - matched_row[0].cost_center = lc.cost_center - - pr_doc.run_method("validate") - pr_doc._validate_mandatory() - for d in pr_doc.get_all_children(): - d.db_update() - - def get_total_pr_amt(self, purchase_receipts): - return frappe.db.sql("""SELECT SUM(net_total) FROM `tabPurchase Receipt` - WHERE name in (%s)""" % ', '.join(['%s']*len(purchase_receipts)), - tuple(purchase_receipts))[0][0] - - def cancel_pr(self, purchase_receipts): - for pr in purchase_receipts: - pr_doc = frappe.get_doc("Purchase Receipt", pr) - - pr_doc.run_method("update_ordered_qty") - - frappe.db.sql("""delete from `tabStock Ledger Entry` - where voucher_type='Purchase Receipt' and voucher_no=%s""", pr) - frappe.db.sql("""delete from `tabGL Entry` where voucher_type='Purchase Receipt' - and voucher_no=%s""", pr) - - def submit_pr(self, purchase_receipts): - for pr in purchase_receipts: - pr_doc = frappe.get_doc("Purchase Receipt", pr) - pr_doc.run_method("update_ordered_qty") - pr_doc.run_method("update_stock") - pr_doc.run_method("make_gl_entries")