From 4cdb79941b814124ce5a3870198d88c8b876968d Mon Sep 17 00:00:00 2001 From: Akhilesh Darjee Date: Thu, 30 Jan 2014 13:56:57 +0530 Subject: [PATCH] map charge to taxes and charges in transactions --- erpnext/controllers/accounts_controller.py | 4 ++++ erpnext/patches.txt | 15 +++++++++++--- .../4_0/map_charge_to_taxes_and_charges.py | 20 +++++++++++++++++++ ...mat.py => reload_purchase_print_format.py} | 4 ---- ...format.py => reload_sales_print_format.py} | 4 ---- erpnext/public/js/queries.js | 2 +- erpnext/utilities/transaction_base.py | 4 ---- 7 files changed, 37 insertions(+), 16 deletions(-) create mode 100644 erpnext/patches/4_0/map_charge_to_taxes_and_charges.py rename erpnext/patches/4_0/{reload_purchase_doctype_and_print_format.py => reload_purchase_print_format.py} (62%) rename erpnext/patches/4_0/{reload_sales_doctype_and_print_format.py => reload_sales_print_format.py} (82%) diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py index 937449c6a2..2e05903040 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -130,6 +130,10 @@ class AccountsController(TransactionBase): }) self.doclist.append(tax) + + def get_other_charges(self): + self.doclist = self.doc.clear_table(self.doclist, "other_charges") + self.set_taxes("other_charges", "taxes_and_charges") def calculate_taxes_and_totals(self): self.discount_amount_applied = False diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 9843f870ba..3eb69fd013 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -3,8 +3,17 @@ erpnext.patches.4_0.update_user_properties erpnext.patches.4_0.move_warehouse_user_to_restrictions erpnext.patches.4_0.new_permissions erpnext.patches.4_0.update_incharge_name_to_sales_person_in_maintenance_schedule -erpnext.patches.4_0.reload_sales_doctype_and_print_format -erpnext.patches.4_0.reload_purchase_doctype_and_print_format +execute:webnotes.reload_doc('accounts', 'doctype', 'sales_invoice') # 2014-01-29 +execute:webnotes.reload_doc('selling', 'doctype', 'sales_order') # 2014-01-29 +execute:webnotes.reload_doc('selling', 'doctype', 'quotation') # 2014-01-29 +execute:webnotes.reload_doc('stock', 'doctype', 'delivery_note') # 2014-01-29 +erpnext.patches.4_0.reload_sales_print_format +execute:webnotes.reload_doc('accounts', 'doctype', 'purchase_invoice') # 2014-01-29 +execute:webnotes.reload_doc('buying', 'doctype', 'purchase_order') # 2014-01-29 +execute:webnotes.reload_doc('buying', 'doctype', 'supplier_quotation') # 2014-01-29 +execute:webnotes.reload_doc('stock', 'doctype', 'purchase_receipt') # 2014-01-29 +erpnext.patches.4_0.reload_purchase_print_format execute:webnotes.reload_doc('accounts', 'doctype', 'pos_setting') # 2014-01-29 execute:webnotes.reload_doc('selling', 'doctype', 'customer') # 2014-01-29 -execute:webnotes.reload_doc('buying', 'doctype', 'supplier') # 2014-01-29 \ No newline at end of file +execute:webnotes.reload_doc('buying', 'doctype', 'supplier') # 2014-01-29 +erpnext.patches.4_0.map_charge_to_taxes_and_charges \ No newline at end of file diff --git a/erpnext/patches/4_0/map_charge_to_taxes_and_charges.py b/erpnext/patches/4_0/map_charge_to_taxes_and_charges.py new file mode 100644 index 0000000000..fc51c2a794 --- /dev/null +++ b/erpnext/patches/4_0/map_charge_to_taxes_and_charges.py @@ -0,0 +1,20 @@ +# 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 webnotes + +def execute(): + # udpate sales cycle + webnotes.conn.sql("""update `tabSales Invoice` set taxes_and_charges=charge""") + webnotes.conn.sql("""update `tabSales Order` set taxes_and_charges=charge""") + webnotes.conn.sql("""update `tabQuotation` set taxes_and_charges=charge""") + webnotes.conn.sql("""update `tabDelivery Note` set taxes_and_charges=charge""") + + # udpate purchase cycle + webnotes.conn.sql("""update `tabPurchase Invoice` set taxes_and_charges=purchase_other_charges""") + webnotes.conn.sql("""update `tabPurchase Order` set taxes_and_charges=purchase_other_charges""") + webnotes.conn.sql("""update `tabSupplier Quotation` set taxes_and_charges=purchase_other_charges""") + webnotes.conn.sql("""update `tabPurchase Receipt` set taxes_and_charges=purchase_other_charges""") + + webnotes.conn.sql("""update `tabPurchase Taxes and Charges` set parentfield='other_charges'""") \ No newline at end of file diff --git a/erpnext/patches/4_0/reload_purchase_doctype_and_print_format.py b/erpnext/patches/4_0/reload_purchase_print_format.py similarity index 62% rename from erpnext/patches/4_0/reload_purchase_doctype_and_print_format.py rename to erpnext/patches/4_0/reload_purchase_print_format.py index 96d4fc6545..83f95c0e25 100644 --- a/erpnext/patches/4_0/reload_purchase_doctype_and_print_format.py +++ b/erpnext/patches/4_0/reload_purchase_print_format.py @@ -5,10 +5,6 @@ from __future__ import unicode_literals import webnotes def execute(): - webnotes.reload_doc('accounts', 'doctype', 'purchase_invoice') - webnotes.reload_doc('buying', 'doctype', 'purchase_order') - webnotes.reload_doc('buying', 'doctype', 'supplier_quotation') - webnotes.reload_doc('stock', 'doctype', 'purchase_receipt') webnotes.reload_doc('buying', 'Print Format', 'Purchase Order Classic') webnotes.reload_doc('buying', 'Print Format', 'Purchase Order Modern') webnotes.reload_doc('buying', 'Print Format', 'Purchase Order Spartan') \ No newline at end of file diff --git a/erpnext/patches/4_0/reload_sales_doctype_and_print_format.py b/erpnext/patches/4_0/reload_sales_print_format.py similarity index 82% rename from erpnext/patches/4_0/reload_sales_doctype_and_print_format.py rename to erpnext/patches/4_0/reload_sales_print_format.py index a435be39f3..f4cf446d3a 100644 --- a/erpnext/patches/4_0/reload_sales_doctype_and_print_format.py +++ b/erpnext/patches/4_0/reload_sales_print_format.py @@ -5,10 +5,6 @@ from __future__ import unicode_literals import webnotes def execute(): - webnotes.reload_doc('accounts', 'doctype', 'sales_invoice') - webnotes.reload_doc('selling', 'doctype', 'sales_order') - webnotes.reload_doc('selling', 'doctype', 'quotation') - webnotes.reload_doc('stock', 'doctype', 'delivery_note') webnotes.reload_doc('accounts', 'Print Format', 'POS Invoice') webnotes.reload_doc('accounts', 'Print Format', 'Sales Invoice Classic') webnotes.reload_doc('accounts', 'Print Format', 'Sales Invoice Modern') diff --git a/erpnext/public/js/queries.js b/erpnext/public/js/queries.js index dbaa27d2de..a3ad44142d 100644 --- a/erpnext/public/js/queries.js +++ b/erpnext/public/js/queries.js @@ -33,7 +33,7 @@ $.extend(erpnext.queries, { }, task: function() { - return { query: "projects.utils.query_task" }; + return { query: "erpnext.projects.utils.query_task" }; }, customer_filter: function(doc) { diff --git a/erpnext/utilities/transaction_base.py b/erpnext/utilities/transaction_base.py index 0b4b9032eb..8df7f25b4d 100644 --- a/erpnext/utilities/transaction_base.py +++ b/erpnext/utilities/transaction_base.py @@ -143,10 +143,6 @@ class TransactionBase(StatusUpdater): for fieldname, val in self.get_supplier_defaults().items(): if self.meta.get_field(fieldname): self.doc.fields[fieldname] = val - - def get_other_charges(self): - self.doclist = self.doc.clear_table(self.doclist, "other_charges") - self.set_taxes("other_charges", "taxes_and_charges") def get_lead_defaults(self): out = self.get_default_address_and_contact("lead")