diff --git a/erpnext/accounts/doctype/c_form/c_form.py b/erpnext/accounts/doctype/c_form/c_form.py index c04e7c257d..a0a9dc1618 100644 --- a/erpnext/accounts/doctype/c_form/c_form.py +++ b/erpnext/accounts/doctype/c_form/c_form.py @@ -54,17 +54,17 @@ class CForm(Document): frappe.throw(_("Please enter atleast 1 invoice in the table")) def set_total_invoiced_amount(self): - total = sum([flt(d.grand_total) for d in self.get('invoices')]) + total = sum([flt(d.base_grand_total) for d in self.get('invoices')]) frappe.db.set(self, 'total_invoiced_amount', total) def get_invoice_details(self, invoice_no): """ Pull details from invoices for referrence """ if invoice_no: inv = frappe.db.get_value("Sales Invoice", invoice_no, - ["posting_date", "territory", "net_total", "grand_total"], as_dict=True) + ["posting_date", "territory", "base_net_total", "base_grand_total"], as_dict=True) return { 'invoice_date' : inv.posting_date, 'territory' : inv.territory, - 'net_total' : inv.net_total, - 'grand_total' : inv.grand_total + 'net_total' : inv.base_net_total, + 'grand_total' : inv.base_grand_total } diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.py b/erpnext/accounts/doctype/journal_entry/journal_entry.py index 9930d8d38b..79eeb709fc 100644 --- a/erpnext/accounts/doctype/journal_entry/journal_entry.py +++ b/erpnext/accounts/doctype/journal_entry/journal_entry.py @@ -220,7 +220,7 @@ class JournalEntry(AccountsController): def validate_against_order_fields(self, doctype, payment_against_voucher): for voucher_no, payment_list in payment_against_voucher.items(): voucher_properties = frappe.db.get_value(doctype, voucher_no, - ["docstatus", "per_billed", "status", "advance_paid", "grand_total"]) + ["docstatus", "per_billed", "status", "advance_paid", "base_grand_total"]) if voucher_properties[0] != 1: frappe.throw(_("{0} {1} is not submitted").format(doctype, voucher_no)) diff --git a/erpnext/accounts/doctype/mode_of_payment/mode_of_payment.js b/erpnext/accounts/doctype/mode_of_payment/mode_of_payment.js index ffd8ea7589..2b79e297b1 100644 --- a/erpnext/accounts/doctype/mode_of_payment/mode_of_payment.js +++ b/erpnext/accounts/doctype/mode_of_payment/mode_of_payment.js @@ -1,7 +1,7 @@ // Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors // License: GNU General Public License v3. See license.txt -cur_frm.set_query("default_account", "mode_of_payment_details", function(doc, cdt, cdn) { +cur_frm.set_query("default_account", "accounts", function(doc, cdt, cdn) { return{ filters: [ ['Account', 'account_type', 'in', 'Bank, Cash'], @@ -9,4 +9,4 @@ cur_frm.set_query("default_account", "mode_of_payment_details", function(doc, cd ['Account', 'company', '=', doc.company] ] } -}); \ No newline at end of file +}); diff --git a/erpnext/accounts/doctype/payment_tool/payment_tool.py b/erpnext/accounts/doctype/payment_tool/payment_tool.py index 9a8df4dfaf..3ff3dc9578 100644 --- a/erpnext/accounts/doctype/payment_tool/payment_tool.py +++ b/erpnext/accounts/doctype/payment_tool/payment_tool.py @@ -82,8 +82,8 @@ def get_orders_to_be_billed(party_type, party): orders = frappe.db.sql(""" select name as voucher_no, - ifnull(grand_total, 0) as invoice_amount, - (ifnull(grand_total, 0) - ifnull(advance_paid, 0)) as outstanding_amount, + ifnull(base_grand_total, 0) as invoice_amount, + (ifnull(base_grand_total, 0) - ifnull(advance_paid, 0)) as outstanding_amount, transaction_date as posting_date from `tab%s` @@ -91,7 +91,7 @@ def get_orders_to_be_billed(party_type, party): %s = %s and docstatus = 1 and ifnull(status, "") != "Stopped" - and ifnull(grand_total, 0) > ifnull(advance_paid, 0) + and ifnull(base_grand_total, 0) > ifnull(advance_paid, 0) and abs(100 - ifnull(per_billed, 0)) > 0.01 """ % (voucher_type, 'customer' if party_type == "Customer" else 'supplier', '%s'), party, as_dict = True) @@ -106,9 +106,9 @@ def get_orders_to_be_billed(party_type, party): @frappe.whitelist() def get_against_voucher_amount(against_voucher_type, against_voucher_no): if against_voucher_type in ["Sales Order", "Purchase Order"]: - select_cond = "grand_total as total_amount, ifnull(grand_total, 0) - ifnull(advance_paid, 0) as outstanding_amount" + select_cond = "base_grand_total as total_amount, ifnull(base_grand_total, 0) - ifnull(advance_paid, 0) as outstanding_amount" elif against_voucher_type in ["Sales Invoice", "Purchase Invoice"]: - select_cond = "grand_total as total_amount, outstanding_amount" + select_cond = "base_grand_total as total_amount, outstanding_amount" elif against_voucher_type == "Journal Entry": select_cond = "total_debit as total_amount" diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json index 98a1a69bde..6c32971f74 100755 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json @@ -978,7 +978,7 @@ } ], "read_only_onload": 1, - "search_fields": "posting_date, supplier, fiscal_year, bill_no, grand_total, outstanding_amount", + "search_fields": "posting_date, supplier, fiscal_year, bill_no, base_grand_total, outstanding_amount", "sort_field": "modified", "sort_order": "DESC", "title_field": "supplier_name" diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py index 9b0b8b1d55..4e0570f9b9 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py @@ -240,7 +240,7 @@ class PurchaseInvoice(BuyingController): self.check_prev_docstatus() frappe.get_doc('Authorization Control').validate_approving_authority(self.doctype, - self.company, self.grand_total) + self.company, self.base_grand_total) # this sequence because outstanding may get -negative self.make_gl_entries() @@ -258,7 +258,7 @@ class PurchaseInvoice(BuyingController): gl_entries = [] # parent's gl entry - if self.grand_total: + if self.base_grand_total: gl_entries.append( self.get_gl_dict({ "account": self.credit_to, diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice_list.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice_list.js index 82112d1de3..1c43b7e38b 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice_list.js +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice_list.js @@ -3,7 +3,7 @@ // render frappe.listview_settings['Purchase Invoice'] = { - add_fields: ["supplier", "supplier_name", "grand_total", "outstanding_amount", "due_date", "company", + add_fields: ["supplier", "supplier_name", "base_grand_total", "outstanding_amount", "due_date", "company", "currency"], get_indicator: function(doc) { if(doc.outstanding_amount > 0 && doc.docstatus==1) { diff --git a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py index ffb9ad028f..49011b00fc 100644 --- a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py @@ -145,7 +145,7 @@ class TestPurchaseInvoice(unittest.TestCase): self.assertEqual(item.item_tax_amount, expected_values[i][1]) self.assertEqual(item.valuation_rate, expected_values[i][2]) - self.assertEqual(wrapper.net_total, 1250) + self.assertEqual(wrapper.base_net_total, 1250) # tax amounts expected_values = [ @@ -179,7 +179,7 @@ class TestPurchaseInvoice(unittest.TestCase): self.assertEqual(item.item_tax_amount, expected_values[i][1]) self.assertEqual(item.valuation_rate, expected_values[i][2]) - self.assertEqual(wrapper.net_total, 1250) + self.assertEqual(wrapper.base_net_total, 1250) # tax amounts expected_values = [ diff --git a/erpnext/accounts/doctype/purchase_invoice/test_records.json b/erpnext/accounts/doctype/purchase_invoice/test_records.json index dd5daea276..9139e0c542 100644 --- a/erpnext/accounts/doctype/purchase_invoice/test_records.json +++ b/erpnext/accounts/doctype/purchase_invoice/test_records.json @@ -41,7 +41,7 @@ } ], "fiscal_year": "_Test Fiscal Year 2013", - "grand_total_import": 0, + "grand_total": 0, "naming_series": "_T-BILL", "taxes": [ { @@ -164,7 +164,7 @@ } ], "fiscal_year": "_Test Fiscal Year 2013", - "grand_total_import": 0, + "grand_total": 0, "naming_series": "_T-Purchase Invoice-", "taxes": [ { 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 b0988b21d9..4f91c56a48 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 @@ -8,15 +8,15 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) { } // For customizing print -cur_frm.pformat.net_total_import = function(doc) { +cur_frm.pformat.net_total = function(doc) { return ''; } -cur_frm.pformat.grand_total_import = function(doc) { +cur_frm.pformat.grand_total = function(doc) { return ''; } -cur_frm.pformat.in_words_import = function(doc) { +cur_frm.pformat.in_words = function(doc) { return ''; } @@ -49,8 +49,8 @@ cur_frm.pformat.taxes= function(doc) { // main table out +=''; - if(!print_hide('net_total_import')) - out += make_row('Net Total', doc.net_total_import, 1); + if(!print_hide('net_total')) + out += make_row('Net Total', doc.net_total, 1); // add rows if(cl.length){ @@ -60,14 +60,14 @@ cur_frm.pformat.taxes= function(doc) { } // grand total - if(!print_hide('grand_total_import')) - out += make_row('Grand Total', doc.grand_total_import, 1); + if(!print_hide('grand_total')) + out += make_row('Grand Total', doc.grand_total, 1); - if(doc.in_words_import && !print_hide('in_words_import')) { + if(doc.in_words && !print_hide('in_words')) { out += '
'; out += ''; out += ''; - out += ''; + out += ''; } out +='
In Words' + doc.in_words_import + '
' + doc.in_words + '
'; diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js index 5a1e258668..820e42da64 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js @@ -54,7 +54,7 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte frappe.set_route("query-report", "General Ledger"); }, "icon-table"); - // var percent_paid = cint(flt(doc.grand_total - doc.outstanding_amount) / flt(doc.grand_total) * 100); + // var percent_paid = cint(flt(doc.base_grand_total - doc.outstanding_amount) / flt(doc.base_grand_total) * 100); // cur_frm.dashboard.add_progress(percent_paid + "% Paid", percent_paid); cur_frm.add_custom_button(__('Send SMS'), cur_frm.cscript.send_sms, 'icon-mobile-phone'); @@ -173,10 +173,10 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte write_off_outstanding_amount_automatically: function() { if(cint(this.frm.doc.write_off_outstanding_amount_automatically)) { - frappe.model.round_floats_in(this.frm.doc, ["grand_total", "paid_amount"]); + frappe.model.round_floats_in(this.frm.doc, ["base_grand_total", "paid_amount"]); // this will make outstanding amount 0 this.frm.set_value("write_off_amount", - flt(this.frm.doc.grand_total - this.frm.doc.paid_amount, precision("write_off_amount")) + flt(this.frm.doc.base_grand_total - this.frm.doc.paid_amount, precision("write_off_amount")) ); } diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json index 1fbc77208d..8e796039c2 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json @@ -1258,7 +1258,7 @@ } ], "read_only_onload": 1, - "search_fields": "posting_date, due_date, customer, fiscal_year, grand_total, outstanding_amount", + "search_fields": "posting_date, due_date, customer, fiscal_year, base_grand_total, outstanding_amount", "sort_field": "modified", "sort_order": "DESC", "title_field": "customer_name" diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index 132304f690..4e46fde7a8 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -77,7 +77,7 @@ class SalesInvoice(SellingController): # Check for Approving Authority if not self.recurring_id: frappe.get_doc('Authorization Control').validate_approving_authority(self.doctype, - self.company, self.grand_total, self) + self.company, self.base_grand_total, self) self.check_prev_docstatus() @@ -329,7 +329,7 @@ class SalesInvoice(SellingController): frappe.throw(_("Cash or Bank Account is mandatory for making payment entry")) if flt(self.paid_amount) + flt(self.write_off_amount) \ - - flt(self.grand_total) > 1/(10**(self.precision("grand_total") + 1)): + - flt(self.base_grand_total) > 1/(10**(self.precision("base_grand_total") + 1)): frappe.throw(_("""Paid amount + Write Off Amount can not be greater than Grand Total""")) @@ -410,7 +410,7 @@ class SalesInvoice(SellingController): if flt(self.paid_amount) == 0: if self.cash_bank_account: frappe.db.set(self, 'paid_amount', - (flt(self.grand_total) - flt(self.write_off_amount))) + (flt(self.base_grand_total) - flt(self.write_off_amount))) else: # show message that the amount is not paid frappe.db.set(self,'paid_amount',0) @@ -483,14 +483,14 @@ class SalesInvoice(SellingController): return gl_entries def make_customer_gl_entry(self, gl_entries): - if self.grand_total: + if self.base_grand_total: gl_entries.append( self.get_gl_dict({ "account": self.debit_to, "party_type": "Customer", "party": self.customer, "against": self.against_income_account, - "debit": self.grand_total, + "debit": self.base_grand_total, "remarks": self.remarks, "against_voucher": self.name, "against_voucher_type": self.doctype, diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice_list.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice_list.js index 46b720111b..01dcc0e372 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice_list.js +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice_list.js @@ -3,7 +3,7 @@ // render frappe.listview_settings['Sales Invoice'] = { - add_fields: ["customer", "customer_name", "grand_total", "outstanding_amount", "due_date", "company", + add_fields: ["customer", "customer_name", "base_grand_total", "outstanding_amount", "due_date", "company", "currency"], get_indicator: function(doc) { if(doc.outstanding_amount==0) { @@ -14,5 +14,5 @@ frappe.listview_settings['Sales Invoice'] = { return [__("Overdue"), "red", "outstanding_amount,>,0|due_date,<=,Today"] } }, - right_column: "grand_total_export" + right_column: "grand_total" }; diff --git a/erpnext/accounts/doctype/sales_invoice/test_records.json b/erpnext/accounts/doctype/sales_invoice/test_records.json index abc360badc..dc69339d9d 100644 --- a/erpnext/accounts/doctype/sales_invoice/test_records.json +++ b/erpnext/accounts/doctype/sales_invoice/test_records.json @@ -25,11 +25,11 @@ } ], "fiscal_year": "_Test Fiscal Year 2013", + "base_grand_total": 561.8, "grand_total": 561.8, - "grand_total_export": 561.8, "is_pos": 0, "naming_series": "_T-Sales Invoice-", - "net_total": 500.0, + "base_net_total": 500.0, "taxes": [ { "account_head": "_Test Account VAT - _TC", @@ -95,11 +95,11 @@ } ], "fiscal_year": "_Test Fiscal Year 2013", + "base_grand_total": 630.0, "grand_total": 630.0, - "grand_total_export": 630.0, "is_pos": 0, "naming_series": "_T-Sales Invoice-", - "net_total": 500.0, + "base_net_total": 500.0, "taxes": [ { "account_head": "_Test Account VAT - _TC", @@ -163,7 +163,7 @@ } ], "fiscal_year": "_Test Fiscal Year 2013", - "grand_total_export": 0, + "grand_total": 0, "is_pos": 0, "naming_series": "_T-Sales Invoice-", "taxes": [ @@ -287,7 +287,7 @@ } ], "fiscal_year": "_Test Fiscal Year 2013", - "grand_total_export": 0, + "grand_total": 0, "is_pos": 0, "naming_series": "_T-Sales Invoice-", "taxes": [ diff --git a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py index a0c2fb6564..a8e92c9e49 100644 --- a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py @@ -53,8 +53,8 @@ class TestSalesInvoice(unittest.TestCase): self.assertEquals(d.get(k), expected_values[d.item_code][i]) # check net total + self.assertEquals(si.base_net_total, 1250) self.assertEquals(si.net_total, 1250) - self.assertEquals(si.net_total_export, 1250) # check tax calculation expected_values = { @@ -73,8 +73,8 @@ class TestSalesInvoice(unittest.TestCase): for i, k in enumerate(expected_values["keys"]): self.assertEquals(d.get(k), expected_values[d.account_head][i]) + self.assertEquals(si.base_grand_total, 1627.05) self.assertEquals(si.grand_total, 1627.05) - self.assertEquals(si.grand_total_export, 1627.05) def test_sales_invoice_calculation_export_currency(self): si = frappe.copy_doc(test_records[2]) @@ -103,8 +103,8 @@ class TestSalesInvoice(unittest.TestCase): self.assertEquals(d.get(k), expected_values[d.item_code][i]) # check net total - self.assertEquals(si.net_total, 1250) - self.assertEquals(si.net_total_export, 25) + self.assertEquals(si.base_net_total, 1250) + self.assertEquals(si.net_total, 25) # check tax calculation expected_values = { @@ -123,8 +123,8 @@ class TestSalesInvoice(unittest.TestCase): for i, k in enumerate(expected_values["keys"]): self.assertEquals(d.get(k), expected_values[d.account_head][i]) - self.assertEquals(si.grand_total, 1627.05) - self.assertEquals(si.grand_total_export, 32.54) + self.assertEquals(si.base_grand_total, 1627.05) + self.assertEquals(si.grand_total, 32.54) def test_sales_invoice_discount_amount(self): si = frappe.copy_doc(test_records[3]) @@ -157,8 +157,8 @@ class TestSalesInvoice(unittest.TestCase): self.assertEquals(d.get(k), expected_values[d.item_code][i]) # check net total - self.assertEquals(si.net_total, 1163.45) - self.assertEquals(si.net_total_export, 1578.3) + self.assertEquals(si.base_net_total, 1163.45) + self.assertEquals(si.net_total, 1578.3) # check tax calculation expected_values = { @@ -178,8 +178,8 @@ class TestSalesInvoice(unittest.TestCase): for i, k in enumerate(expected_values["keys"]): self.assertEquals(d.get(k), expected_values[d.account_head][i]) + self.assertEquals(si.base_grand_total, 1500) self.assertEquals(si.grand_total, 1500) - self.assertEquals(si.grand_total_export, 1500) def test_discount_amount_gl_entry(self): si = frappe.copy_doc(test_records[3]) @@ -268,8 +268,8 @@ class TestSalesInvoice(unittest.TestCase): self.assertEquals(d.get(k), expected_values[d.item_code][i]) # check net total - self.assertEquals(si.net_total, 1249.98) - self.assertEquals(si.net_total_export, 1578.3) + self.assertEquals(si.base_net_total, 1249.98) + self.assertEquals(si.net_total, 1578.3) # check tax calculation expected_values = { @@ -288,8 +288,8 @@ class TestSalesInvoice(unittest.TestCase): for i, k in enumerate(expected_values["keys"]): self.assertEquals(d.get(k), expected_values[d.account_head][i]) + self.assertEquals(si.base_grand_total, 1622.98) self.assertEquals(si.grand_total, 1622.98) - self.assertEquals(si.grand_total_export, 1622.98) def test_sales_invoice_calculation_export_currency_with_tax_inclusive_price(self): # prepare @@ -320,8 +320,8 @@ class TestSalesInvoice(unittest.TestCase): self.assertEquals(d.get(k), expected_values[d.item_code][i]) # check net total - self.assertEquals(si.net_total, 49501.7) - self.assertEquals(si.net_total_export, 1250) + self.assertEquals(si.base_net_total, 49501.7) + self.assertEquals(si.net_total, 1250) # check tax calculation expected_values = { @@ -340,12 +340,12 @@ class TestSalesInvoice(unittest.TestCase): for i, k in enumerate(expected_values["keys"]): self.assertEquals(d.get(k), expected_values[d.account_head][i]) - self.assertEquals(si.grand_total, 65205.16) - self.assertEquals(si.grand_total_export, 1304.1) + self.assertEquals(si.base_grand_total, 65205.16) + self.assertEquals(si.grand_total, 1304.1) def test_outstanding(self): w = self.make() - self.assertEquals(w.outstanding_amount, w.grand_total) + self.assertEquals(w.outstanding_amount, w.base_grand_total) def test_payment(self): frappe.db.sql("""delete from `tabGL Entry`""") 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 ae77fe80af..af744e9f8e 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 @@ -13,7 +13,7 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) { } // For customizing print -cur_frm.pformat.net_total_export = function(doc) { +cur_frm.pformat.net_total = function(doc) { return ''; } @@ -21,15 +21,15 @@ cur_frm.pformat.discount_amount = function(doc) { return ''; } -cur_frm.pformat.grand_total_export = function(doc) { +cur_frm.pformat.grand_total = function(doc) { return ''; } -cur_frm.pformat.rounded_total_export = function(doc) { +cur_frm.pformat.rounded_total = function(doc) { return ''; } -cur_frm.pformat.in_words_export = function(doc) { +cur_frm.pformat.in_words = function(doc) { return ''; } @@ -63,8 +63,8 @@ cur_frm.pformat.taxes= function(doc){ out +=''; - if(!print_hide('net_total_export')) { - out += make_row('Net Total', doc.net_total_export, 1); + if(!print_hide('net_total')) { + out += make_row('Net Total', doc.net_total, 1); } // add rows @@ -80,17 +80,17 @@ cur_frm.pformat.taxes= function(doc){ out += make_row('Discount Amount', doc.discount_amount, 0); // grand total - if(!print_hide('grand_total_export')) - out += make_row('Grand Total', doc.grand_total_export, 1); + if(!print_hide('grand_total')) + out += make_row('Grand Total', doc.grand_total, 1); - if(!print_hide('rounded_total_export')) - out += make_row('Rounded Total', doc.rounded_total_export, 1); + if(!print_hide('rounded_total')) + out += make_row('Rounded Total', doc.rounded_total, 1); - if(doc.in_words_export && !print_hide('in_words_export')) { + if(doc.in_words && !print_hide('in_words')) { out +='
'; out += ''; out += ''; - out += ''; + out += ''; } out += '
In Words' + doc.in_words_export + '
' + doc.in_words + '
'; } diff --git a/erpnext/accounts/print_format/pos_invoice/pos_invoice.json b/erpnext/accounts/print_format/pos_invoice/pos_invoice.json index fcda5135e1..997eb84429 100644 --- a/erpnext/accounts/print_format/pos_invoice/pos_invoice.json +++ b/erpnext/accounts/print_format/pos_invoice/pos_invoice.json @@ -3,9 +3,9 @@ "doc_type": "Sales Invoice", "docstatus": 0, "doctype": "Print Format", - "html": "\n\n

\n\t{{ doc.company }}
\n\t{{ doc.select_print_heading or _(\"Invoice\") }}
\n

\n

\n\t{{ _(\"Receipt No\") }}: {{ doc.name }}
\n\t{{ _(\"Date\") }}: {{ doc.get_formatted(\"posting_date\") }}
\n\t{{ _(\"Customer\") }}: {{ doc.customer_name }}\n

\n\n
\n\n\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\n\t\n\t\t{%- for item in doc.items -%}\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t{%- endfor -%}\n\t\n
{{ _(\"Item\") }}{{ _(\"Qty\") }}{{ _(\"Rate\") }}
\n\t\t\t\t{{ item.item_code }}\n\t\t\t\t{%- if item.item_name != item.item_code -%}\n\t\t\t\t\t
{{ item.item_name }}{%- endif -%}\n\t\t\t
{{ item.qty }}{{ item.amount }}
\n\n\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t{%- for row in doc.taxes -%}\n\t\t{%- if not row.included_in_print_rate -%}\n\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t{%- endif -%}\n\t\t{%- endfor -%}\n\t\t{%- if doc.discount_amount -%}\n\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t{%- endif -%}\n\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\n
\n\t\t\t\t{{ _(\"Net Total\") }}\n\t\t\t\n\t\t\t\t{{ doc.get_formatted(\"net_total_export\") }}\n\t\t\t
\n\t\t\t\t{{ row.description }}\n\t\t\t\n\t\t\t\t{{ row.get_formatted(\"tax_amount\", doc) }}\n\t\t\t
\n\t\t\t\t{{ _(\"Discount\") }}\n\t\t\t\n\t\t\t\t{{ doc.get_formatted(\"discount_amount\") }}\n\t\t\t
\n\t\t\t\t{{ _(\"Grand Total\") }}\n\t\t\t\n\t\t\t\t{{ doc.get_formatted(\"grand_total_export\") }}\n\t\t\t
\n{% if doc.get(\"taxes\", filters={\"included_in_print_rate\": 1}) %}\n
\n

Taxes Included:

\n\n\t\n\t\t{%- for row in doc.taxes -%}\n\t\t{%- if row.included_in_print_rate -%}\n\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t{%- endif -%}\n\t\t{%- endfor -%}\n\t\n
\n\t\t\t\t{{ row.description }}\n\t\t\t\n\t\t\t\t{{ row.get_formatted(\"tax_amount_after_discount_amount\", doc) }}\n\t\t\t
\n{%- endif -%}\n
\n

{{ doc.terms or \"\" }}

\n

{{ _(\"Thank you, please visit again.\") }}

", + "html": "\n\n

\n\t{{ doc.company }}
\n\t{{ doc.select_print_heading or _(\"Invoice\") }}
\n

\n

\n\t{{ _(\"Receipt No\") }}: {{ doc.name }}
\n\t{{ _(\"Date\") }}: {{ doc.get_formatted(\"posting_date\") }}
\n\t{{ _(\"Customer\") }}: {{ doc.customer_name }}\n

\n\n
\n\n\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\n\t\n\t\t{%- for item in doc.items -%}\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t{%- endfor -%}\n\t\n
{{ _(\"Item\") }}{{ _(\"Qty\") }}{{ _(\"Rate\") }}
\n\t\t\t\t{{ item.item_code }}\n\t\t\t\t{%- if item.item_name != item.item_code -%}\n\t\t\t\t\t
{{ item.item_name }}{%- endif -%}\n\t\t\t
{{ item.qty }}{{ item.amount }}
\n\n\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t{%- for row in doc.taxes -%}\n\t\t{%- if not row.included_in_print_rate -%}\n\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t{%- endif -%}\n\t\t{%- endfor -%}\n\t\t{%- if doc.discount_amount -%}\n\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t{%- endif -%}\n\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\n
\n\t\t\t\t{{ _(\"Net Total\") }}\n\t\t\t\n\t\t\t\t{{ doc.get_formatted(\"net_total\") }}\n\t\t\t
\n\t\t\t\t{{ row.description }}\n\t\t\t\n\t\t\t\t{{ row.get_formatted(\"tax_amount\", doc) }}\n\t\t\t
\n\t\t\t\t{{ _(\"Discount\") }}\n\t\t\t\n\t\t\t\t{{ doc.get_formatted(\"discount_amount\") }}\n\t\t\t
\n\t\t\t\t{{ _(\"Grand Total\") }}\n\t\t\t\n\t\t\t\t{{ doc.get_formatted(\"grand_total\") }}\n\t\t\t
\n{% if doc.get(\"taxes\", filters={\"included_in_print_rate\": 1}) %}\n
\n

Taxes Included:

\n\n\t\n\t\t{%- for row in doc.taxes -%}\n\t\t{%- if row.included_in_print_rate -%}\n\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t{%- endif -%}\n\t\t{%- endfor -%}\n\t\n
\n\t\t\t\t{{ row.description }}\n\t\t\t\n\t\t\t\t{{ row.get_formatted(\"tax_amount_after_discount_amount\", doc) }}\n\t\t\t
\n{%- endif -%}\n
\n

{{ doc.terms or \"\" }}

\n

{{ _(\"Thank you, please visit again.\") }}

", "idx": 1, - "modified": "2014-12-26 02:08:26.603223", + "modified": "2015-02-12 02:08:26.603223", "modified_by": "Administrator", "module": "Accounts", "name": "POS Invoice", diff --git a/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py b/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py index f0ca4c803c..dbfdee7c3d 100644 --- a/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py +++ b/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py @@ -68,7 +68,7 @@ def get_items(filters): match_conditions = frappe.build_match_conditions("Purchase Invoice") return frappe.db.sql("""select pi_item.parent, pi.posting_date, pi.credit_to, pi.company, - pi.supplier, pi.remarks, pi.net_total, pi_item.item_code, pi_item.item_name, pi_item.item_group, + pi.supplier, pi.remarks, pi.base_net_total, pi_item.item_code, pi_item.item_name, pi_item.item_group, pi_item.project_name, pi_item.purchase_order, pi_item.purchase_receipt, pi_item.po_detail pi_item.expense_account, pi_item.qty, pi_item.base_rate, pi_item.base_amount, pi.supplier_name from `tabPurchase Invoice` pi, `tabPurchase Invoice Item` pi_item @@ -107,7 +107,7 @@ def get_tax_accounts(item_list, columns): elif charge_type == "Actual" and tax_amount: for d in invoice_wise_items.get(parent, []): item_tax.setdefault(parent, {}).setdefault(d.item_code, {})[account_head] = \ - (tax_amount * d.base_amount) / d.net_total + (tax_amount * d.base_amount) / d.base_net_total tax_accounts.sort() columns += [account_head + ":Currency:80" for account_head in tax_accounts] diff --git a/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py b/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py index d79db0f15a..4907cbb71e 100644 --- a/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py +++ b/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py @@ -67,7 +67,7 @@ def get_conditions(filters): def get_items(filters): conditions = get_conditions(filters) return frappe.db.sql("""select si_item.parent, si.posting_date, si.debit_to, si.project_name, - si.customer, si.remarks, si.territory, si.company, si.net_total, si_item.item_code, si_item.item_name, + si.customer, si.remarks, si.territory, si.company, si.base_net_total, si_item.item_code, si_item.item_name, si_item.item_group, si_item.sales_order, si_item.delivery_note, si_item.income_account, si_item.qty, si_item.base_rate, si_item.base_amount, si.customer_name, si.customer_group, si_item.so_detail @@ -104,7 +104,7 @@ def get_tax_accounts(item_list, columns): elif charge_type == "Actual" and tax_amount: for d in invoice_wise_items.get(parent, []): item_tax.setdefault(parent, {}).setdefault(d.item_code, {})[account_head] = \ - flt((tax_amount * d.base_amount) / d.net_total) + flt((tax_amount * d.base_amount) / d.base_net_total) tax_accounts.sort() columns += [account_head + ":Currency:80" for account_head in tax_accounts] diff --git a/erpnext/accounts/report/purchase_register/purchase_register.py b/erpnext/accounts/report/purchase_register/purchase_register.py index 244a20cbfe..727a663bf9 100644 --- a/erpnext/accounts/report/purchase_register/purchase_register.py +++ b/erpnext/accounts/report/purchase_register/purchase_register.py @@ -35,14 +35,14 @@ def execute(filters=None): ", ".join(purchase_order), ", ".join(purchase_receipt)] # map expense values - net_total = 0 + base_net_total = 0 for expense_acc in expense_accounts: expense_amount = flt(invoice_expense_map.get(inv.name, {}).get(expense_acc)) - net_total += expense_amount + base_net_total += expense_amount row.append(expense_amount) # net total - row.append(net_total or inv.net_total) + row.append(base_net_total or inv.base_net_total) # tax account total_tax = 0 @@ -53,7 +53,7 @@ def execute(filters=None): row.append(tax_amount) # total tax, grand total, outstanding amount & rounded total - row += [total_tax, inv.grand_total, flt(inv.grand_total, 2), inv.outstanding_amount] + row += [total_tax, inv.base_grand_total, flt(inv.base_grand_total, 2), inv.outstanding_amount] data.append(row) # raise Exception @@ -108,7 +108,7 @@ def get_conditions(filters): def get_invoices(filters): conditions = get_conditions(filters) return frappe.db.sql("""select name, posting_date, credit_to, supplier, supplier_name - bill_no, bill_date, remarks, net_total, grand_total, outstanding_amount + bill_no, bill_date, remarks, base_net_total, base_grand_total, outstanding_amount from `tabPurchase Invoice` where docstatus = 1 %s order by posting_date desc, name desc""" % conditions, filters, as_dict=1) diff --git a/erpnext/accounts/report/sales_partners_commission/sales_partners_commission.json b/erpnext/accounts/report/sales_partners_commission/sales_partners_commission.json index 4ac7dbcf03..592e93dc0c 100644 --- a/erpnext/accounts/report/sales_partners_commission/sales_partners_commission.json +++ b/erpnext/accounts/report/sales_partners_commission/sales_partners_commission.json @@ -1,17 +1,17 @@ { - "apply_user_permissions": 1, - "creation": "2013-05-06 12:28:23", - "docstatus": 0, - "doctype": "Report", - "idx": 1, - "is_standard": "Yes", - "modified": "2014-06-03 07:18:17.302063", - "modified_by": "Administrator", - "module": "Accounts", - "name": "Sales Partners Commission", - "owner": "Administrator", - "query": "SELECT\n sales_partner as \"Sales Partner:Link/Sales Partner:150\",\n\tsum(net_total) as \"Invoiced Amount (Exculsive Tax):Currency:210\",\n\tsum(total_commission) as \"Total Commission:Currency:150\",\n\tsum(total_commission)*100/sum(net_total) as \"Average Commission Rate:Currency:170\"\nFROM\n\t`tabSales Invoice`\nWHERE\n\tdocstatus = 1 and ifnull(net_total, 0) > 0 and ifnull(total_commission, 0) > 0\nGROUP BY\n\tsales_partner\nORDER BY\n\t\"Total Commission:Currency:120\"", - "ref_doctype": "Sales Invoice", - "report_name": "Sales Partners Commission", + "apply_user_permissions": 1, + "creation": "2013-05-06 12:28:23", + "docstatus": 0, + "doctype": "Report", + "idx": 1, + "is_standard": "Yes", + "modified": "2015-02-12 07:18:17.302063", + "modified_by": "Administrator", + "module": "Accounts", + "name": "Sales Partners Commission", + "owner": "Administrator", + "query": "SELECT\n sales_partner as \"Sales Partner:Link/Sales Partner:150\",\n\tsum(base_net_total) as \"Invoiced Amount (Exculsive Tax):Currency:210\",\n\tsum(total_commission) as \"Total Commission:Currency:150\",\n\tsum(total_commission)*100/sum(base_net_total) as \"Average Commission Rate:Currency:170\"\nFROM\n\t`tabSales Invoice`\nWHERE\n\tdocstatus = 1 and ifnull(base_net_total, 0) > 0 and ifnull(total_commission, 0) > 0\nGROUP BY\n\tsales_partner\nORDER BY\n\t\"Total Commission:Currency:120\"", + "ref_doctype": "Sales Invoice", + "report_name": "Sales Partners Commission", "report_type": "Query Report" -} \ No newline at end of file +} diff --git a/erpnext/accounts/report/sales_register/sales_register.py b/erpnext/accounts/report/sales_register/sales_register.py index 01e7bad47f..bdce7bd1b0 100644 --- a/erpnext/accounts/report/sales_register/sales_register.py +++ b/erpnext/accounts/report/sales_register/sales_register.py @@ -34,14 +34,14 @@ def execute(filters=None): inv.debit_to, inv.project_name, inv.remarks, ", ".join(sales_order), ", ".join(delivery_note)] # map income values - net_total = 0 + base_net_total = 0 for income_acc in income_accounts: income_amount = flt(invoice_income_map.get(inv.name, {}).get(income_acc)) - net_total += income_amount + base_net_total += income_amount row.append(income_amount) # net total - row.append(net_total or inv.net_total) + row.append(base_net_total or inv.base_net_total) # tax account total_tax = 0 @@ -52,7 +52,7 @@ def execute(filters=None): row.append(tax_amount) # total tax, grand total, outstanding amount & rounded total - row += [total_tax, inv.grand_total, inv.rounded_total, inv.outstanding_amount] + row += [total_tax, inv.base_grand_total, inv.base_rounded_total, inv.outstanding_amount] data.append(row) @@ -107,7 +107,7 @@ def get_conditions(filters): def get_invoices(filters): conditions = get_conditions(filters) return frappe.db.sql("""select name, posting_date, debit_to, project_name, customer, - customer_name, remarks, net_total, grand_total, rounded_total, outstanding_amount + customer_name, remarks, base_net_total, base_grand_total, base_rounded_total, outstanding_amount from `tabSales Invoice` where docstatus = 1 %s order by posting_date desc, name desc""" % conditions, filters, as_dict=1) diff --git a/erpnext/buying/doctype/purchase_common/purchase_common.js b/erpnext/buying/doctype/purchase_common/purchase_common.js index ff1d4f5e6b..b553931db7 100644 --- a/erpnext/buying/doctype/purchase_common/purchase_common.js +++ b/erpnext/buying/doctype/purchase_common/purchase_common.js @@ -175,65 +175,65 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({ calculate_net_total: function() { var me = this; - this.frm.doc.net_total = this.frm.doc.net_total_import = 0.0; + this.frm.doc.base_net_total = this.frm.doc.net_total = 0.0; $.each(this.frm.doc["items"] || [], function(i, item) { - me.frm.doc.net_total += item.base_amount; - me.frm.doc.net_total_import += item.amount; + me.frm.doc.base_net_total += item.base_amount; + me.frm.doc.net_total += item.amount; }); - frappe.model.round_floats_in(this.frm.doc, ["net_total", "net_total_import"]); + frappe.model.round_floats_in(this.frm.doc, ["base_net_total", "net_total"]); }, calculate_totals: function() { var tax_count = this.frm.doc["taxes"] ? this.frm.doc["taxes"].length : 0; - this.frm.doc.grand_total = flt(tax_count ? this.frm.doc["taxes"][tax_count - 1].total : this.frm.doc.net_total); + this.frm.doc.base_grand_total = flt(tax_count ? this.frm.doc["taxes"][tax_count - 1].total : this.frm.doc.base_net_total); - this.frm.doc.total_tax = flt(this.frm.doc.grand_total - this.frm.doc.net_total, precision("total_tax")); + this.frm.doc.base_total_taxes_and_charges = flt(this.frm.doc.base_grand_total - this.frm.doc.base_net_total, precision("base_total_taxes_and_charges")); - this.frm.doc.grand_total = flt(this.frm.doc.grand_total, precision("grand_total")); + this.frm.doc.base_grand_total = flt(this.frm.doc.base_grand_total, precision("base_grand_total")); // rounded totals - if(frappe.meta.get_docfield(this.frm.doc.doctype, "rounded_total", this.frm.doc.name)) { - this.frm.doc.rounded_total = Math.round(this.frm.doc.grand_total); + if(frappe.meta.get_docfield(this.frm.doc.doctype, "base_rounded_total", this.frm.doc.name)) { + this.frm.doc.base_rounded_total = Math.round(this.frm.doc.base_grand_total); } // other charges added/deducted - this.frm.doc.other_charges_added = 0.0 - this.frm.doc.other_charges_deducted = 0.0 + this.frm.doc.base_taxes_and_charges_added = 0.0 + this.frm.doc.base_taxes_and_charges_deducted = 0.0 if(tax_count) { - this.frm.doc.other_charges_added = frappe.utils.sum($.map(this.frm.doc["taxes"], + this.frm.doc.base_taxes_and_charges_added = frappe.utils.sum($.map(this.frm.doc["taxes"], function(tax) { return (tax.add_deduct_tax == "Add" && in_list(["Valuation and Total", "Total"], tax.category)) ? tax.tax_amount : 0.0; })); - this.frm.doc.other_charges_deducted = frappe.utils.sum($.map(this.frm.doc["taxes"], + this.frm.doc.base_taxes_and_charges_deducted = frappe.utils.sum($.map(this.frm.doc["taxes"], function(tax) { return (tax.add_deduct_tax == "Deduct" && in_list(["Valuation and Total", "Total"], tax.category)) ? tax.tax_amount : 0.0; })); frappe.model.round_floats_in(this.frm.doc, - ["other_charges_added", "other_charges_deducted"]); + ["base_taxes_and_charges_added", "base_taxes_and_charges_deducted"]); } - this.frm.doc.grand_total_import = flt((this.frm.doc.other_charges_added || this.frm.doc.other_charges_deducted) ? - flt(this.frm.doc.grand_total / this.frm.doc.conversion_rate) : this.frm.doc.net_total_import); + this.frm.doc.grand_total = flt((this.frm.doc.base_taxes_and_charges_added || this.frm.doc.base_taxes_and_charges_deducted) ? + flt(this.frm.doc.base_grand_total / this.frm.doc.conversion_rate) : this.frm.doc.net_total); - this.frm.doc.grand_total_import = flt(this.frm.doc.grand_total_import, precision("grand_total_import")); + this.frm.doc.grand_total = flt(this.frm.doc.grand_total, precision("grand_total")); - if(frappe.meta.get_docfield(this.frm.doc.doctype, "rounded_total_import", this.frm.doc.name)) { - this.frm.doc.rounded_total_import = Math.round(this.frm.doc.grand_total_import); + if(frappe.meta.get_docfield(this.frm.doc.doctype, "rounded_total", this.frm.doc.name)) { + this.frm.doc.rounded_total = Math.round(this.frm.doc.grand_total); } - this.frm.doc.other_charges_added_import = flt(this.frm.doc.other_charges_added / - this.frm.doc.conversion_rate, precision("other_charges_added_import")); - this.frm.doc.other_charges_deducted_import = flt(this.frm.doc.other_charges_deducted / - this.frm.doc.conversion_rate, precision("other_charges_deducted_import")); + this.frm.doc.taxes_and_charges_added = flt(this.frm.doc.base_taxes_and_charges_added / + this.frm.doc.conversion_rate, precision("taxes_and_charges_added")); + this.frm.doc.taxes_and_charges_deducted = flt(this.frm.doc.base_taxes_and_charges_deducted / + this.frm.doc.conversion_rate, precision("taxes_and_charges_deducted")); }, calculate_outstanding_amount: function() { if(this.frm.doc.doctype == "Purchase Invoice" && this.frm.doc.docstatus < 2) { - frappe.model.round_floats_in(this.frm.doc, ["grand_total", "total_advance", "write_off_amount"]); - this.frm.doc.total_amount_to_pay = flt(this.frm.doc.grand_total - this.frm.doc.write_off_amount, + frappe.model.round_floats_in(this.frm.doc, ["base_grand_total", "total_advance", "write_off_amount"]); + this.frm.doc.total_amount_to_pay = flt(this.frm.doc.base_grand_total - this.frm.doc.write_off_amount, precision("total_amount_to_pay")); this.frm.doc.outstanding_amount = flt(this.frm.doc.total_amount_to_pay - this.frm.doc.total_advance, precision("outstanding_amount")); @@ -267,13 +267,13 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({ }; - setup_field_label_map(["net_total", "total_tax", "grand_total", "in_words", - "other_charges_added", "other_charges_deducted", - "outstanding_amount", "total_advance", "total_amount_to_pay", "rounded_total"], + setup_field_label_map(["base_net_total", "base_total_taxes_and_charges", "base_grand_total", "base_in_words", + "base_taxes_and_charges_added", "base_taxes_and_charges_deducted", + "outstanding_amount", "total_advance", "total_amount_to_pay", "base_rounded_total"], company_currency); - setup_field_label_map(["net_total_import", "grand_total_import", "in_words_import", - "other_charges_added_import", "other_charges_deducted_import"], this.frm.doc.currency); + setup_field_label_map(["net_total", "grand_total", "in_words", + "taxes_and_charges_added", "taxes_and_charges_deducted"], this.frm.doc.currency); cur_frm.set_df_property("conversion_rate", "description", "1 " + this.frm.doc.currency + " = [?] " + company_currency); @@ -284,8 +284,8 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({ } // toggle fields - this.frm.toggle_display(["conversion_rate", "net_total", "grand_total", - "in_words", "other_charges_added", "other_charges_deducted"], + this.frm.toggle_display(["conversion_rate", "base_net_total", "base_grand_total", + "base_in_words", "base_taxes_and_charges_added", "base_taxes_and_charges_deducted"], this.frm.doc.currency !== company_currency); this.frm.toggle_display(["plc_conversion_rate", "price_list_currency"], diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.json b/erpnext/buying/doctype/purchase_order/purchase_order.json index 28c8693799..c1fbe64422 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.json +++ b/erpnext/buying/doctype/purchase_order/purchase_order.json @@ -854,7 +854,7 @@ } ], "read_only_onload": 1, - "search_fields": "status, transaction_date, supplier,grand_total", + "search_fields": "status, transaction_date, supplier,base_grand_total", "sort_field": "modified", "sort_order": "DESC", "title_field": "supplier_name" diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.py b/erpnext/buying/doctype/purchase_order/purchase_order.py index cf4d0068e2..383b0ad58c 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.py +++ b/erpnext/buying/doctype/purchase_order/purchase_order.py @@ -183,7 +183,7 @@ class PurchaseOrder(BuyingController): self.update_ordered_qty() frappe.get_doc('Authorization Control').validate_approving_authority(self.doctype, - self.company, self.grand_total) + self.company, self.base_grand_total) purchase_controller.update_last_purchase_rate(self, is_submit = 1) diff --git a/erpnext/buying/doctype/purchase_order/purchase_order_list.js b/erpnext/buying/doctype/purchase_order/purchase_order_list.js index fe96641568..b094a65f60 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order_list.js +++ b/erpnext/buying/doctype/purchase_order/purchase_order_list.js @@ -1,5 +1,5 @@ frappe.listview_settings['Purchase Order'] = { - add_fields: ["grand_total", "company", "currency", "supplier", + add_fields: ["base_grand_total", "company", "currency", "supplier", "supplier_name", "per_received", "per_billed", "status"], get_indicator: function(doc) { if(doc.status==="Stopped") { diff --git a/erpnext/buying/doctype/purchase_order/test_records.json b/erpnext/buying/doctype/purchase_order/test_records.json index 2b329af0e3..bbe02cc387 100644 --- a/erpnext/buying/doctype/purchase_order/test_records.json +++ b/erpnext/buying/doctype/purchase_order/test_records.json @@ -7,11 +7,11 @@ "currency": "INR", "doctype": "Purchase Order", "fiscal_year": "_Test Fiscal Year 2013", + "base_grand_total": 5000.0, "grand_total": 5000.0, - "grand_total_import": 5000.0, "is_subcontracted": "Yes", "naming_series": "_T-Purchase Order-", - "net_total": 5000.0, + "base_net_total": 5000.0, "items": [ { "base_amount": 5000.0, @@ -41,11 +41,11 @@ "currency": "INR", "doctype": "Purchase Order", "fiscal_year": "_Test Fiscal Year 2013", + "base_grand_total": 5000.0, "grand_total": 5000.0, - "grand_total_import": 5000.0, "is_subcontracted": "No", "naming_series": "_T-Purchase Order-", - "net_total": 5000.0, + "base_net_total": 5000.0, "items": [ { "base_amount": 5000.0, diff --git a/erpnext/buying/doctype/supplier/supplier.py b/erpnext/buying/doctype/supplier/supplier.py index 974ed3829d..6f79f0cf91 100644 --- a/erpnext/buying/doctype/supplier/supplier.py +++ b/erpnext/buying/doctype/supplier/supplier.py @@ -89,7 +89,7 @@ def get_dashboard_info(supplier): out[doctype] = frappe.db.get_value(doctype, {"supplier": supplier, "docstatus": ["!=", 2] }, "count(*)") - billing = frappe.db.sql("""select sum(grand_total), sum(outstanding_amount) + billing = frappe.db.sql("""select sum(base_grand_total), sum(outstanding_amount) from `tabPurchase Invoice` where supplier=%s and docstatus = 1 diff --git a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.json b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.json index b1f0749109..bd1e93ad2c 100644 --- a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.json +++ b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.json @@ -673,7 +673,7 @@ } ], "read_only_onload": 1, - "search_fields": "status, transaction_date, supplier,grand_total", + "search_fields": "status, transaction_date, supplier,base_grand_total", "sort_field": "modified", "sort_order": "DESC", "title_field": "supplier_name" diff --git a/erpnext/buying/doctype/supplier_quotation/supplier_quotation_list.js b/erpnext/buying/doctype/supplier_quotation/supplier_quotation_list.js index 400a820bcc..95554397bb 100644 --- a/erpnext/buying/doctype/supplier_quotation/supplier_quotation_list.js +++ b/erpnext/buying/doctype/supplier_quotation/supplier_quotation_list.js @@ -1,5 +1,5 @@ frappe.listview_settings['Supplier Quotation'] = { - add_fields: ["supplier", "grand_total", "status", "company", "currency"], + add_fields: ["supplier", "base_grand_total", "status", "company", "currency"], get_indicator: function(doc) { if(doc.status==="Ordered") { return [__("Ordered"), "green", "status,=,Ordered"]; diff --git a/erpnext/buying/doctype/supplier_quotation/test_records.json b/erpnext/buying/doctype/supplier_quotation/test_records.json index 70e32fe929..5233fe2770 100644 --- a/erpnext/buying/doctype/supplier_quotation/test_records.json +++ b/erpnext/buying/doctype/supplier_quotation/test_records.json @@ -6,11 +6,11 @@ "currency": "INR", "doctype": "Supplier Quotation", "fiscal_year": "_Test Fiscal Year 2013", + "base_grand_total": 5000.0, "grand_total": 5000.0, - "grand_total_import": 5000.0, "is_subcontracted": "No", "naming_series": "_T-Supplier Quotation-", - "net_total": 5000.0, + "base_net_total": 5000.0, "items": [ { "base_amount": 5000.0, diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py index bb5531f7e6..8b1d7c5c1b 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -18,7 +18,7 @@ class AccountsController(TransactionBase): self.validate_date_with_fiscal_year() if self.meta.get_field("currency"): self.calculate_taxes_and_totals() - self.validate_value("grand_total", ">=", 0) + self.validate_value("base_grand_total", ">=", 0) self.set_total_in_words() self.validate_due_date() @@ -291,7 +291,7 @@ class AccountsController(TransactionBase): self.precision("tax_amount", tax)) def adjust_discount_amount_loss(self, tax): - discount_amount_loss = self.grand_total - flt(self.base_discount_amount) - tax.total + discount_amount_loss = self.base_grand_total - flt(self.base_discount_amount) - tax.total tax.tax_amount_after_discount_amount = flt(tax.tax_amount_after_discount_amount + discount_amount_loss, self.precision("tax_amount", tax)) tax.total = flt(tax.total + discount_amount_loss, self.precision("total", tax)) @@ -303,8 +303,8 @@ class AccountsController(TransactionBase): if tax.charge_type == "Actual": # distribute the tax amount proportionally to each item row actual = flt(tax.rate, self.precision("tax_amount", tax)) - current_tax_amount = (self.net_total - and ((item.base_amount / self.net_total) * actual) + current_tax_amount = (self.base_net_total + and ((item.base_amount / self.base_net_total) * actual) or 0) elif tax.charge_type == "On Net Total": current_tax_amount = (tax_rate / 100.0) * item.base_amount @@ -510,12 +510,12 @@ class AccountsController(TransactionBase): if advance_paid: advance_paid = flt(advance_paid[0][0], self.precision("advance_paid")) - if flt(self.grand_total) >= advance_paid: + if flt(self.base_grand_total) >= advance_paid: frappe.db.set_value(self.doctype, self.name, "advance_paid", advance_paid) else: frappe.throw(_("Total advance ({0}) against Order {1} cannot be greater \ than the Grand Total ({2})") - .format(advance_paid, self.name, self.grand_total)) + .format(advance_paid, self.name, self.base_grand_total)) @property def company_abbr(self): diff --git a/erpnext/controllers/buying_controller.py b/erpnext/controllers/buying_controller.py index 72b4ba0e4b..78ab2f1738 100644 --- a/erpnext/controllers/buying_controller.py +++ b/erpnext/controllers/buying_controller.py @@ -21,7 +21,7 @@ class BuyingController(StockController): def get_feed(self): return _("From {0} | {1} {2}").format(self.supplier_name, self.currency, - self.grand_total_import) + self.grand_total) def validate(self): super(BuyingController, self).validate() @@ -74,10 +74,10 @@ class BuyingController(StockController): def set_total_in_words(self): from frappe.utils import money_in_words company_currency = get_company_currency(self.company) + if self.meta.get_field("base_in_words"): + self.base_in_words = money_in_words(self.base_grand_total, company_currency) if self.meta.get_field("in_words"): - self.in_words = money_in_words(self.grand_total, company_currency) - if self.meta.get_field("in_words_import"): - self.in_words_import = money_in_words(self.grand_total_import, + self.in_words = money_in_words(self.grand_total, self.currency) def calculate_taxes_and_totals(self): @@ -103,55 +103,55 @@ class BuyingController(StockController): def calculate_net_total(self): - self.net_total = self.net_total_import = 0.0 + self.base_net_total = self.net_total = 0.0 for item in self.get("items"): - self.net_total += item.base_amount - self.net_total_import += item.amount + self.base_net_total += item.base_amount + self.net_total += item.amount - self.round_floats_in(self, ["net_total", "net_total_import"]) + self.round_floats_in(self, ["base_net_total", "net_total"]) def calculate_totals(self): - self.grand_total = flt(self.get("taxes")[-1].total if self.get("taxes") else self.net_total) + self.base_grand_total = flt(self.get("taxes")[-1].total if self.get("taxes") else self.base_net_total) - self.total_tax = flt(self.grand_total - self.net_total, self.precision("total_tax")) + self.base_total_taxes_and_charges = flt(self.base_grand_total - self.base_net_total, self.precision("base_total_taxes_and_charges")) + + self.base_grand_total = flt(self.base_grand_total, self.precision("base_grand_total")) + + if self.meta.get_field("base_rounded_total"): + self.base_rounded_total = rounded(self.base_grand_total) + + if self.meta.get_field("base_taxes_and_charges_added"): + self.base_taxes_and_charges_added = flt(sum([flt(d.tax_amount) for d in self.get("taxes") + if d.add_deduct_tax=="Add" and d.category in ["Valuation and Total", "Total"]]), + self.precision("base_taxes_and_charges_added")) + + if self.meta.get_field("base_taxes_and_charges_deducted"): + self.base_taxes_and_charges_deducted = flt(sum([flt(d.tax_amount) for d in self.get("taxes") + if d.add_deduct_tax=="Deduct" and d.category in ["Valuation and Total", "Total"]]), + self.precision("base_taxes_and_charges_deducted")) + + self.grand_total = flt(self.base_grand_total / self.conversion_rate) \ + if (self.base_taxes_and_charges_added or self.base_taxes_and_charges_deducted) else self.net_total self.grand_total = flt(self.grand_total, self.precision("grand_total")) if self.meta.get_field("rounded_total"): self.rounded_total = rounded(self.grand_total) - if self.meta.get_field("other_charges_added"): - self.other_charges_added = flt(sum([flt(d.tax_amount) for d in self.get("taxes") - if d.add_deduct_tax=="Add" and d.category in ["Valuation and Total", "Total"]]), - self.precision("other_charges_added")) + if self.meta.get_field("taxes_and_charges_added"): + self.taxes_and_charges_added = flt(self.base_taxes_and_charges_added / + self.conversion_rate, self.precision("taxes_and_charges_added")) - if self.meta.get_field("other_charges_deducted"): - self.other_charges_deducted = flt(sum([flt(d.tax_amount) for d in self.get("taxes") - if d.add_deduct_tax=="Deduct" and d.category in ["Valuation and Total", "Total"]]), - self.precision("other_charges_deducted")) - - self.grand_total_import = flt(self.grand_total / self.conversion_rate) \ - if (self.other_charges_added or self.other_charges_deducted) else self.net_total_import - - self.grand_total_import = flt(self.grand_total_import, self.precision("grand_total_import")) - - if self.meta.get_field("rounded_total_import"): - self.rounded_total_import = rounded(self.grand_total_import) - - if self.meta.get_field("other_charges_added_import"): - self.other_charges_added_import = flt(self.other_charges_added / - self.conversion_rate, self.precision("other_charges_added_import")) - - if self.meta.get_field("other_charges_deducted_import"): - self.other_charges_deducted_import = flt(self.other_charges_deducted / - self.conversion_rate, self.precision("other_charges_deducted_import")) + if self.meta.get_field("taxes_and_charges_deducted"): + self.taxes_and_charges_deducted = flt(self.base_taxes_and_charges_deducted / + self.conversion_rate, self.precision("taxes_and_charges_deducted")) def calculate_outstanding_amount(self): if self.doctype == "Purchase Invoice" and self.docstatus == 0: self.total_advance = flt(self.total_advance, self.precision("total_advance")) - self.total_amount_to_pay = flt(self.grand_total - flt(self.write_off_amount, + self.total_amount_to_pay = flt(self.base_grand_total - flt(self.write_off_amount, self.precision("write_off_amount")), self.precision("total_amount_to_pay")) self.outstanding_amount = flt(self.total_amount_to_pay - self.total_advance, self.precision("outstanding_amount")) diff --git a/erpnext/controllers/selling_controller.py b/erpnext/controllers/selling_controller.py index 0e56fc7560..41586c8916 100644 --- a/erpnext/controllers/selling_controller.py +++ b/erpnext/controllers/selling_controller.py @@ -19,7 +19,7 @@ class SellingController(StockController): def get_feed(self): return _("To {0} | {1} {2}").format(self.customer_name, self.currency, - self.grand_total_export) + self.grand_total) def onload(self): if self.doctype in ("Sales Order", "Delivery Note", "Sales Invoice"): @@ -65,7 +65,7 @@ class SellingController(StockController): def apply_shipping_rule(self): if self.shipping_rule: shipping_rule = frappe.get_doc("Shipping Rule", self.shipping_rule) - value = self.net_total + value = self.base_net_total # TODO # shipping rule calculation based on item's net weight @@ -114,12 +114,12 @@ class SellingController(StockController): disable_rounded_total = cint(frappe.db.get_value("Global Defaults", None, "disable_rounded_total")) + if self.meta.get_field("base_in_words"): + self.base_in_words = money_in_words(disable_rounded_total and + self.base_grand_total or self.base_rounded_total, company_currency) if self.meta.get_field("in_words"): self.in_words = money_in_words(disable_rounded_total and - self.grand_total or self.rounded_total, company_currency) - if self.meta.get_field("in_words_export"): - self.in_words_export = money_in_words(disable_rounded_total and - self.grand_total_export or self.rounded_total_export, self.currency) + self.grand_total or self.rounded_total, self.currency) def calculate_taxes_and_totals(self): super(SellingController, self).calculate_taxes_and_totals() @@ -204,30 +204,30 @@ class SellingController(StockController): self._set_in_company_currency(item, "amount", "base_amount") def calculate_net_total(self): - self.net_total = self.net_total_export = 0.0 + self.base_net_total = self.net_total = 0.0 for item in self.get("items"): - self.net_total += item.base_amount - self.net_total_export += item.amount + self.base_net_total += item.base_amount + self.net_total += item.amount - self.round_floats_in(self, ["net_total", "net_total_export"]) + self.round_floats_in(self, ["base_net_total", "net_total"]) def calculate_totals(self): - self.grand_total = flt(self.get("taxes")[-1].total if self.get("taxes") else self.net_total) + self.base_grand_total = flt(self.get("taxes")[-1].total if self.get("taxes") else self.base_net_total) - self.other_charges_total = flt(self.grand_total - self.net_total, self.precision("other_charges_total")) + self.base_total_taxes_and_charges = flt(self.base_grand_total - self.base_net_total, self.precision("base_total_taxes_and_charges")) - self.grand_total_export = flt(self.grand_total / self.conversion_rate) \ - if (self.other_charges_total or self.discount_amount) else self.net_total_export + self.grand_total = flt(self.base_grand_total / self.conversion_rate) \ + if (self.base_total_taxes_and_charges or self.discount_amount) else self.net_total - self.other_charges_total_export = flt(self.grand_total_export - self.net_total_export + - flt(self.discount_amount), self.precision("other_charges_total_export")) + self.total_taxes_and_charges = flt(self.grand_total - self.net_total + + flt(self.discount_amount), self.precision("total_taxes_and_charges")) + self.base_grand_total = flt(self.base_grand_total, self.precision("base_grand_total")) self.grand_total = flt(self.grand_total, self.precision("grand_total")) - self.grand_total_export = flt(self.grand_total_export, self.precision("grand_total_export")) + self.base_rounded_total = rounded(self.base_grand_total) self.rounded_total = rounded(self.grand_total) - self.rounded_total_export = rounded(self.grand_total_export) def apply_discount_amount(self): if self.discount_amount: @@ -257,8 +257,8 @@ class SellingController(StockController): flt(tax.rate) / 100 actual_taxes_dict.setdefault(tax.idx, actual_tax_amount) - grand_total_for_discount_amount = flt(self.grand_total - sum(actual_taxes_dict.values()), - self.precision("grand_total")) + grand_total_for_discount_amount = flt(self.base_grand_total - sum(actual_taxes_dict.values()), + self.precision("base_grand_total")) return grand_total_for_discount_amount def calculate_outstanding_amount(self): @@ -266,19 +266,19 @@ class SellingController(StockController): # write_off_amount is only for POS Invoice # total_advance is only for non POS Invoice if self.doctype == "Sales Invoice" and self.docstatus == 0: - self.round_floats_in(self, ["grand_total", "total_advance", "write_off_amount", + self.round_floats_in(self, ["base_grand_total", "total_advance", "write_off_amount", "paid_amount"]) - total_amount_to_pay = self.grand_total - self.write_off_amount + total_amount_to_pay = self.base_grand_total - self.write_off_amount self.outstanding_amount = flt(total_amount_to_pay - self.total_advance \ - self.paid_amount, self.precision("outstanding_amount")) def calculate_commission(self): if self.meta.get_field("commission_rate"): - self.round_floats_in(self, ["net_total", "commission_rate"]) + self.round_floats_in(self, ["base_net_total", "commission_rate"]) if self.commission_rate > 100.0: throw(_("Commission rate cannot be greater than 100")) - self.total_commission = flt(self.net_total * self.commission_rate / 100.0, + self.total_commission = flt(self.base_net_total * self.commission_rate / 100.0, self.precision("total_commission")) def calculate_contribution(self): @@ -291,7 +291,7 @@ class SellingController(StockController): self.round_floats_in(sales_person) sales_person.allocated_amount = flt( - self.net_total * sales_person.allocated_percentage / 100.0, + self.base_net_total * sales_person.allocated_percentage / 100.0, self.precision("allocated_amount", sales_person)) total += sales_person.allocated_percentage diff --git a/erpnext/controllers/status_updater.py b/erpnext/controllers/status_updater.py index e16c725411..2989d1b544 100644 --- a/erpnext/controllers/status_updater.py +++ b/erpnext/controllers/status_updater.py @@ -196,7 +196,7 @@ class StatusUpdater(Document): ref_fieldname = ref_dt.lower().replace(" ", "_") zero_amount_refdoc = [] all_zero_amount_refdoc = frappe.db.sql_list("""select name from `tab%s` - where docstatus=1 and net_total = 0""" % ref_dt) + where docstatus=1 and base_net_total = 0""" % ref_dt) for item in self.get("items"): if item.get(ref_fieldname) \ diff --git a/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py b/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py index 24204f254a..ed4ee768af 100644 --- a/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py +++ b/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py @@ -16,12 +16,12 @@ class ProductionPlanningTool(Document): def get_so_details(self, so): """Pull other details from so""" - so = frappe.db.sql("""select transaction_date, customer, grand_total + so = frappe.db.sql("""select transaction_date, customer, base_grand_total from `tabSales Order` where name = %s""", so, as_dict = 1) ret = { 'sales_order_date': so and so[0]['transaction_date'] or '', 'customer' : so[0]['customer'] or '', - 'grand_total': so[0]['grand_total'] + 'grand_total': so[0]['base_grand_total'] } return ret @@ -61,7 +61,7 @@ class ProductionPlanningTool(Document): item_filter += ' and item.name = "' + self.fg_item + '"' open_so = frappe.db.sql(""" - select distinct so.name, so.transaction_date, so.customer, so.grand_total + select distinct so.name, so.transaction_date, so.customer, so.base_grand_total from `tabSales Order` so, `tabSales Order Item` so_item where so_item.parent = so.name and so.docstatus = 1 and so.status != "Stopped" @@ -90,7 +90,7 @@ class ProductionPlanningTool(Document): pp_so.sales_order = r['name'] pp_so.sales_order_date = cstr(r['transaction_date']) pp_so.customer = cstr(r['customer']) - pp_so.grand_total = flt(r['grand_total']) + pp_so.grand_total = flt(r['base_grand_total']) def get_items_from_so(self): """ Pull items from Sales Order, only proction item diff --git a/erpnext/public/js/controllers/taxes_and_totals.js b/erpnext/public/js/controllers/taxes_and_totals.js index 07d6841b05..113612a21a 100644 --- a/erpnext/public/js/controllers/taxes_and_totals.js +++ b/erpnext/public/js/controllers/taxes_and_totals.js @@ -227,8 +227,8 @@ erpnext.taxes_and_totals = erpnext.stock.StockController.extend({ if(tax.charge_type == "Actual") { // distribute the tax amount proportionally to each item row var actual = flt(tax.rate, precision("tax_amount", tax)); - current_tax_amount = this.frm.doc.net_total ? - ((item.base_amount / this.frm.doc.net_total) * actual) : 0.0; + current_tax_amount = this.frm.doc.base_net_total ? + ((item.base_amount / this.frm.doc.base_net_total) * actual) : 0.0; } else if(tax.charge_type == "On Net Total") { current_tax_amount = (tax_rate / 100.0) * item.base_amount; @@ -258,7 +258,7 @@ erpnext.taxes_and_totals = erpnext.stock.StockController.extend({ }, adjust_discount_amount_loss: function(tax) { - var discount_amount_loss = this.frm.doc.grand_total - flt(this.frm.doc.base_discount_amount) - tax.total; + var discount_amount_loss = this.frm.doc.base_grand_total - flt(this.frm.doc.base_discount_amount) - tax.total; tax.tax_amount_after_discount_amount = flt(tax.tax_amount_after_discount_amount + discount_amount_loss, precision("tax_amount", tax)); tax.total = flt(tax.total + discount_amount_loss, precision("total", tax)); @@ -266,7 +266,7 @@ erpnext.taxes_and_totals = erpnext.stock.StockController.extend({ _cleanup: function() { - this.frm.doc.in_words = this.frm.doc.in_words_import = this.frm.doc.in_words_export = ""; + this.frm.doc.base_in_words = this.frm.doc.in_words = this.frm.doc.in_words = ""; if(this.frm.doc["items"] && this.frm.doc["items"].length) { if(!frappe.meta.get_docfield(this.frm.doc["items"][0].doctype, "item_tax_amount", this.frm.doctype)) { @@ -338,8 +338,8 @@ erpnext.taxes_and_totals = erpnext.stock.StockController.extend({ total_actual_tax += value; }); - grand_total_for_discount_amount = flt(this.frm.doc.grand_total - total_actual_tax, - precision("grand_total")); + grand_total_for_discount_amount = flt(this.frm.doc.base_grand_total - total_actual_tax, + precision("base_grand_total")); return grand_total_for_discount_amount; }, diff --git a/erpnext/public/js/feature_setup.js b/erpnext/public/js/feature_setup.js index 536f956347..f83c953d2d 100644 --- a/erpnext/public/js/feature_setup.js +++ b/erpnext/public/js/feature_setup.js @@ -111,30 +111,30 @@ erpnext.feature_setup.feature_dict = { 'Sales Order': {'items':['page_break']} }, 'fs_exports': { - 'Delivery Note': {'fields':['conversion_rate','currency','grand_total','in_words','rounded_total'],'items':['base_price_list_rate','base_amount','base_rate']}, + 'Delivery Note': {'fields':['conversion_rate','currency','base_grand_total','base_in_words','base_rounded_total'],'items':['base_price_list_rate','base_amount','base_rate']}, 'POS Setting': {'fields':['conversion_rate','currency']}, - 'Quotation': {'fields':['conversion_rate','currency','grand_total','in_words','rounded_total'],'items':['base_price_list_rate','base_amount','base_rate']}, - 'Sales Invoice': {'fields':['conversion_rate','currency','grand_total','in_words','rounded_total'],'items':['base_price_list_rate','base_amount','base_rate']}, + 'Quotation': {'fields':['conversion_rate','currency','base_grand_total','base_in_words','base_rounded_total'],'items':['base_price_list_rate','base_amount','base_rate']}, + 'Sales Invoice': {'fields':['conversion_rate','currency','base_grand_total','base_in_words','base_rounded_total'],'items':['base_price_list_rate','base_amount','base_rate']}, 'Sales BOM': {'fields':['currency']}, - 'Sales Order': {'fields':['conversion_rate','currency','grand_total','in_words','rounded_total'],'items':['base_price_list_rate','base_amount','base_rate']} + 'Sales Order': {'fields':['conversion_rate','currency','base_grand_total','base_in_words','base_rounded_total'],'items':['base_price_list_rate','base_amount','base_rate']} }, 'fs_imports': { 'Purchase Invoice': { - 'fields': ['conversion_rate', 'currency', 'grand_total', - 'in_words', 'net_total', 'other_charges_added', - 'other_charges_deducted'], + 'fields': ['conversion_rate', 'currency', 'base_grand_total', + 'base_in_words', 'base_net_total', 'base_taxes_and_charges_added', + 'base_taxes_and_charges_deducted'], 'items': ['base_price_list_rate', 'base_amount','base_rate'] }, 'Purchase Order': { - 'fields': ['conversion_rate','currency', 'grand_total', - 'in_words', 'net_total', 'other_charges_added', - 'other_charges_deducted'], + 'fields': ['conversion_rate','currency', 'base_grand_total', + 'base_in_words', 'base_net_total', 'base_taxes_and_charges_added', + 'base_taxes_and_charges_deducted'], 'items': ['base_price_list_rate', 'base_amount','base_rate'] }, 'Purchase Receipt': { - 'fields': ['conversion_rate', 'currency','grand_total', 'in_words', - 'net_total', 'other_charges_added', 'other_charges_deducted'], + 'fields': ['conversion_rate', 'currency','base_grand_total', 'base_in_words', + 'base_net_total', 'base_taxes_and_charges_added', 'base_taxes_and_charges_deducted'], 'items': ['base_price_list_rate','base_amount','base_rate'] }, 'Supplier Quotation': { diff --git a/erpnext/public/js/pos/pos.js b/erpnext/public/js/pos/pos.js index e6394f6a1c..5aaadb483a 100644 --- a/erpnext/public/js/pos/pos.js +++ b/erpnext/public/js/pos/pos.js @@ -26,23 +26,19 @@ erpnext.pos.PointOfSale = Class.extend({ // Check whether the transaction is "Sales" or "Purchase" if (frappe.meta.has_field(cur_frm.doc.doctype, "customer")) { - this.set_transaction_defaults("Customer", "export"); + this.set_transaction_defaults("Customer"); } else if (frappe.meta.has_field(cur_frm.doc.doctype, "supplier")) { - this.set_transaction_defaults("Supplier", "import"); + this.set_transaction_defaults("Supplier"); } }, - set_transaction_defaults: function(party, export_or_import) { + set_transaction_defaults: function(party) { var me = this; this.party = party; this.price_list = (party == "Customer" ? this.frm.doc.selling_price_list : this.frm.doc.buying_price_list); this.price_list_field = (party == "Customer" ? "selling_price_list" : "buying_price_list"); this.sales_or_purchase = (party == "Customer" ? "Sales" : "Purchase"); - this.net_total = "net_total_" + export_or_import; - this.grand_total = "grand_total_" + export_or_import; - // this.amount = export_or_import + "_amount"; - // this.rate = export_or_import + "_rate"; }, make: function() { this.make_party(); @@ -282,10 +278,8 @@ erpnext.pos.PointOfSale = Class.extend({ }, set_totals: function() { var me = this; - this.wrapper.find(".net-total").text(format_currency(this.frm.doc[this.net_total], - me.frm.doc.currency)); - this.wrapper.find(".grand-total").text(format_currency(this.frm.doc[this.grand_total], - me.frm.doc.currency)); + this.wrapper.find(".net-total").text(format_currency(me.frm.doc["net_total"], me.frm.doc.currency)); + this.wrapper.find(".grand-total").text(format_currency(me.frm.doc.grand_total, me.frm.doc.currency)); }, call_when_local: function() { var me = this; @@ -414,12 +408,12 @@ erpnext.pos.PointOfSale = Class.extend({ title: 'Payment', fields: [ {fieldtype:'Currency', fieldname:'total_amount', label: __('Total Amount'), read_only:1, - options:"currency", default:me.frm.doc.grand_total_export, read_only: 1}, + options:"currency", default:me.frm.doc.grand_total, read_only: 1}, {fieldtype:'Select', fieldname:'mode_of_payment', label: __('Mode of Payment'), options:modes_of_payment.join('\n'), reqd: 1, default: default_mode}, {fieldtype:'Currency', fieldname:'paid_amount', label:__('Amount Paid'), reqd:1, options: "currency", - default:me.frm.doc.grand_total_export, hidden: 1}, + default:me.frm.doc.grand_total, hidden: 1}, {fieldtype:'Currency', fieldname:'change', label: __('Change'), options: "currency", default: 0.0, hidden: 1}, {fieldtype:'Currency', fieldname:'write_off_amount', label: __('Write Off'), options: "currency", @@ -473,7 +467,7 @@ erpnext.pos.PointOfSale = Class.extend({ me.frm.set_value("paid_amount", paid_amount); // specifying writeoff amount here itself, so as to avoid recursion issue - me.frm.set_value("write_off_amount", me.frm.doc.grand_total - paid_amount); + me.frm.set_value("write_off_amount", me.frm.doc.base_grand_total - paid_amount); me.frm.set_value("outstanding_amount", 0); me.frm.savesubmit(this); diff --git a/erpnext/selling/doctype/customer/customer.py b/erpnext/selling/doctype/customer/customer.py index 8a50de57e9..6a5546b0fc 100644 --- a/erpnext/selling/doctype/customer/customer.py +++ b/erpnext/selling/doctype/customer/customer.py @@ -123,7 +123,7 @@ def get_dashboard_info(customer): out[doctype] = frappe.db.get_value(doctype, {"customer": customer, "docstatus": ["!=", 2] }, "count(*)") - billing = frappe.db.sql("""select sum(grand_total), sum(outstanding_amount) + billing = frappe.db.sql("""select sum(base_grand_total), sum(outstanding_amount) from `tabSales Invoice` where customer=%s and docstatus = 1 @@ -174,7 +174,7 @@ def get_customer_outstanding(customer, company): # Outstanding based on Sales Order outstanding_based_on_so = frappe.db.sql(""" - select sum(grand_total*(100 - ifnull(per_billed, 0))/100) + select sum(base_grand_total*(100 - ifnull(per_billed, 0))/100) from `tabSales Order` where customer=%s and docstatus = 1 and company=%s and ifnull(per_billed, 0) < 100 and status != 'Stopped'""", (customer, company)) @@ -189,8 +189,8 @@ def get_customer_outstanding(customer, company): (ifnull(dn_item.amount, 0) - ifnull((select sum(ifnull(amount, 0)) from `tabSales Invoice Item` where ifnull(dn_detail, '') = dn_item.name and docstatus = 1), 0) - )/dn.net_total - )*dn.grand_total + )/dn.base_net_total + )*dn.base_grand_total ) from `tabDelivery Note` dn, `tabDelivery Note Item` dn_item where diff --git a/erpnext/selling/doctype/quotation/quotation.py b/erpnext/selling/doctype/quotation/quotation.py index 5a052209d1..67277b0fd2 100644 --- a/erpnext/selling/doctype/quotation/quotation.py +++ b/erpnext/selling/doctype/quotation/quotation.py @@ -79,7 +79,7 @@ class Quotation(SellingController): self.check_item_table() # Check for Approving Authority - frappe.get_doc('Authorization Control').validate_approving_authority(self.doctype, self.company, self.grand_total, self) + frappe.get_doc('Authorization Control').validate_approving_authority(self.doctype, self.company, self.base_grand_total, self) #update enquiry status self.update_opportunity() diff --git a/erpnext/selling/doctype/quotation/quotation_list.js b/erpnext/selling/doctype/quotation/quotation_list.js index 7481e9841c..add7aefa95 100644 --- a/erpnext/selling/doctype/quotation/quotation_list.js +++ b/erpnext/selling/doctype/quotation/quotation_list.js @@ -1,5 +1,5 @@ frappe.listview_settings['Quotation'] = { - add_fields: ["customer_name", "grand_total", "status", + add_fields: ["customer_name", "base_grand_total", "status", "company", "currency"], get_indicator: function(doc) { if(doc.status==="Ordered") { diff --git a/erpnext/selling/doctype/quotation/test_records.json b/erpnext/selling/doctype/quotation/test_records.json index 1dc4b07bcc..212d59b8dc 100644 --- a/erpnext/selling/doctype/quotation/test_records.json +++ b/erpnext/selling/doctype/quotation/test_records.json @@ -8,8 +8,8 @@ "customer_name": "_Test Customer", "doctype": "Quotation", "fiscal_year": "_Test Fiscal Year 2013", + "base_grand_total": 1000.0, "grand_total": 1000.0, - "grand_total_export": 1000.0, "order_type": "Sales", "plc_conversion_rate": 1.0, "price_list_currency": "INR", diff --git a/erpnext/selling/doctype/sales_order/sales_order.json b/erpnext/selling/doctype/sales_order/sales_order.json index c94004c7d1..3bbe694b07 100644 --- a/erpnext/selling/doctype/sales_order/sales_order.json +++ b/erpnext/selling/doctype/sales_order/sales_order.json @@ -1,1132 +1,1132 @@ { - "allow_import": 1, - "autoname": "naming_series:", - "creation": "2013-06-18 12:39:59", - "docstatus": 0, - "doctype": "DocType", - "document_type": "Transaction", + "allow_import": 1, + "autoname": "naming_series:", + "creation": "2013-06-18 12:39:59", + "docstatus": 0, + "doctype": "DocType", + "document_type": "Transaction", "fields": [ { - "fieldname": "customer_section", - "fieldtype": "Section Break", - "label": "Customer", - "options": "icon-user", + "fieldname": "customer_section", + "fieldtype": "Section Break", + "label": "Customer", + "options": "icon-user", "permlevel": 0 - }, + }, { - "fieldname": "column_break0", - "fieldtype": "Column Break", - "in_filter": 0, - "oldfieldtype": "Column Break", - "permlevel": 0, - "search_index": 0, + "fieldname": "column_break0", + "fieldtype": "Column Break", + "in_filter": 0, + "oldfieldtype": "Column Break", + "permlevel": 0, + "search_index": 0, "width": "50%" - }, + }, { - "fieldname": "naming_series", - "fieldtype": "Select", - "label": "Series", - "no_copy": 1, - "oldfieldname": "naming_series", - "oldfieldtype": "Select", - "options": "SO-", - "permlevel": 0, - "print_hide": 1, + "fieldname": "naming_series", + "fieldtype": "Select", + "label": "Series", + "no_copy": 1, + "oldfieldname": "naming_series", + "oldfieldtype": "Select", + "options": "SO-", + "permlevel": 0, + "print_hide": 1, "reqd": 1 - }, + }, { - "fieldname": "customer", - "fieldtype": "Link", - "in_filter": 1, - "in_list_view": 0, - "label": "Customer", - "oldfieldname": "customer", - "oldfieldtype": "Link", - "options": "Customer", - "permlevel": 0, - "print_hide": 1, - "reqd": 1, + "fieldname": "customer", + "fieldtype": "Link", + "in_filter": 1, + "in_list_view": 0, + "label": "Customer", + "oldfieldname": "customer", + "oldfieldtype": "Link", + "options": "Customer", + "permlevel": 0, + "print_hide": 1, + "reqd": 1, "search_index": 1 - }, + }, { - "fieldname": "customer_name", - "fieldtype": "Data", - "hidden": 0, - "label": "Name", - "permlevel": 0, + "fieldname": "customer_name", + "fieldtype": "Data", + "hidden": 0, + "label": "Name", + "permlevel": 0, "read_only": 1 - }, + }, { - "fieldname": "address_display", - "fieldtype": "Small Text", - "hidden": 1, - "label": "Address", - "permlevel": 0, + "fieldname": "address_display", + "fieldtype": "Small Text", + "hidden": 1, + "label": "Address", + "permlevel": 0, "read_only": 1 - }, + }, { - "fieldname": "contact_display", - "fieldtype": "Small Text", - "hidden": 1, - "label": "Contact", - "permlevel": 0, + "fieldname": "contact_display", + "fieldtype": "Small Text", + "hidden": 1, + "label": "Contact", + "permlevel": 0, "read_only": 1 - }, + }, { - "fieldname": "contact_mobile", - "fieldtype": "Small Text", - "hidden": 1, - "label": "Mobile No", - "permlevel": 0, + "fieldname": "contact_mobile", + "fieldtype": "Small Text", + "hidden": 1, + "label": "Mobile No", + "permlevel": 0, "read_only": 1 - }, + }, { - "fieldname": "contact_email", - "fieldtype": "Small Text", - "hidden": 1, - "label": "Contact Email", - "permlevel": 0, - "print_hide": 1, + "fieldname": "contact_email", + "fieldtype": "Small Text", + "hidden": 1, + "label": "Contact Email", + "permlevel": 0, + "print_hide": 1, "read_only": 1 - }, + }, { - "default": "Sales", - "fieldname": "order_type", - "fieldtype": "Select", - "in_list_view": 0, - "label": "Order Type", - "oldfieldname": "order_type", - "oldfieldtype": "Select", - "options": "\nSales\nMaintenance\nShopping Cart", - "permlevel": 0, - "print_hide": 1, + "default": "Sales", + "fieldname": "order_type", + "fieldtype": "Select", + "in_list_view": 0, + "label": "Order Type", + "oldfieldname": "order_type", + "oldfieldtype": "Select", + "options": "\nSales\nMaintenance\nShopping Cart", + "permlevel": 0, + "print_hide": 1, "reqd": 1 - }, + }, { - "fieldname": "column_break1", - "fieldtype": "Column Break", - "oldfieldtype": "Column Break", - "permlevel": 0, + "fieldname": "column_break1", + "fieldtype": "Column Break", + "oldfieldtype": "Column Break", + "permlevel": 0, "width": "50%" - }, + }, { - "fieldname": "amended_from", - "fieldtype": "Link", - "hidden": 1, - "ignore_user_permissions": 1, - "label": "Amended From", - "no_copy": 1, - "oldfieldname": "amended_from", - "oldfieldtype": "Data", - "options": "Sales Order", - "permlevel": 0, - "print_hide": 1, - "read_only": 1, + "fieldname": "amended_from", + "fieldtype": "Link", + "hidden": 1, + "ignore_user_permissions": 1, + "label": "Amended From", + "no_copy": 1, + "oldfieldname": "amended_from", + "oldfieldtype": "Data", + "options": "Sales Order", + "permlevel": 0, + "print_hide": 1, + "read_only": 1, "width": "150px" - }, + }, { - "description": "", - "fieldname": "company", - "fieldtype": "Link", - "in_filter": 1, - "label": "Company", - "oldfieldname": "company", - "oldfieldtype": "Link", - "options": "Company", - "permlevel": 0, - "print_hide": 1, - "reqd": 1, - "search_index": 1, + "description": "", + "fieldname": "company", + "fieldtype": "Link", + "in_filter": 1, + "label": "Company", + "oldfieldname": "company", + "oldfieldtype": "Link", + "options": "Company", + "permlevel": 0, + "print_hide": 1, + "reqd": 1, + "search_index": 1, "width": "150px" - }, + }, { - "default": "Today", - "fieldname": "transaction_date", - "fieldtype": "Date", - "in_filter": 1, - "label": "Date", - "no_copy": 1, - "oldfieldname": "transaction_date", - "oldfieldtype": "Date", - "permlevel": 0, - "print_hide": 0, - "reqd": 1, - "search_index": 1, + "default": "Today", + "fieldname": "transaction_date", + "fieldtype": "Date", + "in_filter": 1, + "label": "Date", + "no_copy": 1, + "oldfieldname": "transaction_date", + "oldfieldtype": "Date", + "permlevel": 0, + "print_hide": 0, + "reqd": 1, + "search_index": 1, "width": "160px" - }, + }, { - "depends_on": "eval:doc.order_type == 'Sales'", - "fieldname": "delivery_date", - "fieldtype": "Date", - "hidden": 0, - "in_filter": 1, - "label": "Delivery Date", - "oldfieldname": "delivery_date", - "oldfieldtype": "Date", - "permlevel": 0, - "print_hide": 1, - "reqd": 0, - "search_index": 1, + "depends_on": "eval:doc.order_type == 'Sales'", + "fieldname": "delivery_date", + "fieldtype": "Date", + "hidden": 0, + "in_filter": 1, + "label": "Delivery Date", + "oldfieldname": "delivery_date", + "oldfieldtype": "Date", + "permlevel": 0, + "print_hide": 1, + "reqd": 0, + "search_index": 1, "width": "160px" - }, + }, { - "description": "Customer's Purchase Order Number", - "fieldname": "po_no", - "fieldtype": "Data", - "hidden": 0, - "label": "PO No", - "no_copy": 0, - "oldfieldname": "po_no", - "oldfieldtype": "Data", - "permlevel": 0, - "print_hide": 0, - "reqd": 0, + "description": "Customer's Purchase Order Number", + "fieldname": "po_no", + "fieldtype": "Data", + "hidden": 0, + "label": "PO No", + "no_copy": 0, + "oldfieldname": "po_no", + "oldfieldtype": "Data", + "permlevel": 0, + "print_hide": 0, + "reqd": 0, "width": "100px" - }, + }, { - "depends_on": "eval:doc.po_no", - "description": "Customer's Purchase Order Date", - "fieldname": "po_date", - "fieldtype": "Date", - "hidden": 0, - "label": "PO Date", - "oldfieldname": "po_date", - "oldfieldtype": "Date", - "permlevel": 0, - "print_hide": 0, - "reqd": 0, + "depends_on": "eval:doc.po_no", + "description": "Customer's Purchase Order Date", + "fieldname": "po_date", + "fieldtype": "Date", + "hidden": 0, + "label": "PO Date", + "oldfieldname": "po_date", + "oldfieldtype": "Date", + "permlevel": 0, + "print_hide": 0, + "reqd": 0, "width": "100px" - }, + }, { - "fieldname": "shipping_address_name", - "fieldtype": "Link", - "hidden": 1, - "in_filter": 1, - "label": "Shipping Address Name", - "options": "Address", - "permlevel": 0, - "print_hide": 1, + "fieldname": "shipping_address_name", + "fieldtype": "Link", + "hidden": 1, + "in_filter": 1, + "label": "Shipping Address Name", + "options": "Address", + "permlevel": 0, + "print_hide": 1, "read_only": 0 - }, + }, { - "fieldname": "shipping_address", - "fieldtype": "Small Text", - "hidden": 1, - "in_filter": 0, - "label": "Shipping Address", - "permlevel": 0, - "print_hide": 1, + "fieldname": "shipping_address", + "fieldtype": "Small Text", + "hidden": 1, + "in_filter": 0, + "label": "Shipping Address", + "permlevel": 0, + "print_hide": 1, "read_only": 1 - }, + }, { - "fieldname": "currency_and_price_list", - "fieldtype": "Section Break", - "label": "Currency and Price List", - "options": "icon-tag", - "permlevel": 0, + "fieldname": "currency_and_price_list", + "fieldtype": "Section Break", + "label": "Currency and Price List", + "options": "icon-tag", + "permlevel": 0, "print_hide": 1 - }, + }, { - "fieldname": "currency", - "fieldtype": "Link", - "label": "Currency", - "oldfieldname": "currency", - "oldfieldtype": "Select", - "options": "Currency", - "permlevel": 0, - "print_hide": 1, - "reqd": 1, + "fieldname": "currency", + "fieldtype": "Link", + "label": "Currency", + "oldfieldname": "currency", + "oldfieldtype": "Select", + "options": "Currency", + "permlevel": 0, + "print_hide": 1, + "reqd": 1, "width": "100px" - }, + }, { - "description": "Rate at which customer's currency is converted to company's base currency", - "fieldname": "conversion_rate", - "fieldtype": "Float", - "label": "Exchange Rate", - "oldfieldname": "conversion_rate", - "oldfieldtype": "Currency", - "permlevel": 0, - "print_hide": 1, - "reqd": 1, + "description": "Rate at which customer's currency is converted to company's base currency", + "fieldname": "conversion_rate", + "fieldtype": "Float", + "label": "Exchange Rate", + "oldfieldname": "conversion_rate", + "oldfieldtype": "Currency", + "permlevel": 0, + "print_hide": 1, + "reqd": 1, "width": "100px" - }, + }, { - "fieldname": "column_break2", - "fieldtype": "Column Break", - "permlevel": 0, + "fieldname": "column_break2", + "fieldtype": "Column Break", + "permlevel": 0, "width": "50%" - }, + }, { - "fieldname": "selling_price_list", - "fieldtype": "Link", - "label": "Price List", - "oldfieldname": "price_list_name", - "oldfieldtype": "Select", - "options": "Price List", - "permlevel": 0, - "print_hide": 1, - "reqd": 1, + "fieldname": "selling_price_list", + "fieldtype": "Link", + "label": "Price List", + "oldfieldname": "price_list_name", + "oldfieldtype": "Select", + "options": "Price List", + "permlevel": 0, + "print_hide": 1, + "reqd": 1, "width": "100px" - }, + }, { - "fieldname": "price_list_currency", - "fieldtype": "Link", - "label": "Price List Currency", - "options": "Currency", - "permlevel": 0, - "print_hide": 1, - "read_only": 1, + "fieldname": "price_list_currency", + "fieldtype": "Link", + "label": "Price List Currency", + "options": "Currency", + "permlevel": 0, + "print_hide": 1, + "read_only": 1, "reqd": 1 - }, + }, { - "description": "Rate at which Price list currency is converted to company's base currency", - "fieldname": "plc_conversion_rate", - "fieldtype": "Float", - "label": "Price List Exchange Rate", - "permlevel": 0, - "print_hide": 1, + "description": "Rate at which Price list currency is converted to company's base currency", + "fieldname": "plc_conversion_rate", + "fieldtype": "Float", + "label": "Price List Exchange Rate", + "permlevel": 0, + "print_hide": 1, "reqd": 1 - }, + }, { - "fieldname": "ignore_pricing_rule", - "fieldtype": "Check", - "label": "Ignore Pricing Rule", - "no_copy": 1, - "permlevel": 1, + "fieldname": "ignore_pricing_rule", + "fieldtype": "Check", + "label": "Ignore Pricing Rule", + "no_copy": 1, + "permlevel": 1, "print_hide": 1 - }, + }, { - "fieldname": "items_section", - "fieldtype": "Section Break", - "label": "Items", - "oldfieldtype": "Section Break", - "options": "icon-shopping-cart", + "fieldname": "items_section", + "fieldtype": "Section Break", + "label": "Items", + "oldfieldtype": "Section Break", + "options": "icon-shopping-cart", "permlevel": 0 - }, + }, { - "allow_on_submit": 1, - "fieldname": "items", - "fieldtype": "Table", - "label": "Items", - "oldfieldname": "sales_order_details", - "oldfieldtype": "Table", - "options": "Sales Order Item", - "permlevel": 0, - "print_hide": 0, + "allow_on_submit": 1, + "fieldname": "items", + "fieldtype": "Table", + "label": "Items", + "oldfieldname": "sales_order_details", + "oldfieldtype": "Table", + "options": "Sales Order Item", + "permlevel": 0, + "print_hide": 0, "reqd": 1 - }, + }, { - "fieldname": "section_break_31", - "fieldtype": "Section Break", + "fieldname": "section_break_31", + "fieldtype": "Section Break", "permlevel": 0 - }, + }, { - "fieldname": "column_break_33a", - "fieldtype": "Column Break", + "fieldname": "column_break_33a", + "fieldtype": "Column Break", "permlevel": 0 - }, + }, { - "fieldname": "base_net_total", - "fieldtype": "Currency", - "label": "Net Total (Company Currency)", - "oldfieldname": "net_total", - "oldfieldtype": "Currency", - "options": "Company:company:default_currency", - "permlevel": 0, - "print_hide": 1, - "read_only": 1, - "reqd": 0, + "fieldname": "base_net_total", + "fieldtype": "Currency", + "label": "Net Total (Company Currency)", + "oldfieldname": "net_total", + "oldfieldtype": "Currency", + "options": "Company:company:default_currency", + "permlevel": 0, + "print_hide": 1, + "read_only": 1, + "reqd": 0, "width": "150px" - }, + }, { - "fieldname": "column_break_33", - "fieldtype": "Column Break", + "fieldname": "column_break_33", + "fieldtype": "Column Break", "permlevel": 0 - }, + }, { - "fieldname": "net_total", - "fieldtype": "Currency", - "label": "Net Total", - "options": "currency", - "permlevel": 0, + "fieldname": "net_total", + "fieldtype": "Currency", + "label": "Net Total", + "options": "currency", + "permlevel": 0, "read_only": 1 - }, + }, { - "fieldname": "taxes_section", - "fieldtype": "Section Break", - "label": "Taxes and Charges", - "oldfieldtype": "Section Break", - "options": "icon-money", - "permlevel": 0, + "fieldname": "taxes_section", + "fieldtype": "Section Break", + "label": "Taxes and Charges", + "oldfieldtype": "Section Break", + "options": "icon-money", + "permlevel": 0, "print_hide": 0 - }, + }, { - "fieldname": "taxes_and_charges", - "fieldtype": "Link", - "label": "Taxes and Charges", - "oldfieldname": "charge", - "oldfieldtype": "Link", - "options": "Sales Taxes and Charges Master", - "permlevel": 0, + "fieldname": "taxes_and_charges", + "fieldtype": "Link", + "label": "Taxes and Charges", + "oldfieldname": "charge", + "oldfieldtype": "Link", + "options": "Sales Taxes and Charges Master", + "permlevel": 0, "print_hide": 1 - }, + }, { - "fieldname": "column_break_38", - "fieldtype": "Column Break", + "fieldname": "column_break_38", + "fieldtype": "Column Break", "permlevel": 0 - }, + }, { - "fieldname": "shipping_rule", - "fieldtype": "Link", - "label": "Shipping Rule", - "oldfieldtype": "Button", - "options": "Shipping Rule", - "permlevel": 0, + "fieldname": "shipping_rule", + "fieldtype": "Link", + "label": "Shipping Rule", + "oldfieldtype": "Button", + "options": "Shipping Rule", + "permlevel": 0, "print_hide": 1 - }, + }, { - "fieldname": "section_break_40", - "fieldtype": "Section Break", + "fieldname": "section_break_40", + "fieldtype": "Section Break", "permlevel": 0 - }, + }, { - "fieldname": "taxes", - "fieldtype": "Table", - "label": "Sales Taxes and Charges", - "oldfieldname": "other_charges", - "oldfieldtype": "Table", - "options": "Sales Taxes and Charges", + "fieldname": "taxes", + "fieldtype": "Table", + "label": "Sales Taxes and Charges", + "oldfieldname": "other_charges", + "oldfieldtype": "Table", + "options": "Sales Taxes and Charges", "permlevel": 0 - }, + }, { - "fieldname": "other_charges_calculation", - "fieldtype": "HTML", - "label": "Taxes and Charges Calculation", - "oldfieldtype": "HTML", - "permlevel": 0, + "fieldname": "other_charges_calculation", + "fieldtype": "HTML", + "label": "Taxes and Charges Calculation", + "oldfieldtype": "HTML", + "permlevel": 0, "print_hide": 1 - }, + }, { - "fieldname": "section_break_43", - "fieldtype": "Section Break", + "fieldname": "section_break_43", + "fieldtype": "Section Break", "permlevel": 0 - }, + }, { - "fieldname": "total_taxes_and_charges", - "fieldtype": "Currency", - "label": "Total Taxes and Charges", - "options": "currency", - "permlevel": 0, - "print_hide": 1, + "fieldname": "total_taxes_and_charges", + "fieldtype": "Currency", + "label": "Total Taxes and Charges", + "options": "currency", + "permlevel": 0, + "print_hide": 1, "read_only": 1 - }, + }, { - "fieldname": "base_total_taxes_and_charges", - "fieldtype": "Currency", - "label": "Total Taxes and Charges (Company Currency)", - "oldfieldname": "other_charges_total", - "oldfieldtype": "Currency", - "options": "Company:company:default_currency", - "permlevel": 0, - "print_hide": 1, - "read_only": 1, + "fieldname": "base_total_taxes_and_charges", + "fieldtype": "Currency", + "label": "Total Taxes and Charges (Company Currency)", + "oldfieldname": "other_charges_total", + "oldfieldtype": "Currency", + "options": "Company:company:default_currency", + "permlevel": 0, + "print_hide": 1, + "read_only": 1, "width": "150px" - }, + }, { - "fieldname": "column_break_46", - "fieldtype": "Column Break", + "fieldname": "column_break_46", + "fieldtype": "Column Break", "permlevel": 0 - }, + }, { - "fieldname": "discount_amount", - "fieldtype": "Currency", - "label": "Discount Amount", - "options": "currency", - "permlevel": 0, + "fieldname": "discount_amount", + "fieldtype": "Currency", + "label": "Discount Amount", + "options": "currency", + "permlevel": 0, "print_hide": 0 - }, + }, { - "fieldname": "base_discount_amount", - "fieldtype": "Currency", - "label": "Discount Amount (Company Currency)", - "options": "Company:company:default_currency", - "permlevel": 0, - "precision": "", - "print_hide": 1, + "fieldname": "base_discount_amount", + "fieldtype": "Currency", + "label": "Discount Amount (Company Currency)", + "options": "Company:company:default_currency", + "permlevel": 0, + "precision": "", + "print_hide": 1, "read_only": 1 - }, + }, { - "fieldname": "totals", - "fieldtype": "Section Break", - "label": "Totals", - "oldfieldtype": "Section Break", - "options": "icon-money", - "permlevel": 0, + "fieldname": "totals", + "fieldtype": "Section Break", + "label": "Totals", + "oldfieldtype": "Section Break", + "options": "icon-money", + "permlevel": 0, "print_hide": 1 - }, + }, { - "fieldname": "base_grand_total", - "fieldtype": "Currency", - "label": "Grand Total (Company Currency)", - "oldfieldname": "grand_total", - "oldfieldtype": "Currency", - "options": "Company:company:default_currency", - "permlevel": 0, - "print_hide": 1, - "read_only": 1, - "reqd": 0, + "fieldname": "base_grand_total", + "fieldtype": "Currency", + "label": "Grand Total (Company Currency)", + "oldfieldname": "grand_total", + "oldfieldtype": "Currency", + "options": "Company:company:default_currency", + "permlevel": 0, + "print_hide": 1, + "read_only": 1, + "reqd": 0, "width": "150px" - }, + }, { - "fieldname": "base_rounded_total", - "fieldtype": "Currency", - "label": "Rounded Total (Company Currency)", - "oldfieldname": "rounded_total", - "oldfieldtype": "Currency", - "options": "Company:company:default_currency", - "permlevel": 0, - "print_hide": 1, - "read_only": 1, + "fieldname": "base_rounded_total", + "fieldtype": "Currency", + "label": "Rounded Total (Company Currency)", + "oldfieldname": "rounded_total", + "oldfieldtype": "Currency", + "options": "Company:company:default_currency", + "permlevel": 0, + "print_hide": 1, + "read_only": 1, "width": "150px" - }, + }, { - "description": "In Words will be visible once you save the Sales Order.", - "fieldname": "base_in_words", - "fieldtype": "Data", - "label": "In Words (Company Currency)", - "oldfieldname": "in_words", - "oldfieldtype": "Data", - "permlevel": 0, - "print_hide": 1, - "read_only": 1, + "description": "In Words will be visible once you save the Sales Order.", + "fieldname": "base_in_words", + "fieldtype": "Data", + "label": "In Words (Company Currency)", + "oldfieldname": "in_words", + "oldfieldtype": "Data", + "permlevel": 0, + "print_hide": 1, + "read_only": 1, "width": "200px" - }, + }, { - "fieldname": "column_break3", - "fieldtype": "Column Break", - "oldfieldtype": "Column Break", - "permlevel": 0, - "print_hide": 1, + "fieldname": "column_break3", + "fieldtype": "Column Break", + "oldfieldtype": "Column Break", + "permlevel": 0, + "print_hide": 1, "width": "50%" - }, + }, { - "fieldname": "grand_total", - "fieldtype": "Currency", - "in_list_view": 1, - "label": "Grand Total", - "oldfieldname": "grand_total_export", - "oldfieldtype": "Currency", - "options": "currency", - "permlevel": 0, - "print_hide": 0, - "read_only": 1, - "reqd": 0, + "fieldname": "grand_total", + "fieldtype": "Currency", + "in_list_view": 1, + "label": "Grand Total", + "oldfieldname": "grand_total_export", + "oldfieldtype": "Currency", + "options": "currency", + "permlevel": 0, + "print_hide": 0, + "read_only": 1, + "reqd": 0, "width": "150px" - }, + }, { - "fieldname": "rounded_total", - "fieldtype": "Currency", - "label": "Rounded Total", - "oldfieldname": "rounded_total_export", - "oldfieldtype": "Currency", - "options": "currency", - "permlevel": 0, - "print_hide": 0, - "read_only": 1, + "fieldname": "rounded_total", + "fieldtype": "Currency", + "label": "Rounded Total", + "oldfieldname": "rounded_total_export", + "oldfieldtype": "Currency", + "options": "currency", + "permlevel": 0, + "print_hide": 0, + "read_only": 1, "width": "150px" - }, + }, { - "fieldname": "in_words", - "fieldtype": "Data", - "label": "In Words", - "oldfieldname": "in_words_export", - "oldfieldtype": "Data", - "permlevel": 0, - "print_hide": 0, - "read_only": 1, + "fieldname": "in_words", + "fieldtype": "Data", + "label": "In Words", + "oldfieldname": "in_words_export", + "oldfieldtype": "Data", + "permlevel": 0, + "print_hide": 0, + "read_only": 1, "width": "200px" - }, + }, { - "fieldname": "advance_paid", - "fieldtype": "Currency", - "label": "Advance Paid", - "options": "Company:company:default_currency", - "permlevel": 0, - "print_hide": 1, + "fieldname": "advance_paid", + "fieldtype": "Currency", + "label": "Advance Paid", + "options": "Company:company:default_currency", + "permlevel": 0, + "print_hide": 1, "read_only": 1 - }, + }, { - "fieldname": "view_details", - "fieldtype": "Fold", - "label": "View Details", + "fieldname": "view_details", + "fieldtype": "Fold", + "label": "View Details", "permlevel": 0 - }, + }, { - "description": "Display all the individual items delivered with the main items", - "fieldname": "packing_list", - "fieldtype": "Section Break", - "hidden": 0, - "label": "Packing List", - "oldfieldtype": "Section Break", - "options": "icon-suitcase", - "permlevel": 0, + "description": "Display all the individual items delivered with the main items", + "fieldname": "packing_list", + "fieldtype": "Section Break", + "hidden": 0, + "label": "Packing List", + "oldfieldtype": "Section Break", + "options": "icon-suitcase", + "permlevel": 0, "print_hide": 1 - }, + }, { - "fieldname": "packed_items", - "fieldtype": "Table", - "label": "Packed Items", - "oldfieldname": "packing_details", - "oldfieldtype": "Table", - "options": "Packed Item", - "permlevel": 0, - "print_hide": 1, + "fieldname": "packed_items", + "fieldtype": "Table", + "label": "Packed Items", + "oldfieldname": "packing_details", + "oldfieldtype": "Table", + "options": "Packed Item", + "permlevel": 0, + "print_hide": 1, "read_only": 1 - }, + }, { - "fieldname": "terms_section_break", - "fieldtype": "Section Break", - "label": "Terms and Conditions", - "oldfieldtype": "Section Break", - "options": "icon-legal", - "permlevel": 0, + "fieldname": "terms_section_break", + "fieldtype": "Section Break", + "label": "Terms and Conditions", + "oldfieldtype": "Section Break", + "options": "icon-legal", + "permlevel": 0, "print_hide": 0 - }, + }, { - "fieldname": "tc_name", - "fieldtype": "Link", - "label": "Terms", - "oldfieldname": "tc_name", - "oldfieldtype": "Link", - "options": "Terms and Conditions", - "permlevel": 0, - "print_hide": 1, + "fieldname": "tc_name", + "fieldtype": "Link", + "label": "Terms", + "oldfieldname": "tc_name", + "oldfieldtype": "Link", + "options": "Terms and Conditions", + "permlevel": 0, + "print_hide": 1, "search_index": 0 - }, + }, { - "fieldname": "terms", - "fieldtype": "Text Editor", - "label": "Terms and Conditions Details", - "oldfieldname": "terms", - "oldfieldtype": "Text Editor", - "permlevel": 0, + "fieldname": "terms", + "fieldtype": "Text Editor", + "label": "Terms and Conditions Details", + "oldfieldname": "terms", + "oldfieldtype": "Text Editor", + "permlevel": 0, "print_hide": 0 - }, + }, { - "depends_on": "customer", - "fieldname": "contact_info", - "fieldtype": "Section Break", - "label": "Contact Info", - "options": "icon-bullhorn", + "depends_on": "customer", + "fieldname": "contact_info", + "fieldtype": "Section Break", + "label": "Contact Info", + "options": "icon-bullhorn", "permlevel": 0 - }, + }, { - "fieldname": "col_break45", - "fieldtype": "Column Break", - "permlevel": 0, + "fieldname": "col_break45", + "fieldtype": "Column Break", + "permlevel": 0, "width": "50%" - }, + }, { - "description": "", - "fieldname": "territory", - "fieldtype": "Link", - "in_filter": 1, - "label": "Territory", - "options": "Territory", - "permlevel": 0, - "print_hide": 1, - "reqd": 1, + "description": "", + "fieldname": "territory", + "fieldtype": "Link", + "in_filter": 1, + "label": "Territory", + "options": "Territory", + "permlevel": 0, + "print_hide": 1, + "reqd": 1, "search_index": 1 - }, + }, { - "description": "", - "fieldname": "customer_group", - "fieldtype": "Link", - "in_filter": 1, - "label": "Customer Group", - "options": "Customer Group", - "permlevel": 0, - "print_hide": 1, - "reqd": 1, + "description": "", + "fieldname": "customer_group", + "fieldtype": "Link", + "in_filter": 1, + "label": "Customer Group", + "options": "Customer Group", + "permlevel": 0, + "print_hide": 1, + "reqd": 1, "search_index": 1 - }, + }, { - "fieldname": "col_break46", - "fieldtype": "Column Break", - "permlevel": 0, + "fieldname": "col_break46", + "fieldtype": "Column Break", + "permlevel": 0, "width": "50%" - }, + }, { - "fieldname": "customer_address", - "fieldtype": "Link", - "hidden": 0, - "in_filter": 1, - "label": "Customer Address", - "options": "Address", - "permlevel": 0, + "fieldname": "customer_address", + "fieldtype": "Link", + "hidden": 0, + "in_filter": 1, + "label": "Customer Address", + "options": "Address", + "permlevel": 0, "print_hide": 1 - }, + }, { - "fieldname": "contact_person", - "fieldtype": "Link", - "in_filter": 1, - "label": "Contact Person", - "options": "Contact", - "permlevel": 0, + "fieldname": "contact_person", + "fieldtype": "Link", + "in_filter": 1, + "label": "Contact Person", + "options": "Contact", + "permlevel": 0, "print_hide": 1 - }, + }, { - "fieldname": "more_info", - "fieldtype": "Section Break", - "label": "More Info", - "oldfieldtype": "Section Break", - "options": "icon-file-text", - "permlevel": 0, + "fieldname": "more_info", + "fieldtype": "Section Break", + "label": "More Info", + "oldfieldtype": "Section Break", + "options": "icon-file-text", + "permlevel": 0, "print_hide": 1 - }, + }, { - "description": "Track this Sales Order against any Project", - "fieldname": "project_name", - "fieldtype": "Link", - "in_filter": 1, - "label": "Project Name", - "oldfieldname": "project_name", - "oldfieldtype": "Link", - "options": "Project", - "permlevel": 0, + "description": "Track this Sales Order against any Project", + "fieldname": "project_name", + "fieldtype": "Link", + "in_filter": 1, + "label": "Project Name", + "oldfieldname": "project_name", + "oldfieldtype": "Link", + "options": "Project", + "permlevel": 0, "search_index": 1 - }, + }, { - "depends_on": "eval:doc.source == 'Campaign'", - "fieldname": "campaign", - "fieldtype": "Link", - "label": "Campaign", - "oldfieldname": "campaign", - "oldfieldtype": "Link", - "options": "Campaign", - "permlevel": 0, + "depends_on": "eval:doc.source == 'Campaign'", + "fieldname": "campaign", + "fieldtype": "Link", + "label": "Campaign", + "oldfieldname": "campaign", + "oldfieldtype": "Link", + "options": "Campaign", + "permlevel": 0, "print_hide": 1 - }, + }, { - "fieldname": "source", - "fieldtype": "Select", - "label": "Source", - "oldfieldname": "source", - "oldfieldtype": "Select", - "options": "\nExisting Customer\nReference\nAdvertisement\nCold Calling\nExhibition\nSupplier Reference\nMass Mailing\nCustomer's Vendor\nCampaign", - "permlevel": 0, + "fieldname": "source", + "fieldtype": "Select", + "label": "Source", + "oldfieldname": "source", + "oldfieldtype": "Select", + "options": "\nExisting Customer\nReference\nAdvertisement\nCold Calling\nExhibition\nSupplier Reference\nMass Mailing\nCustomer's Vendor\nCampaign", + "permlevel": 0, "print_hide": 1 - }, + }, { - "fieldname": "column_break4", - "fieldtype": "Column Break", - "oldfieldtype": "Column Break", - "permlevel": 0, - "print_hide": 1, + "fieldname": "column_break4", + "fieldtype": "Column Break", + "oldfieldtype": "Column Break", + "permlevel": 0, + "print_hide": 1, "width": "50%" - }, + }, { - "allow_on_submit": 1, - "fieldname": "letter_head", - "fieldtype": "Link", - "label": "Letter Head", - "oldfieldname": "letter_head", - "oldfieldtype": "Select", - "options": "Letter Head", - "permlevel": 0, + "allow_on_submit": 1, + "fieldname": "letter_head", + "fieldtype": "Link", + "label": "Letter Head", + "oldfieldname": "letter_head", + "oldfieldtype": "Select", + "options": "Letter Head", + "permlevel": 0, "print_hide": 1 - }, + }, { - "allow_on_submit": 1, - "fieldname": "select_print_heading", - "fieldtype": "Link", - "label": "Print Heading", - "no_copy": 1, - "oldfieldname": "select_print_heading", - "oldfieldtype": "Link", - "options": "Print Heading", - "permlevel": 0, - "print_hide": 1, + "allow_on_submit": 1, + "fieldname": "select_print_heading", + "fieldtype": "Link", + "label": "Print Heading", + "no_copy": 1, + "oldfieldname": "select_print_heading", + "oldfieldtype": "Link", + "options": "Print Heading", + "permlevel": 0, + "print_hide": 1, "report_hide": 1 - }, + }, { - "fieldname": "fiscal_year", - "fieldtype": "Link", - "in_filter": 1, - "label": "Fiscal Year", - "oldfieldname": "fiscal_year", - "oldfieldtype": "Select", - "options": "Fiscal Year", - "permlevel": 0, - "print_hide": 1, - "reqd": 1, - "search_index": 1, + "fieldname": "fiscal_year", + "fieldtype": "Link", + "in_filter": 1, + "label": "Fiscal Year", + "oldfieldname": "fiscal_year", + "oldfieldtype": "Select", + "options": "Fiscal Year", + "permlevel": 0, + "print_hide": 1, + "reqd": 1, + "search_index": 1, "width": "150px" - }, + }, { - "fieldname": "section_break_78", - "fieldtype": "Section Break", - "oldfieldtype": "Column Break", - "permlevel": 0, - "print_hide": 1, + "fieldname": "section_break_78", + "fieldtype": "Section Break", + "oldfieldtype": "Column Break", + "permlevel": 0, + "print_hide": 1, "width": "50%" - }, + }, { - "default": "Draft", - "fieldname": "status", - "fieldtype": "Select", - "in_filter": 1, - "in_list_view": 1, - "label": "Status", - "no_copy": 1, - "oldfieldname": "status", - "oldfieldtype": "Select", - "options": "\nDraft\nSubmitted\nStopped\nCancelled", - "permlevel": 0, - "print_hide": 1, - "read_only": 1, - "reqd": 1, - "search_index": 1, + "default": "Draft", + "fieldname": "status", + "fieldtype": "Select", + "in_filter": 1, + "in_list_view": 1, + "label": "Status", + "no_copy": 1, + "oldfieldname": "status", + "oldfieldtype": "Select", + "options": "\nDraft\nSubmitted\nStopped\nCancelled", + "permlevel": 0, + "print_hide": 1, + "read_only": 1, + "reqd": 1, + "search_index": 1, "width": "100px" - }, + }, { - "fieldname": "delivery_status", - "fieldtype": "Select", - "hidden": 1, - "label": "Delivery Status", - "no_copy": 1, - "options": "Not Delivered\nFully Delivered\nPartly Delivered\nClosed\nNot Applicable", - "permlevel": 0, + "fieldname": "delivery_status", + "fieldtype": "Select", + "hidden": 1, + "label": "Delivery Status", + "no_copy": 1, + "options": "Not Delivered\nFully Delivered\nPartly Delivered\nClosed\nNot Applicable", + "permlevel": 0, "print_hide": 1 - }, + }, { - "depends_on": "eval:!doc.__islocal", - "description": "% of materials delivered against this Sales Order", - "fieldname": "per_delivered", - "fieldtype": "Percent", - "in_filter": 1, - "in_list_view": 1, - "label": "% Delivered", - "no_copy": 1, - "oldfieldname": "per_delivered", - "oldfieldtype": "Currency", - "permlevel": 0, - "print_hide": 1, - "read_only": 1, + "depends_on": "eval:!doc.__islocal", + "description": "% of materials delivered against this Sales Order", + "fieldname": "per_delivered", + "fieldtype": "Percent", + "in_filter": 1, + "in_list_view": 1, + "label": "% Delivered", + "no_copy": 1, + "oldfieldname": "per_delivered", + "oldfieldtype": "Currency", + "permlevel": 0, + "print_hide": 1, + "read_only": 1, "width": "100px" - }, + }, { - "fieldname": "column_break_81", - "fieldtype": "Column Break", + "fieldname": "column_break_81", + "fieldtype": "Column Break", "permlevel": 0 - }, + }, { - "depends_on": "eval:!doc.__islocal", - "description": "% of materials billed against this Sales Order", - "fieldname": "per_billed", - "fieldtype": "Percent", - "in_filter": 1, - "in_list_view": 1, - "label": "% Amount Billed", - "no_copy": 1, - "oldfieldname": "per_billed", - "oldfieldtype": "Currency", - "permlevel": 0, - "print_hide": 1, - "read_only": 1, + "depends_on": "eval:!doc.__islocal", + "description": "% of materials billed against this Sales Order", + "fieldname": "per_billed", + "fieldtype": "Percent", + "in_filter": 1, + "in_list_view": 1, + "label": "% Amount Billed", + "no_copy": 1, + "oldfieldname": "per_billed", + "oldfieldtype": "Currency", + "permlevel": 0, + "print_hide": 1, + "read_only": 1, "width": "100px" - }, + }, { - "fieldname": "billing_status", - "fieldtype": "Select", - "hidden": 1, - "label": "Billing Status", - "no_copy": 1, - "options": "Not Billed\nFully Billed\nPartly Billed\nClosed", - "permlevel": 0, + "fieldname": "billing_status", + "fieldtype": "Select", + "hidden": 1, + "label": "Billing Status", + "no_copy": 1, + "options": "Not Billed\nFully Billed\nPartly Billed\nClosed", + "permlevel": 0, "print_hide": 1 - }, + }, { - "fieldname": "sales_team_section_break", - "fieldtype": "Section Break", - "label": "Sales Team", - "oldfieldtype": "Section Break", - "options": "icon-group", - "permlevel": 0, + "fieldname": "sales_team_section_break", + "fieldtype": "Section Break", + "label": "Sales Team", + "oldfieldtype": "Section Break", + "options": "icon-group", + "permlevel": 0, "print_hide": 1 - }, + }, { - "fieldname": "sales_partner", - "fieldtype": "Link", - "in_filter": 1, - "label": "Sales Partner", - "oldfieldname": "sales_partner", - "oldfieldtype": "Link", - "options": "Sales Partner", - "permlevel": 0, - "print_hide": 1, - "search_index": 1, + "fieldname": "sales_partner", + "fieldtype": "Link", + "in_filter": 1, + "label": "Sales Partner", + "oldfieldname": "sales_partner", + "oldfieldtype": "Link", + "options": "Sales Partner", + "permlevel": 0, + "print_hide": 1, + "search_index": 1, "width": "150px" - }, + }, { - "fieldname": "column_break7", - "fieldtype": "Column Break", - "permlevel": 0, - "print_hide": 1, + "fieldname": "column_break7", + "fieldtype": "Column Break", + "permlevel": 0, + "print_hide": 1, "width": "50%" - }, + }, { - "fieldname": "commission_rate", - "fieldtype": "Float", - "label": "Commission Rate", - "oldfieldname": "commission_rate", - "oldfieldtype": "Currency", - "permlevel": 0, - "print_hide": 1, + "fieldname": "commission_rate", + "fieldtype": "Float", + "label": "Commission Rate", + "oldfieldname": "commission_rate", + "oldfieldtype": "Currency", + "permlevel": 0, + "print_hide": 1, "width": "100px" - }, + }, { - "fieldname": "total_commission", - "fieldtype": "Currency", - "label": "Total Commission", - "oldfieldname": "total_commission", - "oldfieldtype": "Currency", - "options": "Company:company:default_currency", - "permlevel": 0, + "fieldname": "total_commission", + "fieldtype": "Currency", + "label": "Total Commission", + "oldfieldname": "total_commission", + "oldfieldtype": "Currency", + "options": "Company:company:default_currency", + "permlevel": 0, "print_hide": 1 - }, + }, { - "fieldname": "section_break1", - "fieldtype": "Section Break", - "permlevel": 0, + "fieldname": "section_break1", + "fieldtype": "Section Break", + "permlevel": 0, "print_hide": 1 - }, + }, { - "fieldname": "sales_team", - "fieldtype": "Table", - "label": "Sales Team1", - "oldfieldname": "sales_team", - "oldfieldtype": "Table", - "options": "Sales Team", - "permlevel": 0, + "fieldname": "sales_team", + "fieldtype": "Table", + "label": "Sales Team1", + "oldfieldname": "sales_team", + "oldfieldtype": "Table", + "options": "Sales Team", + "permlevel": 0, "print_hide": 1 - }, + }, { - "fieldname": "recurring_order", - "fieldtype": "Section Break", - "label": "Recurring Order", - "options": "icon-time", + "fieldname": "recurring_order", + "fieldtype": "Section Break", + "label": "Recurring Order", + "options": "icon-time", "permlevel": 0 - }, + }, { - "fieldname": "column_break82", - "fieldtype": "Column Break", - "label": "Column Break", + "fieldname": "column_break82", + "fieldtype": "Column Break", + "label": "Column Break", "permlevel": 0 - }, + }, { - "allow_on_submit": 1, - "depends_on": "eval:doc.docstatus<2", - "description": "Check if recurring order, uncheck to stop recurring or put proper End Date", - "fieldname": "is_recurring", - "fieldtype": "Check", - "label": "Is Recurring", - "no_copy": 1, - "permlevel": 0, + "allow_on_submit": 1, + "depends_on": "eval:doc.docstatus<2", + "description": "Check if recurring order, uncheck to stop recurring or put proper End Date", + "fieldname": "is_recurring", + "fieldtype": "Check", + "label": "Is Recurring", + "no_copy": 1, + "permlevel": 0, "print_hide": 1 - }, + }, { - "allow_on_submit": 1, - "depends_on": "eval:doc.is_recurring==1", - "description": "Select the period when the invoice will be generated automatically", - "fieldname": "recurring_type", - "fieldtype": "Select", - "label": "Recurring Type", - "no_copy": 1, - "options": "\nMonthly\nQuarterly\nHalf-yearly\nYearly", - "permlevel": 0, + "allow_on_submit": 1, + "depends_on": "eval:doc.is_recurring==1", + "description": "Select the period when the invoice will be generated automatically", + "fieldname": "recurring_type", + "fieldtype": "Select", + "label": "Recurring Type", + "no_copy": 1, + "options": "\nMonthly\nQuarterly\nHalf-yearly\nYearly", + "permlevel": 0, "print_hide": 1 - }, + }, { - "allow_on_submit": 1, - "depends_on": "eval:doc.is_recurring==1", - "description": "Start date of current order's period", - "fieldname": "from_date", - "fieldtype": "Date", - "label": "From Date", - "no_copy": 1, + "allow_on_submit": 1, + "depends_on": "eval:doc.is_recurring==1", + "description": "Start date of current order's period", + "fieldname": "from_date", + "fieldtype": "Date", + "label": "From Date", + "no_copy": 1, "permlevel": 0 - }, + }, { - "allow_on_submit": 1, - "depends_on": "eval:doc.is_recurring==1", - "description": "End date of current order's period", - "fieldname": "to_date", - "fieldtype": "Date", - "label": "To Date", - "no_copy": 1, + "allow_on_submit": 1, + "depends_on": "eval:doc.is_recurring==1", + "description": "End date of current order's period", + "fieldname": "to_date", + "fieldtype": "Date", + "label": "To Date", + "no_copy": 1, "permlevel": 0 - }, + }, { - "allow_on_submit": 1, - "depends_on": "eval:doc.is_recurring==1", - "description": "The day of the month on which auto order will be generated e.g. 05, 28 etc ", - "fieldname": "repeat_on_day_of_month", - "fieldtype": "Int", - "label": "Repeat on Day of Month", - "no_copy": 1, - "permlevel": 0, + "allow_on_submit": 1, + "depends_on": "eval:doc.is_recurring==1", + "description": "The day of the month on which auto order will be generated e.g. 05, 28 etc ", + "fieldname": "repeat_on_day_of_month", + "fieldtype": "Int", + "label": "Repeat on Day of Month", + "no_copy": 1, + "permlevel": 0, "print_hide": 1 - }, + }, { - "allow_on_submit": 1, - "depends_on": "eval:doc.is_recurring==1", - "description": "The date on which recurring order will be stop", - "fieldname": "end_date", - "fieldtype": "Date", - "label": "End Date", - "no_copy": 1, - "permlevel": 0, + "allow_on_submit": 1, + "depends_on": "eval:doc.is_recurring==1", + "description": "The date on which recurring order will be stop", + "fieldname": "end_date", + "fieldtype": "Date", + "label": "End Date", + "no_copy": 1, + "permlevel": 0, "print_hide": 1 - }, + }, { - "fieldname": "column_break83", - "fieldtype": "Column Break", - "label": "Column Break", - "permlevel": 0, + "fieldname": "column_break83", + "fieldtype": "Column Break", + "label": "Column Break", + "permlevel": 0, "print_hide": 1 - }, + }, { - "depends_on": "eval:doc.is_recurring==1", - "description": "The date on which next invoice will be generated. It is generated on submit.", - "fieldname": "next_date", - "fieldtype": "Date", - "label": "Next Date", - "no_copy": 1, - "permlevel": 0, - "print_hide": 1, + "depends_on": "eval:doc.is_recurring==1", + "description": "The date on which next invoice will be generated. It is generated on submit.", + "fieldname": "next_date", + "fieldtype": "Date", + "label": "Next Date", + "no_copy": 1, + "permlevel": 0, + "print_hide": 1, "read_only": 1 - }, + }, { - "depends_on": "eval:doc.is_recurring==1", - "fieldname": "recurring_id", - "fieldtype": "Data", - "label": "Recurring Id", - "no_copy": 1, - "permlevel": 0, - "print_hide": 1, + "depends_on": "eval:doc.is_recurring==1", + "fieldname": "recurring_id", + "fieldtype": "Data", + "label": "Recurring Id", + "no_copy": 1, + "permlevel": 0, + "print_hide": 1, "read_only": 1 - }, + }, { - "allow_on_submit": 1, - "depends_on": "eval:doc.is_recurring==1", - "description": "Enter email id separated by commas, order will be mailed automatically on particular date", - "fieldname": "notification_email_address", - "fieldtype": "Small Text", - "ignore_user_permissions": 0, - "label": "Notification Email Address", - "no_copy": 1, - "permlevel": 0, + "allow_on_submit": 1, + "depends_on": "eval:doc.is_recurring==1", + "description": "Enter email id separated by commas, order will be mailed automatically on particular date", + "fieldname": "notification_email_address", + "fieldtype": "Small Text", + "ignore_user_permissions": 0, + "label": "Notification Email Address", + "no_copy": 1, + "permlevel": 0, "print_hide": 1 } - ], - "icon": "icon-file-text", - "idx": 1, - "is_submittable": 1, - "issingle": 0, - "modified": "2015-02-11 15:42:09.174504", - "modified_by": "Administrator", - "module": "Selling", - "name": "Sales Order", - "owner": "Administrator", + ], + "icon": "icon-file-text", + "idx": 1, + "is_submittable": 1, + "issingle": 0, + "modified": "2015-02-11 15:42:09.174504", + "modified_by": "Administrator", + "module": "Selling", + "name": "Sales Order", + "owner": "Administrator", "permissions": [ { - "amend": 1, - "apply_user_permissions": 1, - "cancel": 1, - "create": 1, - "delete": 1, - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Sales User", - "share": 1, - "submit": 1, + "amend": 1, + "apply_user_permissions": 1, + "cancel": 1, + "create": 1, + "delete": 1, + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Sales User", + "share": 1, + "submit": 1, "write": 1 - }, + }, { - "amend": 1, - "cancel": 1, - "create": 1, - "delete": 1, - "email": 1, - "export": 1, - "import": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Sales Manager", - "set_user_permissions": 1, - "share": 1, - "submit": 1, + "amend": 1, + "cancel": 1, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "import": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Sales Manager", + "set_user_permissions": 1, + "share": 1, + "submit": 1, "write": 1 - }, + }, { - "amend": 1, - "apply_user_permissions": 1, - "cancel": 1, - "create": 1, - "delete": 1, - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Maintenance User", - "share": 1, - "submit": 1, + "amend": 1, + "apply_user_permissions": 1, + "cancel": 1, + "create": 1, + "delete": 1, + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Maintenance User", + "share": 1, + "submit": 1, "write": 1 - }, + }, { - "apply_user_permissions": 1, - "cancel": 0, - "delete": 0, - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, + "apply_user_permissions": 1, + "cancel": 0, + "delete": 0, + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, "role": "Accounts User" - }, + }, { - "apply_user_permissions": 1, - "cancel": 0, - "delete": 0, - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, + "apply_user_permissions": 1, + "cancel": 0, + "delete": 0, + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, "role": "Customer" - }, + }, { - "apply_user_permissions": 1, - "permlevel": 0, - "read": 1, - "report": 1, + "apply_user_permissions": 1, + "permlevel": 0, + "read": 1, + "report": 1, "role": "Material User" - }, + }, { - "permlevel": 1, - "read": 1, - "role": "Sales Manager", + "permlevel": 1, + "read": 1, + "role": "Sales Manager", "write": 1 } - ], - "read_only_onload": 1, - "search_fields": "status,transaction_date,customer,customer_name, territory,order_type,company", - "sort_field": "modified", - "sort_order": "DESC", + ], + "read_only_onload": 1, + "search_fields": "status,transaction_date,customer,customer_name, territory,order_type,company", + "sort_field": "modified", + "sort_order": "DESC", "title_field": "customer_name" -} \ No newline at end of file +} diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py index d4b92e4f59..64523a9ab4 100644 --- a/erpnext/selling/doctype/sales_order/sales_order.py +++ b/erpnext/selling/doctype/sales_order/sales_order.py @@ -142,7 +142,7 @@ class SalesOrder(SellingController): self.check_credit_limit() self.update_stock_ledger(update_stock = 1) - frappe.get_doc('Authorization Control').validate_approving_authority(self.doctype, self.grand_total, self) + frappe.get_doc('Authorization Control').validate_approving_authority(self.doctype, self.base_grand_total, self) self.update_prevdoc_status('submit') frappe.db.set(self, 'status', 'Submitted') diff --git a/erpnext/selling/doctype/sales_order/sales_order_list.js b/erpnext/selling/doctype/sales_order/sales_order_list.js index 36220c5042..eef91620b4 100644 --- a/erpnext/selling/doctype/sales_order/sales_order_list.js +++ b/erpnext/selling/doctype/sales_order/sales_order_list.js @@ -1,5 +1,5 @@ frappe.listview_settings['Sales Order'] = { - add_fields: ["grand_total", "customer_name", "currency", "delivery_date", "per_delivered", "per_billed", + add_fields: ["base_grand_total", "customer_name", "currency", "delivery_date", "per_delivered", "per_billed", "status"], get_indicator: function(doc) { if(doc.status==="Stopped") { diff --git a/erpnext/selling/doctype/sales_order/test_records.json b/erpnext/selling/doctype/sales_order/test_records.json index 0154d321a9..95a43b9f27 100644 --- a/erpnext/selling/doctype/sales_order/test_records.json +++ b/erpnext/selling/doctype/sales_order/test_records.json @@ -10,8 +10,8 @@ "delivery_date": "2013-02-23", "doctype": "Sales Order", "fiscal_year": "_Test Fiscal Year 2013", + "base_grand_total": 1000.0, "grand_total": 1000.0, - "grand_total_export": 1000.0, "naming_series": "_T-Sales Order-", "order_type": "Sales", "plc_conversion_rate": 1.0, diff --git a/erpnext/selling/report/customer_acquisition_and_loyalty/customer_acquisition_and_loyalty.py b/erpnext/selling/report/customer_acquisition_and_loyalty/customer_acquisition_and_loyalty.py index 1ec9871b77..bbf61630e2 100644 --- a/erpnext/selling/report/customer_acquisition_and_loyalty/customer_acquisition_and_loyalty.py +++ b/erpnext/selling/report/customer_acquisition_and_loyalty/customer_acquisition_and_loyalty.py @@ -17,7 +17,7 @@ def execute(filters=None): if filters.get("company"): company_condition = ' and company=%(company)s' - for si in frappe.db.sql("""select posting_date, customer, grand_total from `tabSales Invoice` + for si in frappe.db.sql("""select posting_date, customer, base_grand_total from `tabSales Invoice` where docstatus=1 and posting_date <= %(to_date)s {company_condition} order by posting_date""".format(company_condition=company_condition), filters, as_dict=1): @@ -26,12 +26,12 @@ def execute(filters=None): if not si.customer in customers: new_customers_in.setdefault(key, [0, 0.0]) new_customers_in[key][0] += 1 - new_customers_in[key][1] += si.grand_total + new_customers_in[key][1] += si.base_grand_total customers.append(si.customer) else: repeat_customers_in.setdefault(key, [0, 0.0]) repeat_customers_in[key][0] += 1 - repeat_customers_in[key][1] += si.grand_total + repeat_customers_in[key][1] += si.base_grand_total # time series from_year, from_month, temp = filters.get("from_date").split("-") diff --git a/erpnext/selling/report/customers_not_buying_since_long_time/customers_not_buying_since_long_time.py b/erpnext/selling/report/customers_not_buying_since_long_time/customers_not_buying_since_long_time.py index a87c4a119f..5b1eb9b677 100644 --- a/erpnext/selling/report/customers_not_buying_since_long_time/customers_not_buying_since_long_time.py +++ b/erpnext/selling/report/customers_not_buying_since_long_time/customers_not_buying_since_long_time.py @@ -30,10 +30,10 @@ def get_so_details(): cust.territory, cust.customer_group, count(distinct(so.name)) as 'num_of_order', - sum(net_total) as 'total_order_value', + sum(base_net_total) as 'total_order_value', sum(if(so.status = "Stopped", - so.net_total * so.per_delivered/100, - so.net_total)) as 'total_order_considered', + so.base_net_total * so.per_delivered/100, + so.base_net_total)) as 'total_order_considered', max(so.transaction_date) as 'last_sales_order_date', DATEDIFF(CURDATE(), max(so.transaction_date)) as 'days_since_last_order' from `tabCustomer` cust, `tabSales Order` so @@ -42,7 +42,7 @@ def get_so_details(): order by 'days_since_last_order' desc """,as_list=1) def get_last_so_amt(customer): - res = frappe.db.sql("""select net_total from `tabSales Order` + res = frappe.db.sql("""select base_net_total from `tabSales Order` where customer ='%(customer)s' and docstatus = 1 order by transaction_date desc limit 1""" % {'customer':customer}) diff --git a/erpnext/selling/sales_common.js b/erpnext/selling/sales_common.js index 50fadc8c8c..e4be0b841b 100644 --- a/erpnext/selling/sales_common.js +++ b/erpnext/selling/sales_common.js @@ -178,20 +178,20 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({ }, total_commission: function() { - if(this.frm.doc.net_total) { - frappe.model.round_floats_in(this.frm.doc, ["net_total", "total_commission"]); + if(this.frm.doc.base_net_total) { + frappe.model.round_floats_in(this.frm.doc, ["base_net_total", "total_commission"]); - if(this.frm.doc.net_total < this.frm.doc.total_commission) { + if(this.frm.doc.base_net_total < this.frm.doc.total_commission) { var msg = (__("[Error]") + " " + __(frappe.meta.get_label(this.frm.doc.doctype, "total_commission", this.frm.doc.name)) + " > " + - __(frappe.meta.get_label(this.frm.doc.doctype, "net_total", this.frm.doc.name))); + __(frappe.meta.get_label(this.frm.doc.doctype, "base_net_total", this.frm.doc.name))); msgprint(msg); throw msg; } this.frm.set_value("commission_rate", - flt(this.frm.doc.total_commission * 100.0 / this.frm.doc.net_total)); + flt(this.frm.doc.total_commission * 100.0 / this.frm.doc.base_net_total)); } }, @@ -201,7 +201,7 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({ if(sales_person.allocated_percentage) { sales_person.allocated_percentage = flt(sales_person.allocated_percentage, precision("allocated_percentage", sales_person)); - sales_person.allocated_amount = flt(this.frm.doc.net_total * + sales_person.allocated_amount = flt(this.frm.doc.base_net_total * sales_person.allocated_percentage / 100.0, precision("allocated_amount", sales_person)); @@ -235,37 +235,37 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({ calculate_net_total: function() { var me = this; - this.frm.doc.net_total = this.frm.doc.net_total_export = 0.0; + this.frm.doc.base_net_total = this.frm.doc.net_total = 0.0; $.each(this.frm.doc["items"] || [], function(i, item) { - me.frm.doc.net_total += item.base_amount; - me.frm.doc.net_total_export += item.amount; + me.frm.doc.base_net_total += item.base_amount; + me.frm.doc.net_total += item.amount; }); - frappe.model.round_floats_in(this.frm.doc, ["net_total", "net_total_export"]); + frappe.model.round_floats_in(this.frm.doc, ["base_net_total", "net_total"]); }, calculate_totals: function() { var me = this; var tax_count = this.frm.doc["taxes"] ? this.frm.doc["taxes"].length: 0; - this.frm.doc.grand_total = flt(tax_count ? this.frm.doc["taxes"][tax_count - 1].total : this.frm.doc.net_total); + this.frm.doc.base_grand_total = flt(tax_count ? this.frm.doc["taxes"][tax_count - 1].total : this.frm.doc.base_net_total); - this.frm.doc.other_charges_total = flt(this.frm.doc.grand_total - this.frm.doc.net_total, - precision("other_charges_total")); + this.frm.doc.base_total_taxes_and_charges = flt(this.frm.doc.base_grand_total - this.frm.doc.base_net_total, + precision("base_total_taxes_and_charges")); - this.frm.doc.grand_total_export = (this.frm.doc.other_charges_total || this.frm.doc.discount_amount) ? - flt(this.frm.doc.grand_total / this.frm.doc.conversion_rate) : this.frm.doc.net_total_export; + this.frm.doc.grand_total = (this.frm.doc.base_total_taxes_and_charges || this.frm.doc.discount_amount) ? + flt(this.frm.doc.base_grand_total / this.frm.doc.conversion_rate) : this.frm.doc.net_total; - this.frm.doc.other_charges_total_export = flt(this.frm.doc.grand_total_export - - this.frm.doc.net_total_export + flt(this.frm.doc.discount_amount), - precision("other_charges_total_export")); + this.frm.doc.total_taxes_and_charges = flt(this.frm.doc.grand_total - + this.frm.doc.net_total + flt(this.frm.doc.discount_amount), + precision("total_taxes_and_charges")); + this.frm.doc.base_grand_total = flt(this.frm.doc.base_grand_total, precision("base_grand_total")); this.frm.doc.grand_total = flt(this.frm.doc.grand_total, precision("grand_total")); - this.frm.doc.grand_total_export = flt(this.frm.doc.grand_total_export, precision("grand_total_export")); + this.frm.doc.base_rounded_total = Math.round(this.frm.doc.base_grand_total); this.frm.doc.rounded_total = Math.round(this.frm.doc.grand_total); - this.frm.doc.rounded_total_export = Math.round(this.frm.doc.grand_total_export); }, calculate_outstanding_amount: function(update_paid_amount) { @@ -273,9 +273,9 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({ // paid_amount and write_off_amount is only for POS Invoice // total_advance is only for non POS Invoice if(this.frm.doc.doctype == "Sales Invoice" && this.frm.doc.docstatus==0) { - frappe.model.round_floats_in(this.frm.doc, ["grand_total", "total_advance", "write_off_amount", + frappe.model.round_floats_in(this.frm.doc, ["base_grand_total", "total_advance", "write_off_amount", "paid_amount"]); - var total_amount_to_pay = this.frm.doc.grand_total - this.frm.doc.write_off_amount + var total_amount_to_pay = this.frm.doc.base_grand_total - this.frm.doc.write_off_amount - this.frm.doc.total_advance; if(this.frm.doc.is_pos) { if(!this.frm.doc.paid_amount || update_paid_amount===undefined || update_paid_amount) { @@ -301,7 +301,7 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({ throw msg; } - this.frm.doc.total_commission = flt(this.frm.doc.net_total * this.frm.doc.commission_rate / 100.0, + this.frm.doc.total_commission = flt(this.frm.doc.base_net_total * this.frm.doc.commission_rate / 100.0, precision("total_commission")); } }, @@ -312,7 +312,7 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({ frappe.model.round_floats_in(sales_person); if(sales_person.allocated_percentage) { sales_person.allocated_amount = flt( - me.frm.doc.net_total * sales_person.allocated_percentage / 100.0, + me.frm.doc.base_net_total * sales_person.allocated_percentage / 100.0, precision("allocated_amount", sales_person)); } }); @@ -371,13 +371,13 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({ } }); }; - setup_field_label_map(["net_total", "other_charges_total", "base_discount_amount", "grand_total", - "rounded_total", "in_words", + setup_field_label_map(["base_net_total", "base_total_taxes_and_charges", "base_discount_amount", "base_grand_total", + "base_rounded_total", "base_in_words", "outstanding_amount", "total_advance", "paid_amount", "write_off_amount"], company_currency); - setup_field_label_map(["net_total_export", "other_charges_total_export", "discount_amount", "grand_total_export", - "rounded_total_export", "in_words_export"], this.frm.doc.currency); + setup_field_label_map(["net_total", "total_taxes_and_charges", "discount_amount", "grand_total", + "rounded_total", "in_words"], this.frm.doc.currency); cur_frm.set_df_property("conversion_rate", "description", "1 " + this.frm.doc.currency + " = [?] " + company_currency) @@ -388,8 +388,8 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({ } // toggle fields - this.frm.toggle_display(["conversion_rate", "net_total", "other_charges_total", - "grand_total", "rounded_total", "in_words", "base_discount_amount"], + this.frm.toggle_display(["conversion_rate", "base_net_total", "base_total_taxes_and_charges", + "base_grand_total", "base_rounded_total", "base_in_words", "base_discount_amount"], this.frm.doc.currency != company_currency); this.frm.toggle_display(["plc_conversion_rate", "price_list_currency"], diff --git a/erpnext/setup/doctype/email_digest/email_digest.py b/erpnext/setup/doctype/email_digest/email_digest.py index 96f75c0a34..ff97d3bf89 100644 --- a/erpnext/setup/doctype/email_digest/email_digest.py +++ b/erpnext/setup/doctype/email_digest/email_digest.py @@ -246,15 +246,15 @@ class EmailDigest(Document): date_field="transaction_date") def get_new_quotations(self): - return self.get_new_sum("Quotation", self.meta.get_label("new_quotations"), "grand_total", + return self.get_new_sum("Quotation", self.meta.get_label("new_quotations"), "base_grand_total", date_field="transaction_date") def get_new_sales_orders(self): - return self.get_new_sum("Sales Order", self.meta.get_label("new_sales_orders"), "grand_total", + return self.get_new_sum("Sales Order", self.meta.get_label("new_sales_orders"), "base_grand_total", date_field="transaction_date") def get_new_delivery_notes(self): - return self.get_new_sum("Delivery Note", self.meta.get_label("new_delivery_notes"), "grand_total", + return self.get_new_sum("Delivery Note", self.meta.get_label("new_delivery_notes"), "base_grand_total", date_field="posting_date") def get_new_purchase_requests(self): @@ -263,15 +263,15 @@ class EmailDigest(Document): def get_new_supplier_quotations(self): return self.get_new_sum("Supplier Quotation", self.meta.get_label("new_supplier_quotations"), - "grand_total", date_field="transaction_date") + "base_grand_total", date_field="transaction_date") def get_new_purchase_orders(self): return self.get_new_sum("Purchase Order", self.meta.get_label("new_purchase_orders"), - "grand_total", date_field="transaction_date") + "base_grand_total", date_field="transaction_date") def get_new_purchase_receipts(self): return self.get_new_sum("Purchase Receipt", self.meta.get_label("new_purchase_receipts"), - "grand_total", date_field="posting_date") + "base_grand_total", date_field="posting_date") def get_new_stock_entries(self): return self.get_new_sum("Stock Entry", self.meta.get_label("new_stock_entries"), "total_amount", diff --git a/erpnext/setup/doctype/global_defaults/global_defaults.py b/erpnext/setup/doctype/global_defaults/global_defaults.py index e67ba44438..5f5bd6c503 100644 --- a/erpnext/setup/doctype/global_defaults/global_defaults.py +++ b/erpnext/setup/doctype/global_defaults/global_defaults.py @@ -57,8 +57,8 @@ class GlobalDefaults(Document): # Make property setters to hide rounded total fields for doctype in ("Quotation", "Sales Order", "Sales Invoice", "Delivery Note"): - make_property_setter(doctype, "rounded_total", "hidden", self.disable_rounded_total, "Check") - make_property_setter(doctype, "rounded_total", "print_hide", 1, "Check") + make_property_setter(doctype, "base_rounded_total", "hidden", self.disable_rounded_total, "Check") + make_property_setter(doctype, "base_rounded_total", "print_hide", 1, "Check") - make_property_setter(doctype, "rounded_total_export", "hidden", self.disable_rounded_total, "Check") - make_property_setter(doctype, "rounded_total_export", "print_hide", self.disable_rounded_total, "Check") + make_property_setter(doctype, "rounded_total", "hidden", self.disable_rounded_total, "Check") + make_property_setter(doctype, "rounded_total", "print_hide", self.disable_rounded_total, "Check") diff --git a/erpnext/shopping_cart/cart.py b/erpnext/shopping_cart/cart.py index 5b544858ec..7b836166c5 100644 --- a/erpnext/shopping_cart/cart.py +++ b/erpnext/shopping_cart/cart.py @@ -144,7 +144,7 @@ def decorate_quotation_doc(quotation_doc): d["formatted_tax_amount"] = fmt_money(flt(d.get("tax_amount")) / doc.conversion_rate, currency=doc.currency) - doc.formatted_grand_total_export = fmt_money(doc.grand_total_export, + doc.formatted_grand_total_export = fmt_money(doc.grand_total, currency=doc.currency) return doc diff --git a/erpnext/shopping_cart/test_shopping_cart.py b/erpnext/shopping_cart/test_shopping_cart.py index 9d124b787a..00222bb3b5 100644 --- a/erpnext/shopping_cart/test_shopping_cart.py +++ b/erpnext/shopping_cart/test_shopping_cart.py @@ -84,7 +84,7 @@ class TestShoppingCart(unittest.TestCase): self.assertEquals(quotation.get("items")[0].item_code, "_Test Item") self.assertEquals(quotation.get("items")[0].qty, 5) self.assertEquals(quotation.get("items")[0].amount, 50) - self.assertEquals(quotation.net_total, 70) + self.assertEquals(quotation.base_net_total, 70) self.assertEquals(len(quotation.get("items")), 2) def test_remove_from_cart(self): @@ -97,13 +97,13 @@ class TestShoppingCart(unittest.TestCase): self.assertEquals(quotation.get("items")[0].item_code, "_Test Item 2") self.assertEquals(quotation.get("items")[0].qty, 1) self.assertEquals(quotation.get("items")[0].amount, 20) - self.assertEquals(quotation.net_total, 20) + self.assertEquals(quotation.base_net_total, 20) self.assertEquals(len(quotation.get("items")), 1) # remove second item set_item_in_cart("_Test Item 2", 0) quotation = self.test_get_cart_lead() - self.assertEquals(quotation.net_total, 0) + self.assertEquals(quotation.base_net_total, 0) self.assertEquals(len(quotation.get("items")), 0) def test_set_billing_address(self): diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.json b/erpnext/stock/doctype/delivery_note/delivery_note.json index cbbc400bc6..d518e8c13a 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note.json +++ b/erpnext/stock/doctype/delivery_note/delivery_note.json @@ -1110,7 +1110,7 @@ } ], "read_only_onload": 1, - "search_fields": "status,customer,customer_name, territory,grand_total", + "search_fields": "status,customer,customer_name, territory,base_grand_total", "sort_field": "modified", "sort_order": "DESC", "title_field": "customer_name" diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.py b/erpnext/stock/doctype/delivery_note/delivery_note.py index 4c73b3b32f..ec45623ec0 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note.py +++ b/erpnext/stock/doctype/delivery_note/delivery_note.py @@ -67,7 +67,7 @@ class DeliveryNote(SellingController): item_meta = frappe.get_meta("Delivery Note Item") print_hide_fields = { - "parent": ["grand_total_export", "rounded_total_export", "in_words_export", "currency", "net_total_export"], + "parent": ["grand_total", "rounded_total", "in_words", "currency", "net_total"], "items": ["rate", "amount", "price_list_rate", "discount_percentage"] } @@ -186,7 +186,7 @@ class DeliveryNote(SellingController): self.validate_packed_qty() # Check for Approving Authority - frappe.get_doc('Authorization Control').validate_approving_authority(self.doctype, self.company, self.grand_total, self) + frappe.get_doc('Authorization Control').validate_approving_authority(self.doctype, self.company, self.base_grand_total, self) # update delivered qty in sales order self.update_prevdoc_status() diff --git a/erpnext/stock/doctype/delivery_note/delivery_note_list.js b/erpnext/stock/doctype/delivery_note/delivery_note_list.js index 065f896c3d..d30dec91e5 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note_list.js +++ b/erpnext/stock/doctype/delivery_note/delivery_note_list.js @@ -1,4 +1,4 @@ frappe.listview_settings['Delivery Note'] = { - add_fields: ["customer", "customer_name", "grand_total", "per_installed", - "transporter_name", "grand_total_export"] + add_fields: ["customer", "customer_name", "base_grand_total", "per_installed", + "transporter_name", "grand_total"] }; diff --git a/erpnext/stock/doctype/delivery_note/test_records.json b/erpnext/stock/doctype/delivery_note/test_records.json index 803e86469b..ff06637d3f 100644 --- a/erpnext/stock/doctype/delivery_note/test_records.json +++ b/erpnext/stock/doctype/delivery_note/test_records.json @@ -24,10 +24,10 @@ ], "doctype": "Delivery Note", "fiscal_year": "_Test Fiscal Year 2013", + "base_grand_total": 500.0, "grand_total": 500.0, - "grand_total_export": 500.0, "naming_series": "_T-Delivery Note-", - "net_total": 500.0, + "base_net_total": 500.0, "plc_conversion_rate": 1.0, "posting_date": "2013-02-21", "posting_time": "9:00:00", diff --git a/erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.js b/erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.js index 1eb557f1cc..09cfcfd436 100644 --- a/erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.js +++ b/erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.js @@ -21,7 +21,7 @@ erpnext.stock.LandedCostVoucher = erpnext.stock.StockController.extend({ this.frm.add_fetch("purchase_receipt", "supplier", "supplier"); this.frm.add_fetch("purchase_receipt", "posting_date", "posting_date"); - this.frm.add_fetch("purchase_receipt", "grand_total", "grand_total"); + this.frm.add_fetch("purchase_receipt", "base_grand_total", "grand_total"); }, diff --git a/erpnext/stock/doctype/landed_cost_voucher/test_landed_cost_voucher.py b/erpnext/stock/doctype/landed_cost_voucher/test_landed_cost_voucher.py index 4b0e23ce59..6345bec13c 100644 --- a/erpnext/stock/doctype/landed_cost_voucher/test_landed_cost_voucher.py +++ b/erpnext/stock/doctype/landed_cost_voucher/test_landed_cost_voucher.py @@ -80,7 +80,7 @@ class TestLandedCostVoucher(unittest.TestCase): "purchase_receipt": pr.name, "supplier": pr.supplier, "posting_date": pr.posting_date, - "grand_total": pr.grand_total + "grand_total": pr.base_grand_total }]) lcv.set("taxes", [{ "description": "Insurance Charges", diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py index e7606fd955..367a6a2261 100644 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py @@ -212,7 +212,7 @@ class PurchaseReceipt(BuyingController): purchase_controller = frappe.get_doc("Purchase Common") # Check for Approving Authority - frappe.get_doc('Authorization Control').validate_approving_authority(self.doctype, self.company, self.grand_total) + frappe.get_doc('Authorization Control').validate_approving_authority(self.doctype, self.company, self.base_grand_total) # Set status as Submitted frappe.db.set(self, 'status', 'Submitted') diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt_list.js b/erpnext/stock/doctype/purchase_receipt/purchase_receipt_list.js index 7869f7f7da..b0559cea73 100644 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt_list.js +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt_list.js @@ -1,4 +1,4 @@ frappe.listview_settings['Purchase Receipt'] = { - add_fields: ["supplier", "supplier_name", "grand_total", "is_subcontracted", + add_fields: ["supplier", "supplier_name", "base_grand_total", "is_subcontracted", "transporter_name"] }; diff --git a/erpnext/stock/doctype/purchase_receipt/test_records.json b/erpnext/stock/doctype/purchase_receipt/test_records.json index 47253ad72f..481bb170bd 100644 --- a/erpnext/stock/doctype/purchase_receipt/test_records.json +++ b/erpnext/stock/doctype/purchase_receipt/test_records.json @@ -6,9 +6,9 @@ "currency": "INR", "doctype": "Purchase Receipt", "fiscal_year": "_Test Fiscal Year 2013", - "grand_total": 720.0, + "base_grand_total": 720.0, "naming_series": "_T-Purchase Receipt-", - "net_total": 500.0, + "base_net_total": 500.0, "taxes": [ { "account_head": "_Test Account Shipping Charges - _TC", @@ -94,9 +94,9 @@ "currency": "INR", "doctype": "Purchase Receipt", "fiscal_year": "_Test Fiscal Year 2013", - "grand_total": 5000.0, + "base_grand_total": 5000.0, "is_subcontracted": "Yes", - "net_total": 5000.0, + "base_net_total": 5000.0, "posting_date": "2013-02-12", "posting_time": "15:33:30", "items": [ diff --git a/erpnext/templates/includes/sale.html b/erpnext/templates/includes/sale.html index e823248b02..6323995003 100644 --- a/erpnext/templates/includes/sale.html +++ b/erpnext/templates/includes/sale.html @@ -55,7 +55,7 @@ Net Total {{ - frappe.utils.fmt_money(doc.net_total/doc.conversion_rate, currency=doc.currency) + frappe.utils.fmt_money(doc.base_net_total/doc.conversion_rate, currency=doc.currency) }} {%- for charge in doc.get({"doctype":"Sales Taxes and Charges"}) -%} @@ -68,11 +68,11 @@ {%- endfor -%} Grand Total - {{ frappe.utils.fmt_money(doc.grand_total_export, currency=doc.currency) }} + {{ frappe.utils.fmt_money(doc.grand_total, currency=doc.currency) }} Rounded Total - {{ frappe.utils.fmt_money(doc.rounded_total_export, currency=doc.currency) }} + {{ frappe.utils.fmt_money(doc.rounded_total, currency=doc.currency) }} diff --git a/erpnext/templates/includes/sales_transactions.html b/erpnext/templates/includes/sales_transactions.html index e8717af391..465f5ede6d 100644 --- a/erpnext/templates/includes/sales_transactions.html +++ b/erpnext/templates/includes/sales_transactions.html @@ -10,7 +10,7 @@ $(document).ready(function() {