Merge pull request #6675 from KanchanChauhan/holiday-in-lwp-salaryslip
include_holiday being taken into consideration while calculating lwp
diff --git a/erpnext/accounts/doctype/accounts_settings/accounts_settings.json b/erpnext/accounts/doctype/accounts_settings/accounts_settings.json
index c5b3e5b..c389b5c 100644
--- a/erpnext/accounts/doctype/accounts_settings/accounts_settings.json
+++ b/erpnext/accounts/doctype/accounts_settings/accounts_settings.json
@@ -10,6 +10,7 @@
"doctype": "DocType",
"document_type": "Other",
"editable_grid": 1,
+ "engine": "InnoDB",
"fields": [
{
"allow_on_submit": 0,
@@ -194,6 +195,33 @@
"search_index": 0,
"set_only_once": 0,
"unique": 0
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "default": "1",
+ "fieldname": "unlink_payment_on_cancellation_of_invoice",
+ "fieldtype": "Check",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "label": "Unlink Payment on Cancellation of Invoice",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0
}
],
"hide_heading": 0,
@@ -207,8 +235,8 @@
"issingle": 1,
"istable": 0,
"max_attachments": 0,
- "modified": "2016-10-05 16:13:10.978208",
- "modified_by": "rohitw1991@gmail.com",
+ "modified": "2016-10-20 16:12:38.595075",
+ "modified_by": "Administrator",
"module": "Accounts",
"name": "Accounts Settings",
"owner": "Administrator",
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
index 042af0b..1c9bcbc 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
@@ -578,7 +578,8 @@
if not self.is_return:
from erpnext.accounts.utils import unlink_ref_doc_from_payment_entries
- unlink_ref_doc_from_payment_entries(self.doctype, self.name)
+ if frappe.db.get_single_value('Accounts Settings', 'unlink_payment_on_cancellation_of_invoice'):
+ unlink_ref_doc_from_payment_entries(self.doctype, self.name)
self.update_prevdoc_status()
self.update_billing_status_for_zero_amount_refdoc("Purchase Order")
diff --git a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py
index 4ea18ac..b4b8444 100644
--- a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py
+++ b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py
@@ -6,7 +6,7 @@
import unittest
import frappe
import frappe.model
-from frappe.utils import cint, flt, today
+from frappe.utils import cint, flt, today, nowdate
import frappe.defaults
from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import set_perpetual_inventory, \
test_records as pr_test_records
@@ -17,6 +17,12 @@
test_ignore = ["Serial No"]
class TestPurchaseInvoice(unittest.TestCase):
+ def setUp(self):
+ unlink_payment_on_cancel_of_invoice()
+
+ def tearDown(self):
+ unlink_payment_on_cancel_of_invoice(0)
+
def test_gl_entries_without_auto_accounting_for_stock(self):
set_perpetual_inventory(0)
self.assertTrue(not cint(frappe.defaults.get_global_default("auto_accounting_for_stock")))
@@ -55,6 +61,27 @@
set_perpetual_inventory(0)
+ def test_payment_entry_unlink_against_purchase_invoice(self):
+ from erpnext.accounts.doctype.payment_entry.test_payment_entry import get_payment_entry
+ unlink_payment_on_cancel_of_invoice(0)
+
+ pi_doc = make_purchase_invoice()
+
+ pe = get_payment_entry("Purchase Invoice", pi_doc.name, bank_account="_Test Bank - _TC")
+ pe.reference_no = "1"
+ pe.reference_date = nowdate()
+ pe.paid_from_account_currency = pi_doc.currency
+ pe.paid_to_account_currency = pi_doc.currency
+ pe.source_exchange_rate = 1
+ pe.target_exchange_rate = 1
+ pe.paid_amount = pi_doc.grand_total
+ pe.save(ignore_permissions=True)
+ pe.submit()
+
+ pi_doc = frappe.get_doc('Purchase Invoice', pi_doc.name)
+
+ self.assertRaises(frappe.LinkExistsError, pi_doc.cancel)
+
def test_gl_entries_with_auto_accounting_for_stock_against_pr(self):
set_perpetual_inventory(1)
self.assertEqual(cint(frappe.defaults.get_global_default("auto_accounting_for_stock")), 1)
@@ -411,6 +438,11 @@
self.assertEquals(frappe.db.get_value("Serial No", pi.get("items")[0].rejected_serial_no,
"warehouse"), pi.get("items")[0].rejected_warehouse)
+def unlink_payment_on_cancel_of_invoice(enable=1):
+ accounts_settings = frappe.get_doc("Accounts Settings")
+ accounts_settings.unlink_payment_on_cancellation_of_invoice = enable
+ accounts_settings.save()
+
def make_purchase_invoice(**args):
pi = frappe.new_doc("Purchase Invoice")
args = frappe._dict(args)
@@ -455,4 +487,4 @@
pi.submit()
return pi
-test_records = frappe.get_test_records('Purchase Invoice')
+test_records = frappe.get_test_records('Purchase Invoice')
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
index 3c46a16..521b0eb 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
@@ -136,7 +136,8 @@
self.check_close_sales_order("sales_order")
from erpnext.accounts.utils import unlink_ref_doc_from_payment_entries
- unlink_ref_doc_from_payment_entries(self.doctype, self.name)
+ if frappe.db.get_single_value('Accounts Settings', 'unlink_payment_on_cancellation_of_invoice'):
+ unlink_ref_doc_from_payment_entries(self.doctype, self.name)
if self.is_return:
# NOTE status updating bypassed for is_return
diff --git a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
index 1bb7b1c..83fc83c 100644
--- a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
@@ -4,8 +4,9 @@
import frappe
import unittest, copy
-from frappe.utils import nowdate, add_days, flt
+from frappe.utils import nowdate, add_days, flt, nowdate
from erpnext.stock.doctype.stock_entry.test_stock_entry import make_stock_entry, get_qty_after_transaction
+from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import unlink_payment_on_cancel_of_invoice
from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import set_perpetual_inventory
from erpnext.exceptions import InvalidAccountCurrency, InvalidCurrency
from erpnext.stock.doctype.serial_no.serial_no import SerialNoWarehouseError
@@ -19,6 +20,12 @@
w.submit()
return w
+ def setUp(self):
+ unlink_payment_on_cancel_of_invoice()
+
+ def tearDown(self):
+ unlink_payment_on_cancel_of_invoice(0)
+
def test_timestamp_change(self):
w = frappe.copy_doc(test_records[0])
w.docstatus = 0
@@ -78,6 +85,28 @@
self.assertEquals(si.base_grand_total, 1627.05)
self.assertEquals(si.grand_total, 1627.05)
+ def test_payment_entry_unlink_against_invoice(self):
+ from erpnext.accounts.doctype.payment_entry.test_payment_entry import get_payment_entry
+ si = frappe.copy_doc(test_records[0])
+ si.is_pos = 0
+ si.insert()
+ si.submit()
+
+ pe = get_payment_entry("Sales Invoice", si.name, bank_account="_Test Bank - _TC")
+ pe.reference_no = "1"
+ pe.reference_date = nowdate()
+ pe.paid_from_account_currency = si.currency
+ pe.paid_to_account_currency = si.currency
+ pe.source_exchange_rate = 1
+ pe.target_exchange_rate = 1
+ pe.paid_amount = si.grand_total
+ pe.insert()
+ pe.submit()
+
+ unlink_payment_on_cancel_of_invoice(0)
+ si = frappe.get_doc('Sales Invoice', si.name)
+ self.assertRaises(frappe.LinkExistsError, si.cancel)
+
def test_sales_invoice_calculation_export_currency(self):
si = frappe.copy_doc(test_records[2])
si.currency = "USD"
diff --git a/erpnext/accounts/doctype/sales_taxes_and_charges_template/sales_taxes_and_charges_template.py b/erpnext/accounts/doctype/sales_taxes_and_charges_template/sales_taxes_and_charges_template.py
index 28964bb..3947450 100644
--- a/erpnext/accounts/doctype/sales_taxes_and_charges_template/sales_taxes_and_charges_template.py
+++ b/erpnext/accounts/doctype/sales_taxes_and_charges_template/sales_taxes_and_charges_template.py
@@ -4,12 +4,18 @@
from __future__ import unicode_literals
import frappe
from frappe import _
+from frappe.utils import flt
from frappe.model.document import Document
from erpnext.controllers.accounts_controller import validate_taxes_and_charges, validate_inclusive_tax
class SalesTaxesandChargesTemplate(Document):
def validate(self):
valdiate_taxes_and_charges_template(self)
+
+ def set_missing_values(self):
+ for data in self.taxes:
+ if data.charge_type == 'On Net Total' and flt(data.rate) == 0.0:
+ data.rate = frappe.db.get_value('Account', data.account_head, 'tax_rate')
def valdiate_taxes_and_charges_template(doc):
# default should not be disabled
diff --git a/erpnext/accounts/report/gross_profit/gross_profit.py b/erpnext/accounts/report/gross_profit/gross_profit.py
index a052821..3451238 100644
--- a/erpnext/accounts/report/gross_profit/gross_profit.py
+++ b/erpnext/accounts/report/gross_profit/gross_profit.py
@@ -17,7 +17,7 @@
source = gross_profit_data.grouped_data if filters.get("group_by") != "Invoice" else gross_profit_data.data
group_wise_columns = frappe._dict({
- "invoice": ["parent", "customer", "posting_date","item_code", "item_name","item_group", "brand", "description", \
+ "invoice": ["parent", "customer", "customer_group", "posting_date","item_code", "item_name","item_group", "brand", "description", \
"warehouse", "qty", "base_rate", "buying_rate", "base_amount",
"buying_amount", "gross_profit", "gross_profit_percent", "project"],
"item_code": ["item_code", "item_name", "brand", "description", "qty", "base_rate",
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.json b/erpnext/buying/doctype/purchase_order/purchase_order.json
index 923a3ed..8177b57 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.json
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.json
@@ -9,11 +9,13 @@
"docstatus": 0,
"doctype": "DocType",
"document_type": "Document",
+ "editable_grid": 0,
"fields": [
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "supplier_section",
"fieldtype": "Section Break",
"hidden": 0,
@@ -39,6 +41,7 @@
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"default": "{supplier_name}",
"fieldname": "title",
"fieldtype": "Data",
@@ -65,6 +68,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "naming_series",
"fieldtype": "Select",
"hidden": 0,
@@ -92,6 +96,7 @@
"allow_on_submit": 0,
"bold": 1,
"collapsible": 0,
+ "columns": 0,
"description": "",
"fieldname": "supplier",
"fieldtype": "Link",
@@ -120,6 +125,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "eval:doc.supplier && doc.docstatus===0 && (!(doc.items && doc.items.length) || (doc.items.length==1 && !doc.items[0].item_code))",
"fieldname": "get_items_from_open_material_requests",
"fieldtype": "Button",
@@ -146,6 +152,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"default": "No",
"fieldname": "is_subcontracted",
"fieldtype": "Select",
@@ -172,6 +179,7 @@
"allow_on_submit": 0,
"bold": 1,
"collapsible": 0,
+ "columns": 0,
"fieldname": "supplier_name",
"fieldtype": "Data",
"hidden": 0,
@@ -196,6 +204,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "column_break1",
"fieldtype": "Column Break",
"hidden": 0,
@@ -222,6 +231,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"default": "Today",
"fieldname": "transaction_date",
"fieldtype": "Date",
@@ -249,6 +259,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "amended_from",
"fieldtype": "Link",
"hidden": 0,
@@ -276,6 +287,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"description": "",
"fieldname": "company",
"fieldtype": "Link",
@@ -305,6 +317,7 @@
"bold": 0,
"collapsible": 0,
"collapsible_depends_on": "",
+ "columns": 0,
"fieldname": "drop_ship",
"fieldtype": "Section Break",
"hidden": 0,
@@ -330,6 +343,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "",
"fieldname": "customer",
"fieldtype": "Link",
@@ -357,6 +371,7 @@
"allow_on_submit": 0,
"bold": 1,
"collapsible": 0,
+ "columns": 0,
"depends_on": "",
"fieldname": "customer_name",
"fieldtype": "Data",
@@ -383,6 +398,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "column_break_19",
"fieldtype": "Column Break",
"hidden": 0,
@@ -407,6 +423,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "",
"fieldname": "customer_contact_person",
"fieldtype": "Link",
@@ -434,6 +451,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "customer_contact_display",
"fieldtype": "Small Text",
"hidden": 1,
@@ -459,6 +477,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "customer_contact_mobile",
"fieldtype": "Small Text",
"hidden": 1,
@@ -484,6 +503,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "customer_contact_email",
"fieldtype": "Code",
"hidden": 1,
@@ -510,6 +530,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 1,
+ "columns": 0,
"fieldname": "section_addresses",
"fieldtype": "Section Break",
"hidden": 0,
@@ -535,6 +556,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "supplier_address",
"fieldtype": "Link",
"hidden": 0,
@@ -560,6 +582,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "contact_person",
"fieldtype": "Link",
"hidden": 0,
@@ -585,6 +608,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "",
"fieldname": "address_display",
"fieldtype": "Small Text",
@@ -610,6 +634,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "contact_display",
"fieldtype": "Small Text",
"hidden": 0,
@@ -634,6 +659,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "contact_mobile",
"fieldtype": "Small Text",
"hidden": 0,
@@ -658,6 +684,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "contact_email",
"fieldtype": "Small Text",
"hidden": 0,
@@ -682,6 +709,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "col_break_address",
"fieldtype": "Column Break",
"hidden": 0,
@@ -706,6 +734,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "",
"fieldname": "shipping_address",
"fieldtype": "Link",
@@ -733,6 +762,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "shipping_address_display",
"fieldtype": "Small Text",
"hidden": 0,
@@ -758,6 +788,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 1,
+ "columns": 0,
"fieldname": "currency_and_price_list",
"fieldtype": "Section Break",
"hidden": 0,
@@ -783,6 +814,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "currency",
"fieldtype": "Link",
"hidden": 0,
@@ -810,6 +842,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"description": "",
"fieldname": "conversion_rate",
"fieldtype": "Float",
@@ -838,6 +871,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "cb_price_list",
"fieldtype": "Column Break",
"hidden": 0,
@@ -861,6 +895,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "buying_price_list",
"fieldtype": "Link",
"hidden": 0,
@@ -886,6 +921,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "price_list_currency",
"fieldtype": "Link",
"hidden": 0,
@@ -911,6 +947,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "plc_conversion_rate",
"fieldtype": "Float",
"hidden": 0,
@@ -936,6 +973,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "ignore_pricing_rule",
"fieldtype": "Check",
"hidden": 0,
@@ -960,6 +998,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "items_section",
"fieldtype": "Section Break",
"hidden": 0,
@@ -986,6 +1025,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "items",
"fieldtype": "Table",
"hidden": 0,
@@ -1013,6 +1053,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "eval:doc.docstatus===0 && (doc.items && doc.items.length)",
"fieldname": "get_last_purchase_rate",
"fieldtype": "Button",
@@ -1039,6 +1080,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "sb_last_purchase",
"fieldtype": "Section Break",
"hidden": 0,
@@ -1062,6 +1104,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "base_total",
"fieldtype": "Currency",
"hidden": 0,
@@ -1088,6 +1131,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "base_net_total",
"fieldtype": "Currency",
"hidden": 0,
@@ -1115,6 +1159,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "column_break_26",
"fieldtype": "Column Break",
"hidden": 0,
@@ -1138,6 +1183,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "total",
"fieldtype": "Currency",
"hidden": 0,
@@ -1164,6 +1210,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "net_total",
"fieldtype": "Currency",
"hidden": 0,
@@ -1191,6 +1238,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "taxes_section",
"fieldtype": "Section Break",
"hidden": 0,
@@ -1217,6 +1265,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"description": "",
"fieldname": "taxes_and_charges",
"fieldtype": "Link",
@@ -1245,6 +1294,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "taxes",
"fieldtype": "Table",
"hidden": 0,
@@ -1272,6 +1322,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "other_charges_calculation",
"fieldtype": "HTML",
"hidden": 0,
@@ -1297,6 +1348,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "totals",
"fieldtype": "Section Break",
"hidden": 0,
@@ -1323,6 +1375,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "base_taxes_and_charges_added",
"fieldtype": "Currency",
"hidden": 0,
@@ -1350,6 +1403,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "base_taxes_and_charges_deducted",
"fieldtype": "Currency",
"hidden": 0,
@@ -1377,6 +1431,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "base_total_taxes_and_charges",
"fieldtype": "Currency",
"hidden": 0,
@@ -1404,6 +1459,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "column_break_39",
"fieldtype": "Column Break",
"hidden": 0,
@@ -1428,6 +1484,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "taxes_and_charges_added",
"fieldtype": "Currency",
"hidden": 0,
@@ -1455,6 +1512,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "taxes_and_charges_deducted",
"fieldtype": "Currency",
"hidden": 0,
@@ -1482,6 +1540,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "total_taxes_and_charges",
"fieldtype": "Currency",
"hidden": 0,
@@ -1509,6 +1568,7 @@
"bold": 0,
"collapsible": 1,
"collapsible_depends_on": "discount_amount",
+ "columns": 0,
"fieldname": "discount_section",
"fieldtype": "Section Break",
"hidden": 0,
@@ -1534,6 +1594,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"default": "Grand Total",
"fieldname": "apply_discount_on",
"fieldtype": "Select",
@@ -1561,6 +1622,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "base_discount_amount",
"fieldtype": "Currency",
"hidden": 0,
@@ -1587,6 +1649,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "column_break_45",
"fieldtype": "Column Break",
"hidden": 0,
@@ -1611,6 +1674,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "additional_discount_percentage",
"fieldtype": "Float",
"hidden": 0,
@@ -1636,6 +1700,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "discount_amount",
"fieldtype": "Currency",
"hidden": 0,
@@ -1662,6 +1727,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "totals_section",
"fieldtype": "Section Break",
"hidden": 0,
@@ -1686,6 +1752,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "base_grand_total",
"fieldtype": "Currency",
"hidden": 0,
@@ -1713,6 +1780,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"description": "In Words will be visible once you save the Purchase Order.",
"fieldname": "base_in_words",
"fieldtype": "Data",
@@ -1740,6 +1808,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "base_rounded_total",
"fieldtype": "Currency",
"hidden": 0,
@@ -1767,6 +1836,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "column_break4",
"fieldtype": "Column Break",
"hidden": 0,
@@ -1791,6 +1861,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "grand_total",
"fieldtype": "Currency",
"hidden": 0,
@@ -1818,6 +1889,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "in_words",
"fieldtype": "Data",
"hidden": 0,
@@ -1844,6 +1916,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "advance_paid",
"fieldtype": "Currency",
"hidden": 0,
@@ -1870,6 +1943,7 @@
"bold": 0,
"collapsible": 1,
"collapsible_depends_on": "terms",
+ "columns": 0,
"fieldname": "terms_section_break",
"fieldtype": "Section Break",
"hidden": 0,
@@ -1896,6 +1970,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "tc_name",
"fieldtype": "Link",
"hidden": 0,
@@ -1923,6 +1998,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "terms",
"fieldtype": "Text Editor",
"hidden": 0,
@@ -1949,6 +2025,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 1,
+ "columns": 0,
"fieldname": "more_info",
"fieldtype": "Section Break",
"hidden": 0,
@@ -1974,6 +2051,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"default": "Draft",
"fieldname": "status",
"fieldtype": "Select",
@@ -2002,6 +2080,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "ref_sq",
"fieldtype": "Data",
"hidden": 1,
@@ -2028,6 +2107,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "party_account_currency",
"fieldtype": "Link",
"hidden": 1,
@@ -2054,6 +2134,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "column_break_74",
"fieldtype": "Column Break",
"hidden": 0,
@@ -2078,6 +2159,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "eval:!doc.__islocal",
"description": "",
"fieldname": "per_received",
@@ -2106,6 +2188,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "eval:!doc.__islocal",
"description": "",
"fieldname": "per_billed",
@@ -2134,6 +2217,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 1,
+ "columns": 0,
"fieldname": "column_break5",
"fieldtype": "Section Break",
"hidden": 0,
@@ -2161,6 +2245,7 @@
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "letter_head",
"fieldtype": "Link",
"hidden": 0,
@@ -2188,6 +2273,7 @@
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "select_print_heading",
"fieldtype": "Link",
"hidden": 0,
@@ -2215,6 +2301,59 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
+ "fieldname": "column_break_86",
+ "fieldtype": "Column Break",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0
+ },
+ {
+ "allow_on_submit": 1,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "description": "",
+ "fieldname": "group_same_items",
+ "fieldtype": "Check",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "label": "Group same items",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 1,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
"default": "",
"fieldname": "language",
"fieldtype": "Data",
@@ -2243,6 +2382,7 @@
"bold": 0,
"collapsible": 1,
"collapsible_depends_on": "supplied_items",
+ "columns": 0,
"description": "",
"fieldname": "raw_material_details",
"fieldtype": "Section Break",
@@ -2270,6 +2410,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "supplied_items",
"fieldtype": "Table",
"hidden": 0,
@@ -2298,6 +2439,7 @@
"bold": 0,
"collapsible": 1,
"collapsible_depends_on": "is_recurring",
+ "columns": 0,
"fieldname": "recurring_order",
"fieldtype": "Section Break",
"hidden": 0,
@@ -2323,6 +2465,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "column_break",
"fieldtype": "Column Break",
"hidden": 0,
@@ -2347,6 +2490,7 @@
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "eval:doc.docstatus<2",
"description": "",
"fieldname": "is_recurring",
@@ -2373,6 +2517,7 @@
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "is_recurring",
"description": "",
"fieldname": "recurring_id",
@@ -2400,6 +2545,7 @@
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "eval:doc.is_recurring && doc.recurring_id === doc.name",
"description": "",
"fieldname": "recurring_type",
@@ -2427,6 +2573,7 @@
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "eval:doc.is_recurring && doc.recurring_id === doc.name",
"description": "",
"fieldname": "repeat_on_day_of_month",
@@ -2453,6 +2600,7 @@
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "eval:doc.is_recurring && doc.recurring_id === doc.name",
"description": "",
"fieldname": "end_date",
@@ -2479,6 +2627,7 @@
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "eval:doc.is_recurring && doc.recurring_id === doc.name",
"fieldname": "submit_on_creation",
"fieldtype": "Check",
@@ -2505,6 +2654,7 @@
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "eval:doc.is_recurring && doc.recurring_id === doc.name",
"description": "",
"fieldname": "notify_by_email",
@@ -2532,6 +2682,7 @@
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "eval:doc.is_recurring && doc.notify_by_email && doc.recurring_id === doc.name",
"description": "",
"fieldname": "notification_email_address",
@@ -2559,6 +2710,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "eval:doc.is_recurring && doc.notify_by_email && doc.recurring_id === doc.name",
"fieldname": "recurring_print_format",
"fieldtype": "Link",
@@ -2586,6 +2738,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "column_break83",
"fieldtype": "Column Break",
"hidden": 0,
@@ -2610,6 +2763,7 @@
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "is_recurring",
"description": "",
"fieldname": "from_date",
@@ -2636,6 +2790,7 @@
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "is_recurring",
"description": "",
"fieldname": "to_date",
@@ -2662,6 +2817,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "is_recurring",
"description": "",
"fieldname": "next_date",
@@ -2696,7 +2852,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
- "modified": "2016-07-07 11:32:05.248626",
+ "modified": "2016-10-20 03:07:24.683178",
"modified_by": "Administrator",
"module": "Buying",
"name": "Purchase Order",
@@ -2712,6 +2868,7 @@
"export": 0,
"if_owner": 0,
"import": 0,
+ "is_custom": 0,
"permlevel": 0,
"print": 0,
"read": 1,
@@ -2732,6 +2889,7 @@
"export": 0,
"if_owner": 0,
"import": 0,
+ "is_custom": 0,
"permlevel": 0,
"print": 1,
"read": 1,
@@ -2752,6 +2910,7 @@
"export": 0,
"if_owner": 0,
"import": 0,
+ "is_custom": 0,
"permlevel": 0,
"print": 1,
"read": 1,
@@ -2772,6 +2931,7 @@
"export": 0,
"if_owner": 0,
"import": 0,
+ "is_custom": 0,
"permlevel": 1,
"print": 0,
"read": 1,
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.py b/erpnext/buying/doctype/purchase_order/purchase_order.py
index 3230cd0..54ca07b 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.py
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.py
@@ -155,6 +155,30 @@
if date_diff and date_diff[0][0]:
msgprint(_("{0} {1} has been modified. Please refresh.").format(self.doctype, self.name),
raise_exception=True)
+
+ def before_print(self):
+ if self.get("group_same_items"):
+
+ group_item_qty = {}
+ group_item_amount = {}
+
+ for item in self.items:
+ group_item_qty[item.item_code] = group_item_qty.get(item.item_code, 0) + item.qty
+ group_item_amount[item.item_code] = group_item_amount.get(item.item_code, 0) + item.amount
+
+ duplicate_list = []
+
+ for item in self.items:
+ if item.item_code in group_item_qty:
+ item.qty = group_item_qty[item.item_code]
+ item.amount = group_item_amount[item.item_code]
+ del group_item_qty[item.item_code]
+ else:
+ duplicate_list.append(item)
+
+ for item in duplicate_list:
+ self.remove(item)
+
def update_status(self, status):
self.check_modified_date()
diff --git a/erpnext/buying/doctype/purchase_order/test_purchase_order.py b/erpnext/buying/doctype/purchase_order/test_purchase_order.py
index c24bcdc..d4a0d07 100644
--- a/erpnext/buying/doctype/purchase_order/test_purchase_order.py
+++ b/erpnext/buying/doctype/purchase_order/test_purchase_order.py
@@ -110,6 +110,37 @@
po.update_status("Closed")
self.assertEquals(get_ordered_qty(item_code="_Test Item", warehouse="_Test Warehouse - _TC"), existing_ordered_qty)
+
+ def test_group_same_items(self):
+ frappe.get_doc({
+ "doctype": "Purchase Order",
+ "company": "_Test Company",
+ "supplier" : "_Test Supplier",
+ "is_subcontracted" : "No",
+ "currency" : frappe.db.get_value("Company", "_Test Company", "default_currency"),
+ "conversion_factor" : 1,
+ "items" : get_same_items(),
+ "group_same_items": 1
+ }).insert()
+
+
+def get_same_items():
+ return [
+ {
+ "item_code": "_Test FG Item",
+ "warehouse": "_Test Warehouse - _TC",
+ "qty": 1,
+ "rate": 500,
+ "schedule_date": add_days(nowdate(), 1)
+ },
+ {
+ "item_code": "_Test FG Item",
+ "warehouse": "_Test Warehouse - _TC",
+ "qty": 4,
+ "rate": 500,
+ "schedule_date": add_days(nowdate(), 1)
+ }
+ ]
def create_purchase_order(**args):
po = frappe.new_doc("Purchase Order")
diff --git a/erpnext/controllers/selling_controller.py b/erpnext/controllers/selling_controller.py
index 3f4d12d..68e9155 100644
--- a/erpnext/controllers/selling_controller.py
+++ b/erpnext/controllers/selling_controller.py
@@ -8,6 +8,7 @@
from frappe import _, throw
from erpnext.stock.get_item_details import get_bin_details
from erpnext.stock.utils import get_incoming_rate
+from erpnext.stock.stock_ledger import get_valuation_rate
from erpnext.controllers.stock_controller import StockController
@@ -32,6 +33,7 @@
def validate(self):
super(SellingController, self).validate()
self.validate_max_discount()
+ self.validate_selling_price()
check_active_sales_items(self)
def set_missing_values(self, for_validate=False):
@@ -161,6 +163,29 @@
if discount and flt(d.discount_percentage) > discount:
frappe.throw(_("Maxiumm discount for Item {0} is {1}%").format(d.item_code, discount))
+ def validate_selling_price(self):
+ if not frappe.db.get_single_value("Selling Settings", "validate_selling_price"):
+ return
+
+ for it in self.get("items"):
+ last_purchase_rate, is_stock_item = frappe.db.get_value("Item", it.name, ["last_purchase_rate", "is_stock_item"])
+
+ if flt(it.base_rate) < flt(last_purchase_rate):
+ throw(it.name, last_purchase_rate, "last purchase rate")
+
+ last_valuation_rate = frappe.db.sql("""
+ SELECT valuation_rate FROM `tabStock Ledger Entry` WHERE item_code = %s
+ AND warehouse = %s AND valuation_rate > 0
+ ORDER BY posting_date DESC, posting_time DESC, name DESC LIMIT 1
+ """, (it.item_code, it.warehouse))
+
+ if is_stock_item and flt(it.base_rate) < flt(last_valuation_rate):
+ throw_message(it.name, last_valuation_rate, "valuation rate")
+
+ def throw_message(item_name, rate, ref_rate_field):
+ frappe.throw(_("""Selling price for item {0} is lower than its {1}. Selling price should be atleast {2}""")
+ .format(item_name, ref_rate_field, rate))
+
def get_item_list(self):
il = []
for d in self.get("items"):
@@ -230,7 +255,7 @@
status = frappe.db.get_value("Sales Order", d.get(ref_fieldname), "status")
if status == "Closed":
frappe.throw(_("Sales Order {0} is {1}").format(d.get(ref_fieldname), status))
-
+
def update_reserved_qty(self):
so_map = {}
for d in self.get("items"):
@@ -310,7 +335,7 @@
item = frappe.db.sql("""select docstatus,
income_account from tabItem where name = %s""",
d.item_code, as_dict=True)[0]
-
+
if getattr(d, "income_account", None) and not item.income_account:
frappe.db.set_value("Item", d.item_code, "income_account",
d.income_account)
diff --git a/erpnext/demo/setup/setup_data.py b/erpnext/demo/setup/setup_data.py
index d279a64..f25bbc3 100644
--- a/erpnext/demo/setup/setup_data.py
+++ b/erpnext/demo/setup/setup_data.py
@@ -130,7 +130,7 @@
ss.from_date = e.date_of_joining if (e.date_of_joining
and e.date_of_joining > f.year_start_date) else f.year_start_date
ss.to_date = f.year_end_date
-
+ ss.payment_account = frappe.get_value('Account', {'account_type': 'Cash', 'company': erpnext.get_default_company(),'is_group':0}, "name")
ss.append('earnings', {
'salary_component': 'Basic',
"abbr":'B',
diff --git a/erpnext/demo/user/hr.py b/erpnext/demo/user/hr.py
index 2b80afb..2686987 100644
--- a/erpnext/demo/user/hr.py
+++ b/erpnext/demo/user/hr.py
@@ -1,5 +1,5 @@
from __future__ import unicode_literals
-import frappe
+import frappe, erpnext
import random
from frappe.utils import random_string, add_days, cint
from erpnext.projects.doctype.timesheet.test_timesheet import make_timesheet
@@ -24,18 +24,14 @@
process_payroll.company = frappe.flags.company
process_payroll.month = prev_month
process_payroll.fiscal_year = year
- process_payroll.create_sal_slip()
+ process_payroll.from_date = frappe.flags.current_date
+ process_payroll.to_date = add_days(frappe.flags.current_date, random.randint(0, 30))
+ process_payroll.reference_number = "DemoRef23"
+ process_payroll.reference_date = frappe.flags.current_date
+ process_payroll.payment_account = frappe.get_value('Account', {'account_type': 'Cash', 'company': erpnext.get_default_company(),'is_group':0}, "name")
process_payroll.submit_salary_slip()
- r = process_payroll.make_journal_entry(frappe.get_value('Account',
- {'account_name': 'Salary'}))
-
- journal_entry = frappe.get_doc(r)
- journal_entry.cheque_no = random_string(10)
- journal_entry.cheque_date = frappe.flags.current_date
- journal_entry.posting_date = frappe.flags.current_date
- journal_entry.insert()
- journal_entry.submit()
-
+ process_payroll.make_journal_entry()
+
if frappe.db.get_global('demo_hr_user'):
make_timesheet_records()
diff --git a/erpnext/docs/user/manual/en/accounts/setup/accounts-settings.md b/erpnext/docs/user/manual/en/accounts/setup/accounts-settings.md
index 5242b39..e920b65 100644
--- a/erpnext/docs/user/manual/en/accounts/setup/accounts-settings.md
+++ b/erpnext/docs/user/manual/en/accounts/setup/accounts-settings.md
@@ -7,4 +7,8 @@
* Credit Controller: Role that is allowed to submit transactions that exceed credit limits set.
+* Make Payment via Journal Entry: If checked, on invoice if uer has clicked on payment system open the journal entry else payment entry
+
+* Unlink Payment on Cancellation of Invoice: If checked system inlink the payment against the invoice else shows the link error.
+
{next}
\ No newline at end of file
diff --git a/erpnext/hr/doctype/leave_application/leave_application.py b/erpnext/hr/doctype/leave_application/leave_application.py
index c1a9a06..a51e2b5 100755
--- a/erpnext/hr/doctype/leave_application/leave_application.py
+++ b/erpnext/hr/doctype/leave_application/leave_application.py
@@ -193,7 +193,7 @@
def validate_max_days(self):
max_days = frappe.db.get_value("Leave Type", self.leave_type, "max_days_allowed")
- if max_days and self.total_leave_days > max_days:
+ if max_days and self.total_leave_days > cint(max_days):
frappe.throw(_("Leave of type {0} cannot be longer than {1}").format(self.leave_type, max_days))
def validate_leave_approver(self):
@@ -279,7 +279,7 @@
@frappe.whitelist()
def get_number_of_leave_days(employee, leave_type, from_date, to_date, half_day=None):
- if half_day:
+ if half_day==1:
return 0.5
number_of_days = date_diff(to_date, from_date) + 1
if not frappe.db.get_value("Leave Type", leave_type, "include_holiday"):
diff --git a/erpnext/hr/doctype/process_payroll/process_payroll.json b/erpnext/hr/doctype/process_payroll/process_payroll.json
index 13d3191..546da97 100644
--- a/erpnext/hr/doctype/process_payroll/process_payroll.json
+++ b/erpnext/hr/doctype/process_payroll/process_payroll.json
@@ -609,7 +609,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
- "depends_on": "payment_account",
+ "depends_on": "eval:doc.payment_account",
"description": "Create Bank Entry for the total salary paid for the above selected criteria",
"fieldname": "make_bank_entry",
"fieldtype": "Button",
@@ -692,7 +692,7 @@
"issingle": 1,
"istable": 0,
"max_attachments": 0,
- "modified": "2016-09-28 05:43:26.472928",
+ "modified": "2016-10-22 08:10:44.293748",
"modified_by": "Administrator",
"module": "HR",
"name": "Process Payroll",
@@ -708,6 +708,7 @@
"export": 0,
"if_owner": 0,
"import": 0,
+ "is_custom": 0,
"permlevel": 0,
"print": 0,
"read": 1,
diff --git a/erpnext/hr/doctype/salary_slip/test_salary_slip.py b/erpnext/hr/doctype/salary_slip/test_salary_slip.py
index db98e2b..8bb9653 100644
--- a/erpnext/hr/doctype/salary_slip/test_salary_slip.py
+++ b/erpnext/hr/doctype/salary_slip/test_salary_slip.py
@@ -143,6 +143,8 @@
"department": frappe.get_all("Department", fields="name")[0].name,
"gender": "Female",
"company_email": user,
+ "prefered_contact_email": "Company Email",
+ "prefered_email": user,
"status": "Active",
"employment_type": "Intern"
}).insert()
diff --git a/erpnext/hr/report/monthly_salary_register/monthly_salary_register.py b/erpnext/hr/report/monthly_salary_register/monthly_salary_register.py
index 33f3784..2c6cf72 100644
--- a/erpnext/hr/report/monthly_salary_register/monthly_salary_register.py
+++ b/erpnext/hr/report/monthly_salary_register/monthly_salary_register.py
@@ -38,25 +38,25 @@
columns = [
_("Salary Slip ID") + ":Link/Salary Slip:150",_("Employee") + ":Link/Employee:120", _("Employee Name") + "::140", _("Branch") + ":Link/Branch:120",
_("Department") + ":Link/Department:120", _("Designation") + ":Link/Designation:120",
- _("Company") + ":Link/Company:120", _("Month") + "::80", _("Leave Without Pay") + ":Float:130",
+ _("Company") + ":Link/Company:120", _("Month") + "::80", _("Leave Without Pay") + ":Float:130",
_("Payment Days") + ":Float:120"
]
- earning_types = frappe.db.sql_list("""select distinct salary_component from `tabSalary Detail`
- where amount != 0 and parent in (%s)""" %
- (', '.join(['%s']*len(salary_slips))), tuple([d.name for d in salary_slips]))
-
- ded_types = frappe.db.sql_list("""select distinct salary_component from `tabSalary Detail`
- where amount != 0 and parent in (%s)""" %
- (', '.join(['%s']*len(salary_slips))), tuple([d.name for d in salary_slips]))
-
- columns = columns + [(e + ":Currency:120") for e in earning_types] + \
- ["Arrear Amount:Currency:120", "Leave Encashment Amount:Currency:150",
- "Gross Pay:Currency:120"] + [(d + ":Currency:120") for d in ded_types] + \
- ["Total Deduction:Currency:120", "Net Pay:Currency:120"]
+ salary_components = {_("Earning"): [], _("Deduction"): []}
- return columns, earning_types, ded_types
-
+ for component in frappe.db.sql("""select distinct sd.salary_component, sc.type
+ from `tabSalary Detail` sd, `tabSalary Component` sc
+ where sc.name=sd.salary_component and sd.amount != 0 and sd.parent in (%s)""" %
+ (', '.join(['%s']*len(salary_slips))), tuple([d.name for d in salary_slips]), as_dict=1):
+ salary_components[component.type].append(component.salary_component)
+
+ columns = columns + [(e + ":Currency:120") for e in salary_components[_("Earning")]] + \
+ [ _("Arrear Amount") + ":Currency:120", _("Leave Encashment Amount") + ":Currency:150",
+ _("Gross Pay") + ":Currency:120"] + [(d + ":Currency:120") for d in salary_components[_("Deduction")]] + \
+ [_("Total Deduction") + ":Currency:120", _("Net Pay") + ":Currency:120"]
+
+ return columns, salary_components[_("Earning")], salary_components[_("Deduction")]
+
def get_salary_slips(filters):
conditions, filters = get_conditions(filters)
salary_slips = frappe.db.sql("""select * from `tabSalary Slip` where docstatus = 1 %s
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index 31eb2c5..e5cdb1a 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -339,3 +339,6 @@
erpnext.patches.v7_0.update_status_of_zero_amount_sales_order
erpnext.patches.v7_1.add_field_for_task_dependent
erpnext.patches.v7_0.repost_bin_qty_and_item_projected_qty
+erpnext.patches.v7_1.set_prefered_contact_email
+execute:frappe.db.sql("update `tabSingles` set value = 1 where field = 'unlink_payment_on_cancellation_of_invoice' and doctype = 'Accounts Settings'")
+execute:frappe.db.sql("update `tabStock Entry` set total_amount = null where purpose in('Repack', 'Manufacture')")
\ No newline at end of file
diff --git a/erpnext/patches/v7_1/set_prefered_contact_email.py b/erpnext/patches/v7_1/set_prefered_contact_email.py
new file mode 100644
index 0000000..d662e0d
--- /dev/null
+++ b/erpnext/patches/v7_1/set_prefered_contact_email.py
@@ -0,0 +1,19 @@
+from __future__ import unicode_literals
+import frappe
+
+def execute():
+ for d in frappe.get_all("Employee"):
+ employee = frappe.get_doc("Employee", d.name)
+ if employee.company_email:
+ employee.prefered_contact_email = "Company Email"
+ employee.prefered_email = employee.company_email
+ elif employee.personal_email:
+ employee.prefered_contact_email = "Personal Email"
+ employee.prefered_email = employee.personal_email
+ elif employee.user_id:
+ employee.prefered_contact_email = "User ID"
+ employee.prefered_email = employee.user_id
+
+ employee.flags.ignore_mandatory = True
+ employee.flags.ignore_validate = True
+ employee.save()
\ No newline at end of file
diff --git a/erpnext/selling/doctype/customer/customer.py b/erpnext/selling/doctype/customer/customer.py
index 82dbba7..e291696 100644
--- a/erpnext/selling/doctype/customer/customer.py
+++ b/erpnext/selling/doctype/customer/customer.py
@@ -53,7 +53,7 @@
def get_customer_name(self):
if frappe.db.get_value("Customer", self.customer_name):
- count = frappe.db.sql("""select ifnull(max(SUBSTRING_INDEX(name, ' ', -1)), 0) from tabCustomer
+ count = frappe.db.sql("""select ifnull(MAX(CAST(SUBSTRING_INDEX(name, ' ', -1) AS UNSIGNED)), 0) from tabCustomer
where name like %s""", "%{0} - %".format(self.customer_name), as_list=1)[0][0]
count = cint(count) + 1
return "{0} - {1}".format(self.customer_name, cstr(count))
diff --git a/erpnext/selling/doctype/selling_settings/selling_settings.js b/erpnext/selling/doctype/selling_settings/selling_settings.js
new file mode 100644
index 0000000..cf6fb28
--- /dev/null
+++ b/erpnext/selling/doctype/selling_settings/selling_settings.js
@@ -0,0 +1,8 @@
+// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
+// For license information, please see license.txt
+
+frappe.ui.form.on('Selling Settings', {
+ refresh: function(frm) {
+
+ }
+});
diff --git a/erpnext/selling/doctype/selling_settings/selling_settings.json b/erpnext/selling/doctype/selling_settings/selling_settings.json
index affa38b..dd9bcd7 100644
--- a/erpnext/selling/doctype/selling_settings/selling_settings.json
+++ b/erpnext/selling/doctype/selling_settings/selling_settings.json
@@ -2,29 +2,36 @@
"allow_copy": 0,
"allow_import": 0,
"allow_rename": 0,
+ "beta": 0,
"creation": "2013-06-25 10:25:16",
"custom": 0,
"description": "Settings for Selling Module",
"docstatus": 0,
"doctype": "DocType",
"document_type": "Other",
+ "editable_grid": 0,
+ "engine": "InnoDB",
"fields": [
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"default": "Customer Name",
"fieldname": "cust_master_name",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Customer Naming By",
+ "length": 0,
"no_copy": 0,
"options": "Customer Name\nNaming Series",
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -36,17 +43,21 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "campaign_naming_by",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Campaign Naming By",
+ "length": 0,
"no_copy": 0,
"options": "Campaign Name\nNaming Series",
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -58,18 +69,22 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"description": "",
"fieldname": "customer_group",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Default Customer Group",
+ "length": 0,
"no_copy": 0,
"options": "Customer Group",
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -81,18 +96,22 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"description": "",
"fieldname": "territory",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Default Territory",
+ "length": 0,
"no_copy": 0,
"options": "Territory",
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -104,17 +123,21 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "selling_price_list",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Default Price List",
+ "length": 0,
"no_copy": 0,
"options": "Price List",
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -126,15 +149,19 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "column_break_5",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -146,17 +173,21 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "so_required",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Sales Order Required",
+ "length": 0,
"no_copy": 0,
"options": "No\nYes",
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -168,17 +199,21 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "dn_required",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Delivery Note Required",
+ "length": 0,
"no_copy": 0,
"options": "No\nYes",
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -190,16 +225,20 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "maintain_same_sales_rate",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Maintain Same Rate Throughout Sales Cycle",
+ "length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -211,16 +250,20 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "editable_price_list_rate",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Allow user to edit Price List Rate in transactions",
+ "length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -232,17 +275,21 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "allow_multiple_items",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Allow Item to be added multiple times in a transaction",
+ "length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -254,17 +301,47 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "allow_against_multiple_purchase_orders",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Allow multiple Sales Orders against a Customer's Purchase Order",
+ "length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "validate_selling_price",
+ "fieldtype": "Check",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "label": "Validate Selling Price for Item against Purchase Rate or Valuation Rate",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -277,12 +354,14 @@
"hide_toolbar": 0,
"icon": "icon-cog",
"idx": 1,
+ "image_view": 0,
"in_create": 0,
"in_dialog": 0,
"is_submittable": 0,
"issingle": 1,
"istable": 0,
- "modified": "2015-08-27 02:42:56.512460",
+ "max_attachments": 0,
+ "modified": "2016-10-20 08:17:45.621151",
"modified_by": "Administrator",
"module": "Selling",
"name": "Selling Settings",
@@ -298,6 +377,7 @@
"export": 0,
"if_owner": 0,
"import": 0,
+ "is_custom": 0,
"permlevel": 0,
"print": 1,
"read": 1,
@@ -309,6 +389,10 @@
"write": 1
}
],
+ "quick_entry": 0,
"read_only": 0,
- "read_only_onload": 0
+ "read_only_onload": 0,
+ "sort_field": "modified",
+ "sort_order": "DESC",
+ "track_seen": 0
}
\ No newline at end of file
diff --git a/erpnext/setup/setup_wizard/data/country_wise_tax.json b/erpnext/setup/setup_wizard/data/country_wise_tax.json
new file mode 100644
index 0000000..06f7f09
--- /dev/null
+++ b/erpnext/setup/setup_wizard/data/country_wise_tax.json
@@ -0,0 +1,1380 @@
+{
+ "Albania": {
+ "Albania VAT": {
+ "account_name": "VAT",
+ "tax_rate": 20.00
+ }
+ },
+ "Algeria": {
+ "Algeria VAT 17%": {
+ "account_name": "VAT 17%",
+ "tax_rate": 17.00,
+ "default": 1
+ },
+ "Algeria VAT 7%": {
+ "account_name": "VAT 7%",
+ "tax_rate": 7.00
+ }
+ },
+
+ "Andorra": {
+ "Andorra VAT": {
+ "account_name": "VAT",
+ "tax_rate": 4.50
+ }
+ },
+
+ "Angola": {
+ "Angola VAT": {
+ "account_name": "VAT",
+ "tax_rate": 10.00
+ }
+ },
+
+ "Antigua And Barbuda": {
+ "Antigua & Barbuda Sales Tax": {
+ "account_name": "ABST",
+ "tax_rate": 15.00
+ }
+ },
+
+ "Argentina": {
+ "Argentina Tax": {
+ "account_name": "VAT",
+ "tax_rate": 21.00
+ }
+ },
+
+ "Armenia": {
+ "Armenia Tax": {
+ "account_name": "VAT",
+ "tax_rate": 20.00
+ }
+ },
+
+ "Aruba": {
+ "Aruba Tax": {
+ "account_name": "VAT",
+ "tax_rate": 1.50
+ }
+ },
+
+ "Australia": {
+ "Australia GST1": {
+ "account_name": "GST 10%",
+ "tax_rate": 10.00,
+ "default": 1
+ },
+ "Australia GST 2%": {
+ "account_name": "GST 2%",
+ "tax_rate": 2
+ }
+ },
+
+ "Austria": {
+ "Austria Tax": {
+ "account_name": "VAT",
+ "tax_rate": 20.00
+ }
+ },
+
+ "Azerbaijan": {
+ "Azerbaijan Tax": {
+ "account_name": "GST",
+ "tax_rate": 18.00
+ }
+ },
+
+ "Bahamas": {
+ "Bahamas Tax": {
+ "account_name": "VAT",
+ "tax_rate": 7.50
+ }
+ },
+
+ "Bangladesh": {
+ "Bangladesh Tax": {
+ "account_name": "VAT",
+ "tax_rate": 15.00
+ }
+ },
+
+ "Barbados": {
+ "Barbados Tax": {
+ "account_name": "VAT",
+ "tax_rate": 17.50
+ }
+ },
+
+ "Belarus": {
+ "Belarus Tax": {
+ "account_name": "VAT",
+ "tax_rate": 20.00
+ }
+ },
+
+ "Belgium": {
+ "Belgium VAT 21%": {
+ "account_name": "VAT 21%",
+ "tax_rate": 21.00,
+ "default": 1
+ },
+ "Belgium VAT 12%": {
+ "account_name": "VAT 12%",
+ "tax_rate": 12
+ }
+ },
+
+ "Belize": {
+ "Belize Tax": {
+ "account_name": "GST",
+ "tax_rate": 12.50
+ }
+ },
+
+ "Benin": {
+ "Benin Tax": {
+ "account_name": "VAT",
+ "tax_rate": 18.00
+ }
+ },
+
+ "Bhutan": {
+ "Bhutan Tax": {
+ "account_name": "VAT",
+ "tax_rate": 50.00
+ }
+ },
+
+ "Bolivia": {
+ "Bolivia Tax": {
+ "account_name": "VAT",
+ "tax_rate": 13.00
+ }
+ },
+
+ "Bosnia and Herzegovina": {
+ "Bosnia & Herzegovina Tax": {
+ "account_name": "VAT",
+ "tax_rate": 17.00
+ }
+ },
+
+ "Botswana": {
+ "Botswana Tax": {
+ "account_name": "VAT",
+ "tax_rate": 12.00
+ }
+ },
+
+ "Brazil": {
+ "Brazil ICMS 19%": {
+ "account_name": "ICMS 19%",
+ "tax_rate": 19.00,
+ "default": 1
+ },
+ "Brazil ICMS 17%": {
+ "account_name": "ICMS 17%",
+ "tax_rate": 17.00
+ },
+ "Brazil PIS 1.65%": {
+ "account_name": "PIS 1.65%",
+ "tax_rate": 1.65
+ },
+ "Brazil COFINS 7.6%": {
+ "account_name": "COFINS 7.6%",
+ "tax_rate": 7.6
+ },
+ "Brazil COFINS 5.0%": {
+ "account_name": "ISS 5%",
+ "tax_rate": 5.0
+ }
+ },
+
+ "Bulgaria": {
+ "Bulgaria VAT 20%": {
+ "account_name": "VAT 20%",
+ "tax_rate": 20.00,
+ "default": 1
+ },
+ "Bulgaria VAT 7%": {
+ "account_name": "VAT 7%",
+ "tax_rate": 7.00
+ }
+ },
+
+ "Burkina Faso": {
+ "Burkina Faso Tax": {
+ "account_name": "VAT",
+ "tax_rate": 18.00
+ }
+ },
+
+ "Burundi": {
+ "Burundi Tax": {
+ "account_name": "VAT",
+ "tax_rate": 18.00
+ }
+ },
+
+ "Cambodia": {
+ "Cambodia Tax": {
+ "account_name": "VAT",
+ "tax_rate": 10.00
+ }
+ },
+
+ "Cameroon": {
+ "Cameroon Tax": {
+ "account_name": "VAT",
+ "tax_rate": 19.25
+ }
+ },
+
+ "Canada": {
+ "Canada GST 5%": {
+ "account_name": "GST",
+ "tax_rate": 5.00,
+ "default": 1
+ },
+ "Canada HST 15%": {
+ "account_name": "HST",
+ "tax_rate": 15.00
+ },
+ "Canada PST 8%": {
+ "account_name": "PST 8%",
+ "tax_rate": 8.00
+ },
+ "Canada PST 7%": {
+ "account_name": "PST 7%",
+ "tax_rate": 7.00
+ },
+ "Canada PST 5%": {
+ "account_name": "PST 5%",
+ "tax_rate": 5.00
+ }
+ },
+
+ "Cape Verde": {
+ "Cape Verde Tax": {
+ "account_name": "VAT",
+ "tax_rate": 15.00
+ }
+ },
+
+ "Central African Republic": {
+ "Central African Republic Tax": {
+ "account_name": "VAT",
+ "tax_rate": 19.00
+ }
+ },
+
+ "Chad": {
+ "Chad Tax": {
+ "account_name": "VAT",
+ "tax_rate": 18.00
+ }
+ },
+
+ "Chile": {
+ "Chile Tax": {
+ "account_name": "VAT",
+ "tax_rate": 19.00
+ }
+ },
+
+ "China": {
+ "China Tax": {
+ "account_name": "VAT",
+ "tax_rate": 17.00
+ }
+ },
+
+ "Colombia": {
+ "Colombia Tax": {
+ "account_name": "VAT",
+ "tax_rate": 16.00
+ }
+ },
+
+ "Comoros": {
+ "Comoros Tax": {
+ "account_name": "VAT",
+ "tax_rate": 10.00
+ }
+ },
+
+ "Congo": {
+ "Congo Tax": {
+ "account_name": "VAT",
+ "tax_rate": 16.00
+ }
+ },
+
+ "Costa Rica": {
+ "Costa Rica": {
+ "account_name": "VAT",
+ "tax_rate": 13.00
+ }
+ },
+
+ "Croatia": {
+ "Croatia VAT 25%": {
+ "account_name": "VAT 25%",
+ "tax_rate": 25.00,
+ "default": 1
+ },
+ "Croatia VAT 10%": {
+ "account_name": "VAT 10%",
+ "tax_rate": 10.00
+ }
+ },
+
+ "Cuba": {
+ "Cuba Tax": {
+ "account_name": "VAT",
+ "tax_rate": 20.00
+ }
+ },
+
+ "Cyprus": {
+ "Cyprus Tax": {
+ "account_name": "VAT",
+ "tax_rate": 18.00
+ }
+ },
+
+ "Czech Republic": {
+ "Czech Republic VAT 21%": {
+ "account_name": "VAT 21%",
+ "tax_rate": 21.00,
+ "default": 1
+ },
+ "Czech Republic VAT 15%": {
+ "account_name": "VAT 15%",
+ "tax_rate": 15.00
+ }
+ },
+
+ "Denmark": {
+ "Denmark Tax": {
+ "account_name": "VAT",
+ "tax_rate": 25.00
+ }
+ },
+
+ "Djibouti": {
+ "Dijbouti Tax": {
+ "account_name": "VAT",
+ "tax_rate": 33.00
+ }
+ },
+
+ "Dominica": {
+ "Dominica Tax": {
+ "account_name": "VAT",
+ "tax_rate": 15.00
+ }
+ },
+
+ "Dominican Republic": {
+ "Dominican Republic Tax": {
+ "account_name": "ITBIS",
+ "tax_rate": 16.00
+ }
+ },
+
+ "Ecuador": {
+ "Ecuador Tax": {
+ "account_name": "VAT",
+ "tax_rate": 12.00
+ }
+ },
+
+ "Egypt": {
+ "Egypt Tax": {
+ "account_name": "GST",
+ "tax_rate": 10.00
+ }
+ },
+
+ "El Salvador": {
+ "El Salvador Tax": {
+ "account_name": "VAT",
+ "tax_rate": 13.00
+ }
+ },
+
+ "Equatorial Guinea": {
+ "Equatorial Guinea": {
+ "account_name": "VAT",
+ "tax_rate": 15.00
+ }
+ },
+
+ "Eritrea": {
+ "Eritrea Tax": {
+ "account_name": "VAT",
+ "tax_rate": 4.00
+ }
+ },
+
+ "Estonia": {
+ "Estonia Tax": {
+ "account_name": "VAT",
+ "tax_rate": 20.00
+ }
+ },
+
+ "Ethiopia": {
+ "Ethiopia Tax": {
+ "account_name": "VAT",
+ "tax_rate": 15.00
+ }
+ },
+
+ "Fiji": {
+ "Fiji Tax": {
+ "account_name": "VAT",
+ "tax_rate": 15.00
+ }
+ },
+
+ "Finland": {
+ "Finland Tax": {
+ "account_name": "VAT",
+ "tax_rate": 24.00
+ }
+ },
+
+ "France": {
+ "France VAT 19.6%": {
+ "account_name": "VAT 19.6%",
+ "tax_rate": 19.6,
+ "default": 1
+ },
+ "France VAT 5.5%": {
+ "account_name": "VAT 5.5%",
+ "tax_rate": 5.5
+ }
+ },
+
+ "Gabon": {
+ "Gabon Tax": {
+ "account_name": "VAT",
+ "tax_rate": 18.00
+ }
+ },
+
+ "Gambia": {
+ "Gambia Tax": {
+ "account_name": "VAT",
+ "tax_rate": 15.00
+ }
+ },
+
+ "Georgia": {
+ "Georgia Tax": {
+ "account_name": "VAT",
+ "tax_rate": 18.00
+ }
+ },
+
+ "Germany": {
+ "Germany VAT 19%": {
+ "account_name": "VAT 19%",
+ "tax_rate": 19.00,
+ "default": 1
+ },
+ "Germany VAT 7%": {
+ "account_name": "VAT 7%",
+ "tax_rate": 7.00
+ }
+ },
+
+ "Ghana": {
+ "Ghana Tax": {
+ "account_name": "VAT",
+ "tax_rate": 15.00
+ }
+ },
+
+ "Greece": {
+ "Greece VAT 23%": {
+ "account_name": "VAT 23%",
+ "tax_rate": 23.00,
+ "default": 1
+ },
+ "Greece VAT 9%": {
+ "account_name": "VAT 9%",
+ "tax_rate": 9.00
+ }
+ },
+
+ "Grenada": {
+ "Grenada Tax": {
+ "account_name": "VAT",
+ "tax_rate": 15.00
+ }
+ },
+
+ "Guam": {
+ "Guam Tax": {
+ "account_name": "VAT",
+ "tax_rate": 4.00
+ }
+ },
+
+ "Guatemala": {
+ "Guatemala Tax": {
+ "account_name": "IVA",
+ "tax_rate": 12.00
+ }
+ },
+
+ "Guinea": {
+ "Guinea Tax": {
+ "account_name": "VAT",
+ "tax_rate": 18.00
+ }
+ },
+
+ "Guyana": {
+ "Guyana Tax": {
+ "account_name": "GST",
+ "tax_rate": 16.00
+ }
+ },
+
+ "Haiti": {
+ "Haiti Tax": {
+ "account_name": "VAT",
+ "tax_rate": 10.00
+ }
+ },
+
+ "Honduras": {
+ "Honduras Tax": {
+ "account_name": "VAT",
+ "tax_rate": 15.00
+ }
+ },
+
+ "Hungary": {
+ "Hungary Tax": {
+ "account_name": "VAT",
+ "tax_rate": 27.00
+ }
+ },
+
+ "Iceland": {
+ "Iceland VAT 25.5%": {
+ "account_name": "VAT 25.5%",
+ "tax_rate": 25.5,
+ "default": 1
+ },
+ "Iceland VAT 7.5%": {
+ "account_name": "VAT 7.5%",
+ "tax_rate": 7.5
+ }
+ },
+
+ "India": {
+ "India VAT 5%": {
+ "account_name": "VAT 5%",
+ "tax_rate": 5.00,
+ "default": 1
+ },
+ "India VAT 4%": {
+ "account_name": "VAT 4%",
+ "tax_rate": 4.00
+ },
+ "India VAT 14%": {
+ "account_name": "VAT 14%",
+ "tax_rate": 14.00
+ }
+ },
+
+ "Indonesia": {
+ "Indonesia Tax": {
+ "account_name": "VAT",
+ "tax_rate": 10.00
+ }
+ },
+
+ "Iran": {
+ "Iran Tax": {
+ "account_name": "VAT",
+ "tax_rate": 7.00
+ }
+ },
+
+ "Ireland": {
+ "Ireland Tax": {
+ "account_name": "VAT",
+ "tax_rate": 23.00
+ }
+ },
+
+ "Isle Of Man": {
+ "Isle of Man VAT 20%": {
+ "account_name": "VAT",
+ "tax_rate": 20.00,
+ "default": 1
+ },
+ "Isle of Man VAT 5%": {
+ "account_name": "VAT",
+ "tax_rate": 5.00
+ }
+ },
+
+ "Israel": {
+ "Israel Tax": {
+ "account_name": "VAT",
+ "tax_rate": 18.00
+ }
+ },
+
+ "Italy": {
+ "Italy Tax": {
+ "account_name": "VAT",
+ "tax_rate": 22.00
+ }
+ },
+
+ "Ivory Coast": {
+ "Ivory Coast": {
+ "account_name": "Metric",
+ "tax_rate": 18.00
+ }
+ },
+
+ "Jamaica": {
+ "Jamaica Tax": {
+ "account_name": "GCT",
+ "tax_rate": 16.50
+ }
+ },
+
+ "Japan": {
+ "Japan Tax": {
+ "account_name": "CT",
+ "tax_rate": 5.00
+ }
+ },
+
+ "Jordan": {
+ "Jordan Tax": {
+ "account_name": "VAT",
+ "tax_rate": 16.00
+ }
+ },
+
+ "Kazakhstan": {
+ "Kazakhstan Tax": {
+ "account_name": "VAT",
+ "tax_rate": 12.00
+ }
+ },
+
+ "Kenya": {
+ "Kenya Tax": {
+ "account_name": "VAT",
+ "tax_rate": 16.00
+ }
+ },
+
+ "Kosovo": {
+ "Kosovo Tax": {
+ "account_name": "VAT",
+ "tax_rate": 16.00
+ }
+ },
+
+ "Kyrgyzstan": {
+ "Kyrgyztan Tax": {
+ "account_name": "VAT",
+ "tax_rate": 12.00
+ }
+ },
+
+ "Lao People's Democratic Republic": {
+ "Lao Republic Tax": {
+ "account_name": "VAT",
+ "tax_rate": 10.00
+ }
+ },
+
+ "Latvia": {
+ "Latvia Tax": {
+ "account_name": "VAT",
+ "tax_rate": 20.00
+ }
+ },
+
+ "Lebanon": {
+ "Lebanon Tax": {
+ "account_name": "VAT",
+ "tax_rate": 10.00
+ }
+ },
+
+ "Liechtenstein": {
+ "Liechtenstein Tax": {
+ "account_name": "VAT",
+ "tax_rate": 8.00
+ }
+ },
+
+ "Lithuania": {
+ "Lithunia Tax": {
+ "account_name": "VAT",
+ "tax_rate": 21.00
+ }
+ },
+
+ "Luxembourg": {
+ "Luxembourg VAT 15%": {
+ "account_name": "VAT 15%",
+ "tax_rate": 15.00,
+ "default": 1
+ },
+ "Luxembourg VAT 3%": {
+ "account_name": "VAT 3%",
+ "tax_rate": 3.00
+ }
+ },
+
+ "Macedonia": {
+ "Macedonia VAT 18%": {
+ "account_name": "VAT",
+ "tax_rate": 18.00,
+ "default": 1
+ },
+ "Macedonia VAT 5%": {
+ "account_name": "VAT",
+ "tax_rate": 5.00
+ }
+ },
+
+ "Madagascar": {
+ "Madagascar Tax": {
+ "account_name": "VAT",
+ "tax_rate": 20.00
+ }
+ },
+
+ "Malawi": {
+ "Malawi Tax": {
+ "account_name": "VAT",
+ "tax_rate": 16.50
+ }
+ },
+
+ "Malaysia": {
+ "Malaysia GST 6%": {
+ "account_name": "GST",
+ "tax_rate": 6.00,
+ "default": 1
+ },
+ "Malaysia GST 5%": {
+ "account_name": "GST",
+ "tax_rate": 5.00
+ },
+ "Malaysia GST 10%": {
+ "account_name": "GST",
+ "tax_rate": 10.00
+ }
+ },
+
+ "Mali": {
+ "Mali Tax": {
+ "account_name": "VAT",
+ "tax_rate": 18.00
+ }
+ },
+
+ "Malta": {
+ "Malta Tax": {
+ "account_name": "VAT",
+ "tax_rate": 18.00
+ }
+ },
+
+ "Mauritania": {
+ "Mauritania Tax": {
+ "account_name": "VAT",
+ "tax_rate": 18.00
+ }
+ },
+
+ "Mauritius": {
+ "Mauritius Tax": {
+ "account_name": "VAT",
+ "tax_rate": 15.00
+ }
+ },
+
+ "Mexico": {
+ "Mexico Tax": {
+ "account_name": "IVA",
+ "tax_rate": 16.00
+ }
+ },
+
+ "Micronesia": {
+ "Micronesia Tax": {
+ "account_name": "VAT",
+ "tax_rate": 5.00
+ }
+ },
+
+ "Moldova": {
+ "Moldova VAT 20%": {
+ "account_name": "VAT 20%",
+ "tax_rate": 20.00,
+ "default": 1
+ },
+ "Moldova VAT 8%": {
+ "account_name": "VAT 8%",
+ "tax_rate": 8.00
+ }
+ },
+
+ "Monaco": {
+ "Monaco Tax 19.6%": {
+ "account_name": "VAT 19.6%",
+ "tax_rate": 19.6,
+ "default": 1
+ },
+ "Monaco Tax 5.5%": {
+ "account_name": "VAT 5,5%",
+ "tax_rate": 5.5
+ }
+ },
+
+ "Mongolia": {
+ "Mongolia Tax": {
+ "account_name": "VAT",
+ "tax_rate": 10.00
+ }
+ },
+
+ "Montenegro": {
+ "Montenegro Tax 17%": {
+ "account_name": "VAT 17%",
+ "tax_rate": 17.00,
+ "default": 1
+ },
+ "Montenegro Tax 7%": {
+ "account_name": "VAT 7%",
+ "tax_rate": 7.00
+ }
+ },
+
+ "Morocco": {
+ "Morroco VAT 20%": {
+ "account_name": "VAT 20%",
+ "tax_rate": 20.00,
+ "default": 1
+ },
+ "Morroco VAT 10%": {
+ "account_name": "VAT 10%",
+ "tax_rate": 10.00
+ }
+ },
+
+ "Mozambique": {
+ "Mozambique Tax": {
+ "account_name": "VAT",
+ "tax_rate": 17.00
+ }
+ },
+
+ "Myanmar": {
+ "Myanamar Tax": {
+ "account_name": "VAT",
+ "tax_rate": 30.00
+ }
+ },
+
+ "Namibia": {
+ "Namibia Tax": {
+ "account_name": "VAT",
+ "tax_rate": 15.00
+ }
+ },
+
+ "Nepal": {
+ "Nepal Tax": {
+ "account_name": "VAT",
+ "tax_rate": 13.00
+ }
+ },
+
+ "Netherlands": {
+ "Netherlands VAT 21%": {
+ "account_name": "VAT 21%",
+ "tax_rate": 21.00,
+ "default": 1
+ },
+ "Netherlands VAT 6%": {
+ "account_name": "VAT 6%",
+ "tax_rate": 6.00
+ }
+ },
+
+ "New Zealand": {
+ "New Zealand": {
+ "account_name": "GST",
+ "tax_rate": 15.00
+ }
+ },
+
+ "Nicaragua": {
+ "Nicaragua Tax": {
+ "account_name": "VAT",
+ "tax_rate": 15.00
+ }
+ },
+
+ "Nigeria": {
+ "Nigeria Tax": {
+ "account_name": "VAT",
+ "tax_rate": 5
+ }
+ },
+
+ "North Korea": {
+ "North Korea": {
+ "account_name": "VAT",
+ "tax_rate": 15.00
+ }
+ },
+
+ "Norway": {
+ "Norway VAT 25%": {
+ "account_name": "VAT 25%",
+ "tax_rate": 25.00,
+ "default": 1
+ },
+ "Norway VAT 12%": {
+ "account_name": "VAT 12%",
+ "tax_rate": 12.00
+ }
+ },
+
+ "Pakistan": {
+ "Pakistan Tax": {
+ "account_name": "GST",
+ "tax_rate": 17.00
+ }
+ },
+
+ "Panama": {
+ "Panama Tax": {
+ "account_name": "VAT",
+ "tax_rate": 7.00
+ }
+ },
+
+ "Papua New Guinea": {
+ "Papua New Guinea Tax": {
+ "account_name": "VAT",
+ "tax_rate": 10.00
+ }
+ },
+
+ "Paraguay": {
+ "Paraguay Tax": {
+ "account_name": "VAT",
+ "tax_rate": 10.00
+ }
+ },
+
+ "Peru": {
+ "Peru Tax": {
+ "account_name": "VAT",
+ "tax_rate": 16.00
+ }
+ },
+
+ "Philippines": {
+ "Philippines Tax": {
+ "account_name": "VAT",
+ "tax_rate": 12.00
+ }
+ },
+
+ "Poland": {
+ "Poland VAT 23%": {
+ "account_name": "VAT 23%",
+ "tax_rate": 23.00,
+ "default": 1
+ },
+ "Poland VAT 7%": {
+ "account_name": "VAT 7%",
+ "tax_rate": 7
+ }
+ },
+
+ "Portugal": {
+ "Portugal Tax": {
+ "account_name": "VAT",
+ "tax_rate": 23.00
+ }
+ },
+
+ "Republic Of The Congo": {
+ "Congo Tax": {
+ "account_name": "VAT",
+ "tax_rate": 18.00
+ }
+ },
+
+ "Romania": {
+ "Romania Tax": {
+ "account_name": "VAT",
+ "tax_rate": 24.00
+ }
+ },
+
+ "Russia": {
+ "Russia VAT 18%": {
+ "account_name": "VAT 18%",
+ "tax_rate": 18.00,
+ "default": 1
+ },
+ "Russia VAT 10%": {
+ "account_name": "VAT 10%",
+ "tax_rate": 10.00
+ }
+ },
+
+ "Rwanda": {
+ "Rwanda Tax": {
+ "account_name": "VAT",
+ "tax_rate": 18.00
+ }
+ },
+
+ "Senegal": {
+ "Senegal Tax": {
+ "account_name": "VAT",
+ "tax_rate": 18.00
+ }
+ },
+
+ "Serbia": {
+ "Serbia Tax": {
+ "account_name": "VAT",
+ "tax_rate": 20.00
+ }
+ },
+
+ "Seychelles": {
+ "Seychelles Tax": {
+ "account_name": "VAT",
+ "tax_rate": 15.00
+ }
+ },
+
+ "Sierra Leone": {
+ "Sierra Leone Tax": {
+ "account_name": "VAT",
+ "tax_rate": 15.00
+ }
+ },
+
+ "Singapore": {
+ "Singapore Tax": {
+ "account_name": "GST",
+ "tax_rate": 7.00
+ }
+ },
+
+ "Slovakia": {
+ "Slovakia VAT 20%": {
+ "account_name": "VAT 20%",
+ "tax_rate": 20.00,
+ "default": 1
+ },
+ "Slovakia VAT 10%": {
+ "account_name": "VAT 10%",
+ "tax_rate": 10.00
+ }
+ },
+
+ "Slovenia": {
+ "Slovenia VAT 22%": {
+ "account_name": "VAT 22%",
+ "tax_rate": 22.00,
+ "default": 1
+ },
+ "Slovenia VAT 8.5%": {
+ "account_name": "VAT 8.5%",
+ "tax_rate": 8.50
+ }
+ },
+
+ "Solomon Islands": {
+ "Solomon Islands Tax": {
+ "account_name": "VAT",
+ "tax_rate": 15.00
+ }
+ },
+
+ "Somalia": {
+ "Somalia Tax": {
+ "account_name": "VAT",
+ "tax_rate": 10.00
+ }
+ },
+
+ "South Africa": {
+ "South Africa Tax": {
+ "account_name": "VAT",
+ "tax_rate": 14.00
+ }
+ },
+
+ "South Korea": {
+ "South Korea Tax": {
+ "account_name": "VAT",
+ "tax_rate": 10.00
+ }
+ },
+
+ "Spain": {
+ "Spain Tax": {
+ "account_name": "VAT",
+ "tax_rate": 21.00
+ }
+ },
+
+ "Sri Lanka": {
+ "Sri Lanka Tax": {
+ "account_name": "VAT",
+ "tax_rate": 12.00
+ }
+ },
+
+ "St Lucia": {
+ "St Lucia Tax": {
+ "account_name": "VAT",
+ "tax_rate": 15.00
+ }
+ },
+
+ "Sudan": {
+ "Sudan Tax": {
+ "account_name": "VAT",
+ "tax_rate": 10.00
+ }
+ },
+
+ "Suriname": {
+ "Suriname Tax": {
+ "account_name": "VAT",
+ "tax_rate": 10.00
+ }
+ },
+
+ "Swaziland": {
+ "Swaziland tax": {
+ "account_name": "VAT",
+ "tax_rate": 14.00
+ }
+ },
+
+ "Sweden": {
+ "Sweden Tax": {
+ "account_name": "VAT",
+ "tax_rate": 25.00
+ }
+ },
+
+ "Switzerland": {
+ "Switzerland VAT 8%": {
+ "account_name": "VAT 8%",
+ "tax_rate": 8.00,
+ "default": 1
+ },
+ "Switzerland VAT 2.4%": {
+ "account_name": "VAT 2.4%",
+ "tax_rate": 2.40
+ }
+ },
+
+ "Taiwan": {
+ "Taiwan Tax": {
+ "account_name": "VAT",
+ "tax_rate": 5.00
+ }
+ },
+
+ "Tajikistan": {
+ "Tajikistan Tax": {
+ "account_name": "VAT",
+ "tax_rate": 20
+ }
+ },
+
+ "Tanzania": {
+ "Tanzania Tax": {
+ "account_name": "VAT",
+ "tax_rate": 18.00
+ }
+ },
+
+ "Thailand": {
+ "Thailand Tax": {
+ "account_name": "VAT",
+ "tax_rate": 7.00
+ }
+ },
+
+ "Togo": {
+ "Togo Tax": {
+ "account_name": "VAT",
+ "tax_rate": 18.00
+ }
+ },
+
+ "Tonga": {
+ "Tonga Tax": {
+ "account_name": "VAT",
+ "tax_rate": 15.00
+ }
+ },
+
+ "Trinidad And Tobago": {
+ "Trinidad & Tobago Tax": {
+ "account_name": "VAT",
+ "tax_rate": 15.00
+ }
+ },
+
+ "Tunisia": {
+ "Tunisia VAT 18%": {
+ "account_name": "VAT 18%",
+ "tax_rate": 18.00,
+ "default": 1
+ },
+ "Tunisia VAT 12%": {
+ "account_name": "VAT 12%",
+ "tax_rate": 12.00
+ },
+ "Tunisia VAT 6%": {
+ "account_name": "VAT 6%",
+ "tax_rate": 6.00
+ }
+ },
+
+ "Turkey": {
+ "Turkey Tax": {
+ "account_name": "VAT 18%",
+ "tax_rate": 18.00
+ }
+ },
+
+ "Turkmenistan": {
+ "Turkmenistan Tax": {
+ "account_name": "VAT",
+ "tax_rate": 20.00
+ }
+ },
+
+ "Uganda": {
+ "Uganda Tax": {
+ "account_name": "VAT",
+ "tax_rate": 18.00
+ }
+ },
+
+ "Ukraine": {
+ "Ukraine Tax": {
+ "account_name": "VAT",
+ "tax_rate": 20.00
+ }
+ },
+
+ "United Kingdom": {
+ "United Kingdom Tax": {
+ "account_name": "VAT",
+ "tax_rate": 20.00
+ }
+ },
+
+ "United States": {
+ "US ST 6%": {
+ "account_name": "ST 6%",
+ "tax_rate": 6.00,
+ "default": 1
+ },
+ "US ST 4%": {
+ "account_name": "ST 4%",
+ "tax_rate": 4.00
+ },
+ "US ST 6.25%": {
+ "account_name": "ST 6.25%",
+ "tax_rate": 6.25
+ }
+ },
+
+ "Uruguay": {
+ "Uruguay Tax": {
+ "account_name": "VAT",
+ "tax_rate": 22.00
+ }
+ },
+
+ "Uzbekistan": {
+ "Uzbekistan Tax": {
+ "account_name": "VAT",
+ "tax_rate": 20.00
+ }
+ },
+
+ "Vanuatu": {
+ "Vanuatu Tax": {
+ "account_name": "VAT",
+ "tax_rate": 12.50
+ }
+ },
+
+ "Venezuela": {
+ "Venezuela Tax": {
+ "account_name": "VAT",
+ "tax_rate": 12.00
+ }
+ },
+
+ "Vietnam": {
+ "Vietnam Tax": {
+ "account_name": "VAT",
+ "tax_rate": 10.00
+ }
+ },
+
+ "Yemen": {
+ "Yemen Tax": {
+ "account_name": "VAT",
+ "tax_rate": 5.00
+ }
+ },
+
+ "Zambia": {
+ "Zambia Tax": {
+ "account_name": "VAT",
+ "tax_rate": 16.00
+ }
+ },
+
+ "Zimbabwe": {
+ "Zimbabwe Tax": {
+ "account_name": "VAT",
+ "tax_rate": 15.00
+ }
+ }
+}
\ No newline at end of file
diff --git a/erpnext/setup/setup_wizard/setup_wizard.py b/erpnext/setup/setup_wizard/setup_wizard.py
index 945dfb1..7c65f88 100644
--- a/erpnext/setup/setup_wizard/setup_wizard.py
+++ b/erpnext/setup/setup_wizard/setup_wizard.py
@@ -4,6 +4,8 @@
from __future__ import unicode_literals
import frappe, copy
+import os
+import json
from frappe.utils import cstr, flt, getdate
from frappe import _
from frappe.utils.file_manager import save_file
@@ -15,541 +17,573 @@
from erpnext.setup.setup_wizard.domainify import setup_domain
def setup_complete(args=None):
- if frappe.db.sql("select name from tabCompany"):
- frappe.throw(_("Setup Already Complete!!"))
+ if frappe.db.sql("select name from tabCompany"):
+ frappe.throw(_("Setup Already Complete!!"))
- install_fixtures.install(args.get("country"))
+ install_fixtures.install(args.get("country"))
- create_price_lists(args)
- create_fiscal_year_and_company(args)
- create_users(args)
- set_defaults(args)
- create_territories()
- create_feed_and_todo()
- create_email_digest()
- create_letter_head(args)
- create_taxes(args)
- create_items(args)
- create_customers(args)
- create_suppliers(args)
+ create_price_lists(args)
+ create_fiscal_year_and_company(args)
+ create_sales_tax(args)
+ create_users(args)
+ set_defaults(args)
+ create_territories()
+ create_feed_and_todo()
+ create_email_digest()
+ create_letter_head(args)
+ create_taxes(args)
+ create_items(args)
+ create_customers(args)
+ create_suppliers(args)
- if args.domain.lower() == 'education':
- create_academic_year()
- create_academic_term()
- create_program(args)
- create_course(args)
- create_instructor(args)
- create_room(args)
+ if args.domain.lower() == 'education':
+ create_academic_year()
+ create_academic_term()
+ create_program(args)
+ create_course(args)
+ create_instructor(args)
+ create_room(args)
- if args.get('setup_website'):
- website_maker(args)
+ if args.get('setup_website'):
+ website_maker(args)
- create_logo(args)
+ create_logo(args)
- frappe.local.message_log = []
- setup_domain(args.get('domain'))
+ frappe.local.message_log = []
+ setup_domain(args.get('domain'))
- frappe.db.commit()
- login_as_first_user(args)
+ frappe.db.commit()
+ login_as_first_user(args)
- frappe.db.commit()
- frappe.clear_cache()
+ frappe.db.commit()
+ frappe.clear_cache()
- if args.get("add_sample_data"):
- try:
- make_sample_data()
- frappe.clear_cache()
- except:
- # clear message
- if frappe.message_log:
- frappe.message_log.pop()
+ if args.get("add_sample_data"):
+ try:
+ make_sample_data()
+ frappe.clear_cache()
+ except:
+ # clear message
+ if frappe.message_log:
+ frappe.message_log.pop()
- pass
-
+ pass
+
def create_fiscal_year_and_company(args):
- if (args.get('fy_start_date')):
- curr_fiscal_year = get_fy_details(args.get('fy_start_date'), args.get('fy_end_date'))
- frappe.get_doc({
- "doctype":"Fiscal Year",
- 'year': curr_fiscal_year,
- 'year_start_date': args.get('fy_start_date'),
- 'year_end_date': args.get('fy_end_date'),
- }).insert()
- args["curr_fiscal_year"] = curr_fiscal_year
+ if (args.get('fy_start_date')):
+ curr_fiscal_year = get_fy_details(args.get('fy_start_date'), args.get('fy_end_date'))
+ frappe.get_doc({
+ "doctype":"Fiscal Year",
+ 'year': curr_fiscal_year,
+ 'year_start_date': args.get('fy_start_date'),
+ 'year_end_date': args.get('fy_end_date'),
+ }).insert()
+ args["curr_fiscal_year"] = curr_fiscal_year
- # Company
- if (args.get('company_name')):
- frappe.get_doc({
- "doctype":"Company",
- 'company_name':args.get('company_name').strip(),
- 'abbr':args.get('company_abbr'),
- 'default_currency':args.get('currency'),
- 'country': args.get('country'),
- 'chart_of_accounts': args.get(('chart_of_accounts')),
- 'domain': args.get('domain')
- }).insert()
+ # Company
+ if (args.get('company_name')):
+ frappe.get_doc({
+ "doctype":"Company",
+ 'company_name':args.get('company_name').strip(),
+ 'abbr':args.get('company_abbr'),
+ 'default_currency':args.get('currency'),
+ 'country': args.get('country'),
+ 'chart_of_accounts': args.get(('chart_of_accounts')),
+ 'domain': args.get('domain')
+ }).insert()
- #Enable shopping cart
- enable_shopping_cart(args)
+ #Enable shopping cart
+ enable_shopping_cart(args)
- # Bank Account
- create_bank_account(args)
+ # Bank Account
+ create_bank_account(args)
def enable_shopping_cart(args):
- frappe.get_doc({
- "doctype": "Shopping Cart Settings",
- "enabled": 1,
- 'company': args.get('company_name').strip(),
- 'price_list': frappe.db.get_value("Price List", {"selling": 1}),
- 'default_customer_group': _("Individual"),
- 'quotation_series': "QTN-",
- }).insert()
+ frappe.get_doc({
+ "doctype": "Shopping Cart Settings",
+ "enabled": 1,
+ 'company': args.get('company_name').strip(),
+ 'price_list': frappe.db.get_value("Price List", {"selling": 1}),
+ 'default_customer_group': _("Individual"),
+ 'quotation_series': "QTN-",
+ }).insert()
def create_bank_account(args):
- if args.get("bank_account"):
- company_name = args.get('company_name').strip()
- bank_account_group = frappe.db.get_value("Account",
- {"account_type": "Bank", "is_group": 1, "root_type": "Asset",
- "company": company_name})
- if bank_account_group:
- bank_account = frappe.get_doc({
- "doctype": "Account",
- 'account_name': args.get("bank_account"),
- 'parent_account': bank_account_group,
- 'is_group':0,
- 'company': company_name,
- "account_type": "Bank",
- })
- try:
- return bank_account.insert()
- except RootNotEditable:
- frappe.throw(_("Bank account cannot be named as {0}").format(args.get("bank_account")))
- except frappe.DuplicateEntryError:
- # bank account same as a CoA entry
- pass
+ if args.get("bank_account"):
+ company_name = args.get('company_name').strip()
+ bank_account_group = frappe.db.get_value("Account",
+ {"account_type": "Bank", "is_group": 1, "root_type": "Asset",
+ "company": company_name})
+ if bank_account_group:
+ bank_account = frappe.get_doc({
+ "doctype": "Account",
+ 'account_name': args.get("bank_account"),
+ 'parent_account': bank_account_group,
+ 'is_group':0,
+ 'company': company_name,
+ "account_type": "Bank",
+ })
+ try:
+ return bank_account.insert()
+ except RootNotEditable:
+ frappe.throw(_("Bank account cannot be named as {0}").format(args.get("bank_account")))
+ except frappe.DuplicateEntryError:
+ # bank account same as a CoA entry
+ pass
def create_price_lists(args):
- for pl_type, pl_name in (("Selling", _("Standard Selling")), ("Buying", _("Standard Buying"))):
- frappe.get_doc({
- "doctype": "Price List",
- "price_list_name": pl_name,
- "enabled": 1,
- "buying": 1 if pl_type == "Buying" else 0,
- "selling": 1 if pl_type == "Selling" else 0,
- "currency": args["currency"]
- }).insert()
+ for pl_type, pl_name in (("Selling", _("Standard Selling")), ("Buying", _("Standard Buying"))):
+ frappe.get_doc({
+ "doctype": "Price List",
+ "price_list_name": pl_name,
+ "enabled": 1,
+ "buying": 1 if pl_type == "Buying" else 0,
+ "selling": 1 if pl_type == "Selling" else 0,
+ "currency": args["currency"]
+ }).insert()
def set_defaults(args):
- # enable default currency
- frappe.db.set_value("Currency", args.get("currency"), "enabled", 1)
+ # enable default currency
+ frappe.db.set_value("Currency", args.get("currency"), "enabled", 1)
- global_defaults = frappe.get_doc("Global Defaults", "Global Defaults")
- global_defaults.update({
- 'current_fiscal_year': args.curr_fiscal_year,
- 'default_currency': args.get('currency'),
- 'default_company':args.get('company_name').strip(),
- "country": args.get("country"),
- })
+ global_defaults = frappe.get_doc("Global Defaults", "Global Defaults")
+ global_defaults.update({
+ 'current_fiscal_year': args.curr_fiscal_year,
+ 'default_currency': args.get('currency'),
+ 'default_company':args.get('company_name').strip(),
+ "country": args.get("country"),
+ })
- global_defaults.save()
+ global_defaults.save()
- frappe.db.set_value("System Settings", None, "email_footer_address", args.get("company"))
+ frappe.db.set_value("System Settings", None, "email_footer_address", args.get("company"))
- accounts_settings = frappe.get_doc("Accounts Settings")
- accounts_settings.auto_accounting_for_stock = 1
- accounts_settings.save()
+ accounts_settings = frappe.get_doc("Accounts Settings")
+ accounts_settings.auto_accounting_for_stock = 1
+ accounts_settings.save()
- stock_settings = frappe.get_doc("Stock Settings")
- stock_settings.item_naming_by = "Item Code"
- stock_settings.valuation_method = "FIFO"
- stock_settings.default_warehouse = frappe.db.get_value('Warehouse', {'warehouse_name': _('Stores')})
- stock_settings.stock_uom = _("Nos")
- stock_settings.auto_indent = 1
- stock_settings.auto_insert_price_list_rate_if_missing = 1
- stock_settings.automatically_set_serial_nos_based_on_fifo = 1
- stock_settings.save()
+ stock_settings = frappe.get_doc("Stock Settings")
+ stock_settings.item_naming_by = "Item Code"
+ stock_settings.valuation_method = "FIFO"
+ stock_settings.default_warehouse = frappe.db.get_value('Warehouse', {'warehouse_name': _('Stores')})
+ stock_settings.stock_uom = _("Nos")
+ stock_settings.auto_indent = 1
+ stock_settings.auto_insert_price_list_rate_if_missing = 1
+ stock_settings.automatically_set_serial_nos_based_on_fifo = 1
+ stock_settings.save()
- selling_settings = frappe.get_doc("Selling Settings")
- selling_settings.cust_master_name = "Customer Name"
- selling_settings.so_required = "No"
- selling_settings.dn_required = "No"
- selling_settings.save()
+ selling_settings = frappe.get_doc("Selling Settings")
+ selling_settings.cust_master_name = "Customer Name"
+ selling_settings.so_required = "No"
+ selling_settings.dn_required = "No"
+ selling_settings.save()
- buying_settings = frappe.get_doc("Buying Settings")
- buying_settings.supp_master_name = "Supplier Name"
- buying_settings.po_required = "No"
- buying_settings.pr_required = "No"
- buying_settings.maintain_same_rate = 1
- buying_settings.save()
+ buying_settings = frappe.get_doc("Buying Settings")
+ buying_settings.supp_master_name = "Supplier Name"
+ buying_settings.po_required = "No"
+ buying_settings.pr_required = "No"
+ buying_settings.maintain_same_rate = 1
+ buying_settings.save()
- notification_control = frappe.get_doc("Notification Control")
- notification_control.quotation = 1
- notification_control.sales_invoice = 1
- notification_control.purchase_order = 1
- notification_control.save()
+ notification_control = frappe.get_doc("Notification Control")
+ notification_control.quotation = 1
+ notification_control.sales_invoice = 1
+ notification_control.purchase_order = 1
+ notification_control.save()
- hr_settings = frappe.get_doc("HR Settings")
- hr_settings.emp_created_by = "Naming Series"
- hr_settings.save()
+ hr_settings = frappe.get_doc("HR Settings")
+ hr_settings.emp_created_by = "Naming Series"
+ hr_settings.save()
def create_feed_and_todo():
- """update Activity feed and create todo for creation of item, customer, vendor"""
- add_info_comment(**{
- "subject": _("ERPNext Setup Complete!")
- })
+ """update Activity feed and create todo for creation of item, customer, vendor"""
+ add_info_comment(**{
+ "subject": _("ERPNext Setup Complete!")
+ })
def create_email_digest():
- from frappe.utils.user import get_system_managers
- system_managers = get_system_managers(only_name=True)
- if not system_managers:
- return
+ from frappe.utils.user import get_system_managers
+ system_managers = get_system_managers(only_name=True)
+ if not system_managers:
+ return
- companies = frappe.db.sql_list("select name FROM `tabCompany`")
- for company in companies:
- if not frappe.db.exists("Email Digest", "Default Weekly Digest - " + company):
- edigest = frappe.get_doc({
- "doctype": "Email Digest",
- "name": "Default Weekly Digest - " + company,
- "company": company,
- "frequency": "Weekly",
- "recipient_list": "\n".join(system_managers)
- })
+ companies = frappe.db.sql_list("select name FROM `tabCompany`")
+ for company in companies:
+ if not frappe.db.exists("Email Digest", "Default Weekly Digest - " + company):
+ edigest = frappe.get_doc({
+ "doctype": "Email Digest",
+ "name": "Default Weekly Digest - " + company,
+ "company": company,
+ "frequency": "Weekly",
+ "recipient_list": "\n".join(system_managers)
+ })
- for df in edigest.meta.get("fields", {"fieldtype": "Check"}):
- if df.fieldname != "scheduler_errors":
- edigest.set(df.fieldname, 1)
+ for df in edigest.meta.get("fields", {"fieldtype": "Check"}):
+ if df.fieldname != "scheduler_errors":
+ edigest.set(df.fieldname, 1)
- edigest.insert()
+ edigest.insert()
- # scheduler errors digest
- if companies:
- edigest = frappe.new_doc("Email Digest")
- edigest.update({
- "name": "Scheduler Errors",
- "company": companies[0],
- "frequency": "Daily",
- "recipient_list": "\n".join(system_managers),
- "scheduler_errors": 1,
- "enabled": 1
- })
- edigest.insert()
+ # scheduler errors digest
+ if companies:
+ edigest = frappe.new_doc("Email Digest")
+ edigest.update({
+ "name": "Scheduler Errors",
+ "company": companies[0],
+ "frequency": "Daily",
+ "recipient_list": "\n".join(system_managers),
+ "scheduler_errors": 1,
+ "enabled": 1
+ })
+ edigest.insert()
def get_fy_details(fy_start_date, fy_end_date):
- start_year = getdate(fy_start_date).year
- if start_year == getdate(fy_end_date).year:
- fy = cstr(start_year)
- else:
- fy = cstr(start_year) + '-' + cstr(start_year + 1)
- return fy
+ start_year = getdate(fy_start_date).year
+ if start_year == getdate(fy_end_date).year:
+ fy = cstr(start_year)
+ else:
+ fy = cstr(start_year) + '-' + cstr(start_year + 1)
+ return fy
+
+def create_sales_tax(args):
+ country_wise_tax = get_country_wise_tax(args.get("country"))
+ if len(country_wise_tax)>0:
+ for sales_tax, tax_data in country_wise_tax.items():
+ make_tax_account_and_template(args.get("company_name").strip(),
+ tax_data.get('account_name'), tax_data.get('tax_rate'), sales_tax)
+
+def get_country_wise_tax(country):
+ data = {}
+ with open (os.path.join(os.path.dirname(__file__), "data", "country_wise_tax.json")) as countrywise_tax:
+ data = json.load(countrywise_tax).get(country)
+
+ return data
def create_taxes(args):
+ for i in xrange(1,6):
+ if args.get("tax_" + str(i)):
+ # replace % in case someone also enters the % symbol
+ tax_rate = cstr(args.get("tax_rate_" + str(i)) or "").replace("%", "")
+ account_name = args.get("tax_" + str(i))
- for i in xrange(1,6):
- if args.get("tax_" + str(i)):
- # replace % in case someone also enters the % symbol
- tax_rate = cstr(args.get("tax_rate_" + str(i)) or "").replace("%", "")
+ make_tax_account_and_template(args.get("company_name").strip(), account_name, tax_rate)
+
+def make_tax_account_and_template(company, account_name, tax_rate, template_name=None):
+ try:
+ account = make_tax_account(company, account_name, tax_rate)
+ if account:
+ make_sales_and_purchase_tax_templates(account, template_name)
+ except frappe.NameError, e:
+ if e.args[2][0]==1062:
+ pass
+ else:
+ raise
+ except RootNotEditable, e:
+ pass
+
+def get_tax_account_group(company):
+ tax_group = frappe.db.get_value("Account",
+ {"account_name": "Duties and Taxes", "is_group": 1, "company": company})
+ if not tax_group:
+ tax_group = frappe.db.get_value("Account", {"is_group": 1, "root_type": "Liability",
+ "account_type": "Tax", "company": company})
+
+ return tax_group
- try:
- tax_group = frappe.db.get_value("Account", {"company": args.get("company_name"),
- "is_group": 1, "account_type": "Tax", "root_type": "Liability"})
- if tax_group:
- account = make_tax_head(args, i, tax_group, tax_rate)
- make_sales_and_purchase_tax_templates(account)
+def make_tax_account(company, account_name, tax_rate):
+ tax_group = get_tax_account_group(company)
+ if tax_group:
+ return frappe.get_doc({
+ "doctype":"Account",
+ "company": company,
+ "parent_account": tax_group,
+ "account_name": account_name,
+ "is_group": 0,
+ "report_type": "Balance Sheet",
+ "root_type": "Liability",
+ "account_type": "Tax",
+ "tax_rate": flt(tax_rate) if tax_rate else None
+ }).insert(ignore_permissions=True)
- except frappe.NameError, e:
- if e.args[2][0]==1062:
- pass
- else:
- raise
- except RootNotEditable, e:
- pass
+def make_sales_and_purchase_tax_templates(account, template_name=None):
+ if not template_name:
+ template_name = account.name
+
+ sales_tax_template = {
+ "doctype": "Sales Taxes and Charges Template",
+ "title": template_name,
+ "company": account.company,
+ "taxes": [{
+ "category": "Valuation and Total",
+ "charge_type": "On Net Total",
+ "account_head": account.name,
+ "description": "{0} @ {1}".format(account.account_name, account.tax_rate),
+ "rate": account.tax_rate
+ }]
+ }
-def make_tax_head(args, i, tax_group, tax_rate):
- return frappe.get_doc({
- "doctype":"Account",
- "company": args.get("company_name").strip(),
- "parent_account": tax_group,
- "account_name": args.get("tax_" + str(i)),
- "is_group": 0,
- "report_type": "Balance Sheet",
- "account_type": "Tax",
- "tax_rate": flt(tax_rate) if tax_rate else None
- }).insert(ignore_permissions=True)
+ # Sales
+ frappe.get_doc(copy.deepcopy(sales_tax_template)).insert(ignore_permissions=True)
-def make_sales_and_purchase_tax_templates(account):
- doc = {
- "doctype": "Sales Taxes and Charges Template",
- "title": account.name,
- "taxes": [{
- "category": "Valuation and Total",
- "charge_type": "On Net Total",
- "account_head": account.name,
- "description": "{0} @ {1}".format(account.account_name, account.tax_rate),
- "rate": account.tax_rate
- }]
- }
-
- # Sales
- frappe.get_doc(copy.deepcopy(doc)).insert()
-
- # Purchase
- doc["doctype"] = "Purchase Taxes and Charges Template"
- frappe.get_doc(copy.deepcopy(doc)).insert()
+ # Purchase
+ purchase_tax_template = copy.deepcopy(sales_tax_template)
+ purchase_tax_template["doctype"] = "Purchase Taxes and Charges Template"
+ frappe.get_doc(purchase_tax_template).insert(ignore_permissions=True)
def create_items(args):
- for i in xrange(1,6):
- item = args.get("item_" + str(i))
- if item:
- item_group = args.get("item_group_" + str(i))
- is_sales_item = args.get("is_sales_item_" + str(i))
- is_purchase_item = args.get("is_purchase_item_" + str(i))
- is_stock_item = item_group!=_("Services")
- default_warehouse = ""
- if is_stock_item:
- default_warehouse = frappe.db.get_value("Warehouse", filters={
- "warehouse_name": _("Finished Goods") if is_sales_item else _("Stores"),
- "company": args.get("company_name").strip()
- })
+ for i in xrange(1,6):
+ item = args.get("item_" + str(i))
+ if item:
+ item_group = args.get("item_group_" + str(i))
+ is_sales_item = args.get("is_sales_item_" + str(i))
+ is_purchase_item = args.get("is_purchase_item_" + str(i))
+ is_stock_item = item_group!=_("Services")
+ default_warehouse = ""
+ if is_stock_item:
+ default_warehouse = frappe.db.get_value("Warehouse", filters={
+ "warehouse_name": _("Finished Goods") if is_sales_item else _("Stores"),
+ "company": args.get("company_name").strip()
+ })
- try:
- frappe.get_doc({
- "doctype":"Item",
- "item_code": item,
- "item_name": item,
- "description": item,
- "show_in_website": 1,
- "is_sales_item": is_sales_item,
- "is_purchase_item": is_purchase_item,
- "is_stock_item": is_stock_item and 1 or 0,
- "item_group": item_group,
- "stock_uom": args.get("item_uom_" + str(i)),
- "default_warehouse": default_warehouse
- }).insert()
+ try:
+ frappe.get_doc({
+ "doctype":"Item",
+ "item_code": item,
+ "item_name": item,
+ "description": item,
+ "show_in_website": 1,
+ "is_sales_item": is_sales_item,
+ "is_purchase_item": is_purchase_item,
+ "is_stock_item": is_stock_item and 1 or 0,
+ "item_group": item_group,
+ "stock_uom": args.get("item_uom_" + str(i)),
+ "default_warehouse": default_warehouse
+ }).insert()
- if args.get("item_img_" + str(i)):
- item_image = args.get("item_img_" + str(i)).split(",")
- if len(item_image)==3:
- filename, filetype, content = item_image
- fileurl = save_file(filename, content, "Item", item, decode=True).file_url
- frappe.db.set_value("Item", item, "image", fileurl)
+ if args.get("item_img_" + str(i)):
+ item_image = args.get("item_img_" + str(i)).split(",")
+ if len(item_image)==3:
+ filename, filetype, content = item_image
+ fileurl = save_file(filename, content, "Item", item, decode=True).file_url
+ frappe.db.set_value("Item", item, "image", fileurl)
- if args.get("item_price_" + str(i)):
- item_price = flt(args.get("item_price_" + str(i)))
+ if args.get("item_price_" + str(i)):
+ item_price = flt(args.get("item_price_" + str(i)))
- if is_sales_item:
- price_list_name = frappe.db.get_value("Price List", {"selling": 1})
- make_item_price(item, price_list_name, item_price)
+ if is_sales_item:
+ price_list_name = frappe.db.get_value("Price List", {"selling": 1})
+ make_item_price(item, price_list_name, item_price)
- if is_purchase_item:
- price_list_name = frappe.db.get_value("Price List", {"buying": 1})
- make_item_price(item, price_list_name, item_price)
+ if is_purchase_item:
+ price_list_name = frappe.db.get_value("Price List", {"buying": 1})
+ make_item_price(item, price_list_name, item_price)
- except frappe.NameError:
- pass
+ except frappe.NameError:
+ pass
def make_item_price(item, price_list_name, item_price):
- frappe.get_doc({
- "doctype": "Item Price",
- "price_list": price_list_name,
- "item_code": item,
- "price_list_rate": item_price
- }).insert()
+ frappe.get_doc({
+ "doctype": "Item Price",
+ "price_list": price_list_name,
+ "item_code": item,
+ "price_list_rate": item_price
+ }).insert()
def create_customers(args):
- for i in xrange(1,6):
- customer = args.get("customer_" + str(i))
- if customer:
- try:
- doc = frappe.get_doc({
- "doctype":"Customer",
- "customer_name": customer,
- "customer_type": "Company",
- "customer_group": _("Commercial"),
- "territory": args.get("country"),
- "company": args.get("company_name").strip()
- }).insert()
+ for i in xrange(1,6):
+ customer = args.get("customer_" + str(i))
+ if customer:
+ try:
+ doc = frappe.get_doc({
+ "doctype":"Customer",
+ "customer_name": customer,
+ "customer_type": "Company",
+ "customer_group": _("Commercial"),
+ "territory": args.get("country"),
+ "company": args.get("company_name").strip()
+ }).insert()
- if args.get("customer_contact_" + str(i)):
- create_contact(args.get("customer_contact_" + str(i)),
- "customer", doc.name)
- except frappe.NameError:
- pass
+ if args.get("customer_contact_" + str(i)):
+ create_contact(args.get("customer_contact_" + str(i)),
+ "customer", doc.name)
+ except frappe.NameError:
+ pass
def create_suppliers(args):
- for i in xrange(1,6):
- supplier = args.get("supplier_" + str(i))
- if supplier:
- try:
- doc = frappe.get_doc({
- "doctype":"Supplier",
- "supplier_name": supplier,
- "supplier_type": _("Local"),
- "company": args.get("company_name").strip()
- }).insert()
+ for i in xrange(1,6):
+ supplier = args.get("supplier_" + str(i))
+ if supplier:
+ try:
+ doc = frappe.get_doc({
+ "doctype":"Supplier",
+ "supplier_name": supplier,
+ "supplier_type": _("Local"),
+ "company": args.get("company_name").strip()
+ }).insert()
- if args.get("supplier_contact_" + str(i)):
- create_contact(args.get("supplier_contact_" + str(i)),
- "supplier", doc.name)
- except frappe.NameError:
- pass
+ if args.get("supplier_contact_" + str(i)):
+ create_contact(args.get("supplier_contact_" + str(i)),
+ "supplier", doc.name)
+ except frappe.NameError:
+ pass
def create_contact(contact, party_type, party):
- """Create contact based on given contact name"""
- contact = contact.strip().split(" ")
+ """Create contact based on given contact name"""
+ contact = contact.strip().split(" ")
- frappe.get_doc({
- "doctype":"Contact",
- party_type: party,
- "first_name":contact[0],
- "last_name": len(contact) > 1 and contact[1] or ""
- }).insert()
+ frappe.get_doc({
+ "doctype":"Contact",
+ party_type: party,
+ "first_name":contact[0],
+ "last_name": len(contact) > 1 and contact[1] or ""
+ }).insert()
def create_letter_head(args):
- if args.get("attach_letterhead"):
- frappe.get_doc({
- "doctype":"Letter Head",
- "letter_head_name": _("Standard"),
- "is_default": 1
- }).insert()
+ if args.get("attach_letterhead"):
+ frappe.get_doc({
+ "doctype":"Letter Head",
+ "letter_head_name": _("Standard"),
+ "is_default": 1
+ }).insert()
- attach_letterhead = args.get("attach_letterhead").split(",")
- if len(attach_letterhead)==3:
- filename, filetype, content = attach_letterhead
- fileurl = save_file(filename, content, "Letter Head", _("Standard"), decode=True).file_url
- frappe.db.set_value("Letter Head", _("Standard"), "content", "<img src='%s' style='max-width: 100%%;'>" % fileurl)
+ attach_letterhead = args.get("attach_letterhead").split(",")
+ if len(attach_letterhead)==3:
+ filename, filetype, content = attach_letterhead
+ fileurl = save_file(filename, content, "Letter Head", _("Standard"), decode=True).file_url
+ frappe.db.set_value("Letter Head", _("Standard"), "content", "<img src='%s' style='max-width: 100%%;'>" % fileurl)
def create_logo(args):
- if args.get("attach_logo"):
- attach_logo = args.get("attach_logo").split(",")
- if len(attach_logo)==3:
- filename, filetype, content = attach_logo
- fileurl = save_file(filename, content, "Website Settings", "Website Settings",
- decode=True).file_url
- frappe.db.set_value("Website Settings", "Website Settings", "brand_html",
- "<img src='{0}' style='max-width: 40px; max-height: 25px;'> {1}".format(fileurl, args.get("company_name").strip()))
+ if args.get("attach_logo"):
+ attach_logo = args.get("attach_logo").split(",")
+ if len(attach_logo)==3:
+ filename, filetype, content = attach_logo
+ fileurl = save_file(filename, content, "Website Settings", "Website Settings",
+ decode=True).file_url
+ frappe.db.set_value("Website Settings", "Website Settings", "brand_html",
+ "<img src='{0}' style='max-width: 40px; max-height: 25px;'> {1}".format(fileurl, args.get("company_name").strip()))
def create_territories():
- """create two default territories, one for home country and one named Rest of the World"""
- from frappe.utils.nestedset import get_root_of
- country = frappe.db.get_default("country")
- root_territory = get_root_of("Territory")
- for name in (country, _("Rest Of The World")):
- if name and not frappe.db.exists("Territory", name):
- frappe.get_doc({
- "doctype": "Territory",
- "territory_name": name.replace("'", ""),
- "parent_territory": root_territory,
- "is_group": "No"
- }).insert()
+ """create two default territories, one for home country and one named Rest of the World"""
+ from frappe.utils.nestedset import get_root_of
+ country = frappe.db.get_default("country")
+ root_territory = get_root_of("Territory")
+ for name in (country, _("Rest Of The World")):
+ if name and not frappe.db.exists("Territory", name):
+ frappe.get_doc({
+ "doctype": "Territory",
+ "territory_name": name.replace("'", ""),
+ "parent_territory": root_territory,
+ "is_group": "No"
+ }).insert()
def login_as_first_user(args):
- if args.get("email") and hasattr(frappe.local, "login_manager"):
- frappe.local.login_manager.login_as(args.get("email"))
+ if args.get("email") and hasattr(frappe.local, "login_manager"):
+ frappe.local.login_manager.login_as(args.get("email"))
def create_users(args):
- if frappe.session.user == 'Administrator':
- return
+ if frappe.session.user == 'Administrator':
+ return
- # create employee for self
- emp = frappe.get_doc({
- "doctype": "Employee",
- "employee_name": " ".join(filter(None, [args.get("first_name"), args.get("last_name")])),
- "user_id": frappe.session.user,
- "status": "Active",
- "company": args.get("company_name")
- })
- emp.flags.ignore_mandatory = True
- emp.insert(ignore_permissions = True)
+ # create employee for self
+ emp = frappe.get_doc({
+ "doctype": "Employee",
+ "employee_name": " ".join(filter(None, [args.get("first_name"), args.get("last_name")])),
+ "user_id": frappe.session.user,
+ "status": "Active",
+ "company": args.get("company_name")
+ })
+ emp.flags.ignore_mandatory = True
+ emp.insert(ignore_permissions = True)
- for i in xrange(1,5):
- email = args.get("user_email_" + str(i))
- fullname = args.get("user_fullname_" + str(i))
- if email:
- if not fullname:
- fullname = email.split("@")[0]
+ for i in xrange(1,5):
+ email = args.get("user_email_" + str(i))
+ fullname = args.get("user_fullname_" + str(i))
+ if email:
+ if not fullname:
+ fullname = email.split("@")[0]
- parts = fullname.split(" ", 1)
+ parts = fullname.split(" ", 1)
- user = frappe.get_doc({
- "doctype": "User",
- "email": email,
- "first_name": parts[0],
- "last_name": parts[1] if len(parts) > 1 else "",
- "enabled": 1,
- "user_type": "System User"
- })
+ user = frappe.get_doc({
+ "doctype": "User",
+ "email": email,
+ "first_name": parts[0],
+ "last_name": parts[1] if len(parts) > 1 else "",
+ "enabled": 1,
+ "user_type": "System User"
+ })
- # default roles
- user.append_roles("Projects User", "Stock User", "Support Team")
+ # default roles
+ user.append_roles("Projects User", "Stock User", "Support Team")
- if args.get("user_sales_" + str(i)):
- user.append_roles("Sales User", "Sales Manager", "Accounts User")
- if args.get("user_purchaser_" + str(i)):
- user.append_roles("Purchase User", "Purchase Manager", "Accounts User")
- if args.get("user_accountant_" + str(i)):
- user.append_roles("Accounts Manager", "Accounts User")
+ if args.get("user_sales_" + str(i)):
+ user.append_roles("Sales User", "Sales Manager", "Accounts User")
+ if args.get("user_purchaser_" + str(i)):
+ user.append_roles("Purchase User", "Purchase Manager", "Accounts User")
+ if args.get("user_accountant_" + str(i)):
+ user.append_roles("Accounts Manager", "Accounts User")
- user.flags.delay_emails = True
+ user.flags.delay_emails = True
- if not frappe.db.get_value("User", email):
- user.insert(ignore_permissions=True)
+ if not frappe.db.get_value("User", email):
+ user.insert(ignore_permissions=True)
- # create employee
- emp = frappe.get_doc({
- "doctype": "Employee",
- "employee_name": fullname,
- "user_id": email,
- "status": "Active",
- "company": args.get("company_name")
- })
- emp.flags.ignore_mandatory = True
- emp.insert(ignore_permissions = True)
+ # create employee
+ emp = frappe.get_doc({
+ "doctype": "Employee",
+ "employee_name": fullname,
+ "user_id": email,
+ "status": "Active",
+ "company": args.get("company_name")
+ })
+ emp.flags.ignore_mandatory = True
+ emp.insert(ignore_permissions = True)
def create_academic_term():
- at = ["Semester 1", "Semester 2", "Semester 3"]
- ay = ["2013-14", "2014-15", "2015-16", "2016-17", "2017-18"]
- for y in ay:
- for t in at:
- academic_term = frappe.new_doc("Academic Term")
- academic_term.academic_year = y
- academic_term.term_name = t
- academic_term.save()
+ at = ["Semester 1", "Semester 2", "Semester 3"]
+ ay = ["2013-14", "2014-15", "2015-16", "2016-17", "2017-18"]
+ for y in ay:
+ for t in at:
+ academic_term = frappe.new_doc("Academic Term")
+ academic_term.academic_year = y
+ academic_term.term_name = t
+ academic_term.save()
def create_academic_year():
- ac = ["2013-14", "2014-15", "2015-16", "2016-17", "2017-18"]
- for d in ac:
- academic_year = frappe.new_doc("Academic Year")
- academic_year.academic_year_name = d
- academic_year.save()
+ ac = ["2013-14", "2014-15", "2015-16", "2016-17", "2017-18"]
+ for d in ac:
+ academic_year = frappe.new_doc("Academic Year")
+ academic_year.academic_year_name = d
+ academic_year.save()
def create_program(args):
- for i in xrange(1,6):
- if args.get("program_" + str(i)):
- program = frappe.new_doc("Program")
- program.program_name = args.get("program_" + str(i))
- program.save()
+ for i in xrange(1,6):
+ if args.get("program_" + str(i)):
+ program = frappe.new_doc("Program")
+ program.program_name = args.get("program_" + str(i))
+ program.save()
def create_course(args):
- for i in xrange(1,6):
- if args.get("course_" + str(i)):
- course = frappe.new_doc("Course")
- course.course_name = args.get("course_" + str(i))
- course.save()
+ for i in xrange(1,6):
+ if args.get("course_" + str(i)):
+ course = frappe.new_doc("Course")
+ course.course_name = args.get("course_" + str(i))
+ course.save()
def create_instructor(args):
- for i in xrange(1,6):
- if args.get("instructor_" + str(i)):
- instructor = frappe.new_doc("Instructor")
- instructor.instructor_name = args.get("instructor_" + str(i))
- instructor.save()
+ for i in xrange(1,6):
+ if args.get("instructor_" + str(i)):
+ instructor = frappe.new_doc("Instructor")
+ instructor.instructor_name = args.get("instructor_" + str(i))
+ instructor.save()
def create_room(args):
- for i in xrange(1,6):
- if args.get("room_" + str(i)):
- room = frappe.new_doc("Room")
- room.room_name = args.get("room_" + str(i))
- room.seating_capacity = args.get("room_capacity_" + str(i))
- room.save()
+ for i in xrange(1,6):
+ if args.get("room_" + str(i)):
+ room = frappe.new_doc("Room")
+ room.room_name = args.get("room_" + str(i))
+ room.seating_capacity = args.get("room_capacity_" + str(i))
+ room.save()
diff --git a/erpnext/stock/doctype/material_request/material_request.js b/erpnext/stock/doctype/material_request/material_request.js
index 78f17d3..44b7dea 100644
--- a/erpnext/stock/doctype/material_request/material_request.js
+++ b/erpnext/stock/doctype/material_request/material_request.js
@@ -7,7 +7,13 @@
onload: function(frm) {
// formatter for material request item
frm.set_indicator_formatter('item_code',
- function(doc) { return (doc.qty<=doc.ordered_qty) ? "green" : "orange" })
+ function(doc) { return (doc.qty<=doc.ordered_qty) ? "green" : "orange" }),
+
+ frm.fields_dict["items"].grid.get_field("warehouse").get_query = function(doc, cdt, cdn){
+ return{
+ filters: {'company': doc.company}
+ }
+ }
}
});
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.json b/erpnext/stock/doctype/stock_entry/stock_entry.json
index 0ab80c2..8e31332 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.json
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.json
@@ -3,16 +3,20 @@
"allow_import": 1,
"allow_rename": 0,
"autoname": "naming_series:",
+ "beta": 0,
"creation": "2013-04-09 11:43:55",
"custom": 0,
"docstatus": 0,
"doctype": "DocType",
"document_type": "Document",
+ "editable_grid": 0,
+ "engine": "InnoDB",
"fields": [
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "items_section",
"fieldtype": "Section Break",
"hidden": 0,
@@ -38,6 +42,7 @@
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"default": "{purpose}",
"fieldname": "title",
"fieldtype": "Data",
@@ -64,6 +69,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "naming_series",
"fieldtype": "Select",
"hidden": 0,
@@ -91,6 +97,7 @@
"allow_on_submit": 0,
"bold": 1,
"collapsible": 0,
+ "columns": 0,
"default": "Material Issue",
"fieldname": "purpose",
"fieldtype": "Select",
@@ -119,6 +126,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "company",
"fieldtype": "Link",
"hidden": 0,
@@ -146,6 +154,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "eval:in_list([\"Material Transfer for Manufacture\", \"Manufacture\"], doc.purpose)",
"fieldname": "production_order",
"fieldtype": "Link",
@@ -174,6 +183,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "eval:doc.purpose==\"Subcontract\"",
"fieldname": "purchase_order",
"fieldtype": "Link",
@@ -201,6 +211,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "eval:doc.purpose==\"Sales Return\"",
"fieldname": "delivery_note_no",
"fieldtype": "Link",
@@ -229,6 +240,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "eval:doc.purpose==\"Sales Return\"",
"fieldname": "sales_invoice_no",
"fieldtype": "Link",
@@ -255,6 +267,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "eval:doc.purpose==\"Purchase Return\"",
"fieldname": "purchase_receipt_no",
"fieldtype": "Link",
@@ -283,6 +296,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "eval:in_list([\"Material Issue\", \"Material Transfer\", \"Manufacture\", \"Repack\", \t\t\t\t\t\"Subcontract\", \"Material Transfer for Manufacture\"], doc.purpose)",
"fieldname": "from_bom",
"fieldtype": "Check",
@@ -309,6 +323,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "col2",
"fieldtype": "Column Break",
"hidden": 0,
@@ -335,6 +350,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"default": "Today",
"fieldname": "posting_date",
"fieldtype": "Date",
@@ -362,6 +378,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "posting_time",
"fieldtype": "Time",
"hidden": 0,
@@ -388,6 +405,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "eval: doc.from_bom && (doc.purpose!==\"Sales Return\" && doc.purpose!==\"Purchase Return\")",
"fieldname": "sb1",
"fieldtype": "Section Break",
@@ -413,6 +431,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "from_bom",
"fieldname": "bom_no",
"fieldtype": "Link",
@@ -439,6 +458,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "from_bom",
"description": "As per Stock UOM",
"fieldname": "fg_completed_qty",
@@ -467,6 +487,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "cb1",
"fieldtype": "Column Break",
"hidden": 0,
@@ -490,6 +511,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"default": "1",
"depends_on": "from_bom",
"description": "Including items for sub assemblies",
@@ -517,6 +539,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "from_bom",
"fieldname": "get_items",
"fieldtype": "Button",
@@ -543,6 +566,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "section_break_12",
"fieldtype": "Section Break",
"hidden": 0,
@@ -567,6 +591,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "from_warehouse",
"fieldtype": "Link",
"hidden": 0,
@@ -594,6 +619,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "cb0",
"fieldtype": "Column Break",
"hidden": 0,
@@ -617,6 +643,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "to_warehouse",
"fieldtype": "Link",
"hidden": 0,
@@ -644,6 +671,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "sb0",
"fieldtype": "Section Break",
"hidden": 0,
@@ -668,6 +696,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "items",
"fieldtype": "Table",
"hidden": 0,
@@ -695,6 +724,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"description": "",
"fieldname": "get_stock_and_rate",
"fieldtype": "Button",
@@ -722,6 +752,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "section_break_19",
"fieldtype": "Section Break",
"hidden": 0,
@@ -746,6 +777,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "total_incoming_value",
"fieldtype": "Currency",
"hidden": 0,
@@ -772,6 +804,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "column_break_22",
"fieldtype": "Column Break",
"hidden": 0,
@@ -796,6 +829,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "total_outgoing_value",
"fieldtype": "Currency",
"hidden": 0,
@@ -822,6 +856,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "value_difference",
"fieldtype": "Currency",
"hidden": 0,
@@ -849,6 +884,7 @@
"bold": 0,
"collapsible": 1,
"collapsible_depends_on": "total_additional_costs",
+ "columns": 0,
"fieldname": "additional_costs_section",
"fieldtype": "Section Break",
"hidden": 0,
@@ -874,6 +910,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "additional_costs",
"fieldtype": "Table",
"hidden": 0,
@@ -900,6 +937,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "total_additional_costs",
"fieldtype": "Currency",
"hidden": 0,
@@ -926,6 +964,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 1,
+ "columns": 0,
"depends_on": "eval: in_list([\"Sales Return\", \"Purchase Return\", \"Subcontract\"], doc.purpose)",
"fieldname": "contact_section",
"fieldtype": "Section Break",
@@ -951,6 +990,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "eval:doc.purpose==\"Purchase Return\" || doc.purpose==\"Subcontract\"",
"fieldname": "supplier",
"fieldtype": "Link",
@@ -979,6 +1019,7 @@
"allow_on_submit": 0,
"bold": 1,
"collapsible": 0,
+ "columns": 0,
"depends_on": "eval:doc.purpose==\"Purchase Return\" || doc.purpose==\"Subcontract\"",
"fieldname": "supplier_name",
"fieldtype": "Data",
@@ -1006,6 +1047,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "eval:doc.purpose==\"Purchase Return\" || doc.purpose==\"Subcontract\"",
"fieldname": "supplier_address",
"fieldtype": "Small Text",
@@ -1033,6 +1075,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "column_break_39",
"fieldtype": "Column Break",
"hidden": 0,
@@ -1057,6 +1100,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "eval:doc.purpose==\"Sales Return\"",
"fieldname": "customer",
"fieldtype": "Link",
@@ -1085,6 +1129,7 @@
"allow_on_submit": 0,
"bold": 1,
"collapsible": 0,
+ "columns": 0,
"depends_on": "eval:doc.purpose==\"Sales Return\"",
"fieldname": "customer_name",
"fieldtype": "Data",
@@ -1112,6 +1157,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "eval:doc.purpose==\"Sales Return\"",
"fieldname": "customer_address",
"fieldtype": "Small Text",
@@ -1139,6 +1185,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 1,
+ "columns": 0,
"fieldname": "printing_settings",
"fieldtype": "Section Break",
"hidden": 0,
@@ -1164,6 +1211,7 @@
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "select_print_heading",
"fieldtype": "Link",
"hidden": 0,
@@ -1191,6 +1239,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "letter_head",
"fieldtype": "Link",
"hidden": 0,
@@ -1217,6 +1266,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 1,
+ "columns": 0,
"fieldname": "more_info",
"fieldtype": "Section Break",
"hidden": 0,
@@ -1242,6 +1292,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "project",
"fieldtype": "Link",
"hidden": 0,
@@ -1268,6 +1319,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "remarks",
"fieldtype": "Text",
"hidden": 0,
@@ -1294,6 +1346,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "col5",
"fieldtype": "Column Break",
"hidden": 0,
@@ -1319,6 +1372,8 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
+ "depends_on": "total_amount",
"fieldname": "total_amount",
"fieldtype": "Currency",
"hidden": 0,
@@ -1332,7 +1387,7 @@
"options": "Company:company:default_currency",
"permlevel": 0,
"print_hide": 0,
- "print_hide_if_no_value": 0,
+ "print_hide_if_no_value": 1,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
@@ -1344,6 +1399,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "amended_from",
"fieldtype": "Link",
"hidden": 0,
@@ -1371,6 +1427,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "credit_note",
"fieldtype": "Link",
"hidden": 1,
@@ -1398,13 +1455,14 @@
"hide_toolbar": 0,
"icon": "icon-file-text",
"idx": 1,
+ "image_view": 0,
"in_create": 0,
"in_dialog": 0,
"is_submittable": 1,
"issingle": 0,
"istable": 0,
"max_attachments": 0,
- "modified": "2016-09-08 06:40:03.284036",
+ "modified": "2016-10-19 16:11:22.110926",
"modified_by": "Administrator",
"module": "Stock",
"name": "Stock Entry",
@@ -1420,6 +1478,7 @@
"export": 0,
"if_owner": 0,
"import": 0,
+ "is_custom": 0,
"permlevel": 0,
"print": 1,
"read": 1,
@@ -1440,6 +1499,7 @@
"export": 0,
"if_owner": 0,
"import": 0,
+ "is_custom": 0,
"permlevel": 0,
"print": 1,
"read": 1,
@@ -1460,6 +1520,7 @@
"export": 0,
"if_owner": 0,
"import": 0,
+ "is_custom": 0,
"permlevel": 0,
"print": 1,
"read": 1,
@@ -1480,6 +1541,7 @@
"export": 0,
"if_owner": 0,
"import": 0,
+ "is_custom": 0,
"permlevel": 0,
"print": 1,
"read": 1,
@@ -1491,6 +1553,7 @@
"write": 1
}
],
+ "quick_entry": 0,
"read_only": 0,
"read_only_onload": 0,
"search_fields": "posting_date, from_warehouse, to_warehouse, purpose, remarks",
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py
index 44782d5..ec3873e 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.py
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.py
@@ -319,7 +319,9 @@
self.value_difference = self.total_incoming_value - self.total_outgoing_value
def set_total_amount(self):
- self.total_amount = sum([flt(item.amount) for item in self.get("items")])
+ self.total_amount = None
+ if self.purpose not in ['Manufacture', 'Repack']:
+ self.total_amount = sum([flt(item.amount) for item in self.get("items")])
def validate_purchase_order(self):
"""Throw exception if more raw material is transferred against Purchase Order than in