From a7ab20ec78ae1379053a53a35a9ac611fbc24bab Mon Sep 17 00:00:00 2001 From: Akhilesh Darjee Date: Tue, 28 Jan 2014 15:50:28 +0530 Subject: [PATCH 1/5] webnotes/erpnext#912 Stay Updated button in website fixed --- erpnext/templates/includes/footer_extension.html | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/erpnext/templates/includes/footer_extension.html b/erpnext/templates/includes/footer_extension.html index 51367e140d..315be06054 100644 --- a/erpnext/templates/includes/footer_extension.html +++ b/erpnext/templates/includes/footer_extension.html @@ -11,11 +11,10 @@ From 2ced3b07d477b04e5d3b936718308b24055efe48 Mon Sep 17 00:00:00 2001 From: Akhilesh Darjee Date: Tue, 28 Jan 2014 19:16:05 +0530 Subject: [PATCH 2/5] changed fieldname from charge to taxes --- .../purchase_invoice/purchase_invoice.txt | 8 ++++---- .../doctype/sales_invoice/sales_invoice.py | 2 +- .../doctype/sales_invoice/sales_invoice.txt | 7 ++++--- .../doctype/purchase_common/purchase_common.js | 4 ++-- .../doctype/purchase_order/purchase_order.txt | 9 +++++---- erpnext/buying/doctype/supplier/supplier.txt | 17 ++++++++++++----- .../supplier_quotation/supplier_quotation.txt | 8 ++++---- erpnext/controllers/buying_controller.py | 4 ++-- erpnext/controllers/selling_controller.py | 4 ++-- erpnext/selling/doctype/customer/customer.txt | 13 ++++++++++--- erpnext/selling/doctype/quotation/quotation.txt | 8 ++++---- .../selling/doctype/sales_order/sales_order.txt | 10 ++++++---- erpnext/selling/sales_common.js | 2 +- .../doctype/delivery_note/delivery_note.txt | 9 +++++---- .../purchase_receipt/purchase_receipt.txt | 9 +++++---- erpnext/utilities/transaction_base.py | 7 ++++++- 16 files changed, 73 insertions(+), 48 deletions(-) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.txt b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.txt index 5dbe9f649e..45f7e9073d 100755 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.txt +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.txt @@ -2,7 +2,7 @@ { "creation": "2013-05-21 16:16:39", "docstatus": 0, - "modified": "2014-01-20 17:49:04", + "modified": "2014-01-28 18:46:48", "modified_by": "Administrator", "owner": "Administrator" }, @@ -324,16 +324,16 @@ "doctype": "DocField", "fieldname": "taxes", "fieldtype": "Section Break", - "label": "Taxes", + "label": "Taxes and Charges", "oldfieldtype": "Section Break", "options": "icon-money", "read_only": 0 }, { "doctype": "DocField", - "fieldname": "purchase_other_charges", + "fieldname": "taxes_and_charges", "fieldtype": "Link", - "label": "Tax Master", + "label": "Taxes and Charges", "oldfieldname": "purchase_other_charges", "oldfieldtype": "Link", "options": "Purchase Taxes and Charges Master", diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index 1292507a65..5c092cfa01 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -215,7 +215,7 @@ class DocType(SellingController): # fetch charges if self.doc.charge and not len(self.doclist.get({"parentfield": "other_charges"})): - self.set_taxes("other_charges", "charge") + self.set_taxes("other_charges", "taxes_and_charges") def get_customer_account(self): """Get Account Head to which amount needs to be Debited based on Customer""" diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.txt b/erpnext/accounts/doctype/sales_invoice/sales_invoice.txt index a3be27dcf8..49cc213349 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.txt +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.txt @@ -2,7 +2,7 @@ { "creation": "2013-05-24 19:29:05", "docstatus": 0, - "modified": "2014-01-20 17:49:20", + "modified": "2014-01-28 18:43:10", "modified_by": "Administrator", "owner": "Administrator" }, @@ -376,9 +376,9 @@ }, { "doctype": "DocField", - "fieldname": "charge", + "fieldname": "taxes_and_charges", "fieldtype": "Link", - "label": "Tax Master", + "label": "Taxes and Charges", "oldfieldname": "charge", "oldfieldtype": "Link", "options": "Sales Taxes and Charges Master", @@ -1231,6 +1231,7 @@ "write": 1 }, { + "cancel": 0, "delete": 0, "doctype": "DocPerm", "role": "Customer" diff --git a/erpnext/buying/doctype/purchase_common/purchase_common.js b/erpnext/buying/doctype/purchase_common/purchase_common.js index d01627a208..1556634d76 100644 --- a/erpnext/buying/doctype/purchase_common/purchase_common.js +++ b/erpnext/buying/doctype/purchase_common/purchase_common.js @@ -241,9 +241,9 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({ } }, - purchase_other_charges: function() { + taxes_and_charges: function() { var me = this; - if(this.frm.doc.purchase_other_charges) { + if(this.frm.doc.taxes_and_charges) { return this.frm.call({ doc: this.frm.doc, method: "get_purchase_tax_details", diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.txt b/erpnext/buying/doctype/purchase_order/purchase_order.txt index 2790e41088..bce007c992 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.txt +++ b/erpnext/buying/doctype/purchase_order/purchase_order.txt @@ -2,7 +2,7 @@ { "creation": "2013-05-21 16:16:39", "docstatus": 0, - "modified": "2014-01-20 17:49:08", + "modified": "2014-01-28 18:49:03", "modified_by": "Administrator", "owner": "Administrator" }, @@ -299,7 +299,7 @@ "doctype": "DocField", "fieldname": "taxes", "fieldtype": "Section Break", - "label": "Taxes", + "label": "Taxes and Charges", "oldfieldtype": "Section Break", "options": "icon-money", "print_hide": 0 @@ -307,9 +307,9 @@ { "description": "If you have created a standard template in Purchase Taxes and Charges Master, select one and click on the button below.", "doctype": "DocField", - "fieldname": "purchase_other_charges", + "fieldname": "taxes_and_charges", "fieldtype": "Link", - "label": "Tax Master", + "label": "Taxes and Charges", "no_copy": 0, "oldfieldname": "purchase_other_charges", "oldfieldtype": "Link", @@ -699,6 +699,7 @@ "write": 1 }, { + "cancel": 0, "delete": 0, "doctype": "DocPerm", "role": "Supplier" diff --git a/erpnext/buying/doctype/supplier/supplier.txt b/erpnext/buying/doctype/supplier/supplier.txt index 5c305f5cd0..a5d100fdd5 100644 --- a/erpnext/buying/doctype/supplier/supplier.txt +++ b/erpnext/buying/doctype/supplier/supplier.txt @@ -2,7 +2,7 @@ { "creation": "2013-01-10 16:34:11", "docstatus": 0, - "modified": "2014-01-20 17:49:29", + "modified": "2014-01-28 19:05:55", "modified_by": "Administrator", "owner": "Administrator" }, @@ -157,6 +157,14 @@ "reqd": 1, "search_index": 0 }, + { + "doctype": "DocField", + "fieldname": "default_currency", + "fieldtype": "Link", + "label": "Default Currency", + "no_copy": 1, + "options": "Currency" + }, { "doctype": "DocField", "fieldname": "default_price_list", @@ -166,11 +174,10 @@ }, { "doctype": "DocField", - "fieldname": "default_currency", + "fieldname": "default_taxes_and_charges", "fieldtype": "Link", - "label": "Default Currency", - "no_copy": 1, - "options": "Currency" + "label": "Taxes and Charges", + "options": "Purchase Taxes and Charges Master" }, { "doctype": "DocField", diff --git a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.txt b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.txt index e1441e5289..324bd41023 100644 --- a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.txt +++ b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.txt @@ -2,7 +2,7 @@ { "creation": "2013-05-21 16:16:45", "docstatus": 0, - "modified": "2014-01-20 17:49:29", + "modified": "2014-01-28 18:50:58", "modified_by": "Administrator", "owner": "Administrator" }, @@ -290,16 +290,16 @@ "doctype": "DocField", "fieldname": "taxes", "fieldtype": "Section Break", - "label": "Taxes", + "label": "Taxes and Charges", "oldfieldtype": "Section Break", "options": "icon-money" }, { "description": "If you have created a standard template in Purchase Taxes and Charges Master, select one and click on the button below.", "doctype": "DocField", - "fieldname": "purchase_other_charges", + "fieldname": "taxes_and_charges", "fieldtype": "Link", - "label": "Purchase Taxes and Charges", + "label": "Taxes and Charges", "no_copy": 1, "oldfieldname": "purchase_other_charges", "oldfieldtype": "Link", diff --git a/erpnext/controllers/buying_controller.py b/erpnext/controllers/buying_controller.py index 83b590994d..f7b1e27a44 100644 --- a/erpnext/controllers/buying_controller.py +++ b/erpnext/controllers/buying_controller.py @@ -38,7 +38,7 @@ class BuyingController(StockController): self.set_missing_item_details(get_item_details) if self.doc.fields.get("__islocal"): - self.set_taxes("purchase_tax_details", "purchase_other_charges") + self.set_taxes("purchase_tax_details", "taxes_and_charges") def set_supplier_from_item_default(self): if self.meta.get_field("supplier") and not self.doc.supplier: @@ -59,7 +59,7 @@ class BuyingController(StockController): def get_purchase_tax_details(self): self.doclist = self.doc.clear_table(self.doclist, "purchase_tax_details") - self.set_taxes("purchase_tax_details", "purchase_other_charges") + self.set_taxes("purchase_tax_details", "taxes_and_charges") def validate_stock_or_nonstock_items(self): if not self.get_stock_items(): diff --git a/erpnext/controllers/selling_controller.py b/erpnext/controllers/selling_controller.py index 52dcaaaf92..2c1f0784cb 100644 --- a/erpnext/controllers/selling_controller.py +++ b/erpnext/controllers/selling_controller.py @@ -30,7 +30,7 @@ class SellingController(StockController): self.set_missing_lead_customer_details() self.set_price_list_and_item_details() if self.doc.fields.get("__islocal"): - self.set_taxes("other_charges", "charge") + self.set_taxes("other_charges", "taxes_and_charges") def set_missing_lead_customer_details(self): if self.doc.customer: @@ -52,7 +52,7 @@ class SellingController(StockController): def get_other_charges(self): self.doclist = self.doc.clear_table(self.doclist, "other_charges") - self.set_taxes("other_charges", "charge") + self.set_taxes("other_charges", "taxes_and_charges") def apply_shipping_rule(self): if self.doc.shipping_rule: diff --git a/erpnext/selling/doctype/customer/customer.txt b/erpnext/selling/doctype/customer/customer.txt index 6eabaf0a37..c6c0e9ff34 100644 --- a/erpnext/selling/doctype/customer/customer.txt +++ b/erpnext/selling/doctype/customer/customer.txt @@ -2,7 +2,7 @@ { "creation": "2013-06-11 14:26:44", "docstatus": 0, - "modified": "2014-01-20 17:48:32", + "modified": "2014-01-28 19:06:18", "modified_by": "Administrator", "owner": "Administrator" }, @@ -26,6 +26,7 @@ "parenttype": "DocType" }, { + "cancel": 0, "doctype": "DocPerm", "name": "__common__", "parent": "Customer", @@ -252,6 +253,14 @@ "options": "Price List", "permlevel": 0 }, + { + "doctype": "DocField", + "fieldname": "default_taxes_and_charges", + "fieldtype": "Link", + "label": "Taxes and Charges", + "options": "Sales Taxes and Charges Master", + "permlevel": 0 + }, { "doctype": "DocField", "fieldname": "credit_days", @@ -343,7 +352,6 @@ }, { "amend": 0, - "cancel": 0, "create": 1, "delete": 0, "doctype": "DocPerm", @@ -363,7 +371,6 @@ }, { "amend": 0, - "cancel": 0, "create": 1, "delete": 1, "doctype": "DocPerm", diff --git a/erpnext/selling/doctype/quotation/quotation.txt b/erpnext/selling/doctype/quotation/quotation.txt index f12a2a738e..6cf538d806 100644 --- a/erpnext/selling/doctype/quotation/quotation.txt +++ b/erpnext/selling/doctype/quotation/quotation.txt @@ -2,7 +2,7 @@ { "creation": "2013-05-24 19:29:08", "docstatus": 0, - "modified": "2014-01-20 17:49:16", + "modified": "2014-01-28 18:50:17", "modified_by": "Administrator", "owner": "Administrator" }, @@ -373,17 +373,17 @@ "doctype": "DocField", "fieldname": "taxes", "fieldtype": "Section Break", - "label": "Taxes", + "label": "Taxes and Charges", "oldfieldtype": "Section Break", "options": "icon-money", "read_only": 0 }, { "doctype": "DocField", - "fieldname": "charge", + "fieldname": "taxes_and_charges", "fieldtype": "Link", "hidden": 0, - "label": "Tax Master", + "label": "Taxes and Charges", "oldfieldname": "charge", "oldfieldtype": "Link", "options": "Sales Taxes and Charges Master", diff --git a/erpnext/selling/doctype/sales_order/sales_order.txt b/erpnext/selling/doctype/sales_order/sales_order.txt index d187f67b89..01c2817306 100644 --- a/erpnext/selling/doctype/sales_order/sales_order.txt +++ b/erpnext/selling/doctype/sales_order/sales_order.txt @@ -2,7 +2,7 @@ { "creation": "2013-06-18 12:39:59", "docstatus": 0, - "modified": "2014-01-20 17:49:23", + "modified": "2014-01-28 18:47:42", "modified_by": "Administrator", "owner": "Administrator" }, @@ -398,16 +398,16 @@ "doctype": "DocField", "fieldname": "taxes", "fieldtype": "Section Break", - "label": "Taxes", + "label": "Taxes and Charges", "oldfieldtype": "Section Break", "options": "icon-money", "print_hide": 0 }, { "doctype": "DocField", - "fieldname": "charge", + "fieldname": "taxes_and_charges", "fieldtype": "Link", - "label": "Tax Master", + "label": "Taxes and Charges", "oldfieldname": "charge", "oldfieldtype": "Link", "options": "Sales Taxes and Charges Master", @@ -928,11 +928,13 @@ "write": 1 }, { + "cancel": 0, "delete": 0, "doctype": "DocPerm", "role": "Accounts User" }, { + "cancel": 0, "delete": 0, "doctype": "DocPerm", "role": "Customer" diff --git a/erpnext/selling/sales_common.js b/erpnext/selling/sales_common.js index 1baaf7b4d5..a9ed2b77dc 100644 --- a/erpnext/selling/sales_common.js +++ b/erpnext/selling/sales_common.js @@ -518,7 +518,7 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({ } }, - charge: function() { + taxes_and_charges: function() { var me = this; if(this.frm.doc.charge) { return this.frm.call({ diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.txt b/erpnext/stock/doctype/delivery_note/delivery_note.txt index 63b62d604c..a20723de33 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note.txt +++ b/erpnext/stock/doctype/delivery_note/delivery_note.txt @@ -2,7 +2,7 @@ { "creation": "2013-05-24 19:29:09", "docstatus": 0, - "modified": "2014-01-20 17:48:35", + "modified": "2014-01-28 18:51:42", "modified_by": "Administrator", "owner": "Administrator" }, @@ -402,7 +402,7 @@ "doctype": "DocField", "fieldname": "taxes", "fieldtype": "Section Break", - "label": "Taxes", + "label": "Taxes and Charges", "oldfieldtype": "Section Break", "options": "icon-money", "read_only": 0 @@ -410,9 +410,9 @@ { "description": "If you have created a standard template in Sales Taxes and Charges Master, select one and click on the button below.", "doctype": "DocField", - "fieldname": "charge", + "fieldname": "taxes_and_charges", "fieldtype": "Link", - "label": "Tax Master", + "label": "Taxes and Charges", "oldfieldname": "charge", "oldfieldtype": "Link", "options": "Sales Taxes and Charges Master", @@ -1071,6 +1071,7 @@ "write": 0 }, { + "cancel": 0, "delete": 0, "doctype": "DocPerm", "role": "Customer" diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.txt b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.txt index 960bb210fa..e1ba3622e7 100755 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.txt +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.txt @@ -2,7 +2,7 @@ { "creation": "2013-05-21 16:16:39", "docstatus": 0, - "modified": "2014-01-20 17:49:12", + "modified": "2014-01-28 18:52:19", "modified_by": "Administrator", "owner": "Administrator" }, @@ -329,16 +329,16 @@ "doctype": "DocField", "fieldname": "taxes", "fieldtype": "Section Break", - "label": "Taxes", + "label": "Taxes and Charges", "oldfieldtype": "Section Break", "options": "icon-money" }, { "description": "If you have created a standard template in Purchase Taxes and Charges Master, select one and click on the button below.", "doctype": "DocField", - "fieldname": "purchase_other_charges", + "fieldname": "taxes_and_charges", "fieldtype": "Link", - "label": "Purchase Taxes and Charges", + "label": "Taxes and Charges", "oldfieldname": "purchase_other_charges", "oldfieldtype": "Link", "options": "Purchase Taxes and Charges Master", @@ -836,6 +836,7 @@ "write": 1 }, { + "cancel": 0, "delete": 0, "doctype": "DocPerm", "role": "Supplier" diff --git a/erpnext/utilities/transaction_base.py b/erpnext/utilities/transaction_base.py index 2c6357acff..a1ff0f8474 100644 --- a/erpnext/utilities/transaction_base.py +++ b/erpnext/utilities/transaction_base.py @@ -64,7 +64,7 @@ class TransactionBase(StatusUpdater): out[f] = customer.fields.get(f) # fields prepended with default in Customer doctype - for f in ['sales_partner', 'commission_rate', 'currency', 'price_list']: + for f in ['sales_partner', 'commission_rate', 'currency', 'price_list', 'taxes_and_charges']: if customer.fields.get("default_" + f): out[f] = customer.fields.get("default_" + f) @@ -128,6 +128,11 @@ class TransactionBase(StatusUpdater): out["supplier_name"] = supplier.supplier_name if supplier.default_currency: out["currency"] = supplier.default_currency + + # fields prepended with default in Customer doctype + for f in ['currency', 'taxes_and_charges']: + if supplier.fields.get("default_" + f): + out[f] = supplier.fields.get("default_" + f) out["buying_price_list"] = self.get_user_default_price_list("buying_price_list") or \ supplier.default_price_list or self.doc.buying_price_list From 4f7215662d1cd25aeed9b81dc61bbd46011e354e Mon Sep 17 00:00:00 2001 From: Akhilesh Darjee Date: Wed, 29 Jan 2014 16:31:38 +0530 Subject: [PATCH 3/5] webnotes/erpnext#1090 set default tax type in customer and supplier --- erpnext/accounts/doctype/account/account.py | 76 ++--- .../doctype/cost_center/cost_center.js | 4 +- .../doctype/pos_setting/pos_setting.txt | 8 +- .../purchase_invoice/purchase_invoice.js | 2 +- .../purchase_invoice/purchase_invoice.py | 2 +- .../purchase_invoice/purchase_invoice.txt | 8 +- .../purchase_invoice/test_purchase_invoice.py | 26 +- .../purchase_taxes_and_charges_master.js | 259 +++++++++--------- .../purchase_taxes_and_charges_master.txt | 4 +- .../doctype/sales_invoice/sales_invoice.py | 4 +- .../sales_taxes_and_charges_master.js | 49 ++-- erpnext/accounts/utils.py | 17 +- .../Purchase Order Classic.txt | 2 +- .../Purchase Order Modern.txt | 2 +- .../Purchase Order Spartan.txt | 2 +- .../purchase_common/purchase_common.js | 27 +- .../doctype/purchase_order/purchase_order.js | 2 +- .../doctype/purchase_order/purchase_order.txt | 8 +- .../supplier_quotation/supplier_quotation.js | 2 +- .../supplier_quotation/supplier_quotation.txt | 8 +- erpnext/controllers/buying_controller.py | 12 +- erpnext/controllers/selling_controller.py | 4 - .../leave_control_panel.js | 40 ++- erpnext/public/js/transaction.js | 22 ++ erpnext/selling/sales_common.js | 30 +- erpnext/stock/doctype/item/item.js | 92 +++---- .../landed_cost_wizard/landed_cost_wizard.py | 6 +- .../purchase_receipt/purchase_receipt.js | 45 ++- .../purchase_receipt/purchase_receipt.txt | 8 +- .../purchase_receipt/test_purchase_receipt.py | 6 +- .../stock/doctype/stock_entry/stock_entry.js | 43 ++- .../doctype/stock_entry/test_stock_entry.py | 4 +- erpnext/utilities/transaction_base.py | 8 +- 33 files changed, 399 insertions(+), 433 deletions(-) diff --git a/erpnext/accounts/doctype/account/account.py b/erpnext/accounts/doctype/account/account.py index 99d4f24f63..d8d3881daf 100644 --- a/erpnext/accounts/doctype/account/account.py +++ b/erpnext/accounts/doctype/account/account.py @@ -5,7 +5,7 @@ from __future__ import unicode_literals import webnotes from webnotes.utils import flt, fmt_money, cstr, cint -from webnotes import msgprint, _ +from webnotes import msgprint, throw, _ get_value = webnotes.conn.get_value @@ -43,7 +43,7 @@ class DocType: msgprint(_("Please enter Master Name once the account is created.")) elif not webnotes.conn.exists(self.doc.master_type or self.doc.account_type, self.doc.master_name): - webnotes.throw(_("Invalid Master Name")) + throw(_("Invalid Master Name")) def validate_parent(self): """Fetch Parent Details and validation for account not to be created under ledger""" @@ -51,14 +51,19 @@ class DocType: par = webnotes.conn.sql("""select name, group_or_ledger, is_pl_account, debit_or_credit from tabAccount where name =%s""", self.doc.parent_account) if not par: - msgprint("Parent account does not exists", raise_exception=1) + throw(_("Parent account does not exists")) elif par[0][0] == self.doc.name: - msgprint("You can not assign itself as parent account", raise_exception=1) + throw(_("You can not assign itself as parent account")) elif par[0][1] != 'Group': - msgprint("Parent account can not be a ledger", raise_exception=1) + throw(_("Parent account can not be a ledger")) elif self.doc.debit_or_credit and par[0][3] != self.doc.debit_or_credit: - msgprint("You can not move a %s account under %s account" % - (self.doc.debit_or_credit, par[0][3]), raise_exception=1) + throw("{msg} {debit_or_credit} {under} {account} {acc}".format(**{ + "msg": _("You cannot move a"), + "debit_or_credit": self.doc.debit_or_credit, + "under": _("account under"), + "account": par[0][3], + "acc": _("account") + })) if not self.doc.is_pl_account: self.doc.is_pl_account = par[0][2] @@ -70,22 +75,25 @@ class DocType: if webnotes.conn.sql("""select count(*) from tabAccount where company=%s and ifnull(parent_account,'')='' and docstatus != 2""", self.doc.company)[0][0] > 4: - webnotes.msgprint("One company cannot have more than 4 root Accounts", - raise_exception=1) + throw(_("One company cannot have more than 4 root Accounts")) def validate_duplicate_account(self): if self.doc.fields.get('__islocal') or not self.doc.name: company_abbr = webnotes.conn.get_value("Company", self.doc.company, "abbr") if webnotes.conn.sql("""select name from tabAccount where name=%s""", (self.doc.account_name + " - " + company_abbr)): - msgprint("Account Name: %s already exists, please rename" - % self.doc.account_name, raise_exception=1) + throw("{name}: {acc_name} {exist}, {rename}".format(**{ + "name": _("Account Name"), + "acc_name": self.doc.account_name, + "exist": _("already exists"), + "rename": _("please rename") + })) def validate_root_details(self): #does not exists parent if webnotes.conn.exists("Account", self.doc.name): if not webnotes.conn.get_value("Account", self.doc.name, "parent_account"): - webnotes.msgprint("Root cannot be edited.", raise_exception=1) + throw(_("Root cannot be edited.")) def validate_frozen_accounts_modifier(self): old_value = webnotes.conn.get_value("Account", self.doc.name, "freeze_account") @@ -94,15 +102,18 @@ class DocType: 'frozen_accounts_modifier') if not frozen_accounts_modifier or \ frozen_accounts_modifier not in webnotes.user.get_roles(): - webnotes.throw(_("You are not authorized to set Frozen value")) + throw(_("You are not authorized to set Frozen value")) def convert_group_to_ledger(self): if self.check_if_child_exists(): - msgprint("Account: %s has existing child. You can not convert this account to ledger" % - (self.doc.name), raise_exception=1) + throw("{acc}: {account_name} {child}. {msg}".format(**{ + "acc": _("Account"), + "account_name": self.doc.name, + "child": _("has existing child"), + "msg": _("You can not convert this account to ledger") + })) elif self.check_gle_exists(): - msgprint("Account with existing transaction can not be converted to ledger.", - raise_exception=1) + throw(_("Account with existing transaction can not be converted to ledger.")) else: self.doc.group_or_ledger = 'Ledger' self.doc.save() @@ -110,11 +121,9 @@ class DocType: def convert_ledger_to_group(self): if self.check_gle_exists(): - msgprint("Account with existing transaction can not be converted to group.", - raise_exception=1) + throw(_("Account with existing transaction can not be converted to group.")) elif self.doc.master_type or self.doc.account_type: - msgprint("Cannot covert to Group because Master Type or Account Type is selected.", - raise_exception=1) + throw(_("Cannot covert to Group because Master Type or Account Type is selected.")) else: self.doc.group_or_ledger = 'Group' self.doc.save() @@ -130,9 +139,9 @@ class DocType: def validate_mandatory(self): if not self.doc.debit_or_credit: - msgprint("Debit or Credit field is mandatory", raise_exception=1) + throw(_("Debit or Credit field is mandatory")) if not self.doc.is_pl_account: - msgprint("Is PL Account field is mandatory", raise_exception=1) + throw(_("Is PL Account field is mandatory")) def validate_warehouse_account(self): if not cint(webnotes.defaults.get_global_default("auto_accounting_for_stock")): @@ -146,11 +155,11 @@ class DocType: if self.doc.master_name: self.validate_warehouse(self.doc.master_name) else: - webnotes.throw(_("Master Name is mandatory if account type is Warehouse")) + throw(_("Master Name is mandatory if account type is Warehouse")) def validate_warehouse(self, warehouse): if webnotes.conn.get_value("Stock Ledger Entry", {"warehouse": warehouse}): - webnotes.throw(_("Stock transactions exist against warehouse ") + warehouse + + throw(_("Stock transactions exist against warehouse ") + warehouse + _(" .You can not assign / modify / remove Master Name")) def update_nsm_model(self): @@ -183,22 +192,21 @@ class DocType: # If outstanding greater than credit limit and not authorized person raise exception if credit_limit > 0 and flt(total_outstanding) > credit_limit \ and not self.get_authorized_user(): - msgprint("""Total Outstanding amount (%s) for %s can not be \ + throw("""Total Outstanding amount (%s) for %s can not be \ greater than credit limit (%s). To change your credit limit settings, \ please update in the %s master""" % (fmt_money(total_outstanding), - self.doc.name, fmt_money(credit_limit), credit_limit_from), raise_exception=1) + self.doc.name, fmt_money(credit_limit), credit_limit_from)) def validate_trash(self): """checks gl entries and if child exists""" if not self.doc.parent_account: - msgprint("Root account can not be deleted", raise_exception=1) + throw(_("Root account can not be deleted")) if self.check_gle_exists(): - msgprint("""Account with existing transaction (Sales Invoice / Purchase Invoice / \ - Journal Voucher) can not be deleted""", raise_exception=1) + throw("""Account with existing transaction (Sales Invoice / Purchase Invoice / \ + Journal Voucher) can not be deleted""") if self.check_if_child_exists(): - msgprint("Child account exists for this account. You can not delete this account.", - raise_exception=1) + throw(_("Child account exists for this account. You can not delete this account.")) def on_trash(self): self.validate_trash() @@ -212,13 +220,13 @@ class DocType: # Validate properties before merging if merge: if not webnotes.conn.exists("Account", new): - webnotes.throw(_("Account ") + new +_(" does not exists")) + throw(_("Account ") + new +_(" does not exists")) val = list(webnotes.conn.get_value("Account", new_account, ["group_or_ledger", "debit_or_credit", "is_pl_account"])) if val != [self.doc.group_or_ledger, self.doc.debit_or_credit, self.doc.is_pl_account]: - webnotes.throw(_("""Merging is only possible if following \ + throw(_("""Merging is only possible if following \ properties are same in both records. Group or Ledger, Debit or Credit, Is PL Account""")) diff --git a/erpnext/accounts/doctype/cost_center/cost_center.js b/erpnext/accounts/doctype/cost_center/cost_center.js index fbab41803b..a18efaaa32 100644 --- a/erpnext/accounts/doctype/cost_center/cost_center.js +++ b/erpnext/accounts/doctype/cost_center/cost_center.js @@ -54,9 +54,9 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) { function() { wn.set_route("Accounts Browser", "Cost Center"); }, 'icon-sitemap') } -cur_frm.cscript.parent_cost_center = function(doc,cdt,cdn){ +cur_frm.cscript.parent_cost_center = function(doc, cdt, cdn) { if(!doc.company){ - alert(wn._('Please enter company name first')); + msgprint(wn._('Please enter company name first')); } } diff --git a/erpnext/accounts/doctype/pos_setting/pos_setting.txt b/erpnext/accounts/doctype/pos_setting/pos_setting.txt index 1c9e0bf844..c00e75e7e9 100755 --- a/erpnext/accounts/doctype/pos_setting/pos_setting.txt +++ b/erpnext/accounts/doctype/pos_setting/pos_setting.txt @@ -2,7 +2,7 @@ { "creation": "2013-05-24 12:15:51", "docstatus": 0, - "modified": "2014-01-15 16:23:58", + "modified": "2014-01-29 13:08:24", "modified_by": "Administrator", "owner": "Administrator" }, @@ -22,6 +22,8 @@ "permlevel": 0 }, { + "cancel": 0, + "delete": 0, "doctype": "DocPerm", "email": 1, "name": "__common__", @@ -191,9 +193,9 @@ }, { "doctype": "DocField", - "fieldname": "charge", + "fieldname": "taxes_and_charges", "fieldtype": "Link", - "label": "Charge", + "label": "Taxes and Charges", "oldfieldname": "charge", "oldfieldtype": "Link", "options": "Sales Taxes and Charges Master", diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js index dda621950c..bc992282ca 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js @@ -3,7 +3,7 @@ cur_frm.cscript.tname = "Purchase Invoice Item"; cur_frm.cscript.fname = "entries"; -cur_frm.cscript.other_fname = "purchase_tax_details"; +cur_frm.cscript.other_fname = "other_charges"; wn.provide("erpnext.accounts"); {% include 'buying/doctype/purchase_common/purchase_common.js' %}; diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py index db42a12753..db44831553 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py @@ -325,7 +325,7 @@ class DocType(BuyingController): # tax table gl entries valuation_tax = {} - for tax in self.doclist.get({"parentfield": "purchase_tax_details"}): + for tax in self.doclist.get({"parentfield": "other_charges"}): if tax.category in ("Total", "Valuation and Total") and flt(tax.tax_amount): gl_entries.append( self.get_gl_dict({ diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.txt b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.txt index 45f7e9073d..d0eb1b3b9d 100755 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.txt +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.txt @@ -2,7 +2,7 @@ { "creation": "2013-05-21 16:16:39", "docstatus": 0, - "modified": "2014-01-28 18:46:48", + "modified": "2014-01-29 15:26:54", "modified_by": "Administrator", "owner": "Administrator" }, @@ -342,7 +342,7 @@ }, { "doctype": "DocField", - "fieldname": "purchase_tax_details", + "fieldname": "other_charges", "fieldtype": "Table", "label": "Purchase Taxes and Charges", "oldfieldname": "purchase_tax_details", @@ -352,9 +352,9 @@ }, { "doctype": "DocField", - "fieldname": "tax_calculation", + "fieldname": "other_charges_calculation", "fieldtype": "HTML", - "label": "Tax Calculation", + "label": "Taxes and Charges Calculation", "oldfieldtype": "HTML", "print_hide": 1, "read_only": 0 diff --git a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py index 8a8b4a7b6e..e276219148 100644 --- a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py @@ -130,7 +130,7 @@ class TestPurchaseInvoice(unittest.TestCase): ["_Test Account Discount - _TC", 168.03, 1512.30], ] - for i, tax in enumerate(wrapper.doclist.get({"parentfield": "purchase_tax_details"})): + for i, tax in enumerate(wrapper.doclist.get({"parentfield": "other_charges"})): self.assertEqual(tax.account_head, expected_values[i][0]) self.assertEqual(tax.tax_amount, expected_values[i][1]) self.assertEqual(tax.total, expected_values[i][2]) @@ -165,7 +165,7 @@ class TestPurchaseInvoice(unittest.TestCase): ["_Test Account Discount - _TC", 168.03, 1512.30], ] - for i, tax in enumerate(wrapper.doclist.get({"parentfield": "purchase_tax_details"})): + for i, tax in enumerate(wrapper.doclist.get({"parentfield": "other_charges"})): self.assertEqual(tax.account_head, expected_values[i][0]) self.assertEqual(tax.tax_amount, expected_values[i][1]) self.assertEqual(tax.total, expected_values[i][2]) @@ -258,7 +258,7 @@ test_records = [ # taxes { "doctype": "Purchase Taxes and Charges", - "parentfield": "purchase_tax_details", + "parentfield": "other_charges", "charge_type": "Actual", "account_head": "_Test Account Shipping Charges - _TC", "cost_center": "_Test Cost Center - _TC", @@ -269,7 +269,7 @@ test_records = [ }, { "doctype": "Purchase Taxes and Charges", - "parentfield": "purchase_tax_details", + "parentfield": "other_charges", "charge_type": "On Net Total", "account_head": "_Test Account Customs Duty - _TC", "cost_center": "_Test Cost Center - _TC", @@ -280,7 +280,7 @@ test_records = [ }, { "doctype": "Purchase Taxes and Charges", - "parentfield": "purchase_tax_details", + "parentfield": "other_charges", "charge_type": "On Net Total", "account_head": "_Test Account Excise Duty - _TC", "cost_center": "_Test Cost Center - _TC", @@ -291,7 +291,7 @@ test_records = [ }, { "doctype": "Purchase Taxes and Charges", - "parentfield": "purchase_tax_details", + "parentfield": "other_charges", "charge_type": "On Previous Row Amount", "account_head": "_Test Account Education Cess - _TC", "cost_center": "_Test Cost Center - _TC", @@ -303,7 +303,7 @@ test_records = [ }, { "doctype": "Purchase Taxes and Charges", - "parentfield": "purchase_tax_details", + "parentfield": "other_charges", "charge_type": "On Previous Row Amount", "account_head": "_Test Account S&H Education Cess - _TC", "cost_center": "_Test Cost Center - _TC", @@ -315,7 +315,7 @@ test_records = [ }, { "doctype": "Purchase Taxes and Charges", - "parentfield": "purchase_tax_details", + "parentfield": "other_charges", "charge_type": "On Previous Row Total", "account_head": "_Test Account CST - _TC", "cost_center": "_Test Cost Center - _TC", @@ -327,7 +327,7 @@ test_records = [ }, { "doctype": "Purchase Taxes and Charges", - "parentfield": "purchase_tax_details", + "parentfield": "other_charges", "charge_type": "On Net Total", "account_head": "_Test Account VAT - _TC", "cost_center": "_Test Cost Center - _TC", @@ -338,7 +338,7 @@ test_records = [ }, { "doctype": "Purchase Taxes and Charges", - "parentfield": "purchase_tax_details", + "parentfield": "other_charges", "charge_type": "On Previous Row Total", "account_head": "_Test Account Discount - _TC", "cost_center": "_Test Cost Center - _TC", @@ -380,7 +380,7 @@ test_records = [ # taxes { "doctype": "Purchase Taxes and Charges", - "parentfield": "purchase_tax_details", + "parentfield": "other_charges", "charge_type": "Actual", "account_head": "_Test Account Shipping Charges - _TC", "cost_center": "_Test Cost Center - _TC", @@ -391,7 +391,7 @@ test_records = [ }, { "doctype": "Purchase Taxes and Charges", - "parentfield": "purchase_tax_details", + "parentfield": "other_charges", "charge_type": "Actual", "account_head": "_Test Account VAT - _TC", "cost_center": "_Test Cost Center - _TC", @@ -402,7 +402,7 @@ test_records = [ }, { "doctype": "Purchase Taxes and Charges", - "parentfield": "purchase_tax_details", + "parentfield": "other_charges", "charge_type": "Actual", "account_head": "_Test Account Customs Duty - _TC", "cost_center": "_Test Cost Center - _TC", diff --git a/erpnext/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.js b/erpnext/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.js index b589651f18..933382e5cd 100644 --- a/erpnext/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.js +++ b/erpnext/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.js @@ -1,17 +1,10 @@ // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors // License: GNU General Public License v3. See license.txt -// - -//--------- ONLOAD ------------- {% include "public/js/controllers/accounts.js" %} -cur_frm.cscript.onload = function(doc, cdt, cdn) { - -} - cur_frm.cscript.refresh = function(doc, cdt, cdn) { - cur_frm.set_footnote(wn.markdown(cur_frm.meta.description)); + cur_frm.set_footnote(wn.markdown(cur_frm.meta.description)); } // For customizing print @@ -27,120 +20,123 @@ cur_frm.pformat.in_words_import = function(doc) { return ''; } -cur_frm.pformat.purchase_tax_details= function(doc){ - - //function to make row of table - var make_row = function(title,val,bold){ - var bstart = ''; var bend = ''; - return ''+(bold?bstart:'')+title+(bold?bend:'')+'' - +'' - +''+format_currency(val, doc.currency)+'' - +'' - } +cur_frm.pformat.other_charges= function(doc) { - function convert_rate(val){ - var new_val = flt(val)/flt(doc.conversion_rate); - return new_val; - } - - function print_hide(fieldname) { - var doc_field = wn.meta.get_docfield(doc.doctype, fieldname, doc.name); - return doc_field.print_hide; - } - - var cl = getchildren('Purchase Taxes and Charges',doc.name,'purchase_tax_details'); - - // outer table - var out='
\ - '; - out += '
'; - - // main table - out +=''; - if(!print_hide('net_total_import')) { - out += make_row('Net Total', doc.net_total_import, 1); - } - - // add rows - if(cl.length){ - for(var i=0;i' + + '' + + '' + + ''; } - if(doc.in_words_import && !print_hide('in_words_import')){ - out +='
' + (bold?bstart:'') + title + (bold?bend:'') + '' + format_currency(val, doc.currency) + '
'; - out += ''; - out+= ''; - } - out +='
In Words'+doc.in_words_import+'
'; - return out; + + function convert_rate(val) { + var new_val = flt(val)/flt(doc.conversion_rate); + return new_val; + } + + function print_hide(fieldname) { + var doc_field = wn.meta.get_docfield(doc.doctype, fieldname, doc.name); + return doc_field.print_hide; + } + + var cl = getchildren('Purchase Taxes and Charges', doc.name, 'other_charges'); + + // outer table + var out='
\ +
'; + + // main table + out +=''; + if(!print_hide('net_total_import')) + out += make_row('Net Total', doc.net_total_import, 1); + + // add rows + if(cl.length){ + for(var i=0; i'; + } + + out +='
'; + return out; } cur_frm.cscript.add_deduct_tax = function(doc, cdt, cdn) { - var d = locals[cdt][cdn]; - if(!d.category && d.add_deduct_tax){ - alert(wn._("Please select Category first")); - d.add_deduct_tax = ''; - } - else if(d.category != 'Total' && d.add_deduct_tax == 'Deduct') { - console.log([d.category, d.add_deduct_tax]); - msgprint(wn._("You cannot deduct when category is for 'Valuation' or 'Valuation and Total'")); - d.add_deduct_tax = ''; - } + var d = locals[cdt][cdn]; + if(!d.category && d.add_deduct_tax) { + msgprint(wn._("Please select Category first")); + d.add_deduct_tax = ''; + } + else if(d.category != 'Total' && d.add_deduct_tax == 'Deduct') { + msgprint(wn._("You cannot deduct when category is for 'Valuation' or 'Valuation and Total'")); + d.add_deduct_tax = ''; + } } cur_frm.cscript.charge_type = function(doc, cdt, cdn) { - var d = locals[cdt][cdn]; - if(!d.category && d.charge_type){ - alert(wn._("Please select Category first")); - d.charge_type = ''; - } - else if(d.idx == 1 && (d.charge_type == 'On Previous Row Amount' || d.charge_type == 'On Previous Row Total')){ - alert(wn._("You cannot select Charge Type as 'On Previous Row Amount' or 'On Previous Row Total' for first row")); - d.charge_type = ''; - } - else if((d.category == 'Valuation' || d.category == 'Valuation and Total') && (d.charge_type == 'On Previous Row Amount' || d.charge_type == 'On Previous Row Total')){ - alert(wn._("You cannot select charge type as 'On Previous Row Amount' or 'On Previous Row Total' for valuation. You can select only 'Total' option for previous row amount or previous row total")) - d.charge_type = ''; - } - validated = false; - refresh_field('charge_type',d.name,'purchase_tax_details'); + var d = locals[cdt][cdn]; - cur_frm.cscript.row_id(doc, cdt, cdn); - cur_frm.cscript.rate(doc, cdt, cdn); - cur_frm.cscript.tax_amount(doc, cdt, cdn); + if(!d.category && d.charge_type) { + msgprint(wn._("Please select Category first")); + d.charge_type = ''; + } + else if(d.idx == 1 && (d.charge_type == 'On Previous Row Amount' || d.charge_type == 'On Previous Row Total')) { + msgprint(wn._("You cannot select Charge Type as 'On Previous Row Amount' or 'On Previous Row Total' for first row")); + d.charge_type = ''; + } + else if((d.category == 'Valuation' || d.category == 'Valuation and Total') && (d.charge_type == 'On Previous Row Amount' || d.charge_type == 'On Previous Row Total')) { + msgprint(wn._("You cannot select charge type as 'On Previous Row Amount' or 'On Previous Row Total' for valuation. You can select only 'Total' option for previous row amount or previous row total")); + d.charge_type = ''; + } + + validated = false; + refresh_field('charge_type', d.name, 'other_charges'); + + cur_frm.cscript.row_id(doc, cdt, cdn); + cur_frm.cscript.rate(doc, cdt, cdn); + cur_frm.cscript.tax_amount(doc, cdt, cdn); } cur_frm.cscript.row_id = function(doc, cdt, cdn) { - var d = locals[cdt][cdn]; - if(!d.charge_type && d.row_id){ - alert(wn._("Please select Charge Type first")); - d.row_id = ''; - } - else if((d.charge_type == 'Actual' || d.charge_type == 'On Net Total') && d.row_id) { - alert(wn._("You can Enter Row only if your Charge Type is 'On Previous Row Amount' or ' Previous Row Total'")); - d.row_id = ''; - } - else if((d.charge_type == 'On Previous Row Amount' || d.charge_type == 'On Previous Row Total') && d.row_id){ - if(d.row_id >= d.idx){ - alert(wn._("You cannot Enter Row no. greater than or equal to current row no. for this Charge type")); - d.row_id = ''; - } - } - validated = false; - refresh_field('row_id',d.name,'purchase_tax_details'); + var d = locals[cdt][cdn]; + + if(!d.charge_type && d.row_id) { + msgprint(wn._("Please select Charge Type first")); + d.row_id = ''; + } + else if((d.charge_type == 'Actual' || d.charge_type == 'On Net Total') && d.row_id) { + msgprint(wn._("You can Enter Row only if your Charge Type is 'On Previous Row Amount' or ' Previous Row Total'")); + d.row_id = ''; + } + else if((d.charge_type == 'On Previous Row Amount' || d.charge_type == 'On Previous Row Total') && d.row_id) { + if(d.row_id >= d.idx){ + msgprint(wn._("You cannot Enter Row no. greater than or equal to current row no. for this Charge type")); + d.row_id = ''; + } + } + validated = false; + refresh_field('row_id', d.name, 'other_charges'); } -cur_frm.set_query("account_head", "purchase_tax_details", function(doc) { +cur_frm.set_query("account_head", "other_charges", function(doc) { return { query: "erpnext.controllers.queries.tax_account_query", - filters: { + filters: { "account_type": ["Tax", "Chargeable", "Expense Account"], "debit_or_credit": "Debit", "company": doc.company @@ -148,35 +144,38 @@ cur_frm.set_query("account_head", "purchase_tax_details", function(doc) { } }); -cur_frm.fields_dict['purchase_tax_details'].grid.get_field("cost_center").get_query = function(doc) { - return { - filters: { - 'company': doc.company, - 'group_or_ledger': "Ledger" - } - } +cur_frm.fields_dict['other_charges'].grid.get_field("cost_center").get_query = function(doc) { + return { + filters: { + 'company': doc.company, + 'group_or_ledger': "Ledger" + } + } } cur_frm.cscript.rate = function(doc, cdt, cdn) { - var d = locals[cdt][cdn]; - if(!d.charge_type && d.rate) { - alert(wn._("Please select Charge Type first")); - d.rate = ''; - } - validated = false; - refresh_field('rate',d.name,'purchase_tax_details'); + var d = locals[cdt][cdn]; + + if(!d.charge_type && d.rate) { + msgprint(wn._("Please select Charge Type first")); + d.rate = ''; + } + validated = false; + refresh_field('rate', d.name, 'other_charges'); } cur_frm.cscript.tax_amount = function(doc, cdt, cdn) { - var d = locals[cdt][cdn]; - if(!d.charge_type && d.tax_amount){ - alert(wn._("Please select Charge Type first")); - d.tax_amount = ''; - } - else if(d.charge_type && d.tax_amount) { - alert(wn._("You cannot directly enter Amount and if your Charge Type is Actual enter your amount in Rate")); - d.tax_amount = ''; - } - validated = false; - refresh_field('tax_amount',d.name,'purchase_tax_details'); -} + var d = locals[cdt][cdn]; + + if(!d.charge_type && d.tax_amount) { + msgprint(wn._("Please select Charge Type first")); + d.tax_amount = ''; + } + else if(d.charge_type && d.tax_amount) { + msgprint(wn._("You cannot directly enter Amount and if your Charge Type is Actual enter your amount in Rate")); + d.tax_amount = ''; + } + + validated = false; + refresh_field('tax_amount', d.name, 'other_charges'); +} \ No newline at end of file diff --git a/erpnext/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.txt b/erpnext/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.txt index bdaf00cf03..adb5f5adf5 100644 --- a/erpnext/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.txt +++ b/erpnext/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.txt @@ -2,7 +2,7 @@ { "creation": "2013-01-10 16:34:08", "docstatus": 0, - "modified": "2014-01-20 17:49:14", + "modified": "2014-01-29 12:26:38", "modified_by": "Administrator", "owner": "wasim@webnotestech.com" }, @@ -70,7 +70,7 @@ }, { "doctype": "DocField", - "fieldname": "purchase_tax_details", + "fieldname": "other_charges", "fieldtype": "Table", "label": "Purchase Taxes and Charges", "oldfieldname": "purchase_tax_details", diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index 5c092cfa01..cfa1aa7c8f 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -194,7 +194,7 @@ class DocType(SellingController): self.doc.customer = pos.customer self.set_customer_defaults() - for fieldname in ('territory', 'naming_series', 'currency', 'charge', 'letter_head', 'tc_name', + for fieldname in ('territory', 'naming_series', 'currency', 'taxes_and_charges', 'letter_head', 'tc_name', 'selling_price_list', 'company', 'select_print_heading', 'cash_bank_account'): if (not for_validate) or (for_validate and not self.doc.fields.get(fieldname)): self.doc.fields[fieldname] = pos.get(fieldname) @@ -214,7 +214,7 @@ class DocType(SellingController): self.doc.terms = webnotes.conn.get_value("Terms and Conditions", self.doc.tc_name, "terms") # fetch charges - if self.doc.charge and not len(self.doclist.get({"parentfield": "other_charges"})): + if self.doc.taxes_and_charges and not len(self.doclist.get({"parentfield": "other_charges"})): self.set_taxes("other_charges", "taxes_and_charges") def get_customer_account(self): diff --git a/erpnext/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js b/erpnext/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js index 0e9b3db6c0..6234563537 100644 --- a/erpnext/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js +++ b/erpnext/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js @@ -1,8 +1,6 @@ // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors // License: GNU General Public License v3. See license.txt -//--------- ONLOAD ------------- - {% include "public/js/controllers/accounts.js" %} cur_frm.cscript.onload = function(doc, cdt, cdn) { @@ -11,7 +9,7 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) { } cur_frm.cscript.refresh = function(doc, cdt, cdn) { - cur_frm.set_footnote(wn.markdown(cur_frm.meta.description)); + cur_frm.set_footnote(wn.markdown(cur_frm.meta.description)); } // For customizing print @@ -40,11 +38,11 @@ cur_frm.pformat.other_charges= function(doc){ var make_row = function(title, val, bold){ var bstart = ''; var bend = ''; return '' + (bold?bstart:'') + title + (bold?bend:'') + '' - +'' + format_currency(val, doc.currency) + '' - +'' + + '' + format_currency(val, doc.currency) + '' + + ''; } - function convert_rate(val){ + function convert_rate(val) { var new_val = flt(val)/flt(doc.conversion_rate); return new_val; } @@ -71,31 +69,28 @@ cur_frm.pformat.other_charges= function(doc){ // add rows if(cl.length){ - for(var i=0;i' + out += ''; + out += ''; } out += '
In Words' + doc.in_words_export + '
'; } @@ -104,8 +99,8 @@ cur_frm.pformat.other_charges= function(doc){ cur_frm.cscript.charge_type = function(doc, cdt, cdn) { var d = locals[cdt][cdn]; - if(d.idx == 1 && (d.charge_type == 'On Previous Row Amount' || d.charge_type == 'On Previous Row Total')){ - alert(wn._("You cannot select Charge Type as 'On Previous Row Amount' or 'On Previous Row Total' for first row")); + if(d.idx == 1 && (d.charge_type == 'On Previous Row Amount' || d.charge_type == 'On Previous Row Total')) { + msgprint(wn._("You cannot select Charge Type as 'On Previous Row Amount' or 'On Previous Row Total' for first row")); d.charge_type = ''; } validated = false; @@ -117,17 +112,17 @@ cur_frm.cscript.charge_type = function(doc, cdt, cdn) { cur_frm.cscript.row_id = function(doc, cdt, cdn) { var d = locals[cdt][cdn]; - if(!d.charge_type && d.row_id){ - alert(wn._("Please select Charge Type first")); + if(!d.charge_type && d.row_id) { + msgprint(wn._("Please select Charge Type first")); d.row_id = ''; } else if((d.charge_type == 'Actual' || d.charge_type == 'On Net Total') && d.row_id) { - alert(wn._("You can Enter Row only if your Charge Type is 'On Previous Row Amount' or ' Previous Row Total'")); + msgprint(wn._("You can Enter Row only if your Charge Type is 'On Previous Row Amount' or ' Previous Row Total'")); d.row_id = ''; } - else if((d.charge_type == 'On Previous Row Amount' || d.charge_type == 'On Previous Row Total') && d.row_id){ + else if((d.charge_type == 'On Previous Row Amount' || d.charge_type == 'On Previous Row Total') && d.row_id) { if(d.row_id >= d.idx){ - alert(wn._("You cannot Enter Row no. greater than or equal to current row no. for this Charge type")); + msgprint(wn._("You cannot Enter Row no. greater than or equal to current row no. for this Charge type")); d.row_id = ''; } } @@ -158,7 +153,7 @@ cur_frm.fields_dict['other_charges'].grid.get_field("cost_center").get_query = f cur_frm.cscript.rate = function(doc, cdt, cdn) { var d = locals[cdt][cdn]; if(!d.charge_type && d.rate) { - alert(wn._("Please select Charge Type first")); + msgprint(wn._("Please select Charge Type first")); d.rate = ''; } validated = false; @@ -167,12 +162,12 @@ cur_frm.cscript.rate = function(doc, cdt, cdn) { cur_frm.cscript.tax_amount = function(doc, cdt, cdn) { var d = locals[cdt][cdn]; - if(!d.charge_type && d.tax_amount){ - alert(wn._("Please select Charge Type first")); + if(!d.charge_type && d.tax_amount) { + msgprint(wn._("Please select Charge Type first")); d.tax_amount = ''; } else if(d.charge_type && d.tax_amount) { - alert(wn._("You cannot directly enter Amount and if your Charge Type is Actual enter your amount in Rate")); + msgprint(wn._("You cannot directly enter Amount and if your Charge Type is Actual enter your amount in Rate")); d.tax_amount = ''; } validated = false; diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py index d9cb516c31..941c2ae74f 100644 --- a/erpnext/accounts/utils.py +++ b/erpnext/accounts/utils.py @@ -6,7 +6,7 @@ from __future__ import unicode_literals import webnotes from webnotes.utils import nowdate, cstr, flt, now, getdate, add_months from webnotes.model.doc import addchild -from webnotes import msgprint, _ +from webnotes import msgprint, throw, _ from webnotes.utils import formatdate from erpnext.utilities import build_filter_conditions @@ -41,12 +41,12 @@ def get_fiscal_years(date=None, fiscal_year=None, label="Date", verbose=1): def validate_fiscal_year(date, fiscal_year, label="Date"): years = [f[0] for f in get_fiscal_years(date, label=label)] if fiscal_year not in years: - webnotes.msgprint(("%(label)s '%(posting_date)s': " + _("not within Fiscal Year") + \ + throw(("%(label)s '%(posting_date)s': " + _("not within Fiscal Year") + \ ": '%(fiscal_year)s'") % { "label": label, "posting_date": formatdate(date), "fiscal_year": fiscal_year - }, raise_exception=1) + }) @webnotes.whitelist() def get_balance_on(account=None, date=None): @@ -169,8 +169,7 @@ def check_if_jv_modified(args): and t1.docstatus=1 and t2.%(dr_or_cr)s = %(unadjusted_amt)s""" % args) if not ret: - msgprint(_("""Payment Entry has been modified after you pulled it. - Please pull it again."""), raise_exception=1) + throw(_("""Payment Entry has been modified after you pulled it. Please pull it again.""")) def update_against_doc(d, jv_obj): """ @@ -247,9 +246,9 @@ def get_company_default(company, fieldname): value = webnotes.conn.get_value("Company", company, fieldname) if not value: - msgprint(_("Please mention default value for '") + + throw(_("Please mention default value for '") + _(webnotes.get_doctype("company").get_label(fieldname) + - _("' in Company: ") + company), raise_exception=True) + _("' in Company: ") + company)) return value @@ -318,11 +317,11 @@ def validate_expense_against_budget(args): if action_for: actual_expense = get_actual_expense(args) if actual_expense > budget_amount: - webnotes.msgprint(action_for + _(" budget ") + cstr(budget_amount) + + throw(action_for + _(" budget ") + cstr(budget_amount) + _(" for account ") + args.account + _(" against cost center ") + args.cost_center + _(" will exceed by ") + cstr(actual_expense - budget_amount) + _(" after this transaction.") - , raise_exception=BudgetError if action=="Stop" else False) + , exc=BudgetError if action=="Stop" else False) def get_allocated_budget(distribution_id, posting_date, fiscal_year, yearly_budget): if distribution_id: diff --git a/erpnext/buying/Print Format/Purchase Order Classic/Purchase Order Classic.txt b/erpnext/buying/Print Format/Purchase Order Classic/Purchase Order Classic.txt index ff8448fb7c..f1514c9146 100644 --- a/erpnext/buying/Print Format/Purchase Order Classic/Purchase Order Classic.txt +++ b/erpnext/buying/Print Format/Purchase Order Classic/Purchase Order Classic.txt @@ -9,7 +9,7 @@ { "doc_type": "Purchase Order", "doctype": "Print Format", - "html": "\n\n\n\n\n\n\n\n\n\n\n\n
\n\t\n\t\n
\n\n", + "html": "\n\n\n\n\n\n\n\n\n\n\n\n
\n\t\n\t\n
\n\n", "module": "Buying", "name": "__common__", "print_format_type": "Client", diff --git a/erpnext/buying/Print Format/Purchase Order Modern/Purchase Order Modern.txt b/erpnext/buying/Print Format/Purchase Order Modern/Purchase Order Modern.txt index 3be7eb0f56..9e0693a61f 100644 --- a/erpnext/buying/Print Format/Purchase Order Modern/Purchase Order Modern.txt +++ b/erpnext/buying/Print Format/Purchase Order Modern/Purchase Order Modern.txt @@ -9,7 +9,7 @@ { "doc_type": "Purchase Order", "doctype": "Print Format", - "html": "\n\n\n\n\n\n\n\n\n\n\n\n
\n\t\n\t\n
\n\n", + "html": "\n\n\n\n\n\n\n\n\n\n\n\n
\n\t\n\t\n
\n\n", "module": "Buying", "name": "__common__", "print_format_type": "Client", diff --git a/erpnext/buying/Print Format/Purchase Order Spartan/Purchase Order Spartan.txt b/erpnext/buying/Print Format/Purchase Order Spartan/Purchase Order Spartan.txt index 908ee78592..79016a7cec 100644 --- a/erpnext/buying/Print Format/Purchase Order Spartan/Purchase Order Spartan.txt +++ b/erpnext/buying/Print Format/Purchase Order Spartan/Purchase Order Spartan.txt @@ -9,7 +9,7 @@ { "doc_type": "Purchase Order", "doctype": "Print Format", - "html": "\n\n\n\n\n\n\n\n\n\n\n\n
\n\t\n\t\n
\n\n", + "html": "\n\n\n\n\n\n\n\n\n\n\n\n
\n\t\n\t\n
\n\n", "module": "Buying", "name": "__common__", "print_format_type": "Client", diff --git a/erpnext/buying/doctype/purchase_common/purchase_common.js b/erpnext/buying/doctype/purchase_common/purchase_common.js index 1556634d76..6739e1ea46 100644 --- a/erpnext/buying/doctype/purchase_common/purchase_common.js +++ b/erpnext/buying/doctype/purchase_common/purchase_common.js @@ -62,14 +62,13 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({ }, supplier: function() { + var me = this; if(this.frm.doc.supplier || this.frm.doc.credit_to) { if(!this.frm.doc.company) { this.frm.set_value("supplier", null); msgprint(wn._("Please specify Company")); } else { - var me = this; var buying_price_list = this.frm.doc.buying_price_list; - return this.frm.call({ doc: this.frm.doc, method: "set_supplier_defaults", @@ -77,6 +76,8 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({ callback: function(r) { if(!r.exc) { if(me.frm.doc.buying_price_list !== buying_price_list) me.buying_price_list(); + if (me.frm.doc.taxes_and_charges) + me.frm.script_manager.trigger("taxes_and_charges") } } }); @@ -241,21 +242,6 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({ } }, - taxes_and_charges: function() { - var me = this; - if(this.frm.doc.taxes_and_charges) { - return this.frm.call({ - doc: this.frm.doc, - method: "get_purchase_tax_details", - callback: function(r) { - if(!r.exc) { - me.calculate_taxes_and_totals(); - } - } - }); - } - }, - calculate_taxes_and_totals: function() { this._super(); this.calculate_total_advance("Purchase Invoice", "advance_allocation_details"); @@ -398,13 +384,6 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({ } }, - show_item_wise_taxes: function() { - if(this.frm.fields_dict.tax_calculation) { - $(this.get_item_wise_taxes_html()) - .appendTo($(this.frm.fields_dict.tax_calculation.wrapper).empty()); - } - }, - change_form_labels: function(company_currency) { var me = this; var field_label_map = {}; diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.js b/erpnext/buying/doctype/purchase_order/purchase_order.js index edf7c82555..5213885002 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.js +++ b/erpnext/buying/doctype/purchase_order/purchase_order.js @@ -5,7 +5,7 @@ wn.provide("erpnext.buying"); cur_frm.cscript.tname = "Purchase Order Item"; cur_frm.cscript.fname = "po_details"; -cur_frm.cscript.other_fname = "purchase_tax_details"; +cur_frm.cscript.other_fname = "other_charges"; {% include 'buying/doctype/purchase_common/purchase_common.js' %}; {% include 'accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.js' %} diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.txt b/erpnext/buying/doctype/purchase_order/purchase_order.txt index bce007c992..2dbafd228a 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.txt +++ b/erpnext/buying/doctype/purchase_order/purchase_order.txt @@ -2,7 +2,7 @@ { "creation": "2013-05-21 16:16:39", "docstatus": 0, - "modified": "2014-01-28 18:49:03", + "modified": "2014-01-29 15:26:21", "modified_by": "Administrator", "owner": "Administrator" }, @@ -318,7 +318,7 @@ }, { "doctype": "DocField", - "fieldname": "purchase_tax_details", + "fieldname": "other_charges", "fieldtype": "Table", "label": "Purchase Taxes and Charges", "no_copy": 0, @@ -328,9 +328,9 @@ }, { "doctype": "DocField", - "fieldname": "tax_calculation", + "fieldname": "other_charges_calculation", "fieldtype": "HTML", - "label": "Tax Calculation", + "label": "Taxes and Charges Calculation", "no_copy": 1, "oldfieldtype": "HTML", "print_hide": 1 diff --git a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js index bc56abd917..562e69d1f1 100644 --- a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js +++ b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js @@ -4,7 +4,7 @@ // define defaults for purchase common cur_frm.cscript.tname = "Supplier Quotation Item"; cur_frm.cscript.fname = "quotation_items"; -cur_frm.cscript.other_fname = "purchase_tax_details"; +cur_frm.cscript.other_fname = "other_charges"; // attach required files {% include 'buying/doctype/purchase_common/purchase_common.js' %}; diff --git a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.txt b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.txt index 324bd41023..0a4a3ec663 100644 --- a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.txt +++ b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.txt @@ -2,7 +2,7 @@ { "creation": "2013-05-21 16:16:45", "docstatus": 0, - "modified": "2014-01-28 18:50:58", + "modified": "2014-01-29 15:25:52", "modified_by": "Administrator", "owner": "Administrator" }, @@ -308,7 +308,7 @@ }, { "doctype": "DocField", - "fieldname": "purchase_tax_details", + "fieldname": "other_charges", "fieldtype": "Table", "label": "Purchase Taxes and Charges", "no_copy": 0, @@ -318,9 +318,9 @@ }, { "doctype": "DocField", - "fieldname": "tax_calculation", + "fieldname": "other_charges_calculation", "fieldtype": "HTML", - "label": "Tax Calculation", + "label": "Taxes and Charges Calculation", "no_copy": 1, "oldfieldtype": "HTML", "print_hide": 1 diff --git a/erpnext/controllers/buying_controller.py b/erpnext/controllers/buying_controller.py index f7b1e27a44..7ef771af83 100644 --- a/erpnext/controllers/buying_controller.py +++ b/erpnext/controllers/buying_controller.py @@ -38,7 +38,7 @@ class BuyingController(StockController): self.set_missing_item_details(get_item_details) if self.doc.fields.get("__islocal"): - self.set_taxes("purchase_tax_details", "taxes_and_charges") + self.set_taxes("other_charges", "taxes_and_charges") def set_supplier_from_item_default(self): if self.meta.get_field("supplier") and not self.doc.supplier: @@ -57,14 +57,10 @@ class BuyingController(StockController): for w in warehouses: validate_warehouse_company(w, self.doc.company) - def get_purchase_tax_details(self): - self.doclist = self.doc.clear_table(self.doclist, "purchase_tax_details") - self.set_taxes("purchase_tax_details", "taxes_and_charges") - def validate_stock_or_nonstock_items(self): if not self.get_stock_items(): tax_for_valuation = [d.account_head for d in - self.doclist.get({"parentfield": "purchase_tax_details"}) + self.doclist.get({"parentfield": "other_charges"}) if d.category in ["Valuation", "Valuation and Total"]] if tax_for_valuation: webnotes.msgprint(_("""Tax Category can not be 'Valuation' or 'Valuation and Total' as all items are non-stock items"""), raise_exception=1) @@ -79,7 +75,7 @@ class BuyingController(StockController): self.doc.currency) def calculate_taxes_and_totals(self): - self.other_fname = "purchase_tax_details" + self.other_fname = "other_charges" super(BuyingController, self).calculate_taxes_and_totals() self.calculate_total_advance("Purchase Invoice", "advance_allocation_details") @@ -203,7 +199,7 @@ class BuyingController(StockController): last_stock_item_idx = d.idx total_valuation_amount = sum([flt(d.tax_amount) for d in - self.doclist.get({"parentfield": "purchase_tax_details"}) + self.doclist.get({"parentfield": "other_charges"}) if d.category in ["Valuation", "Valuation and Total"]]) diff --git a/erpnext/controllers/selling_controller.py b/erpnext/controllers/selling_controller.py index 2c1f0784cb..bcfe0bcfad 100644 --- a/erpnext/controllers/selling_controller.py +++ b/erpnext/controllers/selling_controller.py @@ -50,10 +50,6 @@ class SellingController(StockController): self.set_price_list_currency("Selling") self.set_missing_item_details(get_item_details) - def get_other_charges(self): - self.doclist = self.doc.clear_table(self.doclist, "other_charges") - self.set_taxes("other_charges", "taxes_and_charges") - def apply_shipping_rule(self): if self.doc.shipping_rule: shipping_rule = webnotes.bean("Shipping Rule", self.doc.shipping_rule) diff --git a/erpnext/hr/doctype/leave_control_panel/leave_control_panel.js b/erpnext/hr/doctype/leave_control_panel/leave_control_panel.js index 649c35d31d..59bf829f51 100644 --- a/erpnext/hr/doctype/leave_control_panel/leave_control_panel.js +++ b/erpnext/hr/doctype/leave_control_panel/leave_control_panel.js @@ -1,31 +1,27 @@ // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors // License: GNU General Public License v3. See license.txt -cur_frm.cscript.onload = function(doc,dt,dn){ - if(!doc.posting_date) set_multiple(dt,dn,{posting_date:get_today()}); - if(!doc.leave_transaction_type) set_multiple(dt,dn,{leave_transaction_type:'Allocation'}); - +cur_frm.cscript.onload = function(doc, dt, dn){ + if(!doc.posting_date) + set_multiple(dt, dn, {posting_date: get_today()}); + if(!doc.leave_transaction_type) + set_multiple(dt, dn, {leave_transaction_type: 'Allocation'}); } - -// Validation For To Date -// ================================================================================================ cur_frm.cscript.to_date = function(doc, cdt, cdn) { - return $c('runserverobj', args={'method':'to_date_validation','docs':wn.model.compress(make_doclist(doc.doctype, doc.name))}, - function(r, rt) { - var doc = locals[cdt][cdn]; - if (r.message) { - alert(wn._("To date cannot be before from date")); - doc.to_date = ''; - refresh_field('to_date'); - } - } - ); + return $c('runserverobj', args={'method':'to_date_validation','docs':wn.model.compress(make_doclist(doc.doctype, doc.name))}, + function(r, rt) { + var doc = locals[cdt][cdn]; + if (r.message) { + msgprint(wn._("To date cannot be before from date")); + doc.to_date = ''; + refresh_field('to_date'); + } + } + ); } -// Allocation Type -// ================================================================================================ cur_frm.cscript.allocation_type = function (doc, cdt, cdn){ - doc.no_of_days = ''; - refresh_field('no_of_days'); -} + doc.no_of_days = ''; + refresh_field('no_of_days'); +} \ No newline at end of file diff --git a/erpnext/public/js/transaction.js b/erpnext/public/js/transaction.js index 0dfdd07376..24fc332202 100644 --- a/erpnext/public/js/transaction.js +++ b/erpnext/public/js/transaction.js @@ -708,4 +708,26 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({ }); } }, + + taxes_and_charges: function() { + var me = this; + if(this.frm.doc.taxes_and_charges) { + return this.frm.call({ + doc: this.frm.doc, + method: "get_other_charges", + callback: function(r) { + if(!r.exc) { + me.calculate_taxes_and_totals(); + } + } + }); + } + }, + + show_item_wise_taxes: function() { + if(this.frm.fields_dict.other_charges_calculation) { + $(this.get_item_wise_taxes_html()) + .appendTo($(this.frm.fields_dict.other_charges_calculation.wrapper).empty()); + } + }, }); \ No newline at end of file diff --git a/erpnext/selling/sales_common.js b/erpnext/selling/sales_common.js index a9ed2b77dc..53be7196cf 100644 --- a/erpnext/selling/sales_common.js +++ b/erpnext/selling/sales_common.js @@ -35,8 +35,8 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({ me.frm.set_query(opts[0], erpnext.queries[opts[1]]); }); - if(this.frm.fields_dict.charge) { - this.frm.set_query("charge", function() { + if(this.frm.fields_dict.taxes_and_charges) { + this.frm.set_query("taxes_and_charges", function() { return { filters: [ ['Sales Taxes and Charges Master', 'company', '=', me.frm.doc.company], @@ -80,7 +80,7 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({ if(item.warehouse) filters["warehouse"] = item.warehouse return { - query : "controllers.queries.get_batch_no", + query : "erpnext.controllers.queries.get_batch_no", filters: filters } } @@ -119,6 +119,8 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({ (me.frm.doc.selling_price_list !== selling_price_list) ? me.selling_price_list() : me.price_list_currency(); + if (me.frm.doc.taxes_and_charges) + me.frm.script_manager.trigger("taxes_and_charges") } } }); @@ -511,28 +513,6 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({ this.frm.doc.in_words = this.frm.doc.in_words_export = ""; }, - show_item_wise_taxes: function() { - if(this.frm.fields_dict.other_charges_calculation) { - $(this.get_item_wise_taxes_html()) - .appendTo($(this.frm.fields_dict.other_charges_calculation.wrapper).empty()); - } - }, - - taxes_and_charges: function() { - var me = this; - if(this.frm.doc.charge) { - return this.frm.call({ - doc: this.frm.doc, - method: "get_other_charges", - callback: function(r) { - if(!r.exc) { - me.calculate_taxes_and_totals(); - } - } - }); - } - }, - shipping_rule: function() { var me = this; if(this.frm.doc.shipping_rule) { diff --git a/erpnext/stock/doctype/item/item.js b/erpnext/stock/doctype/item/item.js index e894d0db88..1e89dc1ca8 100644 --- a/erpnext/stock/doctype/item/item.js +++ b/erpnext/stock/doctype/item/item.js @@ -23,7 +23,7 @@ cur_frm.cscript.refresh = function(doc) { cur_frm.cscript.make_dashboard = function() { cur_frm.dashboard.reset(); - if(cur_frm.doc.__islocal) + if(cur_frm.doc.__islocal) return; } @@ -34,26 +34,27 @@ cur_frm.cscript.edit_prices_button = function() { } cur_frm.cscript.item_code = function(doc) { - if(!doc.item_name) cur_frm.set_value("item_name", doc.item_code); - if(!doc.description) cur_frm.set_value("description", doc.item_code); + if(!doc.item_name) + cur_frm.set_value("item_name", doc.item_code); + if(!doc.description) + cur_frm.set_value("description", doc.item_code); } cur_frm.fields_dict['default_bom'].get_query = function(doc) { - //var d = locals[this.doctype][this.docname]; - return{ - filters:{ - 'item': doc.item_code, - 'is_active': 0 - } - } + return { + filters: { + 'item': doc.item_code, + 'is_active': 0 + } + } } // Expense Account // --------------------------------- -cur_frm.fields_dict['purchase_account'].get_query = function(doc){ - return{ - filters:{ +cur_frm.fields_dict['purchase_account'].get_query = function(doc) { + return { + filters: { 'debit_or_credit': "Debit", 'group_or_ledger': "Ledger" } @@ -63,8 +64,8 @@ cur_frm.fields_dict['purchase_account'].get_query = function(doc){ // Income Account // -------------------------------- cur_frm.fields_dict['default_income_account'].get_query = function(doc) { - return{ - filters:{ + return { + filters: { 'debit_or_credit': "Credit", 'group_or_ledger': "Ledger", 'account_type': "Income Account" @@ -76,7 +77,7 @@ cur_frm.fields_dict['default_income_account'].get_query = function(doc) { // Purchase Cost Center // ----------------------------- cur_frm.fields_dict['cost_center'].get_query = function(doc) { - return{ + return { filters:{ 'group_or_ledger': "Ledger" } } } @@ -85,15 +86,15 @@ cur_frm.fields_dict['cost_center'].get_query = function(doc) { // Sales Cost Center // ----------------------------- cur_frm.fields_dict['default_sales_cost_center'].get_query = function(doc) { - return{ + return { filters:{ 'group_or_ledger': "Ledger" } } } cur_frm.fields_dict['item_tax'].grid.get_field("tax_type").get_query = function(doc, cdt, cdn) { - return{ - filters:[ + return { + filters: [ ['Account', 'account_type', 'in', 'Tax, Chargeable, Income Account, Expense Account'], ['Account', 'docstatus', '!=', 2] @@ -102,12 +103,10 @@ cur_frm.fields_dict['item_tax'].grid.get_field("tax_type").get_query = function( } cur_frm.cscript.tax_type = function(doc, cdt, cdn){ - var d = locals[cdt][cdn]; - return get_server_fields('get_tax_rate',d.tax_type,'item_tax',doc, cdt, cdn, 1); + var d = locals[cdt][cdn]; + return get_server_fields('get_tax_rate', d.tax_type, 'item_tax', doc, cdt, cdn, 1); } - -//get query select item group cur_frm.fields_dict['item_group'].get_query = function(doc,cdt,cdn) { return { filters: [ @@ -116,44 +115,39 @@ cur_frm.fields_dict['item_group'].get_query = function(doc,cdt,cdn) { } } -// for description from attachment -// takes the first attachment and creates -// a table with both image and attachment in HTML -// in the "alternate_description" field cur_frm.cscript.add_image = function(doc, dt, dn) { if(!doc.image) { msgprint(wn._('Please select an "Image" first')); return; } - doc.description_html = repl(''+ - ''+ - ''+ - '
%(desc)s
', {imgurl: wn.utils.get_file_link(doc.image), desc:doc.description}); + doc.description_html = repl('' + + '' + + '' + + '
%(desc)s
', {imgurl: wn.utils.get_file_link(doc.image), desc:doc.description}); refresh_field('description_html'); } + // Quotation to validation - either customer or lead mandatory -cur_frm.cscript.weight_to_validate = function(doc,cdt,cdn){ - - if((doc.nett_weight || doc.gross_weight) && !doc.weight_uom) - { - alert(wn._('Weight is mentioned,\nPlease mention "Weight UOM" too')); - validated=0; - } +cur_frm.cscript.weight_to_validate = function(doc, cdt, cdn){ + if((doc.nett_weight || doc.gross_weight) && !doc.weight_uom) { + msgprint(wn._('Weight is mentioned,\nPlease mention "Weight UOM" too')); + validated = 0; + } } -cur_frm.cscript.validate = function(doc,cdt,cdn){ - cur_frm.cscript.weight_to_validate(doc,cdt,cdn); +cur_frm.cscript.validate = function(doc, cdt, cdn){ + cur_frm.cscript.weight_to_validate(doc, cdt, cdn); } -cur_frm.fields_dict.item_customer_details.grid.get_field("customer_name").get_query = -function(doc,cdt,cdn) { - return{ query: "erpnext.controllers.queries.customer_query" } } - -cur_frm.fields_dict.item_supplier_details.grid.get_field("supplier").get_query = - function(doc,cdt,cdn) { - return{ query: "erpnext.controllers.queries.supplier_query" } } +cur_frm.fields_dict.item_customer_details.grid.get_field("customer_name").get_query = function(doc, cdt, cdn) { + return { query: "erpnext.controllers.queries.customer_query" } +} + +cur_frm.fields_dict.item_supplier_details.grid.get_field("supplier").get_query = function(doc, cdt, cdn) { + return { query: "erpnext.controllers.queries.supplier_query" } +} cur_frm.cscript.copy_from_item_group = function(doc) { wn.model.with_doc("Item Group", doc.item_group, function() { @@ -172,9 +166,9 @@ cur_frm.cscript.copy_from_item_group = function(doc) { cur_frm.cscript.image = function() { refresh_field("image_view"); - if(!cur_frm.doc.description_html) { + if(!cur_frm.doc.description_html) cur_frm.cscript.add_image(cur_frm.doc); - } else { + else { msgprint(wn._("You may need to update: ") + wn.meta.get_docfield(cur_frm.doc.doctype, "description_html").label); } 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 95026adbcf..523d5556ce 100644 --- a/erpnext/stock/doctype/landed_cost_wizard/landed_cost_wizard.py +++ b/erpnext/stock/doctype/landed_cost_wizard/landed_cost_wizard.py @@ -39,13 +39,13 @@ class DocType: for pr in purchase_receipts: pr_bean = webnotes.bean('Purchase Receipt', pr) - idx = max([d.idx for d in pr_bean.doclist.get({"parentfield": "purchase_tax_details"})]) + idx = max([d.idx for d in pr_bean.doclist.get({"parentfield": "other_charges"})]) for lc in self.doclist.get({"parentfield": "landed_cost_details"}): amt = flt(lc.amount) * flt(pr_bean.doc.net_total)/ flt(total_amt) matched_row = pr_bean.doclist.get({ - "parentfield": "purchase_tax_details", + "parentfield": "other_charges", "category": "Valuation", "add_deduct_tax": "Add", "charge_type": "Actual", @@ -53,7 +53,7 @@ class DocType: }) if not matched_row: # add if not exists - ch = addchild(pr_bean.doc, 'purchase_tax_details', 'Purchase Taxes and Charges') + ch = addchild(pr_bean.doc, 'other_charges', 'Purchase Taxes and Charges') ch.category = 'Valuation' ch.add_deduct_tax = 'Add' ch.charge_type = 'Actual' diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js index 5151c0090b..1a08cd2eb2 100644 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js @@ -3,7 +3,7 @@ cur_frm.cscript.tname = "Purchase Receipt Item"; cur_frm.cscript.fname = "purchase_receipt_details"; -cur_frm.cscript.other_fname = "purchase_tax_details"; +cur_frm.cscript.other_fname = "other_charges"; {% include 'buying/doctype/purchase_common/purchase_common.js' %}; {% include 'accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.js' %} @@ -106,27 +106,28 @@ erpnext.stock.PurchaseReceiptController = erpnext.buying.BuyingController.extend $.extend(cur_frm.cscript, new erpnext.stock.PurchaseReceiptController({frm: cur_frm})); cur_frm.fields_dict['supplier_address'].get_query = function(doc, cdt, cdn) { - return{ - filters:{ 'supplier': doc.supplier} + return { + filters: { 'supplier': doc.supplier} } } cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) { - return{ - filters:{ 'supplier': doc.supplier} + return { + filters: { 'supplier': doc.supplier } } } -cur_frm.cscript.new_contact = function(){ +cur_frm.cscript.new_contact = function() { tn = wn.model.make_new_doc_and_get_name('Contact'); locals['Contact'][tn].is_supplier = 1; - if(doc.supplier) locals['Contact'][tn].supplier = doc.supplier; + if(doc.supplier) + locals['Contact'][tn].supplier = doc.supplier; loaddoc('Contact', tn); } cur_frm.fields_dict['purchase_receipt_details'].grid.get_field('project_name').get_query = function(doc, cdt, cdn) { - return{ - filters:[ + return { + filters: [ ['Project', 'status', 'not in', 'Completed, Cancelled'] ] } @@ -134,28 +135,25 @@ cur_frm.fields_dict['purchase_receipt_details'].grid.get_field('project_name').g cur_frm.fields_dict['purchase_receipt_details'].grid.get_field('batch_no').get_query= function(doc, cdt, cdn) { var d = locals[cdt][cdn]; - if(d.item_code){ - return{ - filters:{'item': d.item_code} + if(d.item_code) { + return { + filters: {'item': d.item_code} } } - else{ - alert(wn._("Please enter Item Code.")); - } + else + msgprint(wn._("Please enter Item Code.")); } -cur_frm.cscript.select_print_heading = function(doc,cdt,cdn){ - if(doc.select_print_heading){ - // print heading +cur_frm.cscript.select_print_heading = function(doc, cdt, cdn) { + if(doc.select_print_heading) cur_frm.pformat.print_heading = doc.select_print_heading; - } else cur_frm.pformat.print_heading = "Purchase Receipt"; } cur_frm.fields_dict['select_print_heading'].get_query = function(doc, cdt, cdn) { - return{ - filters:[ + return { + filters: [ ['Print Heading', 'docstatus', '!=', '2'] ] } @@ -170,7 +168,6 @@ cur_frm.fields_dict.purchase_receipt_details.grid.get_field("qa_no").get_query = } cur_frm.cscript.on_submit = function(doc, cdt, cdn) { - if(cint(wn.boot.notification_settings.purchase_receipt)) { + if(cint(wn.boot.notification_settings.purchase_receipt)) cur_frm.email_doc(wn.boot.notification_settings.purchase_receipt_message); - } -} +} \ No newline at end of file diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.txt b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.txt index e1ba3622e7..28c2572b08 100755 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.txt +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.txt @@ -2,7 +2,7 @@ { "creation": "2013-05-21 16:16:39", "docstatus": 0, - "modified": "2014-01-28 18:52:19", + "modified": "2014-01-29 15:25:14", "modified_by": "Administrator", "owner": "Administrator" }, @@ -346,7 +346,7 @@ }, { "doctype": "DocField", - "fieldname": "purchase_tax_details", + "fieldname": "other_charges", "fieldtype": "Table", "label": "Purchase Taxes and Charges", "oldfieldname": "purchase_tax_details", @@ -355,9 +355,9 @@ }, { "doctype": "DocField", - "fieldname": "tax_calculation", + "fieldname": "other_charges_calculation", "fieldtype": "HTML", - "label": "Tax Calculation", + "label": "Taxes and Charges Calculation", "oldfieldtype": "HTML", "print_hide": 1 }, diff --git a/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py index 89e77cee81..c40b72babc 100644 --- a/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py +++ b/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py @@ -184,7 +184,7 @@ test_records = [ "charge_type": "Actual", "description": "Shipping Charges", "doctype": "Purchase Taxes and Charges", - "parentfield": "purchase_tax_details", + "parentfield": "other_charges", "rate": 100.0, "tax_amount": 100.0, }, @@ -195,7 +195,7 @@ test_records = [ "charge_type": "Actual", "description": "VAT", "doctype": "Purchase Taxes and Charges", - "parentfield": "purchase_tax_details", + "parentfield": "other_charges", "rate": 120.0, "tax_amount": 120.0, }, @@ -206,7 +206,7 @@ test_records = [ "charge_type": "Actual", "description": "Customs Duty", "doctype": "Purchase Taxes and Charges", - "parentfield": "purchase_tax_details", + "parentfield": "other_charges", "rate": 150.0, "tax_amount": 150.0, }, diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.js b/erpnext/stock/doctype/stock_entry/stock_entry.js index 6bd9564845..52436ee829 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.js +++ b/erpnext/stock/doctype/stock_entry/stock_entry.js @@ -7,7 +7,7 @@ cur_frm.cscript.fname = "mtn_details"; wn.require("assets/erpnext/js/controllers/stock_controller.js"); wn.provide("erpnext.stock"); -erpnext.stock.StockEntry = erpnext.stock.StockController.extend({ +erpnext.stock.StockEntry = erpnext.stock.StockController.extend({ setup: function() { var me = this; @@ -54,11 +54,11 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({ } } }, - + onload_post_render: function() { this.set_default_account(); }, - + refresh: function() { var me = this; erpnext.hide_naming_series(); @@ -79,11 +79,11 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({ } }, - + on_submit: function() { this.clean_up(); }, - + after_cancel: function() { this.clean_up(); }, @@ -114,7 +114,7 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({ }); } }, - + clean_up: function() { // Clear Production Order record from locals, because it is updated via Stock Entry if(this.frm.doc.production_order && @@ -123,7 +123,7 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({ this.frm.doc.production_order); } }, - + get_items: function() { if(this.frm.doc.production_order || this.frm.doc.bom_no) { // if production order / bom is mentioned, get items @@ -136,13 +136,13 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({ }); } }, - + qty: function(doc, cdt, cdn) { var d = locals[cdt][cdn]; d.transfer_qty = flt(d.qty) * flt(d.conversion_factor); refresh_field('mtn_details'); }, - + production_order: function() { var me = this; this.toggle_enable_bom(); @@ -158,11 +158,11 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({ } }); }, - + toggle_enable_bom: function() { this.frm.toggle_enable("bom_no", !this.frm.doc.production_order); }, - + get_doctype_docname: function() { if(this.frm.doc.purpose === "Sales Return") { if(this.frm.doc.delivery_note_no && this.frm.doc.sales_invoice_no) { @@ -191,7 +191,7 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({ } } }, - + add_excise_button: function() { if(wn.boot.control_panel.country === "India") this.frm.add_custom_button(wn._("Make Excise Invoice"), function() { @@ -201,7 +201,7 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({ loaddoc('Journal Voucher', excise.name); }); }, - + make_return_jv: function() { if(this.get_doctype_docname()) { return this.frm.call({ @@ -233,7 +233,7 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({ if(!row.s_warehouse) row.s_warehouse = this.frm.doc.from_warehouse; if(!row.t_warehouse) row.t_warehouse = this.frm.doc.to_warehouse; }, - + mtn_details_on_form_rendered: function(doc, grid_row) { erpnext.setup_serial_no(grid_row) } @@ -288,12 +288,11 @@ cur_frm.cscript.purchase_receipt_no = function(doc, cdt, cdn) { cur_frm.cscript.supplier = function(doc, cdt, cdn) { if(doc.supplier) return get_server_fields('get_supp_addr', '', '', doc, cdt, cdn, 1); - } cur_frm.fields_dict['production_order'].get_query = function(doc) { - return{ - filters:[ + return { + filters: [ ['Production Order', 'docstatus', '=', 1], ['Production Order', 'qty', '>','`tabProduction Order`.produced_qty'] ] @@ -306,7 +305,7 @@ cur_frm.cscript.purpose = function(doc, cdt, cdn) { // Overloaded query for link batch_no cur_frm.fields_dict['mtn_details'].grid.get_field('batch_no').get_query = function(doc, cdt, cdn) { - var d = locals[cdt][cdn]; + var d = locals[cdt][cdn]; if(d.item_code) { return{ query: "erpnext.stock.doctype.stock_entry.stock_entry.get_batch_no", @@ -371,7 +370,7 @@ cur_frm.cscript.validate = function(doc, cdt, cdn) { cur_frm.cscript.validate_items = function(doc) { cl = getchildren('Stock Entry Detail', doc.name, 'mtn_details'); if (!cl.length) { - alert(wn._("Item table can not be blank")); + msgprint(wn._("Item table can not be blank")); validated = false; } } @@ -385,9 +384,9 @@ cur_frm.cscript.cost_center = function(doc, cdt, cdn) { } cur_frm.fields_dict.customer.get_query = function(doc, cdt, cdn) { - return{ query: "erpnext.controllers.queries.customer_query" } + return { query: "erpnext.controllers.queries.customer_query" } } cur_frm.fields_dict.supplier.get_query = function(doc, cdt, cdn) { - return{ query: "erpnext.controllers.queries.supplier_query" } -} + return { query: "erpnext.controllers.queries.supplier_query" } +} \ No newline at end of file diff --git a/erpnext/stock/doctype/stock_entry/test_stock_entry.py b/erpnext/stock/doctype/stock_entry/test_stock_entry.py index 1d7c2e444d..1691349376 100644 --- a/erpnext/stock/doctype/stock_entry/test_stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/test_stock_entry.py @@ -481,7 +481,7 @@ class TestStockEntry(unittest.TestCase): d.expense_head = "_Test Account Cost for Goods Sold - _TC" d.cost_center = "_Test Cost Center - _TC" - for d in pi.doclist.get({"parentfield": "purchase_tax_details"}): + for d in pi.doclist.get({"parentfield": "other_charges"}): d.cost_center = "_Test Cost Center - _TC" pi.run_method("calculate_taxes_and_totals") @@ -583,7 +583,7 @@ class TestStockEntry(unittest.TestCase): for d in pi.doclist.get({"parentfield": "entries"}): d.expense_head = "_Test Account Cost for Goods Sold - _TC" d.cost_center = "_Test Cost Center - _TC" - for d in pi.doclist.get({"parentfield": "purchase_tax_details"}): + for d in pi.doclist.get({"parentfield": "other_charges"}): d.cost_center = "_Test Cost Center - _TC" pi.run_method("calculate_taxes_and_totals") diff --git a/erpnext/utilities/transaction_base.py b/erpnext/utilities/transaction_base.py index a1ff0f8474..0b4b9032eb 100644 --- a/erpnext/utilities/transaction_base.py +++ b/erpnext/utilities/transaction_base.py @@ -115,7 +115,7 @@ class TransactionBase(StatusUpdater): sales_person.update({ "doctype": "Sales Team", "parentfield": "sales_team", - "idx": i+1 + "idx": i + 1 }) # add child @@ -138,11 +138,15 @@ class TransactionBase(StatusUpdater): supplier.default_price_list or self.doc.buying_price_list return out - + def set_supplier_defaults(self): 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") From b665d862925d025b7e15a4a43b84e8e41f284a59 Mon Sep 17 00:00:00 2001 From: Akhilesh Darjee Date: Wed, 29 Jan 2014 17:40:34 +0530 Subject: [PATCH 4/5] patch to reload all sales and purchase doctypes and print formats --- .../purchase_common/purchase_common.js | 2 +- erpnext/patches.txt | 22 ++++------------- ...eload_purchase_doctype_and_print_format.py | 14 +++++++++++ .../reload_sales_doctype_and_print_format.py | 24 +++++++++++++++++++ erpnext/selling/sales_common.js | 2 +- .../Purchase Receipt Format.txt | 20 ---------------- 6 files changed, 45 insertions(+), 39 deletions(-) create mode 100644 erpnext/patches/4_0/reload_purchase_doctype_and_print_format.py create mode 100644 erpnext/patches/4_0/reload_sales_doctype_and_print_format.py delete mode 100644 erpnext/stock/Print Format/Purchase Receipt Format/Purchase Receipt Format.txt diff --git a/erpnext/buying/doctype/purchase_common/purchase_common.js b/erpnext/buying/doctype/purchase_common/purchase_common.js index 6739e1ea46..039165f891 100644 --- a/erpnext/buying/doctype/purchase_common/purchase_common.js +++ b/erpnext/buying/doctype/purchase_common/purchase_common.js @@ -478,4 +478,4 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({ }); var tname = cur_frm.cscript.tname; -var fname = cur_frm.cscript.fname; +var fname = cur_frm.cscript.fname; \ No newline at end of file diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 79644a854e..9843f870ba 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -3,20 +3,8 @@ 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 -execute:webnotes.reload_doc('accounts', 'doctype', 'sales_invoice') # 2014-01-03 -execute:webnotes.reload_doc('selling', 'doctype', 'sales_order') # 2014-01-03 -execute:webnotes.reload_doc('selling', 'doctype', 'quotation') # 2014-01-03 -execute:webnotes.reload_doc('stock', 'doctype', 'delivery_note') # 2014-01-03 -execute:webnotes.reload_doc('accounts', 'Print Format', 'POS Invoice') # 2014-01-03 -execute:webnotes.reload_doc('accounts', 'Print Format', 'Sales Invoice Classic') # 2014-01-03 -execute:webnotes.reload_doc('accounts', 'Print Format', 'Sales Invoice Modern') # 2014-01-03 -execute:webnotes.reload_doc('accounts', 'Print Format', 'Sales Invoice Spartan') # 2014-01-03 -execute:webnotes.reload_doc('selling', 'Print Format', 'Quotation Classic') # 2014-01-03 -execute:webnotes.reload_doc('selling', 'Print Format', 'Quotation Modern') # 2014-01-03 -execute:webnotes.reload_doc('selling', 'Print Format', 'Quotation Spartan') # 2014-01-03 -execute:webnotes.reload_doc('selling', 'Print Format', 'Sales Order Classic') # 2014-01-03 -execute:webnotes.reload_doc('selling', 'Print Format', 'Sales Order Modern') # 2014-01-03 -execute:webnotes.reload_doc('selling', 'Print Format', 'Sales Order Spartan') # 2014-01-03 -execute:webnotes.reload_doc('stock', 'Print Format', 'Delivery Note Classic') # 2014-01-03 -execute:webnotes.reload_doc('stock', 'Print Format', 'Delivery Note Modern') # 2014-01-03 -execute:webnotes.reload_doc('stock', 'Print Format', 'Delivery Note Spartan') # 2014-01-03 \ No newline at end of file +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', '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 diff --git a/erpnext/patches/4_0/reload_purchase_doctype_and_print_format.py b/erpnext/patches/4_0/reload_purchase_doctype_and_print_format.py new file mode 100644 index 0000000000..96d4fc6545 --- /dev/null +++ b/erpnext/patches/4_0/reload_purchase_doctype_and_print_format.py @@ -0,0 +1,14 @@ +# 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(): + 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_doctype_and_print_format.py new file mode 100644 index 0000000000..a435be39f3 --- /dev/null +++ b/erpnext/patches/4_0/reload_sales_doctype_and_print_format.py @@ -0,0 +1,24 @@ +# 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(): + 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') + webnotes.reload_doc('accounts', 'Print Format', 'Sales Invoice Spartan') + webnotes.reload_doc('selling', 'Print Format', 'Quotation Classic') + webnotes.reload_doc('selling', 'Print Format', 'Quotation Modern') + webnotes.reload_doc('selling', 'Print Format', 'Quotation Spartan') + webnotes.reload_doc('selling', 'Print Format', 'Sales Order Classic') + webnotes.reload_doc('selling', 'Print Format', 'Sales Order Modern') + webnotes.reload_doc('selling', 'Print Format', 'Sales Order Spartan') + webnotes.reload_doc('stock', 'Print Format', 'Delivery Note Classic') + webnotes.reload_doc('stock', 'Print Format', 'Delivery Note Modern') + webnotes.reload_doc('stock', 'Print Format', 'Delivery Note Spartan') \ No newline at end of file diff --git a/erpnext/selling/sales_common.js b/erpnext/selling/sales_common.js index 53be7196cf..fe78ee78ce 100644 --- a/erpnext/selling/sales_common.js +++ b/erpnext/selling/sales_common.js @@ -670,4 +670,4 @@ var set_sales_bom_help = function(doc) { } } refresh_field('sales_bom_help'); -} +} \ No newline at end of file diff --git a/erpnext/stock/Print Format/Purchase Receipt Format/Purchase Receipt Format.txt b/erpnext/stock/Print Format/Purchase Receipt Format/Purchase Receipt Format.txt deleted file mode 100644 index d39583e90f..0000000000 --- a/erpnext/stock/Print Format/Purchase Receipt Format/Purchase Receipt Format.txt +++ /dev/null @@ -1,20 +0,0 @@ -[ - { - "owner": "Administrator", - "docstatus": 0, - "creation": "2010-08-08 17:09:34", - "modified_by": "Administrator", - "modified": "2011-10-19 14:18:26" - }, - { - "name": "__common__", - "module": "Stock", - "standard": "Yes", - "html": "\n\n\n\n\n\n
\n\n
\n
\n

Purchase Receipt:
\n
Date:
\n
\n\n
\n
\n

\n
\n\n
\n
\n \n\n
\n\n\n
\n\n \n \n
\n
\n
\n

Payment Terms
\n

\n

For NCSCI
\n


(Authorised Signatory)
\n
\n", - "doctype": "Print Format" - }, - { - "name": "Purchase Receipt Format", - "doctype": "Print Format" - } -] \ No newline at end of file From 4cdb79941b814124ce5a3870198d88c8b876968d Mon Sep 17 00:00:00 2001 From: Akhilesh Darjee Date: Thu, 30 Jan 2014 13:56:57 +0530 Subject: [PATCH 5/5] 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")