diff --git a/erpnext/accounts/doctype/sales_taxes_and_charges/sales_taxes_and_charges.json b/erpnext/accounts/doctype/sales_taxes_and_charges/sales_taxes_and_charges.json index 06c981fe4f4..2a0f5061884 100644 --- a/erpnext/accounts/doctype/sales_taxes_and_charges/sales_taxes_and_charges.json +++ b/erpnext/accounts/doctype/sales_taxes_and_charges/sales_taxes_and_charges.json @@ -1,156 +1,183 @@ { - "autoname": "hash", - "creation": "2013-04-24 11:39:32", - "docstatus": 0, - "doctype": "DocType", + "autoname": "hash", + "creation": "2013-04-24 11:39:32", + "docstatus": 0, + "doctype": "DocType", "fields": [ { - "fieldname": "charge_type", - "fieldtype": "Select", - "in_list_view": 1, - "label": "Type", - "oldfieldname": "charge_type", - "oldfieldtype": "Select", - "options": "\nActual\nOn Net Total\nOn Previous Row Amount\nOn Previous Row Total", - "permlevel": 0, + "fieldname": "charge_type", + "fieldtype": "Select", + "in_list_view": 1, + "label": "Type", + "oldfieldname": "charge_type", + "oldfieldtype": "Select", + "options": "\nActual\nOn Net Total\nOn Previous Row Amount\nOn Previous Row Total", + "permlevel": 0, "reqd": 1 - }, + }, { - "depends_on": "eval:[\"On Previous Row Amount\", \"On Previous Row Total\"].indexOf(doc.charge_type)!==-1", - "fieldname": "row_id", - "fieldtype": "Data", - "hidden": 0, - "label": "Reference Row #", - "oldfieldname": "row_id", - "oldfieldtype": "Data", + "depends_on": "eval:[\"On Previous Row Amount\", \"On Previous Row Total\"].indexOf(doc.charge_type)!==-1", + "fieldname": "row_id", + "fieldtype": "Data", + "hidden": 0, + "label": "Reference Row #", + "oldfieldname": "row_id", + "oldfieldtype": "Data", "permlevel": 0 - }, + }, { - "fieldname": "description", - "fieldtype": "Small Text", - "in_list_view": 1, - "label": "Description", - "oldfieldname": "description", - "oldfieldtype": "Small Text", - "permlevel": 0, - "print_width": "300px", - "reqd": 1, + "fieldname": "description", + "fieldtype": "Small Text", + "in_list_view": 1, + "label": "Description", + "oldfieldname": "description", + "oldfieldtype": "Small Text", + "permlevel": 0, + "print_width": "300px", + "reqd": 1, "width": "300px" - }, + }, { - "fieldname": "col_break_1", - "fieldtype": "Column Break", - "permlevel": 0, + "fieldname": "col_break_1", + "fieldtype": "Column Break", + "permlevel": 0, "width": "50%" - }, + }, { - "fieldname": "account_head", - "fieldtype": "Link", - "in_list_view": 0, - "label": "Account Head", - "oldfieldname": "account_head", - "oldfieldtype": "Link", - "options": "Account", - "permlevel": 0, - "reqd": 1, + "fieldname": "account_head", + "fieldtype": "Link", + "in_list_view": 0, + "label": "Account Head", + "oldfieldname": "account_head", + "oldfieldtype": "Link", + "options": "Account", + "permlevel": 0, + "reqd": 1, "search_index": 1 - }, + }, { - "default": ":Company", - "fieldname": "cost_center", - "fieldtype": "Link", - "in_list_view": 0, - "label": "Cost Center", - "oldfieldname": "cost_center_other_charges", - "oldfieldtype": "Link", - "options": "Cost Center", + "default": ":Company", + "fieldname": "cost_center", + "fieldtype": "Link", + "in_list_view": 0, + "label": "Cost Center", + "oldfieldname": "cost_center_other_charges", + "oldfieldtype": "Link", + "options": "Cost Center", "permlevel": 0 - }, + }, { - "fieldname": "rate", - "fieldtype": "Float", - "in_list_view": 1, - "label": "Rate", - "oldfieldname": "rate", - "oldfieldtype": "Currency", - "permlevel": 0, + "fieldname": "rate", + "fieldtype": "Float", + "in_list_view": 1, + "label": "Rate", + "oldfieldname": "rate", + "oldfieldtype": "Currency", + "permlevel": 0, "reqd": 1 - }, + }, { - "fieldname": "tax_amount", - "fieldtype": "Currency", - "in_list_view": 1, - "label": "Amount", - "oldfieldname": "tax_amount", - "oldfieldtype": "Currency", - "options": "Company:company:default_currency", - "permlevel": 0, - "read_only": 1, + "fieldname": "tax_amount", + "fieldtype": "Currency", + "in_list_view": 1, + "label": "Amount", + "options": "currency", + "permlevel": 0, + "precision": "" + }, + { + "fieldname": "base_tax_amount", + "fieldtype": "Currency", + "in_list_view": 0, + "label": "Amount (Company Currency)", + "oldfieldname": "tax_amount", + "oldfieldtype": "Currency", + "options": "Company:company:default_currency", + "permlevel": 0, + "read_only": 1, "reqd": 0 - }, + }, { - "fieldname": "total", - "fieldtype": "Currency", - "label": "Total", - "oldfieldname": "total", - "oldfieldtype": "Currency", - "options": "Company:company:default_currency", - "permlevel": 0, + "fieldname": "total", + "fieldtype": "Currency", + "label": "Total", + "options": "currency", + "permlevel": 0, + "precision": "", "read_only": 1 - }, + }, { - "allow_on_submit": 0, - "description": "If checked, the tax amount will be considered as already included in the Print Rate / Print Amount", - "fieldname": "included_in_print_rate", - "fieldtype": "Check", - "label": "Is this Tax included in Basic Rate?", - "no_copy": 0, - "permlevel": 0, - "print_hide": 1, - "print_width": "150px", - "report_hide": 1, + "fieldname": "base_total", + "fieldtype": "Currency", + "label": "Total (Company Currency)", + "oldfieldname": "total", + "oldfieldtype": "Currency", + "options": "Company:company:default_currency", + "permlevel": 0, + "read_only": 1 + }, + { + "allow_on_submit": 0, + "description": "If checked, the tax amount will be considered as already included in the Print Rate / Print Amount", + "fieldname": "included_in_print_rate", + "fieldtype": "Check", + "label": "Is this Tax included in Basic Rate?", + "no_copy": 0, + "permlevel": 0, + "print_hide": 1, + "print_width": "150px", + "report_hide": 1, "width": "150px" - }, + }, { - "depends_on": "eval:parent.discount_amount", - "fieldname": "tax_amount_after_discount_amount", - "fieldtype": "Currency", - "hidden": 0, - "label": "Tax Amount After Discount Amount", - "options": "Company:company:default_currency", - "permlevel": 0, + "fieldname": "tax_amount_after_discount_amount", + "fieldtype": "Currency", + "label": "Tax Amount After Discount Amount", + "options": "currency", + "permlevel": 0, + "precision": "", "read_only": 1 - }, + }, { - "fieldname": "item_wise_tax_detail", - "fieldtype": "Small Text", - "hidden": 1, - "label": "Item Wise Tax Detail", - "oldfieldname": "item_wise_tax_detail", - "oldfieldtype": "Small Text", - "permlevel": 0, + "depends_on": "eval:parent.discount_amount", + "fieldname": "base_tax_amount_after_discount_amount", + "fieldtype": "Currency", + "hidden": 0, + "label": "Tax Amount After Discount Amount (Company Currency)", + "options": "Company:company:default_currency", + "permlevel": 0, "read_only": 1 - }, + }, { - "fieldname": "parenttype", - "fieldtype": "Data", - "hidden": 1, - "in_filter": 1, - "label": "Parenttype", - "oldfieldname": "parenttype", - "oldfieldtype": "Data", - "permlevel": 0, - "print_hide": 1, + "fieldname": "item_wise_tax_detail", + "fieldtype": "Small Text", + "hidden": 1, + "label": "Item Wise Tax Detail", + "oldfieldname": "item_wise_tax_detail", + "oldfieldtype": "Small Text", + "permlevel": 0, + "read_only": 1 + }, + { + "fieldname": "parenttype", + "fieldtype": "Data", + "hidden": 1, + "in_filter": 1, + "label": "Parenttype", + "oldfieldname": "parenttype", + "oldfieldtype": "Data", + "permlevel": 0, + "print_hide": 1, "search_index": 1 } - ], - "hide_heading": 1, - "idx": 1, - "istable": 1, - "modified": "2015-02-19 01:07:02.165094", - "modified_by": "Administrator", - "module": "Accounts", - "name": "Sales Taxes and Charges", - "owner": "Administrator", + ], + "hide_heading": 1, + "idx": 1, + "istable": 1, + "modified": "2015-02-19 17:00:07.949352", + "modified_by": "Administrator", + "module": "Accounts", + "name": "Sales Taxes and Charges", + "owner": "Administrator", "permissions": [] -} \ No newline at end of file +} 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 af744e9f8ea..8fd8f0123bd 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 @@ -165,10 +165,10 @@ cur_frm.cscript.tax_amount = function(doc, cdt, cdn) { msgprint(__("Please select Charge Type first")); d.tax_amount = ''; } - else if(d.charge_type && d.tax_amount) { - msgprint(__("Cannot directly set amount. For 'Actual' charge type, use the rate field")); - d.tax_amount = ''; - } + // else if(d.charge_type && d.tax_amount) { + // msgprint(__("Cannot directly set amount. For 'Actual' charge type, use the rate field")); + // d.tax_amount = ''; + // } validated = false; refresh_field('tax_amount', d.name, 'taxes'); }; diff --git a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.json b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.json index 99471ca2d32..352178f18e2 100644 --- a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.json +++ b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.json @@ -1,680 +1,681 @@ { - "allow_import": 1, - "autoname": "naming_series:", - "creation": "2013-05-21 16:16:45", - "docstatus": 0, - "doctype": "DocType", - "document_type": "Transaction", + "allow_import": 1, + "autoname": "naming_series:", + "creation": "2013-05-21 16:16:45", + "docstatus": 0, + "doctype": "DocType", + "document_type": "Transaction", "fields": [ { - "fieldname": "supplier_section", - "fieldtype": "Section Break", - "label": "Supplier", - "options": "icon-user", + "fieldname": "supplier_section", + "fieldtype": "Section Break", + "label": "Supplier", + "options": "icon-user", "permlevel": 0 - }, + }, { - "fieldname": "naming_series", - "fieldtype": "Select", - "label": "Series", - "no_copy": 1, - "oldfieldname": "naming_series", - "oldfieldtype": "Select", - "options": "SQTN-", - "permlevel": 0, - "print_hide": 1, + "fieldname": "naming_series", + "fieldtype": "Select", + "label": "Series", + "no_copy": 1, + "oldfieldname": "naming_series", + "oldfieldtype": "Select", + "options": "SQTN-", + "permlevel": 0, + "print_hide": 1, "reqd": 1 - }, + }, { - "description": "Supplier (vendor) name as entered in supplier master", - "fieldname": "supplier", - "fieldtype": "Link", - "in_filter": 1, - "label": "Supplier", - "oldfieldname": "supplier", - "oldfieldtype": "Link", - "options": "Supplier", - "permlevel": 0, - "print_hide": 1, - "reqd": 1, + "description": "Supplier (vendor) name as entered in supplier master", + "fieldname": "supplier", + "fieldtype": "Link", + "in_filter": 1, + "label": "Supplier", + "oldfieldname": "supplier", + "oldfieldtype": "Link", + "options": "Supplier", + "permlevel": 0, + "print_hide": 1, + "reqd": 1, "search_index": 1 - }, + }, { - "fieldname": "supplier_name", - "fieldtype": "Data", - "hidden": 0, - "in_list_view": 0, - "label": "Name", - "permlevel": 0, + "fieldname": "supplier_name", + "fieldtype": "Data", + "hidden": 0, + "in_list_view": 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 - }, + }, { - "fieldname": "column_break1", - "fieldtype": "Column Break", - "oldfieldtype": "Column Break", - "permlevel": 0, - "print_hide": 0, - "print_width": "50%", + "fieldname": "column_break1", + "fieldtype": "Column Break", + "oldfieldtype": "Column Break", + "permlevel": 0, + "print_hide": 0, + "print_width": "50%", "width": "50%" - }, + }, { - "fieldname": "transaction_date", - "fieldtype": "Date", - "in_filter": 1, - "label": "Date", - "oldfieldname": "transaction_date", - "oldfieldtype": "Date", - "permlevel": 0, - "reqd": 1, + "fieldname": "transaction_date", + "fieldtype": "Date", + "in_filter": 1, + "label": "Date", + "oldfieldname": "transaction_date", + "oldfieldtype": "Date", + "permlevel": 0, + "reqd": 1, "search_index": 1 - }, + }, { - "fieldname": "amended_from", - "fieldtype": "Link", - "hidden": 1, - "ignore_user_permissions": 1, - "label": "Amended From", - "no_copy": 1, - "oldfieldname": "amended_from", - "oldfieldtype": "Data", - "options": "Supplier Quotation", - "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": "Supplier Quotation", + "permlevel": 0, + "print_hide": 1, + "read_only": 1, "report_hide": 0 - }, + }, { - "description": "", - "fieldname": "company", - "fieldtype": "Link", - "in_filter": 1, - "label": "Company", - "no_copy": 0, - "oldfieldname": "company", - "oldfieldtype": "Link", - "options": "Company", - "permlevel": 0, - "print_hide": 1, - "reqd": 1, + "description": "", + "fieldname": "company", + "fieldtype": "Link", + "in_filter": 1, + "label": "Company", + "no_copy": 0, + "oldfieldname": "company", + "oldfieldtype": "Link", + "options": "Company", + "permlevel": 0, + "print_hide": 1, + "reqd": 1, "search_index": 1 - }, + }, { - "fieldname": "currency_and_price_list", - "fieldtype": "Section Break", - "label": "", - "options": "icon-tag", + "fieldname": "currency_and_price_list", + "fieldtype": "Section Break", + "label": "", + "options": "icon-tag", "permlevel": 0 - }, + }, { - "fieldname": "currency", - "fieldtype": "Link", - "label": "Currency", - "no_copy": 0, - "oldfieldname": "currency", - "oldfieldtype": "Select", - "options": "Currency", - "permlevel": 0, - "print_hide": 1, + "fieldname": "currency", + "fieldtype": "Link", + "label": "Currency", + "no_copy": 0, + "oldfieldname": "currency", + "oldfieldtype": "Select", + "options": "Currency", + "permlevel": 0, + "print_hide": 1, "reqd": 1 - }, + }, { - "description": "Rate at which supplier's currency is converted to company's base currency", - "fieldname": "conversion_rate", - "fieldtype": "Float", - "hidden": 0, - "label": "Exchange Rate", - "no_copy": 0, - "oldfieldname": "conversion_rate", - "oldfieldtype": "Currency", - "permlevel": 0, - "print_hide": 1, + "description": "Rate at which supplier's currency is converted to company's base currency", + "fieldname": "conversion_rate", + "fieldtype": "Float", + "hidden": 0, + "label": "Exchange Rate", + "no_copy": 0, + "oldfieldname": "conversion_rate", + "oldfieldtype": "Currency", + "permlevel": 0, + "print_hide": 1, "reqd": 1 - }, + }, { - "fieldname": "cb_price_list", - "fieldtype": "Column Break", - "permlevel": 0, - "print_width": "50%", + "fieldname": "cb_price_list", + "fieldtype": "Column Break", + "permlevel": 0, + "print_width": "50%", "width": "50%" - }, + }, { - "fieldname": "buying_price_list", - "fieldtype": "Link", - "label": "Price List", - "options": "Price List", - "permlevel": 0, + "fieldname": "buying_price_list", + "fieldtype": "Link", + "label": "Price List", + "options": "Price List", + "permlevel": 0, "print_hide": 1 - }, + }, { - "depends_on": "buying_price_list", - "fieldname": "price_list_currency", - "fieldtype": "Link", - "label": "Price List Currency", - "options": "Currency", - "permlevel": 0, - "print_hide": 1, + "depends_on": "buying_price_list", + "fieldname": "price_list_currency", + "fieldtype": "Link", + "label": "Price List Currency", + "options": "Currency", + "permlevel": 0, + "print_hide": 1, "read_only": 1 - }, + }, { - "depends_on": "buying_price_list", - "fieldname": "plc_conversion_rate", - "fieldtype": "Float", - "label": "Price List Exchange Rate", - "permlevel": 0, + "depends_on": "buying_price_list", + "fieldname": "plc_conversion_rate", + "fieldtype": "Float", + "label": "Price List Exchange Rate", + "permlevel": 0, "print_hide": 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": "", - "oldfieldtype": "Section Break", - "options": "icon-shopping-cart", + "fieldname": "items_section", + "fieldtype": "Section Break", + "label": "", + "oldfieldtype": "Section Break", + "options": "icon-shopping-cart", "permlevel": 0 - }, + }, { - "allow_on_submit": 1, - "fieldname": "items", - "fieldtype": "Table", - "label": "Items", - "no_copy": 0, - "oldfieldname": "po_details", - "oldfieldtype": "Table", - "options": "Supplier Quotation Item", + "allow_on_submit": 1, + "fieldname": "items", + "fieldtype": "Table", + "label": "Items", + "no_copy": 0, + "oldfieldname": "po_details", + "oldfieldtype": "Table", + "options": "Supplier Quotation Item", "permlevel": 0 - }, + }, { - "fieldname": "section_break_22", - "fieldtype": "Section Break", + "fieldname": "section_break_22", + "fieldtype": "Section Break", "permlevel": 0 - }, + }, { - "fieldname": "base_net_total", - "fieldtype": "Currency", - "label": "Net Total (Company Currency)", - "no_copy": 1, - "oldfieldname": "net_total", - "oldfieldtype": "Currency", - "options": "Company:company:default_currency", - "permlevel": 0, - "print_hide": 1, - "read_only": 1, + "fieldname": "base_net_total", + "fieldtype": "Currency", + "label": "Net Total (Company Currency)", + "no_copy": 1, + "oldfieldname": "net_total", + "oldfieldtype": "Currency", + "options": "Company:company:default_currency", + "permlevel": 0, + "print_hide": 1, + "read_only": 1, "reqd": 0 - }, + }, { - "fieldname": "column_break_24", - "fieldtype": "Column Break", + "fieldname": "column_break_24", + "fieldtype": "Column Break", "permlevel": 0 - }, + }, { - "fieldname": "net_total", - "fieldtype": "Currency", - "label": "Net Total", - "no_copy": 0, - "oldfieldname": "net_total_import", - "oldfieldtype": "Currency", - "options": "currency", - "permlevel": 0, - "print_hide": 0, + "fieldname": "net_total", + "fieldtype": "Currency", + "label": "Net Total", + "no_copy": 0, + "oldfieldname": "net_total_import", + "oldfieldtype": "Currency", + "options": "currency", + "permlevel": 0, + "print_hide": 0, "read_only": 1 - }, + }, { - "fieldname": "taxes_section", - "fieldtype": "Section Break", - "label": "Taxes and Charges", - "oldfieldtype": "Section Break", - "options": "icon-money", + "fieldname": "taxes_section", + "fieldtype": "Section Break", + "label": "Taxes and Charges", + "oldfieldtype": "Section Break", + "options": "icon-money", "permlevel": 0 - }, + }, { - "description": "If you have created a standard template in Purchase Taxes and Charges Master, select one and click on the button below.", - "fieldname": "taxes_and_charges", - "fieldtype": "Link", - "label": "Taxes and Charges", - "no_copy": 1, - "oldfieldname": "purchase_other_charges", - "oldfieldtype": "Link", - "options": "Purchase Taxes and Charges Master", - "permlevel": 0, + "description": "If you have created a standard template in Purchase Taxes and Charges Master, select one and click on the button below.", + "fieldname": "taxes_and_charges", + "fieldtype": "Link", + "label": "Taxes and Charges", + "no_copy": 1, + "oldfieldname": "purchase_other_charges", + "oldfieldtype": "Link", + "options": "Purchase Taxes and Charges Master", + "permlevel": 0, "print_hide": 1 - }, + }, { - "fieldname": "taxes", - "fieldtype": "Table", - "label": "Purchase Taxes and Charges", - "no_copy": 0, - "oldfieldname": "purchase_tax_details", - "oldfieldtype": "Table", - "options": "Purchase Taxes and Charges", + "fieldname": "taxes", + "fieldtype": "Table", + "label": "Purchase Taxes and Charges", + "no_copy": 0, + "oldfieldname": "purchase_tax_details", + "oldfieldtype": "Table", + "options": "Purchase Taxes and Charges", "permlevel": 0 - }, + }, { - "fieldname": "other_charges_calculation", - "fieldtype": "HTML", - "label": "Taxes and Charges Calculation", - "no_copy": 1, - "oldfieldtype": "HTML", - "permlevel": 0, + "fieldname": "other_charges_calculation", + "fieldtype": "HTML", + "label": "Taxes and Charges Calculation", + "no_copy": 1, + "oldfieldtype": "HTML", + "permlevel": 0, "print_hide": 1 - }, + }, { - "fieldname": "totals", - "fieldtype": "Section Break", - "label": "", - "oldfieldtype": "Section Break", - "options": "icon-money", + "fieldname": "totals", + "fieldtype": "Section Break", + "label": "", + "oldfieldtype": "Section Break", + "options": "icon-money", "permlevel": 0 - }, + }, { - "fieldname": "base_taxes_and_charges_added", - "fieldtype": "Currency", - "label": "Taxes and Charges Added (Company Currency)", - "no_copy": 0, - "oldfieldname": "other_charges_added", - "oldfieldtype": "Currency", - "options": "Company:company:default_currency", - "permlevel": 0, - "print_hide": 1, + "fieldname": "base_taxes_and_charges_added", + "fieldtype": "Currency", + "label": "Taxes and Charges Added (Company Currency)", + "no_copy": 0, + "oldfieldname": "other_charges_added", + "oldfieldtype": "Currency", + "options": "Company:company:default_currency", + "permlevel": 0, + "print_hide": 1, "read_only": 1 - }, + }, { - "fieldname": "base_taxes_and_charges_deducted", - "fieldtype": "Currency", - "label": "Taxes and Charges Deducted (Company Currency)", - "no_copy": 0, - "oldfieldname": "other_charges_deducted", - "oldfieldtype": "Currency", - "options": "Company:company:default_currency", - "permlevel": 0, - "print_hide": 1, + "fieldname": "base_taxes_and_charges_deducted", + "fieldtype": "Currency", + "label": "Taxes and Charges Deducted (Company Currency)", + "no_copy": 0, + "oldfieldname": "other_charges_deducted", + "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)", - "no_copy": 1, - "oldfieldname": "total_tax", - "oldfieldtype": "Currency", - "options": "Company:company:default_currency", - "permlevel": 0, - "print_hide": 1, + "fieldname": "base_total_taxes_and_charges", + "fieldtype": "Currency", + "label": "Total Taxes and Charges (Company Currency)", + "no_copy": 1, + "oldfieldname": "total_tax", + "oldfieldtype": "Currency", + "options": "Company:company:default_currency", + "permlevel": 0, + "print_hide": 1, "read_only": 1 - }, + }, { - "fieldname": "base_grand_total", - "fieldtype": "Currency", - "label": "Grand Total (Company Currency)", - "no_copy": 1, - "oldfieldname": "grand_total", - "oldfieldtype": "Currency", - "options": "Company:company:default_currency", - "permlevel": 0, - "print_hide": 1, + "fieldname": "base_grand_total", + "fieldtype": "Currency", + "label": "Grand Total (Company Currency)", + "no_copy": 1, + "oldfieldname": "grand_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, + "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 - }, + }, { - "description": "In Words will be visible once you save the Purchase Order.", - "fieldname": "base_in_words", - "fieldtype": "Data", - "label": "In Words (Company Currency)", - "oldfieldname": "in_words", - "oldfieldtype": "Data", - "permlevel": 0, - "print_hide": 1, + "description": "In Words will be visible once you save the Purchase 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 - }, + }, { - "fieldname": "column_break4", - "fieldtype": "Column Break", - "oldfieldtype": "Column Break", - "permlevel": 0, + "fieldname": "column_break4", + "fieldtype": "Column Break", + "oldfieldtype": "Column Break", + "permlevel": 0, "print_hide": 0 - }, + }, { - "fieldname": "taxes_and_charges_added", - "fieldtype": "Currency", - "label": "Taxes and Charges Added", - "no_copy": 0, - "oldfieldname": "other_charges_added_import", - "oldfieldtype": "Currency", - "options": "currency", - "permlevel": 0, - "print_hide": 1, - "read_only": 1, + "fieldname": "taxes_and_charges_added", + "fieldtype": "Currency", + "label": "Taxes and Charges Added", + "no_copy": 0, + "oldfieldname": "other_charges_added_import", + "oldfieldtype": "Currency", + "options": "currency", + "permlevel": 0, + "print_hide": 1, + "read_only": 1, "report_hide": 0 - }, + }, { - "fieldname": "taxes_and_charges_deducted", - "fieldtype": "Currency", - "label": "Taxes and Charges Deducted", - "no_copy": 0, - "oldfieldname": "other_charges_deducted_import", - "oldfieldtype": "Currency", - "options": "currency", - "permlevel": 0, - "print_hide": 1, - "read_only": 1, + "fieldname": "taxes_and_charges_deducted", + "fieldtype": "Currency", + "label": "Taxes and Charges Deducted", + "no_copy": 0, + "oldfieldname": "other_charges_deducted_import", + "oldfieldtype": "Currency", + "options": "currency", + "permlevel": 0, + "print_hide": 1, + "read_only": 1, "report_hide": 0 - }, + }, { - "fieldname": "total_taxes_and_charges", - "fieldtype": "Currency", - "label": "Total Taxes and Charges", - "options": "currency", - "permlevel": 0, - "precision": "" - }, - { - "fieldname": "grand_total", - "fieldtype": "Currency", - "in_list_view": 1, - "label": "Grand Total", - "no_copy": 0, - "oldfieldname": "grand_total_import", - "oldfieldtype": "Currency", - "options": "currency", - "permlevel": 0, - "print_hide": 0, - "read_only": 1, - "report_hide": 0 - }, - { - "fieldname": "in_words", - "fieldtype": "Data", - "label": "In Words", - "oldfieldname": "in_words_import", - "oldfieldtype": "Data", - "permlevel": 0, - "print_hide": 0, + "fieldname": "total_taxes_and_charges", + "fieldtype": "Currency", + "label": "Total Taxes and Charges", + "options": "currency", + "permlevel": 0, + "precision": "", "read_only": 1 - }, + }, { - "fieldname": "fold", - "fieldtype": "Fold", + "fieldname": "grand_total", + "fieldtype": "Currency", + "in_list_view": 1, + "label": "Grand Total", + "no_copy": 0, + "oldfieldname": "grand_total_import", + "oldfieldtype": "Currency", + "options": "currency", + "permlevel": 0, + "print_hide": 0, + "read_only": 1, + "report_hide": 0 + }, + { + "fieldname": "in_words", + "fieldtype": "Data", + "label": "In Words", + "oldfieldname": "in_words_import", + "oldfieldtype": "Data", + "permlevel": 0, + "print_hide": 0, + "read_only": 1 + }, + { + "fieldname": "fold", + "fieldtype": "Fold", "permlevel": 0 - }, + }, { - "fieldname": "terms_section_break", - "fieldtype": "Section Break", - "label": "Terms and Conditions", - "oldfieldtype": "Section Break", - "options": "icon-legal", + "fieldname": "terms_section_break", + "fieldtype": "Section Break", + "label": "Terms and Conditions", + "oldfieldtype": "Section Break", + "options": "icon-legal", "permlevel": 0 - }, + }, { - "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 - }, + }, { - "fieldname": "tc_name", - "fieldtype": "Link", - "label": "Terms", - "oldfieldname": "tc_name", - "oldfieldtype": "Link", - "options": "Terms and Conditions", - "permlevel": 0, + "fieldname": "tc_name", + "fieldtype": "Link", + "label": "Terms", + "oldfieldname": "tc_name", + "oldfieldtype": "Link", + "options": "Terms and Conditions", + "permlevel": 0, "print_hide": 1 - }, + }, { - "fieldname": "get_terms", - "fieldtype": "Button", - "label": "Get Terms and Conditions", - "oldfieldtype": "Button", + "fieldname": "get_terms", + "fieldtype": "Button", + "label": "Get Terms and Conditions", + "oldfieldtype": "Button", "permlevel": 0 - }, + }, { - "fieldname": "terms", - "fieldtype": "Text Editor", - "label": "Terms and Conditions", - "oldfieldname": "terms", - "oldfieldtype": "Text Editor", + "fieldname": "terms", + "fieldtype": "Text Editor", + "label": "Terms and Conditions", + "oldfieldname": "terms", + "oldfieldtype": "Text Editor", "permlevel": 0 - }, + }, { - "depends_on": "supplier", - "fieldname": "contact_section", - "fieldtype": "Section Break", - "label": "Contact Info", - "options": "icon-bullhorn", + "depends_on": "supplier", + "fieldname": "contact_section", + "fieldtype": "Section Break", + "label": "Contact Info", + "options": "icon-bullhorn", "permlevel": 0 - }, + }, { - "fieldname": "supplier_address", - "fieldtype": "Link", - "in_filter": 1, - "label": "Supplier Address", - "options": "Address", - "permlevel": 0, + "fieldname": "supplier_address", + "fieldtype": "Link", + "in_filter": 1, + "label": "Supplier 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", + "fieldname": "more_info", + "fieldtype": "Section Break", + "label": "More Info", + "oldfieldtype": "Section Break", + "options": "icon-file-text", "permlevel": 0 - }, + }, { - "fieldname": "status", - "fieldtype": "Select", - "in_filter": 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, + "fieldname": "status", + "fieldtype": "Select", + "in_filter": 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": "No", - "fieldname": "is_subcontracted", - "fieldtype": "Select", - "label": "Is Subcontracted", - "options": "\nYes\nNo", - "permlevel": 0, + "default": "No", + "fieldname": "is_subcontracted", + "fieldtype": "Select", + "label": "Is Subcontracted", + "options": "\nYes\nNo", + "permlevel": 0, "print_hide": 1 - }, + }, { - "fieldname": "column_break_57", - "fieldtype": "Column Break", + "fieldname": "column_break_57", + "fieldtype": "Column Break", "permlevel": 0 - }, + }, { - "fieldname": "fiscal_year", - "fieldtype": "Link", - "in_filter": 1, - "label": "Fiscal Year", - "no_copy": 0, - "oldfieldname": "fiscal_year", - "oldfieldtype": "Select", - "options": "Fiscal Year", - "permlevel": 0, - "print_hide": 1, - "reqd": 1, + "fieldname": "fiscal_year", + "fieldtype": "Link", + "in_filter": 1, + "label": "Fiscal Year", + "no_copy": 0, + "oldfieldname": "fiscal_year", + "oldfieldtype": "Select", + "options": "Fiscal Year", + "permlevel": 0, + "print_hide": 1, + "reqd": 1, "search_index": 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 } - ], - "icon": "icon-shopping-cart", - "idx": 1, - "is_submittable": 1, - "modified": "2015-02-20 05:16:21.307774", - "modified_by": "Administrator", - "module": "Buying", - "name": "Supplier Quotation", - "owner": "Administrator", + ], + "icon": "icon-shopping-cart", + "idx": 1, + "is_submittable": 1, + "modified": "2015-02-20 05:16:21.307774", + "modified_by": "Administrator", + "module": "Buying", + "name": "Supplier Quotation", + "owner": "Administrator", "permissions": [ { - "amend": 1, - "cancel": 1, - "create": 1, - "delete": 1, - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Manufacturing Manager", - "share": 1, - "submit": 1, + "amend": 1, + "cancel": 1, + "create": 1, + "delete": 1, + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Manufacturing Manager", + "share": 1, + "submit": 1, "write": 1 - }, + }, { - "amend": 1, - "cancel": 1, - "create": 1, - "delete": 1, - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Purchase Manager", - "share": 1, - "submit": 1, + "amend": 1, + "cancel": 1, + "create": 1, + "delete": 1, + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Purchase Manager", + "share": 1, + "submit": 1, "write": 1 - }, + }, { - "amend": 1, - "apply_user_permissions": 1, - "cancel": 0, - "create": 1, - "delete": 0, - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Purchase User", - "share": 1, - "submit": 0, + "amend": 1, + "apply_user_permissions": 1, + "cancel": 0, + "create": 1, + "delete": 0, + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Purchase User", + "share": 1, + "submit": 0, "write": 1 - }, + }, { - "amend": 0, - "apply_user_permissions": 1, - "cancel": 0, - "create": 0, - "delete": 0, - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Material User", - "submit": 0, + "amend": 0, + "apply_user_permissions": 1, + "cancel": 0, + "create": 0, + "delete": 0, + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Material User", + "submit": 0, "write": 0 - }, + }, { - "amend": 0, - "apply_user_permissions": 1, - "cancel": 0, - "create": 0, - "delete": 0, - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Supplier", - "submit": 0, + "amend": 0, + "apply_user_permissions": 1, + "cancel": 0, + "create": 0, + "delete": 0, + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Supplier", + "submit": 0, "write": 0 - }, + }, { - "permlevel": 1, - "read": 1, - "role": "Purchase Manager", + "permlevel": 1, + "read": 1, + "role": "Purchase Manager", "write": 1 } - ], - "read_only_onload": 1, - "search_fields": "status, transaction_date, supplier,base_grand_total", - "sort_field": "modified", - "sort_order": "DESC", + ], + "read_only_onload": 1, + "search_fields": "status, transaction_date, supplier,grand_total", + "sort_field": "modified", + "sort_order": "DESC", "title_field": "supplier_name" -} \ No newline at end of file +} diff --git a/erpnext/controllers/taxes_and_totals.py b/erpnext/controllers/taxes_and_totals.py index d9bac98f369..504c446fe9d 100644 --- a/erpnext/controllers/taxes_and_totals.py +++ b/erpnext/controllers/taxes_and_totals.py @@ -11,7 +11,6 @@ from erpnext.controllers.accounts_controller import validate_conversion_rate class calculate_taxes_and_totals(object): def __init__(self, doc): self.doc = doc - self.calculate() def calculate(self): @@ -25,6 +24,15 @@ class calculate_taxes_and_totals(object): self.calculate_total_advance() def _calculate(self): + self.calculate_item_values() + self.initialize_taxes() + self.determine_exclusive_rate() + self.calculate_net_total() + self.calculate_taxes() + self.calculate_totals() + self._cleanup() + + def validate_conversion_rate(self): # validate conversion rate company_currency = get_company_currency(self.doc.company) if not self.doc.currency or self.doc.currency == company_currency: @@ -36,17 +44,6 @@ class calculate_taxes_and_totals(object): self.doc.conversion_rate = flt(self.doc.conversion_rate) - self.calculate_item_values() - self.initialize_taxes() - - if self.doc.doctype in ["Quotation", "Sales Order", "Delivery Note", "Sales Invoice"]: - self.determine_exclusive_rate() - - self.calculate_net_total() - self.calculate_taxes() - self.calculate_totals() - self._cleanup() - def calculate_item_values(self): if not self.discount_amount_applied: for item in self.doc.get("items"): @@ -55,21 +52,22 @@ class calculate_taxes_and_totals(object): if item.discount_percentage == 100: item.rate = 0.0 elif not item.rate: - item.rate = flt(item.price_list_rate * (1.0 - (item.discount_percentage / 100.0)), - self.doc.precision("rate", item)) + item.rate = flt(item.price_list_rate * + (1.0 - (item.discount_percentage / 100.0)), item.precision("rate")) - item.amount = flt(item.rate * item.qty, self.doc.precision("amount", item)) - item.item_tax_amount = 0.0; + item.net_rate = item.rate + item.amount = flt(item.rate * item.qty, item.precision("amount")) + item.net_amount = item.amount - self._set_in_company_currency(item, "price_list_rate", "base_price_list_rate") - self._set_in_company_currency(item, "rate", "base_rate") - self._set_in_company_currency(item, "amount", "base_amount") + self._set_in_company_currency(item, ["price_list_rate", "rate", "net_rate", "amount", "net_amount"]) - def _set_in_company_currency(self, item, print_field, base_field): + item.item_tax_amount = 0.0 + + def _set_in_company_currency(self, doc, fields): """set values in base currency""" - value_in_company_currency = flt(self.doc.conversion_rate * - flt(item.get(print_field), self.doc.precision(print_field, item)), self.doc.precision(base_field, item)) - item.set(base_field, value_in_company_currency) + for f in fields: + val = flt(flt(doc.get(f), doc.precision(f)) * self.doc.conversion_rate, doc.precision("base_" + f)) + doc.set("base_" + f, val) def initialize_taxes(self): for tax in self.doc.get("taxes"): @@ -116,9 +114,9 @@ class calculate_taxes_and_totals(object): _on_previous_row_error("1 - %d" % (tax.row_id,)) def determine_exclusive_rate(self): - if not any((cint(tax.included_in_print_rate) for tax in self.doc.get("taxes"))): - # no inclusive tax - return + if not any((cint(tax.included_in_print_rate) for tax in self.doc.get("taxes"))) or \ + self.doc.doctype not in ["Quotation", "Sales Order", "Delivery Note", "Sales Invoice"]: + return for item in self.doc.get("items"): item_tax_map = self._load_item_tax_rate(item.item_tax_rate) @@ -136,18 +134,24 @@ class calculate_taxes_and_totals(object): cumulated_tax_fraction += tax.tax_fraction_for_current_item if cumulated_tax_fraction and not self.discount_amount_applied and item.qty: - item.base_amount = flt((item.amount * self.doc.conversion_rate) / - (1 + cumulated_tax_fraction), self.doc.precision("base_amount", item)) + item.net_amount = flt(item.amount / (1 + cumulated_tax_fraction), item.precision("net_amount")) + item.net_rate = flt(item.net_amount / item.qty, item.precision("net_rate")) + item.discount_percentage = flt(item.discount_percentage, item.precision("discount_percentage")) - item.base_rate = flt(item.base_amount / item.qty, self.doc.precision("base_rate", item)) - item.discount_percentage = flt(item.discount_percentage, self.doc.precision("discount_percentage", item)) - if item.discount_percentage == 100: - item.base_price_list_rate = item.base_rate - item.base_rate = 0.0 - else: - item.base_price_list_rate = flt(item.base_rate / (1 - (item.discount_percentage / 100.0)), - self.doc.precision("base_price_list_rate", item)) + self._set_in_company_currency(item, ["net_rate", "net_amount"]) + + # below part need to be fixed??? + + # if item.discount_percentage == 100: + # item.price_list_rate = item.net_rate + # item.base_price_list_rate = flt(item.price_list_rate*self.doc.conversion_rate, + # self.doc.precision("base_price_list_rate", item)) + # item.rate = item.base_rate = item.net_rate = item.base_net_rate = 0.0 + # else: + # item.base_price_list_rate = flt(item.net_rate / (1 - (item.discount_percentage / 100.0)), + # self.doc.precision("price_list_rate", item)) + def _load_item_tax_rate(self, item_tax_rate): return json.loads(item_tax_rate) if item_tax_rate else {} @@ -182,17 +186,19 @@ class calculate_taxes_and_totals(object): return tax.rate def calculate_net_total(self): - self.doc.base_net_total = self.doc.net_total = 0.0 + self.doc.print_total = self.doc.base_print_total = self.doc.net_total = self.doc.base_net_total = 0.0 for item in self.doc.get("items"): - self.doc.base_net_total += item.base_amount - self.doc.net_total += item.amount + self.doc.print_total += item.amount + self.doc.base_print_total += item.base_amount + self.doc.net_total += item.net_amount + self.doc.base_net_total += item.base_net_amount - self.doc.round_floats_in(self.doc, ["base_net_total", "net_total"]) + self.doc.round_floats_in(self.doc, ["print_total", "base_print_total", "net_total", "base_net_total"]) def calculate_taxes(self): # maintain actual tax rate based on idx - actual_tax_dict = dict([[tax.idx, flt(tax.rate, self.doc.precision("tax_amount", tax))] + actual_tax_dict = dict([[tax.idx, flt(tax.tax_amount, tax.precision("tax_amount"))] for tax in self.doc.get("taxes") if tax.charge_type == "Actual"]) for n, item in enumerate(self.doc.get("items")): @@ -230,12 +236,10 @@ class calculate_taxes_and_totals(object): # note: grand_total_for_current_item contains the contribution of # item's amount, previously applied tax and the current tax on that item if i==0: - tax.grand_total_for_current_item = flt(item.base_amount + current_tax_amount, - self.doc.precision("total", tax)) + tax.grand_total_for_current_item = flt(item.net_amount + current_tax_amount) else: tax.grand_total_for_current_item = \ - flt(self.doc.get("taxes")[i-1].grand_total_for_current_item + - current_tax_amount, self.doc.precision("total", tax)) + self.doc.get("taxes")[i-1].grand_total_for_current_item + current_tax_amount # in tax.total, accumulate grand total of each item tax.total += tax.grand_total_for_current_item @@ -254,12 +258,11 @@ class calculate_taxes_and_totals(object): if tax.charge_type == "Actual": # distribute the tax amount proportionally to each item row - actual = flt(tax.rate, self.doc.precision("tax_amount", tax)) - current_tax_amount = (self.doc.base_net_total - and ((item.base_amount / self.doc.base_net_total) * actual) - or 0) + actual = flt(tax.tax_amount, tax.precision("tax_amount")) + current_tax_amount = item.net_amount*actual / self.doc.net_total if self.doc.net_total else 0.0 + elif tax.charge_type == "On Net Total": - current_tax_amount = (tax_rate / 100.0) * item.base_amount + current_tax_amount = (tax_rate / 100.0) * item.net_amount elif tax.charge_type == "On Previous Row Amount": current_tax_amount = (tax_rate / 100.0) * \ self.doc.get("taxes")[cint(tax.row_id) - 1].tax_amount_for_current_item @@ -267,72 +270,66 @@ class calculate_taxes_and_totals(object): current_tax_amount = (tax_rate / 100.0) * \ self.doc.get("taxes")[cint(tax.row_id) - 1].grand_total_for_current_item - current_tax_amount = flt(current_tax_amount, self.doc.precision("tax_amount", tax)) + # current_tax_amount = flt(current_tax_amount, tax.precision("tax_amount", tax)) - # store tax breakup for each item - key = item.item_code or item.item_name - if tax.item_wise_tax_detail.get(key): - item_wise_tax_amount = tax.item_wise_tax_detail[key][1] + current_tax_amount - tax.item_wise_tax_detail[key] = [tax_rate,item_wise_tax_amount] - else: - tax.item_wise_tax_detail[key] = [tax_rate,current_tax_amount] + self.set_item_wise_tax(item, tax, tax_rate, current_tax_amount) return current_tax_amount + def set_item_wise_tax(self, item, tax, tax_rate, current_tax_amount): + # store tax breakup for each item + key = item.item_code or item.item_name + item_wise_tax_amount = current_tax_amount*self.doc.conversion_rate + if tax.item_wise_tax_detail.get(key): + item_wise_tax_amount += tax.item_wise_tax_detail[key][1] + + tax.item_wise_tax_detail[key] = [tax_rate,flt(item_wise_tax_amount, tax.precision("base_tax_amount"))] + def round_off_totals(self, tax): - tax.total = flt(tax.total, self.doc.precision("total", tax)) - tax.tax_amount = flt(tax.tax_amount, self.doc.precision("tax_amount", tax)) - tax.tax_amount_after_discount_amount = flt(tax.tax_amount_after_discount_amount, - self.doc.precision("tax_amount", tax)) + tax.total = flt(tax.total, tax.precision("total")) + tax.tax_amount = flt(tax.tax_amount, tax.precision("tax_amount")) + tax.tax_amount_after_discount_amount = flt(tax.tax_amount_after_discount_amount, tax.precision("tax_amount")) def adjust_discount_amount_loss(self, tax): - discount_amount_loss = self.doc.base_grand_total - flt(self.doc.base_discount_amount) - tax.total + discount_amount_loss = self.doc.grand_total - flt(self.doc.discount_amount) - tax.total tax.tax_amount_after_discount_amount = flt(tax.tax_amount_after_discount_amount + discount_amount_loss, self.doc.precision("tax_amount", tax)) tax.total = flt(tax.total + discount_amount_loss, self.doc.precision("total", tax)) def calculate_totals(self): - self.doc.base_grand_total = flt(self.doc.get("taxes")[-1].total - if self.doc.get("taxes") else self.doc.base_net_total) - - self.doc.base_total_taxes_and_charges = flt(self.doc.base_grand_total - self.doc.base_net_total, - self.doc.precision("base_total_taxes_and_charges")) + self.doc.grand_total = flt(self.doc.get("taxes")[-1].total + if self.doc.get("taxes") else self.doc.net_total) if self.doc.doctype in ["Quotation", "Sales Order", "Delivery Note", "Sales Invoice"]: - self.doc.grand_total = flt(self.doc.base_grand_total / self.doc.conversion_rate) \ - if (self.doc.base_total_taxes_and_charges or self.doc.discount_amount) else self.doc.net_total - - self.doc.total_taxes_and_charges = flt(self.doc.grand_total - self.doc.net_total + - flt(self.doc.discount_amount), self.doc.precision("total_taxes_and_charges")) + self.doc.base_grand_total = flt(self.doc.grand_total * self.doc.conversion_rate) \ + if self.doc.total_taxes_and_charges else self.doc.base_net_total else: - self.doc.base_taxes_and_charges_added, self.doc.base_taxes_and_charges_deducted = 0.0, 0.0 + self.doc.taxes_and_charges_added, self.taxes_and_charges_deducted = 0.0, 0.0 for tax in self.doc.get("taxes"): if tax.category in ["Valuation and Total", "Total"]: if tax.add_deduct_tax == "Add": - self.doc.base_taxes_and_charges_added += flt(tax.tax_amount) + self.doc.taxes_and_charges_added += flt(tax.tax_amount) else: - self.doc.base_taxes_and_charges_deducted += flt(tax.tax_amount) + self.doc.taxes_and_charges_deducted += flt(tax.tax_amount) - self.doc.round_floats_in(self.doc, ["base_taxes_and_charges_added", "base_taxes_and_charges_deducted"]) + self.doc.round_floats_in(self.doc, ["taxes_and_charges_added", "taxes_and_charges_deducted"]) - self.doc.grand_total = flt(self.doc.base_grand_total / self.doc.conversion_rate) \ - if (self.doc.base_taxes_and_charges_added or self.doc.base_taxes_and_charges_deducted) else self.doc.net_total + self.doc.base_grand_total = flt(self.doc.grand_total * self.doc.conversion_rate) \ + if (self.doc.taxes_and_charges_added or self.doc.taxes_and_charges_deducted) \ + else self.doc.base_net_total - self.doc.total_taxes_and_charges = flt(self.doc.grand_total - self.doc.net_total, - self.doc.precision("total_taxes_and_charges")) + self._set_in_company_currency(self.doc, ["taxes_and_charges_added", "taxes_and_charges_deducted"]) - self.doc.taxes_and_charges_added = flt(self.doc.base_taxes_and_charges_added / self.doc.conversion_rate, - self.doc.precision("taxes_and_charges_added")) - self.doc.taxes_and_charges_deducted = flt(self.doc.base_taxes_and_charges_deducted / self.doc.conversion_rate, - self.doc.precision("taxes_and_charges_deducted")) + self.doc.total_taxes_and_charges = flt(self.doc.grand_total - self.doc.net_total, + self.doc.precision("total_taxes_and_charges")) - self.doc.base_grand_total = flt(self.doc.base_grand_total, self.doc.precision("base_grand_total")) - self.doc.grand_total = flt(self.doc.grand_total, self.doc.precision("grand_total")) + self._set_in_company_currency(self.doc, ["total_taxes_and_charges"]) + self.doc.round_floats_in(self.doc, ["grand_total", "base_grand_total"]) - if self.doc.meta.get_field("base_rounded_total"): - self.doc.base_rounded_total = rounded(self.doc.base_grand_total) if self.doc.meta.get_field("rounded_total"): self.doc.rounded_total = rounded(self.doc.grand_total) + if self.doc.meta.get_field("base_rounded_total"): + self.doc.base_rounded_total = rounded(self.doc.base_grand_total) def _cleanup(self): for tax in self.doc.get("taxes"): @@ -343,40 +340,44 @@ class calculate_taxes_and_totals(object): self.doc.base_discount_amount = flt(self.doc.discount_amount * self.doc.conversion_rate, self.doc.precision("base_discount_amount")) - grand_total_for_discount_amount = self.get_grand_total_for_discount_amount() + total_for_discount_amount = self.get_total_for_discount_amount() - if grand_total_for_discount_amount: + if total_for_discount_amount: # calculate item amount after Discount Amount for item in self.doc.get("items"): - distributed_amount = flt(self.doc.base_discount_amount) * item.base_amount / grand_total_for_discount_amount - item.base_amount = flt(item.base_amount - distributed_amount, self.doc.precision("base_amount", item)) + distributed_amount = flt(self.doc.discount_amount) * item.net_amount / total_for_discount_amount + item.net_amount = flt(item.net_amount - distributed_amount, item.precision("net_amount")) + item.net_rate = flt(item.net_amount / item.qty, item.precision("net_rate")) + + self._set_in_company_currency(item, ["net_rate", "net_amount"]) self.discount_amount_applied = True self._calculate() else: self.doc.base_discount_amount = 0 - def get_grand_total_for_discount_amount(self): - actual_taxes_dict = {} + def get_total_for_discount_amount(self): + if self.doc.apply_discount_on == "Print Total": + return self.net_total + else: + actual_taxes_dict = {} - for tax in self.doc.get("taxes"): - if tax.charge_type == "Actual": - actual_taxes_dict.setdefault(tax.idx, tax.tax_amount) - elif tax.row_id in actual_taxes_dict: - actual_tax_amount = flt(actual_taxes_dict.get(tax.row_id, 0)) * flt(tax.rate) / 100 - actual_taxes_dict.setdefault(tax.idx, actual_tax_amount) + for tax in self.doc.get("taxes"): + if tax.charge_type == "Actual": + actual_taxes_dict.setdefault(tax.idx, tax.tax_amount) + elif tax.row_id in actual_taxes_dict: + actual_tax_amount = flt(actual_taxes_dict.get(tax.row_id, 0)) * flt(tax.rate) / 100 + actual_taxes_dict.setdefault(tax.idx, actual_tax_amount) - grand_total_for_discount_amount = flt(self.doc.base_grand_total - sum(actual_taxes_dict.values()), - self.doc.precision("base_grand_total")) - return grand_total_for_discount_amount + return flt(self.doc.grand_total - sum(actual_taxes_dict.values()), self.doc.precision("grand_total")) - def calculate_total_advance(self): - if self.doc.docstatus < 2: - sum_of_allocated_amount = sum([flt(adv.allocated_amount, self.doc.precision("allocated_amount", adv)) + def calculate_total_advance(self, parenttype, advance_parentfield): + if self.docstatus < 2: + total_allocated_amount = sum([flt(adv.allocated_amount, adv.precision("allocated_amount")) for adv in self.doc.get("advances")]) - self.doc.total_advance = flt(sum_of_allocated_amount, self.doc.precision("total_advance")) + self.doc.total_advance = flt(total_allocated_amount, self.doc.precision("total_advance")) if self.doc.docstatus == 0: self.calculate_outstanding_amount() diff --git a/erpnext/public/js/controllers/taxes_and_totals.js b/erpnext/public/js/controllers/taxes_and_totals.js index 663f6ab603a..d9e3e43a5a6 100644 --- a/erpnext/public/js/controllers/taxes_and_totals.js +++ b/erpnext/public/js/controllers/taxes_and_totals.js @@ -38,22 +38,46 @@ erpnext.taxes_and_totals = erpnext.stock.StockController.extend({ this.show_item_wise_taxes(); }, + validate_conversion_rate: function() { + this.frm.doc.conversion_rate = flt(this.frm.doc.conversion_rate, precision("conversion_rate")); + var conversion_rate_label = frappe.meta.get_label(this.frm.doc.doctype, "conversion_rate", + this.frm.doc.name); + var company_currency = this.get_company_currency(); + + if(!this.frm.doc.conversion_rate) { + frappe.throw(repl('%(conversion_rate_label)s' + + __(' is mandatory. Maybe Currency Exchange record is not created for ') + + '%(from_currency)s' + __(" to ") + '%(to_currency)s', + { + "conversion_rate_label": conversion_rate_label, + "from_currency": this.frm.doc.currency, + "to_currency": company_currency + })); + } + }, + calculate_item_values: function() { var me = this; if (!this.discount_amount_applied) { $.each(this.frm.doc["items"] || [], function(i, item) { frappe.model.round_floats_in(item); + item.net_rate = item.rate; item.amount = flt(item.rate * item.qty, precision("amount", item)); + item.net_amount = item.amount; item.item_tax_amount = 0.0; - $.each(["price_list_rate", "rate", "amount"], function(i, f) { - item["base_" + f] = flt(item[f] * me.frm.doc.conversion_rate, precision("base_" + f, item)); - }) + this.set_in_company_currency(item, ["price_list_rate", "rate", "amount", "net_rate", "net_amount"]); }); } }, + set_in_company_currency: function(doc, fields) { + $.each(fields, function(i, f) { + doc["base_"+f] = flt(flt(doc[f], precision(f, doc)) * me.frm.doc.conversion_rate, precision("base_" + f, doc)); + }) + } + initialize_taxes: function() { var me = this; @@ -75,7 +99,12 @@ erpnext.taxes_and_totals = erpnext.stock.StockController.extend({ }, determine_exclusive_rate: function() { - if(!in_list(["Quotation", "Sales Order", "Delivery Note", "Sales Invoice"], this.frm.doc.doctype)) return; + var has_inclusive_tax = false; + $.each(me.frm.doc["taxes"] || [], function(i, row) { + if(cint(row.included_in_print_rate)) has_inclusive_tax = true; + }) + if(has_inclusive_tax==false || !in_list(["Quotation", "Sales Order", "Delivery Note", "Sales Invoice"], this.frm.doc.doctype)) + return; var me = this; $.each(me.frm.doc["items"] || [], function(n, item) { @@ -97,19 +126,21 @@ erpnext.taxes_and_totals = erpnext.stock.StockController.extend({ }); if(cumulated_tax_fraction && !me.discount_amount_applied) { - item.base_amount = flt( + item.net_amount = flt( (item.amount * me.frm.doc.conversion_rate) / (1 + cumulated_tax_fraction), - precision("base_amount", item)); + precision("net_amount", item)); - item.base_rate = flt(item.base_amount / item.qty, precision("base_rate", item)); + item.net_rate = flt(item.net_amount / item.qty, precision("net_rate", item)); - if(item.discount_percentage == 100) { - item.base_price_list_rate = item.base_rate; - item.base_rate = 0.0; - } else { - item.base_price_list_rate = flt(item.base_rate / (1 - item.discount_percentage / 100.0), - precision("base_price_list_rate", item)); - } + this.set_in_company_currency(item, ["net_rate", "net_amount"]); + + // if(item.discount_percentage == 100) { + // item.base_price_list_rate = item.base_rate; + // item.base_rate = 0.0; + // } else { + // item.base_price_list_rate = flt(item.base_rate / (1 - item.discount_percentage / 100.0), + // precision("base_price_list_rate", item)); + // } } }); }, @@ -140,20 +171,21 @@ erpnext.taxes_and_totals = erpnext.stock.StockController.extend({ _get_tax_rate: function(tax, item_tax_map) { return (keys(item_tax_map).indexOf(tax.account_head) != -1) ? - flt(item_tax_map[tax.account_head], precision("rate", tax)) : - tax.rate; + flt(item_tax_map[tax.account_head], precision("rate", tax)) : tax.rate; }, calculate_net_total: function() { var me = this; - this.frm.doc.base_net_total = this.frm.doc.net_total = 0.0; + this.frm.doc.print_total = this.frm.doc.base_print_total = this.frm.doc.net_total = this.frm.doc.base_net_total = 0.0; $.each(this.frm.doc["items"] || [], function(i, item) { - me.frm.doc.base_net_total += item.base_amount; - me.frm.doc.net_total += item.amount; + me.frm.doc.print_total += item.amount; + me.frm.doc.base_print_total += item.base_amount; + me.frm.doc.net_total += item.net_amount; + me.frm.doc.base_net_total += item.base_net_amount; }); - frappe.model.round_floats_in(this.frm.doc, ["base_net_total", "net_total"]); + frappe.model.round_floats_in(this.frm.doc, ["print_total", "base_print_total", "net_total", "base_net_total"]); }, calculate_taxes: function() { @@ -163,7 +195,7 @@ erpnext.taxes_and_totals = erpnext.stock.StockController.extend({ // maintain actual tax rate based on idx $.each(this.frm.doc["taxes"] || [], function(i, tax) { if (tax.charge_type == "Actual") { - actual_tax_dict[tax.idx] = flt(tax.rate, precision("tax_amount", tax)); + actual_tax_dict[tax.idx] = flt(tax.tax_amount, precision("tax_amount", tax)); } }); @@ -205,12 +237,10 @@ erpnext.taxes_and_totals = erpnext.stock.StockController.extend({ // note: grand_total_for_current_item contains the contribution of // item's amount, previously applied tax and the current tax on that item if(i==0) { - tax.grand_total_for_current_item = flt(item.base_amount + current_tax_amount, - precision("total", tax)); + tax.grand_total_for_current_item = flt(item.base_amount + current_tax_amount); } else { tax.grand_total_for_current_item = - flt(me.frm.doc["taxes"][i-1].grand_total_for_current_item + current_tax_amount, - precision("total", tax)); + flt(me.frm.doc["taxes"][i-1].grand_total_for_current_item + current_tax_amount); } // in tax.total, accumulate grand total for each item @@ -238,12 +268,12 @@ 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.base_net_total ? - ((item.base_amount / this.frm.doc.base_net_total) * actual) : 0.0; + var actual = flt(tax.tax_amount, precision("tax_amount", tax)); + current_tax_amount = this.frm.doc.net_total ? + ((item.net_amount / this.frm.doc.net_total) * actual) : 0.0; } else if(tax.charge_type == "On Net Total") { - current_tax_amount = (tax_rate / 100.0) * item.base_amount; + current_tax_amount = (tax_rate / 100.0) * item.net_amount; } else if(tax.charge_type == "On Previous Row Amount") { current_tax_amount = (tax_rate / 100.0) * @@ -254,14 +284,24 @@ erpnext.taxes_and_totals = erpnext.stock.StockController.extend({ this.frm.doc["taxes"][cint(tax.row_id) - 1].grand_total_for_current_item; } - current_tax_amount = flt(current_tax_amount, precision("tax_amount", tax)); + // current_tax_amount = flt(current_tax_amount, precision("tax_amount", tax)); - // store tax breakup for each item - tax.item_wise_tax_detail[item.item_code || item.item_name] = [tax_rate, current_tax_amount]; + this.set_item_wise_tax(item, tax, tax_rate, current_tax_amount); return current_tax_amount; }, + set_item_wise_tax: function(item, tax, tax_rate, current_tax_amount) { + // store tax breakup for each item + var key = item.item_code || item.item_name; + var item_wise_tax_amount = current_tax_amount * this.frm.doc.conversion_rate; + if (tax.item_wise_tax_detail.get(key)) + item_wise_tax_amount += tax.item_wise_tax_detail[key][1] + + tax.item_wise_tax_detail[key] = [tax_rate,flt(item_wise_tax_amount, precision("base_tax_amount", tax))] + + }, + round_off_totals: function(tax) { tax.total = flt(tax.total, precision("total", tax)); tax.tax_amount = flt(tax.tax_amount, precision("tax_amount", tax)); @@ -276,9 +316,55 @@ erpnext.taxes_and_totals = erpnext.stock.StockController.extend({ tax.total = flt(tax.total + discount_amount_loss, precision("total", tax)); }, + calculate_totals: function() { + // Changing sequence can cause roundiing issue and on-screen discrepency + 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); + + if(in_list(["Quotation", "Sales Order", "Delivery Note", "Sales Invoice"], this.frm.doc.doctype)) { + this.frm.doc.base_grand_total = (this.frm.doc.base_total_taxes_and_charges) ? + flt(this.frm.doc.grand_total * this.frm.doc.conversion_rate) : this.frm.doc.base_net_total; + } else { + // other charges added/deducted + this.frm.doc.taxes_and_charges_added = this.frm.doc.taxes_and_charges_deducted = 0.0; + if(tax_count) { + $.each(this.frm.doc["taxes"] || [], function(i, tax) { + if in_list(["Valuation and Total", "Total"], tax.category) { + if(tax.add_deduct_tax == "Add") { + me.frm.doc.taxes_and_charges_added += flt(tax.tax_amount); + } else { + me.frm.doc.taxes_and_charges_deducted += flt(tax.tax_amount); + } + } + }) + + frappe.model.round_floats_in(this.frm.doc, ["taxes_and_charges_added", "taxes_and_charges_deducted"]); + } + + this.frm.doc.grand_total = flt((this.frm.doc.taxes_and_charges_added || this.frm.doc.taxes_and_charges_deducted) ? + flt(this.frm.doc.grand_total * this.frm.doc.conversion_rate) : this.frm.doc.base_net_total); + + this.set_in_company_currency(this.frm.doc, ["taxes_and_charges_added", "taxes_and_charges_deducted"]); + } + + this.frm.doc.total_taxes_and_charges = flt(this.frm.doc.grand_total - this.frm.doc.net_total, + precision("total_taxes_and_charges")); + + // Round grand total as per precision + frappe.model.round_floats_in(this.frm.doc, ["grand_total", "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); + } + }, _cleanup: function() { - this.frm.doc.base_in_words = this.frm.doc.in_words = this.frm.doc.in_words = ""; + this.frm.doc.base_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)) { @@ -288,7 +374,6 @@ erpnext.taxes_and_totals = erpnext.stock.StockController.extend({ } } - if(this.frm.doc["taxes"] && this.frm.doc["taxes"].length) { var temporary_fields = ["tax_amount_for_current_item", "grand_total_for_current_item", "tax_fraction_for_current_item", "grand_total_fraction_for_current_item"] @@ -307,65 +392,6 @@ erpnext.taxes_and_totals = erpnext.stock.StockController.extend({ } }, - calculate_totals: function() { - // Changing sequence can cause roundiing issue and on-screen discrepency - - var tax_count = this.frm.doc["taxes"] ? this.frm.doc["taxes"].length : 0; - 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.base_total_taxes_and_charges = flt(this.frm.doc.base_grand_total - this.frm.doc.base_net_total, - precision("base_total_taxes_and_charges")); - - if(in_list(["Quotation", "Sales Order", "Delivery Note", "Sales Invoice"], this.frm.doc.doctype)) { - 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.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")); - } else { - // other charges added/deducted - 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.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.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, - ["base_taxes_and_charges_added", "base_taxes_and_charges_deducted"]); - } - - 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.total_taxes_and_charges = flt(this.frm.doc.grand_total - this.frm.doc.net_total, - precision("total_taxes_and_charges")); - - 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")); - } - - // Round grand total as per precision - 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")); - - // rounded totals - 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); - } - 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); - } - }, - apply_discount_amount: function() { var me = this; var distributed_amount = 0.0; @@ -374,12 +400,15 @@ erpnext.taxes_and_totals = erpnext.stock.StockController.extend({ this.frm.set_value("base_discount_amount", flt(this.frm.doc.discount_amount * this.frm.doc.conversion_rate, precision("base_discount_amount"))) - var grand_total_for_discount_amount = this.get_grand_total_for_discount_amount(); + var total_for_discount_amount = this.get_total_for_discount_amount(); // calculate item amount after Discount Amount - if (grand_total_for_discount_amount) { + if (total_for_discount_amount) { $.each(this.frm.doc["items"] || [], function(i, item) { - distributed_amount = flt(me.frm.doc.base_discount_amount) * item.base_amount / grand_total_for_discount_amount; - item.base_amount = flt(item.base_amount - distributed_amount, precision("base_amount", item)); + distributed_amount = flt(me.frm.doc.discount_amount) * item.net_amount / total_for_discount_amount; + item.base_amount = flt(item.net_amount - distributed_amount, precision("base_amount", item)); + item.net_rate = flt(item.net_amount / item.qty, precision("net_rate", item)); + + me.set_in_company_currency(item, ["net_rate", "net_amount"]); }); this.discount_amount_applied = true; @@ -390,34 +419,38 @@ erpnext.taxes_and_totals = erpnext.stock.StockController.extend({ } }, - get_grand_total_for_discount_amount: function() { + get_total_for_discount_amount: function() { var me = this; - var total_actual_tax = 0.0; - var actual_taxes_dict = {}; - $.each(this.frm.doc["taxes"] || [], function(i, tax) { - if (tax.charge_type == "Actual") - actual_taxes_dict[tax.idx] = tax.tax_amount; - else if (actual_taxes_dict[tax.row_id] !== null) { - actual_tax_amount = flt(actual_taxes_dict[tax.row_id]) * flt(tax.rate) / 100; - actual_taxes_dict[tax.idx] = actual_tax_amount; - } - }); + if(this.apply_discount_amount == "Print Total") { + return this.net_total + } else { + var total_actual_tax = 0.0; + var actual_taxes_dict = {}; - $.each(actual_taxes_dict, function(key, value) { - if (value) - total_actual_tax += value; - }); + $.each(this.frm.doc["taxes"] || [], function(i, tax) { + if (tax.charge_type == "Actual") + actual_taxes_dict[tax.idx] = tax.tax_amount; + else if (actual_taxes_dict[tax.row_id] !== null) { + actual_tax_amount = flt(actual_taxes_dict[tax.row_id]) * flt(tax.rate) / 100; + actual_taxes_dict[tax.idx] = actual_tax_amount; + } + }); - 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; + $.each(actual_taxes_dict, function(key, value) { + if (value) + total_actual_tax += value; + }); + + return flt(this.frm.doc.grand_total - total_actual_tax, precision("grand_total")); + } }, calculate_total_advance: function(update_paid_amount) { - this.frm.doc.total_advance = flt(frappe.utils.sum( - $.map(this.frm.doc["advances"] || [], function(adv) { return adv.allocated_amount }) - ), precision("total_advance")); + var total_allocated_amount = frappe.utils.sum($.map(this.frm.doc["advances"] || [], function(adv) { + return flt(adv.allocated_amount, precision("allocated_amount", adv)) + })); + this.frm.doc.total_advance = flt(total_allocated_amount, precision("total_advance")); this.calculate_outstanding_amount(update_paid_amount); } diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index 1dca8372a78..6e6ea23af2d 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -560,24 +560,6 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({ return valid; }, - validate_conversion_rate: function() { - this.frm.doc.conversion_rate = flt(this.frm.doc.conversion_rate, precision("conversion_rate")); - var conversion_rate_label = frappe.meta.get_label(this.frm.doc.doctype, "conversion_rate", - this.frm.doc.name); - var company_currency = this.get_company_currency(); - - if(!this.frm.doc.conversion_rate) { - frappe.throw(repl('%(conversion_rate_label)s' + - __(' is mandatory. Maybe Currency Exchange record is not created for ') + - '%(from_currency)s' + __(" to ") + '%(to_currency)s', - { - "conversion_rate_label": conversion_rate_label, - "from_currency": this.frm.doc.currency, - "to_currency": company_currency - })); - } - }, - get_terms: function() { var me = this; if(this.frm.doc.tc_name) { diff --git a/erpnext/selling/doctype/quotation/quotation.js b/erpnext/selling/doctype/quotation/quotation.js index 665710072c0..c63939dbf9d 100644 --- a/erpnext/selling/doctype/quotation/quotation.js +++ b/erpnext/selling/doctype/quotation/quotation.js @@ -25,7 +25,7 @@ erpnext.selling.QuotationController = erpnext.selling.SellingController.extend({ cur_frm.add_custom_button(__('Set as Lost'), cur_frm.cscript['Declare Order Lost'], "icon-exclamation", "btn-default"); } - + } if (this.frm.doc.docstatus===0) { @@ -159,4 +159,6 @@ cur_frm.cscript.on_submit = function(doc, cdt, cdn) { cur_frm.email_doc(frappe.boot.notification_settings.quotation_message); } - +frappe.ui.form.on("Quotation Item", "items_on_form_rendered", function(frm, cdt, cdn) { + // enable tax_amount field if Actual +}) diff --git a/erpnext/selling/doctype/quotation/quotation.json b/erpnext/selling/doctype/quotation/quotation.json index 14bce048a9a..d90f1072eff 100644 --- a/erpnext/selling/doctype/quotation/quotation.json +++ b/erpnext/selling/doctype/quotation/quotation.json @@ -1,946 +1,974 @@ { - "allow_import": 1, - "autoname": "naming_series:", - "creation": "2013-05-24 19:29:08", - "docstatus": 0, - "doctype": "DocType", - "document_type": "Transaction", + "allow_import": 1, + "autoname": "naming_series:", + "creation": "2013-05-24 19:29:08", + "docstatus": 0, + "doctype": "DocType", + "document_type": "Transaction", "fields": [ { - "fieldname": "customer_section", - "fieldtype": "Section Break", - "label": "", - "options": "icon-user", + "fieldname": "customer_section", + "fieldtype": "Section Break", + "label": "", + "options": "icon-user", "permlevel": 0 - }, + }, { - "fieldname": "column_break0", - "fieldtype": "Column Break", - "permlevel": 0, - "read_only": 0, + "fieldname": "column_break0", + "fieldtype": "Column Break", + "permlevel": 0, + "read_only": 0, "width": "50%" - }, + }, { - "fieldname": "naming_series", - "fieldtype": "Select", - "label": "Series", - "no_copy": 1, - "oldfieldname": "naming_series", - "oldfieldtype": "Select", - "options": "QTN-", - "permlevel": 0, - "print_hide": 1, - "read_only": 0, + "fieldname": "naming_series", + "fieldtype": "Select", + "label": "Series", + "no_copy": 1, + "oldfieldname": "naming_series", + "oldfieldtype": "Select", + "options": "QTN-", + "permlevel": 0, + "print_hide": 1, + "read_only": 0, "reqd": 1 - }, + }, { - "default": "Customer", - "fieldname": "quotation_to", - "fieldtype": "Select", - "in_filter": 1, - "label": "Quotation To", - "oldfieldname": "quotation_to", - "oldfieldtype": "Select", - "options": "\nLead\nCustomer", - "permlevel": 0, - "print_hide": 1, - "read_only": 0, - "report_hide": 0, + "default": "Customer", + "fieldname": "quotation_to", + "fieldtype": "Select", + "in_filter": 1, + "label": "Quotation To", + "oldfieldname": "quotation_to", + "oldfieldtype": "Select", + "options": "\nLead\nCustomer", + "permlevel": 0, + "print_hide": 1, + "read_only": 0, + "report_hide": 0, "reqd": 1 - }, + }, { - "depends_on": "eval:doc.quotation_to == \"Customer\"", - "fieldname": "customer", - "fieldtype": "Link", - "hidden": 0, - "in_filter": 1, - "label": "Customer", - "oldfieldname": "customer", - "oldfieldtype": "Link", - "options": "Customer", - "permlevel": 0, - "print_hide": 1, - "read_only": 0, + "depends_on": "eval:doc.quotation_to == \"Customer\"", + "fieldname": "customer", + "fieldtype": "Link", + "hidden": 0, + "in_filter": 1, + "label": "Customer", + "oldfieldname": "customer", + "oldfieldtype": "Link", + "options": "Customer", + "permlevel": 0, + "print_hide": 1, + "read_only": 0, "search_index": 1 - }, + }, { - "depends_on": "eval:doc.quotation_to == \"Lead\"", - "fieldname": "lead", - "fieldtype": "Link", - "hidden": 0, - "in_filter": 1, - "label": "Lead", - "oldfieldname": "lead", - "oldfieldtype": "Link", - "options": "Lead", - "permlevel": 0, - "print_hide": 1, + "depends_on": "eval:doc.quotation_to == \"Lead\"", + "fieldname": "lead", + "fieldtype": "Link", + "hidden": 0, + "in_filter": 1, + "label": "Lead", + "oldfieldname": "lead", + "oldfieldtype": "Link", + "options": "Lead", + "permlevel": 0, + "print_hide": 1, "read_only": 0 - }, + }, { - "fieldname": "customer_name", - "fieldtype": "Data", - "hidden": 1, - "in_list_view": 0, - "label": "Customer / Lead Name", - "permlevel": 0, + "fieldname": "customer_name", + "fieldtype": "Data", + "hidden": 1, + "in_list_view": 0, + "label": "Customer / Lead Name", + "permlevel": 0, "read_only": 1 - }, + }, { - "fieldname": "address_display", - "fieldtype": "Small Text", - "hidden": 1, - "in_filter": 0, - "label": "Address", - "oldfieldname": "customer_address", - "oldfieldtype": "Small Text", - "permlevel": 0, - "print_hide": 0, - "read_only": 1, - "reqd": 0, + "fieldname": "address_display", + "fieldtype": "Small Text", + "hidden": 1, + "in_filter": 0, + "label": "Address", + "oldfieldname": "customer_address", + "oldfieldtype": "Small Text", + "permlevel": 0, + "print_hide": 0, + "read_only": 1, + "reqd": 0, "search_index": 0 - }, + }, { - "fieldname": "contact_display", - "fieldtype": "Small Text", - "hidden": 1, - "in_filter": 0, - "label": "Contact", - "permlevel": 0, - "print_hide": 0, + "fieldname": "contact_display", + "fieldtype": "Small Text", + "hidden": 1, + "in_filter": 0, + "label": "Contact", + "permlevel": 0, + "print_hide": 0, "read_only": 1 - }, + }, { - "fieldname": "contact_mobile", - "fieldtype": "Small Text", - "hidden": 1, - "label": "Mobile No", - "permlevel": 0, - "print_hide": 0, + "fieldname": "contact_mobile", + "fieldtype": "Small Text", + "hidden": 1, + "label": "Mobile No", + "permlevel": 0, + "print_hide": 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 - }, + }, { - "fieldname": "column_break1", - "fieldtype": "Column Break", - "oldfieldtype": "Column Break", - "permlevel": 0, - "read_only": 0, + "fieldname": "column_break1", + "fieldtype": "Column Break", + "oldfieldtype": "Column Break", + "permlevel": 0, + "read_only": 0, "width": "50%" - }, + }, { - "fieldname": "amended_from", - "fieldtype": "Link", - "ignore_user_permissions": 1, - "label": "Amended From", - "no_copy": 1, - "oldfieldname": "amended_from", - "oldfieldtype": "Data", - "options": "Quotation", - "permlevel": 0, - "print_hide": 1, - "read_only": 1, + "fieldname": "amended_from", + "fieldtype": "Link", + "ignore_user_permissions": 1, + "label": "Amended From", + "no_copy": 1, + "oldfieldname": "amended_from", + "oldfieldtype": "Data", + "options": "Quotation", + "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, - "read_only": 0, - "reqd": 1, - "search_index": 0, + "description": "", + "fieldname": "company", + "fieldtype": "Link", + "in_filter": 1, + "label": "Company", + "oldfieldname": "company", + "oldfieldtype": "Link", + "options": "Company", + "permlevel": 0, + "print_hide": 1, + "read_only": 0, + "reqd": 1, + "search_index": 0, "width": "150px" - }, + }, { - "default": "Today", - "fieldname": "transaction_date", - "fieldtype": "Date", - "in_filter": 1, - "label": "Date", - "no_copy": 1, - "oldfieldname": "transaction_date", - "oldfieldtype": "Date", - "permlevel": 0, - "read_only": 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, + "read_only": 0, + "reqd": 1, + "search_index": 1, "width": "100px" - }, + }, { - "default": "Sales", - "fieldname": "order_type", - "fieldtype": "Select", - "in_filter": 1, - "label": "Order Type", - "oldfieldname": "order_type", - "oldfieldtype": "Select", - "options": "\nSales\nMaintenance\nShopping Cart", - "permlevel": 0, - "print_hide": 1, - "read_only": 0, - "reqd": 1, + "default": "Sales", + "fieldname": "order_type", + "fieldtype": "Select", + "in_filter": 1, + "label": "Order Type", + "oldfieldname": "order_type", + "oldfieldtype": "Select", + "options": "\nSales\nMaintenance\nShopping Cart", + "permlevel": 0, + "print_hide": 1, + "read_only": 0, + "reqd": 1, "search_index": 0 - }, + }, { - "fieldname": "currency_and_price_list", - "fieldtype": "Section Break", - "label": "", - "options": "icon-tag", - "permlevel": 0, + "fieldname": "currency_and_price_list", + "fieldtype": "Section Break", + "label": "", + "options": "icon-tag", + "permlevel": 0, "read_only": 0 - }, + }, { - "fieldname": "currency", - "fieldtype": "Link", - "in_filter": 1, - "label": "Currency", - "oldfieldname": "currency", - "oldfieldtype": "Select", - "options": "Currency", - "permlevel": 0, - "print_hide": 1, - "read_only": 0, - "reqd": 1, - "search_index": 0, + "fieldname": "currency", + "fieldtype": "Link", + "in_filter": 1, + "label": "Currency", + "oldfieldname": "currency", + "oldfieldtype": "Select", + "options": "Currency", + "permlevel": 0, + "print_hide": 1, + "read_only": 0, + "reqd": 1, + "search_index": 0, "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, - "read_only": 0, - "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, + "read_only": 0, + "reqd": 1, "width": "100px" - }, + }, { - "fieldname": "column_break2", - "fieldtype": "Column Break", - "permlevel": 0, - "read_only": 0, + "fieldname": "column_break2", + "fieldtype": "Column Break", + "permlevel": 0, + "read_only": 0, "width": "50%" - }, + }, { - "fieldname": "selling_price_list", - "fieldtype": "Link", - "in_filter": 1, - "label": "Price List", - "oldfieldname": "price_list_name", - "oldfieldtype": "Select", - "options": "Price List", - "permlevel": 0, - "print_hide": 1, - "read_only": 0, - "reqd": 1, - "search_index": 0, + "fieldname": "selling_price_list", + "fieldtype": "Link", + "in_filter": 1, + "label": "Price List", + "oldfieldname": "price_list_name", + "oldfieldtype": "Select", + "options": "Price List", + "permlevel": 0, + "print_hide": 1, + "read_only": 0, + "reqd": 1, + "search_index": 0, "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, - "read_only": 0, + "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, + "read_only": 0, "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": "", - "oldfieldtype": "Section Break", - "options": "icon-shopping-cart", - "permlevel": 0, - "print_hide": 0, - "read_only": 0, + "fieldname": "items_section", + "fieldtype": "Section Break", + "label": "", + "oldfieldtype": "Section Break", + "options": "icon-shopping-cart", + "permlevel": 0, + "print_hide": 0, + "read_only": 0, "search_index": 0 - }, + }, { - "allow_on_submit": 1, - "fieldname": "items", - "fieldtype": "Table", - "label": "Items", - "oldfieldname": "quotation_details", - "oldfieldtype": "Table", - "options": "Quotation Item", - "permlevel": 0, - "read_only": 0, - "reqd": 0, + "allow_on_submit": 1, + "fieldname": "items", + "fieldtype": "Table", + "label": "Items", + "oldfieldname": "quotation_details", + "oldfieldtype": "Table", + "options": "Quotation Item", + "permlevel": 0, + "read_only": 0, + "reqd": 0, "width": "40px" - }, + }, { - "fieldname": "sec_break23", - "fieldtype": "Section Break", - "permlevel": 0, + "fieldname": "sec_break23", + "fieldtype": "Section Break", + "permlevel": 0, "read_only": 0 - }, + }, { - "fieldname": "base_net_total", - "fieldtype": "Currency", - "label": "Net Total (Company Currency)", - "no_copy": 0, - "oldfieldname": "net_total", - "oldfieldtype": "Currency", - "options": "Company:company:default_currency", - "permlevel": 0, - "print_hide": 1, - "read_only": 1, - "reqd": 0, + "fieldname": "base_print_total", + "fieldtype": "Currency", + "label": "Print Total (Company Currency)", + "options": "Company:company:default_currency", + "permlevel": 0, + "precision": "", + "print_hide": 1, + "read_only": 1 + }, + { + "fieldname": "base_net_total", + "fieldtype": "Currency", + "label": "Net Total (Company Currency)", + "no_copy": 0, + "oldfieldname": "net_total", + "oldfieldtype": "Currency", + "options": "Company:company:default_currency", + "permlevel": 0, + "print_hide": 1, + "read_only": 1, + "reqd": 0, "width": "100px" - }, + }, { - "fieldname": "column_break_28", - "fieldtype": "Column Break", + "fieldname": "column_break_28", + "fieldtype": "Column Break", "permlevel": 0 - }, + }, { - "fieldname": "net_total", - "fieldtype": "Currency", - "label": "Net Total", - "options": "currency", - "permlevel": 0, + "fieldname": "print_total", + "fieldtype": "Currency", + "label": "Print Total", + "options": "currency", + "permlevel": 0, + "precision": "", "read_only": 1 - }, + }, { - "fieldname": "taxes_section", - "fieldtype": "Section Break", - "label": "Taxes and Charges", - "oldfieldtype": "Section Break", - "options": "icon-money", - "permlevel": 0, - "read_only": 0 - }, - { - "fieldname": "taxes_and_charges", - "fieldtype": "Link", - "hidden": 0, - "label": "Taxes and Charges", - "oldfieldname": "charge", - "oldfieldtype": "Link", - "options": "Sales Taxes and Charges Master", - "permlevel": 0, - "print_hide": 1, - "read_only": 0 - }, - { - "fieldname": "column_break_34", - "fieldtype": "Column Break", - "permlevel": 0 - }, - { - "fieldname": "shipping_rule", - "fieldtype": "Link", - "hidden": 0, - "label": "Shipping Rule", - "oldfieldtype": "Button", - "options": "Shipping Rule", - "permlevel": 0, - "print_hide": 1, - "read_only": 0 - }, - { - "fieldname": "section_break_36", - "fieldtype": "Section Break", - "permlevel": 0 - }, - { - "fieldname": "taxes", - "fieldtype": "Table", - "label": "Sales Taxes and Charges", - "oldfieldname": "other_charges", - "oldfieldtype": "Table", - "options": "Sales Taxes and Charges", - "permlevel": 0, - "read_only": 0 - }, - { - "fieldname": "other_charges_calculation", - "fieldtype": "HTML", - "label": "Taxes and Charges Calculation", - "oldfieldtype": "HTML", - "permlevel": 0, - "print_hide": 1, - "read_only": 0 - }, - { - "fieldname": "section_break_39", - "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": "net_total", + "fieldtype": "Currency", + "label": "Net Total", + "options": "currency", + "permlevel": 0, "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": "column_break_42", - "fieldtype": "Column Break", - "permlevel": 0 - }, - { - "fieldname": "discount_amount", - "fieldtype": "Currency", - "label": "Discount Amount", - "options": "currency", - "permlevel": 0 - }, - { - "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": "", - "oldfieldtype": "Section Break", - "options": "icon-money", - "permlevel": 0, - "print_hide": 1, + "fieldname": "taxes_section", + "fieldtype": "Section Break", + "label": "Taxes and Charges", + "oldfieldtype": "Section Break", + "options": "icon-money", + "permlevel": 0, "read_only": 0 - }, + }, { - "fieldname": "base_grand_total", - "fieldtype": "Currency", - "label": "Grand Total (Company Currency)", - "no_copy": 0, - "oldfieldname": "grand_total", - "oldfieldtype": "Currency", - "options": "Company:company:default_currency", - "permlevel": 0, - "print_hide": 1, - "read_only": 1, - "reqd": 0, + "fieldname": "taxes_and_charges", + "fieldtype": "Link", + "hidden": 0, + "label": "Taxes and Charges", + "oldfieldname": "charge", + "oldfieldtype": "Link", + "options": "Sales Taxes and Charges Master", + "permlevel": 0, + "print_hide": 1, + "read_only": 0 + }, + { + "fieldname": "column_break_34", + "fieldtype": "Column Break", + "permlevel": 0 + }, + { + "fieldname": "shipping_rule", + "fieldtype": "Link", + "hidden": 0, + "label": "Shipping Rule", + "oldfieldtype": "Button", + "options": "Shipping Rule", + "permlevel": 0, + "print_hide": 1, + "read_only": 0 + }, + { + "fieldname": "section_break_36", + "fieldtype": "Section Break", + "permlevel": 0 + }, + { + "fieldname": "taxes", + "fieldtype": "Table", + "label": "Sales Taxes and Charges", + "oldfieldname": "other_charges", + "oldfieldtype": "Table", + "options": "Sales Taxes and Charges", + "permlevel": 0, + "read_only": 0 + }, + { + "fieldname": "other_charges_calculation", + "fieldtype": "HTML", + "label": "Taxes and Charges Calculation", + "oldfieldtype": "HTML", + "permlevel": 0, + "print_hide": 1, + "read_only": 0 + }, + { + "fieldname": "section_break_39", + "fieldtype": "Section Break", + "permlevel": 0 + }, + { + "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": "column_break_42", + "fieldtype": "Column Break", + "permlevel": 0 + }, + { + "default": "Grand Total", + "fieldname": "apply_discount_on", + "fieldtype": "Select", + "label": "Apply Discount On", + "options": "\nGrand Total\nPrint Total", + "permlevel": 0, + "precision": "" + }, + { + "fieldname": "discount_amount", + "fieldtype": "Currency", + "label": "Discount Amount", + "options": "currency", + "permlevel": 0 + }, + { + "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": "", + "oldfieldtype": "Section Break", + "options": "icon-money", + "permlevel": 0, + "print_hide": 1, + "read_only": 0 + }, + { + "fieldname": "base_grand_total", + "fieldtype": "Currency", + "label": "Grand Total (Company Currency)", + "no_copy": 0, + "oldfieldname": "grand_total", + "oldfieldtype": "Currency", + "options": "Company:company:default_currency", + "permlevel": 0, + "print_hide": 1, + "read_only": 1, + "reqd": 0, "width": "200px" - }, + }, { - "fieldname": "base_rounded_total", - "fieldtype": "Currency", - "label": "Rounded Total (Company Currency)", - "no_copy": 0, - "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)", + "no_copy": 0, + "oldfieldname": "rounded_total", + "oldfieldtype": "Currency", + "options": "Company:company:default_currency", + "permlevel": 0, + "print_hide": 1, + "read_only": 1, "width": "200px" - }, + }, { - "description": "In Words will be visible once you save the Quotation.", - "fieldname": "base_in_words", - "fieldtype": "Data", - "label": "In Words (Company Currency)", - "no_copy": 0, - "oldfieldname": "in_words", - "oldfieldtype": "Data", - "permlevel": 0, - "print_hide": 1, - "read_only": 1, + "description": "In Words will be visible once you save the Quotation.", + "fieldname": "base_in_words", + "fieldtype": "Data", + "label": "In Words (Company Currency)", + "no_copy": 0, + "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, - "read_only": 0, + "fieldname": "column_break3", + "fieldtype": "Column Break", + "oldfieldtype": "Column Break", + "permlevel": 0, + "print_hide": 1, + "read_only": 0, "width": "50%" - }, + }, { - "fieldname": "grand_total", - "fieldtype": "Currency", - "in_list_view": 1, - "label": "Grand Total", - "no_copy": 0, - "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", + "no_copy": 0, + "oldfieldname": "grand_total_export", + "oldfieldtype": "Currency", + "options": "currency", + "permlevel": 0, + "print_hide": 0, + "read_only": 1, + "reqd": 0, "width": "200px" - }, + }, { - "fieldname": "rounded_total", - "fieldtype": "Currency", - "label": "Rounded Total", - "no_copy": 0, - "oldfieldname": "rounded_total_export", - "oldfieldtype": "Currency", - "options": "currency", - "permlevel": 0, - "print_hide": 0, - "read_only": 1, - "reqd": 0, + "fieldname": "rounded_total", + "fieldtype": "Currency", + "label": "Rounded Total", + "no_copy": 0, + "oldfieldname": "rounded_total_export", + "oldfieldtype": "Currency", + "options": "currency", + "permlevel": 0, + "print_hide": 0, + "read_only": 1, + "reqd": 0, "width": "200px" - }, + }, { - "fieldname": "in_words", - "fieldtype": "Data", - "label": "In Words", - "no_copy": 0, - "oldfieldname": "in_words_export", - "oldfieldtype": "Data", - "permlevel": 0, - "print_hide": 0, - "read_only": 1, + "fieldname": "in_words", + "fieldtype": "Data", + "label": "In Words", + "no_copy": 0, + "oldfieldname": "in_words_export", + "oldfieldtype": "Data", + "permlevel": 0, + "print_hide": 0, + "read_only": 1, "width": "200px" - }, + }, { - "fieldname": "fold", - "fieldtype": "Fold", - "label": "Fold", + "fieldname": "fold", + "fieldtype": "Fold", + "label": "Fold", "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": "terms_section_break", + "fieldtype": "Section Break", + "label": "Terms and Conditions", + "oldfieldtype": "Section Break", + "options": "icon-legal", + "permlevel": 0, + "print_hide": 0, "read_only": 0 - }, + }, { - "fieldname": "tc_name", - "fieldtype": "Link", - "label": "Terms", - "oldfieldname": "tc_name", - "oldfieldtype": "Link", - "options": "Terms and Conditions", - "permlevel": 0, - "print_hide": 1, - "read_only": 0, + "fieldname": "tc_name", + "fieldtype": "Link", + "label": "Terms", + "oldfieldname": "tc_name", + "oldfieldtype": "Link", + "options": "Terms and Conditions", + "permlevel": 0, + "print_hide": 1, + "read_only": 0, "report_hide": 1 - }, + }, { - "fieldname": "terms", - "fieldtype": "Text Editor", - "label": "Term Details", - "oldfieldname": "terms", - "oldfieldtype": "Text Editor", - "permlevel": 0, + "fieldname": "terms", + "fieldtype": "Text Editor", + "label": "Term Details", + "oldfieldname": "terms", + "oldfieldtype": "Text Editor", + "permlevel": 0, "read_only": 0 - }, + }, { - "fieldname": "contact_section", - "fieldtype": "Section Break", - "label": "Contact Info", - "options": "icon-bullhorn", - "permlevel": 0, + "fieldname": "contact_section", + "fieldtype": "Section Break", + "label": "Contact Info", + "options": "icon-bullhorn", + "permlevel": 0, "read_only": 0 - }, + }, { - "description": "", - "fieldname": "territory", - "fieldtype": "Link", - "hidden": 0, - "in_filter": 1, - "label": "Territory", - "options": "Territory", - "permlevel": 0, - "print_hide": 1, - "read_only": 0, - "reqd": 1, + "description": "", + "fieldname": "territory", + "fieldtype": "Link", + "hidden": 0, + "in_filter": 1, + "label": "Territory", + "options": "Territory", + "permlevel": 0, + "print_hide": 1, + "read_only": 0, + "reqd": 1, "search_index": 0 - }, + }, { - "depends_on": "customer", - "description": "", - "fieldname": "customer_group", - "fieldtype": "Link", - "in_filter": 1, - "label": "Customer Group", - "oldfieldname": "customer_group", - "oldfieldtype": "Link", - "options": "Customer Group", - "permlevel": 0, - "print_hide": 1, - "read_only": 0, - "reqd": 0, + "depends_on": "customer", + "description": "", + "fieldname": "customer_group", + "fieldtype": "Link", + "in_filter": 1, + "label": "Customer Group", + "oldfieldname": "customer_group", + "oldfieldtype": "Link", + "options": "Customer Group", + "permlevel": 0, + "print_hide": 1, + "read_only": 0, + "reqd": 0, "search_index": 0 - }, + }, { - "fieldname": "shipping_address_name", - "fieldtype": "Link", - "hidden": 0, - "label": "Shipping Address", - "options": "Address", - "permlevel": 0, + "fieldname": "shipping_address_name", + "fieldtype": "Link", + "hidden": 0, + "label": "Shipping Address", + "options": "Address", + "permlevel": 0, "print_hide": 1 - }, + }, { - "fieldname": "shipping_address", - "fieldtype": "Small Text", - "hidden": 1, - "label": "Shipping Address", - "permlevel": 0, - "print_hide": 1, + "fieldname": "shipping_address", + "fieldtype": "Small Text", + "hidden": 1, + "label": "Shipping Address", + "permlevel": 0, + "print_hide": 1, "read_only": 1 - }, + }, { - "depends_on": "customer", - "fieldname": "col_break98", - "fieldtype": "Column Break", - "permlevel": 0, - "read_only": 0, + "depends_on": "customer", + "fieldname": "col_break98", + "fieldtype": "Column Break", + "permlevel": 0, + "read_only": 0, "width": "50%" - }, + }, { - "fieldname": "customer_address", - "fieldtype": "Link", - "hidden": 0, - "in_filter": 1, - "label": "Customer Address", - "options": "Address", - "permlevel": 0, - "print_hide": 1, + "fieldname": "customer_address", + "fieldtype": "Link", + "hidden": 0, + "in_filter": 1, + "label": "Customer Address", + "options": "Address", + "permlevel": 0, + "print_hide": 1, "read_only": 0 - }, + }, { - "depends_on": "eval:doc.customer", - "fieldname": "contact_person", - "fieldtype": "Link", - "hidden": 0, - "in_filter": 1, - "label": "Contact Person", - "oldfieldname": "contact_person", - "oldfieldtype": "Link", - "options": "Contact", - "permlevel": 0, - "print_hide": 1, - "read_only": 0, + "depends_on": "eval:doc.customer", + "fieldname": "contact_person", + "fieldtype": "Link", + "hidden": 0, + "in_filter": 1, + "label": "Contact Person", + "oldfieldname": "contact_person", + "oldfieldtype": "Link", + "options": "Contact", + "permlevel": 0, + "print_hide": 1, + "read_only": 0, "reqd": 0 - }, + }, { - "fieldname": "more_info", - "fieldtype": "Section Break", - "label": "More Info", - "oldfieldtype": "Section Break", - "options": "icon-file-text", - "permlevel": 0, - "print_hide": 1, + "fieldname": "more_info", + "fieldtype": "Section Break", + "label": "More Info", + "oldfieldtype": "Section Break", + "options": "icon-file-text", + "permlevel": 0, + "print_hide": 1, "read_only": 0 - }, + }, { - "fieldname": "campaign", - "fieldtype": "Link", - "hidden": 0, - "label": "Campaign", - "no_copy": 0, - "oldfieldname": "campaign", - "oldfieldtype": "Link", - "options": "Campaign", - "permlevel": 0, - "print_hide": 1, - "read_only": 0, + "fieldname": "campaign", + "fieldtype": "Link", + "hidden": 0, + "label": "Campaign", + "no_copy": 0, + "oldfieldname": "campaign", + "oldfieldtype": "Link", + "options": "Campaign", + "permlevel": 0, + "print_hide": 1, + "read_only": 0, "report_hide": 0 - }, + }, { - "fieldname": "source", - "fieldtype": "Select", - "hidden": 0, - "label": "Source", - "no_copy": 0, - "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, - "read_only": 0, + "fieldname": "source", + "fieldtype": "Select", + "hidden": 0, + "label": "Source", + "no_copy": 0, + "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, + "read_only": 0, "report_hide": 0 - }, + }, { - "allow_on_submit": 0, - "default": "Draft", - "fieldname": "status", - "fieldtype": "Select", - "in_filter": 1, - "in_list_view": 1, - "label": "Status", - "no_copy": 1, - "oldfieldname": "status", - "oldfieldtype": "Select", - "options": "Draft\nSubmitted\nOrdered\nLost\nCancelled\nOpen\nReplied", - "permlevel": 0, - "print_hide": 1, - "read_only": 1, - "reqd": 1, + "allow_on_submit": 0, + "default": "Draft", + "fieldname": "status", + "fieldtype": "Select", + "in_filter": 1, + "in_list_view": 1, + "label": "Status", + "no_copy": 1, + "oldfieldname": "status", + "oldfieldtype": "Select", + "options": "Draft\nSubmitted\nOrdered\nLost\nCancelled\nOpen\nReplied", + "permlevel": 0, + "print_hide": 1, + "read_only": 1, + "reqd": 1, "search_index": 0 - }, + }, { - "allow_on_submit": 1, - "fieldname": "order_lost_reason", - "fieldtype": "Small Text", - "label": "Quotation Lost Reason", - "no_copy": 1, - "oldfieldname": "order_lost_reason", - "oldfieldtype": "Small Text", - "permlevel": 0, - "print_hide": 1, + "allow_on_submit": 1, + "fieldname": "order_lost_reason", + "fieldtype": "Small Text", + "label": "Quotation Lost Reason", + "no_copy": 1, + "oldfieldname": "order_lost_reason", + "oldfieldtype": "Small Text", + "permlevel": 0, + "print_hide": 1, "read_only": 0 - }, + }, { - "fieldname": "column_break4", - "fieldtype": "Column Break", - "oldfieldtype": "Column Break", - "permlevel": 0, - "print_hide": 1, - "read_only": 0, + "fieldname": "column_break4", + "fieldtype": "Column Break", + "oldfieldtype": "Column Break", + "permlevel": 0, + "print_hide": 1, + "read_only": 0, "width": "50%" - }, + }, { - "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": "letter_head", + "fieldtype": "Link", + "label": "Letter Head", + "oldfieldname": "letter_head", + "oldfieldtype": "Select", + "options": "Letter Head", + "permlevel": 0, + "print_hide": 1, "read_only": 0 - }, + }, { - "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, - "read_only": 0, + "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, + "read_only": 0, "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, - "read_only": 0, - "reqd": 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, + "read_only": 0, + "reqd": 1, "search_index": 0 - }, + }, { - "fieldname": "enq_det", - "fieldtype": "Text", - "hidden": 1, - "label": "Opportunity Item", - "no_copy": 0, - "oldfieldname": "enq_det", - "oldfieldtype": "Text", - "permlevel": 0, - "print_hide": 1, - "read_only": 1, + "fieldname": "enq_det", + "fieldtype": "Text", + "hidden": 1, + "label": "Opportunity Item", + "no_copy": 0, + "oldfieldname": "enq_det", + "oldfieldtype": "Text", + "permlevel": 0, + "print_hide": 1, + "read_only": 1, "report_hide": 0 } - ], - "hide_toolbar": 0, - "icon": "icon-shopping-cart", - "idx": 1, - "is_submittable": 1, - "max_attachments": 1, - "modified": "2015-02-20 05:16:20.664025", - "modified_by": "Administrator", - "module": "Selling", - "name": "Quotation", - "owner": "Administrator", + ], + "hide_toolbar": 0, + "icon": "icon-shopping-cart", + "idx": 1, + "is_submittable": 1, + "max_attachments": 1, + "modified": "2015-02-20 05:16:20.664025", + "modified_by": "Administrator", + "module": "Selling", + "name": "Quotation", + "owner": "Administrator", "permissions": [ { - "amend": 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, + "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": 0, - "cancel": 0, - "create": 0, - "delete": 0, - "match": "", - "permlevel": 1, - "read": 1, - "report": 1, - "role": "Sales User", - "submit": 0, + "amend": 0, + "cancel": 0, + "create": 0, + "delete": 0, + "match": "", + "permlevel": 1, + "read": 1, + "report": 1, + "role": "Sales User", + "submit": 0, "write": 0 - }, + }, { - "cancel": 0, - "delete": 0, - "email": 1, - "match": "", - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, + "cancel": 0, + "delete": 0, + "email": 1, + "match": "", + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, "role": "Customer" - }, + }, { - "amend": 0, - "cancel": 0, - "create": 0, - "delete": 0, - "match": "", - "permlevel": 1, - "read": 1, - "report": 1, - "role": "Sales Manager", - "submit": 0, + "amend": 0, + "cancel": 0, + "create": 0, + "delete": 0, + "match": "", + "permlevel": 1, + "read": 1, + "report": 1, + "role": "Sales Manager", + "submit": 0, "write": 0 - }, + }, { - "amend": 1, - "cancel": 1, - "create": 1, - "delete": 1, - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Sales Manager", - "share": 1, - "submit": 1, + "amend": 1, + "cancel": 1, + "create": 1, + "delete": 1, + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Sales Manager", + "share": 1, + "submit": 1, "write": 1 - }, + }, { - "amend": 1, - "cancel": 1, - "create": 1, - "delete": 1, - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Maintenance Manager", - "share": 1, - "submit": 1, + "amend": 1, + "cancel": 1, + "create": 1, + "delete": 1, + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Maintenance Manager", + "share": 1, + "submit": 1, "write": 1 - }, + }, { - "amend": 0, - "cancel": 0, - "create": 0, - "delete": 0, - "match": "", - "permlevel": 1, - "read": 1, - "report": 1, - "role": "Maintenance Manager", + "amend": 0, + "cancel": 0, + "create": 0, + "delete": 0, + "match": "", + "permlevel": 1, + "read": 1, + "report": 1, + "role": "Maintenance Manager", "submit": 0 - }, + }, { - "amend": 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, + "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 - }, + }, { - "amend": 0, - "cancel": 0, - "create": 0, - "delete": 0, - "match": "", - "permlevel": 1, - "read": 1, - "report": 1, - "role": "Maintenance User", + "amend": 0, + "cancel": 0, + "create": 0, + "delete": 0, + "match": "", + "permlevel": 1, + "read": 1, + "report": 1, + "role": "Maintenance User", "submit": 0 } - ], - "read_only_onload": 1, - "search_fields": "status,transaction_date,customer,lead,order_type", - "sort_field": "modified", - "sort_order": "DESC", + ], + "read_only_onload": 1, + "search_fields": "status,transaction_date,customer,lead,order_type", + "sort_field": "modified", + "sort_order": "DESC", "title_field": "customer_name" -} \ No newline at end of file +} diff --git a/erpnext/selling/doctype/quotation_item/quotation_item.json b/erpnext/selling/doctype/quotation_item/quotation_item.json index 23b0b185916..b2f9307be28 100644 --- a/erpnext/selling/doctype/quotation_item/quotation_item.json +++ b/erpnext/selling/doctype/quotation_item/quotation_item.json @@ -1,360 +1,396 @@ { - "autoname": "hash", - "creation": "2013-03-07 11:42:57", - "docstatus": 0, - "doctype": "DocType", + "autoname": "hash", + "creation": "2013-03-07 11:42:57", + "docstatus": 0, + "doctype": "DocType", "fields": [ { - "fieldname": "item_code", - "fieldtype": "Link", - "hidden": 0, - "in_filter": 1, - "in_list_view": 1, - "label": "Item Code", - "oldfieldname": "item_code", - "oldfieldtype": "Link", - "options": "Item", - "permlevel": 0, - "print_hide": 0, - "print_width": "150px", - "read_only": 0, - "reqd": 1, - "search_index": 1, + "fieldname": "item_code", + "fieldtype": "Link", + "hidden": 0, + "in_filter": 1, + "in_list_view": 1, + "label": "Item Code", + "oldfieldname": "item_code", + "oldfieldtype": "Link", + "options": "Item", + "permlevel": 0, + "print_hide": 0, + "print_width": "150px", + "read_only": 0, + "reqd": 1, + "search_index": 1, "width": "150px" - }, + }, { - "fieldname": "customer_item_code", - "fieldtype": "Data", - "hidden": 1, - "label": "Customer's Item Code", - "permlevel": 0, - "print_hide": 1, + "fieldname": "customer_item_code", + "fieldtype": "Data", + "hidden": 1, + "label": "Customer's Item Code", + "permlevel": 0, + "print_hide": 1, "read_only": 1 - }, + }, { - "fieldname": "item_name", - "fieldtype": "Data", - "in_filter": 1, - "in_list_view": 1, - "label": "Item Name", - "oldfieldname": "item_name", - "oldfieldtype": "Data", - "permlevel": 0, - "print_hide": 1, - "print_width": "150px", - "read_only": 0, - "reqd": 1, - "search_index": 1, + "fieldname": "item_name", + "fieldtype": "Data", + "in_filter": 1, + "in_list_view": 1, + "label": "Item Name", + "oldfieldname": "item_name", + "oldfieldtype": "Data", + "permlevel": 0, + "print_hide": 1, + "print_width": "150px", + "read_only": 0, + "reqd": 1, + "search_index": 1, "width": "150px" - }, + }, { - "fieldname": "col_break1", - "fieldtype": "Column Break", + "fieldname": "col_break1", + "fieldtype": "Column Break", "permlevel": 0 - }, + }, { - "fieldname": "description", - "fieldtype": "Small Text", - "in_list_view": 1, - "label": "Description", - "oldfieldname": "description", - "oldfieldtype": "Small Text", - "permlevel": 0, - "print_hide": 0, - "print_width": "300px", - "read_only": 0, - "reqd": 1, + "fieldname": "description", + "fieldtype": "Small Text", + "in_list_view": 1, + "label": "Description", + "oldfieldname": "description", + "oldfieldtype": "Small Text", + "permlevel": 0, + "print_hide": 0, + "print_width": "300px", + "read_only": 0, + "reqd": 1, "width": "300px" - }, + }, { - "fieldname": "image", - "fieldtype": "Attach", - "hidden": 1, - "label": "Image", - "permlevel": 0, - "precision": "", + "fieldname": "image", + "fieldtype": "Attach", + "hidden": 1, + "label": "Image", + "permlevel": 0, + "precision": "", "print_hide": 1 - }, + }, { - "fieldname": "image_view", - "fieldtype": "Image", - "label": "Image View", - "options": "image", - "permlevel": 0, + "fieldname": "image_view", + "fieldtype": "Image", + "label": "Image View", + "options": "image", + "permlevel": 0, "precision": "" - }, + }, { - "fieldname": "quantity_and_rate", - "fieldtype": "Section Break", - "label": "Quantity and Rate", + "fieldname": "quantity_and_rate", + "fieldtype": "Section Break", + "label": "Quantity and Rate", "permlevel": 0 - }, + }, { - "fieldname": "qty", - "fieldtype": "Float", - "in_filter": 0, - "in_list_view": 1, - "label": "Quantity", - "oldfieldname": "qty", - "oldfieldtype": "Currency", - "permlevel": 0, - "print_hide": 0, - "print_width": "100px", - "read_only": 0, - "reqd": 1, - "search_index": 0, + "fieldname": "qty", + "fieldtype": "Float", + "in_filter": 0, + "in_list_view": 1, + "label": "Quantity", + "oldfieldname": "qty", + "oldfieldtype": "Currency", + "permlevel": 0, + "print_hide": 0, + "print_width": "100px", + "read_only": 0, + "reqd": 1, + "search_index": 0, "width": "100px" - }, + }, { - "fieldname": "price_list_rate", - "fieldtype": "Currency", - "label": "Price List Rate", - "oldfieldname": "ref_rate", - "oldfieldtype": "Currency", - "options": "currency", - "permlevel": 0, - "print_hide": 1, - "print_width": "100px", - "read_only": 1, - "reqd": 0, + "fieldname": "price_list_rate", + "fieldtype": "Currency", + "label": "Price List Rate", + "oldfieldname": "ref_rate", + "oldfieldtype": "Currency", + "options": "currency", + "permlevel": 0, + "print_hide": 1, + "print_width": "100px", + "read_only": 1, + "reqd": 0, "width": "100px" - }, + }, { - "fieldname": "discount_percentage", - "fieldtype": "Percent", - "in_list_view": 1, - "label": "Discount (%)", - "oldfieldname": "adj_rate", - "oldfieldtype": "Float", - "permlevel": 0, - "print_hide": 1, - "print_width": "100px", - "read_only": 0, + "fieldname": "discount_percentage", + "fieldtype": "Percent", + "in_list_view": 1, + "label": "Discount (%)", + "oldfieldname": "adj_rate", + "oldfieldtype": "Float", + "permlevel": 0, + "print_hide": 1, + "print_width": "100px", + "read_only": 0, "width": "100px" - }, + }, { - "fieldname": "col_break2", - "fieldtype": "Column Break", + "fieldname": "col_break2", + "fieldtype": "Column Break", "permlevel": 0 - }, + }, { - "fieldname": "stock_uom", - "fieldtype": "Link", - "in_list_view": 1, - "label": "UOM", - "oldfieldname": "stock_uom", - "oldfieldtype": "Data", - "options": "UOM", - "permlevel": 0, - "print_hide": 0, - "print_width": "100px", - "read_only": 1, - "reqd": 0, + "fieldname": "stock_uom", + "fieldtype": "Link", + "in_list_view": 1, + "label": "UOM", + "oldfieldname": "stock_uom", + "oldfieldtype": "Data", + "options": "UOM", + "permlevel": 0, + "print_hide": 0, + "print_width": "100px", + "read_only": 1, + "reqd": 0, "width": "100px" - }, + }, { - "fieldname": "base_price_list_rate", - "fieldtype": "Currency", - "label": "Price List Rate (Company Currency)", - "oldfieldname": "base_ref_rate", - "oldfieldtype": "Currency", - "options": "Company:company:default_currency", - "permlevel": 0, - "print_hide": 1, - "print_width": "100px", - "read_only": 1, + "fieldname": "base_price_list_rate", + "fieldtype": "Currency", + "label": "Price List Rate (Company Currency)", + "oldfieldname": "base_ref_rate", + "oldfieldtype": "Currency", + "options": "Company:company:default_currency", + "permlevel": 0, + "print_hide": 1, + "print_width": "100px", + "read_only": 1, "width": "100px" - }, + }, { - "fieldname": "Section_break1", - "fieldtype": "Section Break", + "fieldname": "Section_break1", + "fieldtype": "Section Break", "permlevel": 0 - }, + }, { - "fieldname": "rate", - "fieldtype": "Currency", - "in_filter": 0, - "in_list_view": 1, - "label": "Rate", - "oldfieldname": "export_rate", - "oldfieldtype": "Currency", - "options": "currency", - "permlevel": 0, - "print_hide": 0, - "print_width": "100px", - "read_only": 0, - "reqd": 0, - "search_index": 0, + "fieldname": "rate", + "fieldtype": "Currency", + "in_filter": 0, + "in_list_view": 1, + "label": "Rate", + "oldfieldname": "export_rate", + "oldfieldtype": "Currency", + "options": "currency", + "permlevel": 0, + "print_hide": 0, + "print_width": "100px", + "read_only": 0, + "reqd": 0, + "search_index": 0, "width": "100px" - }, + }, { - "fieldname": "amount", - "fieldtype": "Currency", - "in_filter": 0, - "in_list_view": 1, - "label": "Amount", - "oldfieldname": "export_amount", - "oldfieldtype": "Currency", - "options": "currency", - "permlevel": 0, - "print_hide": 0, - "print_width": "100px", - "read_only": 1, - "reqd": 0, - "search_index": 0, - "width": "100px" - }, - { - "fieldname": "col_break3", - "fieldtype": "Column Break", - "permlevel": 0 - }, - { - "fieldname": "base_rate", - "fieldtype": "Currency", - "in_filter": 0, - "label": "Basic Rate (Company Currency)", - "oldfieldname": "basic_rate", - "oldfieldtype": "Currency", - "options": "Company:company:default_currency", - "permlevel": 0, - "print_hide": 1, - "print_width": "100px", - "read_only": 1, - "reqd": 0, - "search_index": 0, - "width": "100px" - }, - { - "fieldname": "base_amount", - "fieldtype": "Currency", - "in_filter": 0, - "label": "Amount (Company Currency)", - "oldfieldname": "amount", - "oldfieldtype": "Currency", - "options": "Company:company:default_currency", - "permlevel": 0, - "print_hide": 1, - "print_width": "100px", - "read_only": 1, - "reqd": 0, - "search_index": 0, - "width": "100px" - }, - { - "fieldname": "pricing_rule", - "fieldtype": "Link", - "label": "Pricing Rule", - "options": "Pricing Rule", - "permlevel": 0, + "fieldname": "net_rate", + "fieldtype": "Currency", + "label": "Net Rate", + "permlevel": 0, + "precision": "", "read_only": 1 - }, + }, { - "fieldname": "reference", - "fieldtype": "Section Break", - "label": "Reference", + "fieldname": "amount", + "fieldtype": "Currency", + "in_filter": 0, + "in_list_view": 1, + "label": "Amount", + "oldfieldname": "export_amount", + "oldfieldtype": "Currency", + "options": "currency", + "permlevel": 0, + "print_hide": 0, + "print_width": "100px", + "read_only": 1, + "reqd": 0, + "search_index": 0, + "width": "100px" + }, + { + "fieldname": "net_amount", + "fieldtype": "Currency", + "label": "Net Amount", + "options": "currency", + "permlevel": 0, + "precision": "", + "print_hide": 1, + "read_only": 1 + }, + { + "fieldname": "col_break3", + "fieldtype": "Column Break", "permlevel": 0 - }, + }, { - "fieldname": "prevdoc_doctype", - "fieldtype": "Data", - "hidden": 1, - "label": "Against Doctype", - "no_copy": 1, - "oldfieldname": "prevdoc_doctype", - "oldfieldtype": "Data", - "permlevel": 0, - "print_hide": 1, - "print_width": "150px", - "read_only": 1, - "report_hide": 0, - "width": "150px" - }, + "fieldname": "base_rate", + "fieldtype": "Currency", + "in_filter": 0, + "label": "Rate (Company Currency)", + "oldfieldname": "basic_rate", + "oldfieldtype": "Currency", + "options": "Company:company:default_currency", + "permlevel": 0, + "print_hide": 1, + "print_width": "100px", + "read_only": 1, + "reqd": 0, + "search_index": 0, + "width": "100px" + }, { - "fieldname": "prevdoc_docname", - "fieldtype": "Data", - "label": "Against Docname", - "no_copy": 1, - "oldfieldname": "prevdoc_docname", - "oldfieldtype": "Data", - "permlevel": 0, - "print_hide": 1, - "print_width": "150px", - "read_only": 1, - "report_hide": 0, - "width": "150px" - }, + "fieldname": "base_net_rate", + "fieldtype": "Currency", + "label": "Net Rate (Company Currency)", + "permlevel": 0, + "precision": "", + "read_only": 1 + }, { - "fieldname": "item_tax_rate", - "fieldtype": "Small Text", - "hidden": 1, - "label": "Item Tax Rate", - "oldfieldname": "item_tax_rate", - "oldfieldtype": "Small Text", - "permlevel": 0, - "print_hide": 1, - "read_only": 1, - "report_hide": 1 - }, + "fieldname": "base_amount", + "fieldtype": "Currency", + "in_filter": 0, + "label": "Amount (Company Currency)", + "oldfieldname": "amount", + "oldfieldtype": "Currency", + "options": "Company:company:default_currency", + "permlevel": 0, + "print_hide": 1, + "print_width": "100px", + "read_only": 1, + "reqd": 0, + "search_index": 0, + "width": "100px" + }, { - "fieldname": "col_break4", - "fieldtype": "Column Break", + "fieldname": "base_net_amount", + "fieldtype": "Currency", + "label": "Net Amount (Company Currency)", + "options": "Company:company:default_currency", + "permlevel": 0, + "precision": "", + "print_hide": 1, + "read_only": 1 + }, + { + "fieldname": "pricing_rule", + "fieldtype": "Link", + "label": "Pricing Rule", + "options": "Pricing Rule", + "permlevel": 0, + "read_only": 1 + }, + { + "fieldname": "reference", + "fieldtype": "Section Break", + "label": "Reference", "permlevel": 0 - }, + }, { - "allow_on_submit": 1, - "fieldname": "page_break", - "fieldtype": "Check", - "hidden": 0, - "label": "Page Break", - "no_copy": 1, - "oldfieldname": "page_break", - "oldfieldtype": "Check", - "permlevel": 0, - "print_hide": 1, - "read_only": 0, + "fieldname": "prevdoc_doctype", + "fieldtype": "Data", + "hidden": 1, + "label": "Against Doctype", + "no_copy": 1, + "oldfieldname": "prevdoc_doctype", + "oldfieldtype": "Data", + "permlevel": 0, + "print_hide": 1, + "print_width": "150px", + "read_only": 1, + "report_hide": 0, + "width": "150px" + }, + { + "fieldname": "prevdoc_docname", + "fieldtype": "Data", + "label": "Against Docname", + "no_copy": 1, + "oldfieldname": "prevdoc_docname", + "oldfieldtype": "Data", + "permlevel": 0, + "print_hide": 1, + "print_width": "150px", + "read_only": 1, + "report_hide": 0, + "width": "150px" + }, + { + "fieldname": "item_tax_rate", + "fieldtype": "Small Text", + "hidden": 1, + "label": "Item Tax Rate", + "oldfieldname": "item_tax_rate", + "oldfieldtype": "Small Text", + "permlevel": 0, + "print_hide": 1, + "read_only": 1, "report_hide": 1 - }, + }, { - "description": "", - "fieldname": "item_group", - "fieldtype": "Link", - "hidden": 1, - "in_filter": 1, - "label": "Item Group", - "oldfieldname": "item_group", - "oldfieldtype": "Link", - "options": "Item Group", - "permlevel": 0, - "print_hide": 1, - "read_only": 1, + "fieldname": "col_break4", + "fieldtype": "Column Break", + "permlevel": 0 + }, + { + "allow_on_submit": 1, + "fieldname": "page_break", + "fieldtype": "Check", + "hidden": 0, + "label": "Page Break", + "no_copy": 1, + "oldfieldname": "page_break", + "oldfieldtype": "Check", + "permlevel": 0, + "print_hide": 1, + "read_only": 0, + "report_hide": 1 + }, + { + "description": "", + "fieldname": "item_group", + "fieldtype": "Link", + "hidden": 1, + "in_filter": 1, + "label": "Item Group", + "oldfieldname": "item_group", + "oldfieldtype": "Link", + "options": "Item Group", + "permlevel": 0, + "print_hide": 1, + "read_only": 1, "search_index": 1 - }, + }, { - "fieldname": "brand", - "fieldtype": "Link", - "hidden": 1, - "in_filter": 1, - "label": "Brand", - "oldfieldname": "brand", - "oldfieldtype": "Link", - "options": "Brand", - "permlevel": 0, - "print_hide": 1, - "print_width": "150px", - "read_only": 1, - "search_index": 1, + "fieldname": "brand", + "fieldtype": "Link", + "hidden": 1, + "in_filter": 1, + "label": "Brand", + "oldfieldname": "brand", + "oldfieldtype": "Link", + "options": "Brand", + "permlevel": 0, + "print_hide": 1, + "print_width": "150px", + "read_only": 1, + "search_index": 1, "width": "150px" } - ], - "idx": 1, - "istable": 1, - "modified": "2015-02-19 01:07:01.742936", - "modified_by": "Administrator", - "module": "Selling", - "name": "Quotation Item", - "owner": "Administrator", - "permissions": [], - "sort_field": "modified", + ], + "idx": 1, + "istable": 1, + "modified": "2015-02-19 15:08:25.451407", + "modified_by": "Administrator", + "module": "Selling", + "name": "Quotation Item", + "owner": "Administrator", + "permissions": [], + "sort_field": "modified", "sort_order": "DESC" -} \ No newline at end of file +} diff --git a/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.py b/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.py index a6abe7cae15..8009b40262f 100644 --- a/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.py +++ b/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.py @@ -53,7 +53,7 @@ class StockLedgerEntry(Document): def validate_item(self): item_det = frappe.db.sql("""select name, has_batch_no, docstatus, - is_stock_item, has_variants + is_stock_item, has_variants, stock_uom from tabItem where name=%s""", self.item_code, as_dict=True)[0] if item_det.is_stock_item != 'Yes':