Merge remote-tracking branch 'frappe/develop' into wip-4.1
diff --git a/.travis.yml b/.travis.yml
index 59acb5c..dba0dab 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -14,9 +14,13 @@
- sudo apt-get update
- sudo apt-get purge -y mysql-common
- sudo apt-get install mariadb-server mariadb-common libmariadbclient-dev
- - CFLAGS=-O0 pip install git+https://github.com/frappe/frappe.git@develop &&
+ - CFLAGS=-O0 pip install git+https://github.com/frappe/frappe.git@$TRAVIS_BRANCH &&
- pip install --editable .
+before_script:
+ - mysql -e 'create database test_frappe'
+ - echo "USE mysql;\nCREATE USER 'test_frappe'@'localhost' IDENTIFIED BY 'test_frappe';\nFLUSH PRIVILEGES;\n" | mysql -u root
+
script:
- cd ./test_sites/
- frappe --use test_site
@@ -25,7 +29,3 @@
- frappe -b
- frappe --serve_test &
- frappe --verbose --run_tests --app erpnext
-
-before_script:
- - mysql -e 'create database test_frappe'
- - echo "USE mysql;\nCREATE USER 'test_frappe'@'localhost' IDENTIFIED BY 'test_frappe';\nFLUSH PRIVILEGES;\n" | mysql -u root
diff --git a/erpnext/accounts/doctype/account/account.json b/erpnext/accounts/doctype/account/account.json
index ab88305..4c24199 100644
--- a/erpnext/accounts/doctype/account/account.json
+++ b/erpnext/accounts/doctype/account/account.json
@@ -91,7 +91,7 @@
"label": "Account Type",
"oldfieldname": "account_type",
"oldfieldtype": "Select",
- "options": "\nBank\nCash\nTax\nChargeable\nWarehouse\nReceivable\nPayable\nEquity\nFixed Asset\nCost of Goods Sold\nExpense Account\nIncome Account\nStock Received But Not Billed\nExpenses Included In Valuation\nStock Adjustment",
+ "options": "\nBank\nCash\nTax\nChargeable\nWarehouse\nReceivable\nPayable\nEquity\nFixed Asset\nCost of Goods Sold\nExpense Account\nIncome Account\nStock Received But Not Billed\nExpenses Included In Valuation\nStock Adjustment\nStock",
"permlevel": 0,
"search_index": 0
},
@@ -210,7 +210,7 @@
"icon": "icon-money",
"idx": 1,
"in_create": 1,
- "modified": "2014-06-03 18:27:58.109303",
+ "modified": "2014-06-19 18:27:58.109303",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Account",
diff --git a/erpnext/accounts/doctype/gl_entry/gl_entry.json b/erpnext/accounts/doctype/gl_entry/gl_entry.json
index 1856386..ce17278 100644
--- a/erpnext/accounts/doctype/gl_entry/gl_entry.json
+++ b/erpnext/accounts/doctype/gl_entry/gl_entry.json
@@ -1,226 +1,226 @@
{
- "autoname": "GL.#######",
- "creation": "2013-01-10 16:34:06",
- "docstatus": 0,
- "doctype": "DocType",
+ "autoname": "GL.#######",
+ "creation": "2013-01-10 16:34:06",
+ "docstatus": 0,
+ "doctype": "DocType",
"fields": [
{
- "fieldname": "posting_date",
- "fieldtype": "Date",
- "in_filter": 1,
- "in_list_view": 1,
- "label": "Posting Date",
- "oldfieldname": "posting_date",
- "oldfieldtype": "Date",
- "permlevel": 0,
+ "fieldname": "posting_date",
+ "fieldtype": "Date",
+ "in_filter": 1,
+ "in_list_view": 1,
+ "label": "Posting Date",
+ "oldfieldname": "posting_date",
+ "oldfieldtype": "Date",
+ "permlevel": 0,
"search_index": 1
- },
+ },
{
- "fieldname": "transaction_date",
- "fieldtype": "Date",
- "in_list_view": 1,
- "label": "Transaction Date",
- "oldfieldname": "transaction_date",
- "oldfieldtype": "Date",
+ "fieldname": "transaction_date",
+ "fieldtype": "Date",
+ "in_list_view": 1,
+ "label": "Transaction Date",
+ "oldfieldname": "transaction_date",
+ "oldfieldtype": "Date",
"permlevel": 0
- },
+ },
{
- "fieldname": "aging_date",
- "fieldtype": "Date",
- "in_filter": 1,
- "in_list_view": 1,
- "label": "Aging Date",
- "oldfieldname": "aging_date",
- "oldfieldtype": "Date",
- "permlevel": 0,
+ "fieldname": "aging_date",
+ "fieldtype": "Date",
+ "in_filter": 1,
+ "in_list_view": 1,
+ "label": "Aging Date",
+ "oldfieldname": "aging_date",
+ "oldfieldtype": "Date",
+ "permlevel": 0,
"search_index": 0
- },
+ },
{
- "fieldname": "account",
- "fieldtype": "Link",
- "in_filter": 1,
- "in_list_view": 1,
- "label": "Account",
- "oldfieldname": "account",
- "oldfieldtype": "Link",
- "options": "Account",
- "permlevel": 0,
+ "fieldname": "account",
+ "fieldtype": "Link",
+ "in_filter": 1,
+ "in_list_view": 1,
+ "label": "Account",
+ "oldfieldname": "account",
+ "oldfieldtype": "Link",
+ "options": "Account",
+ "permlevel": 0,
"search_index": 1
- },
+ },
{
- "fieldname": "cost_center",
- "fieldtype": "Link",
- "in_filter": 1,
- "in_list_view": 1,
- "label": "Cost Center",
- "oldfieldname": "cost_center",
- "oldfieldtype": "Link",
- "options": "Cost Center",
- "permlevel": 0,
+ "fieldname": "cost_center",
+ "fieldtype": "Link",
+ "in_filter": 1,
+ "in_list_view": 1,
+ "label": "Cost Center",
+ "oldfieldname": "cost_center",
+ "oldfieldtype": "Link",
+ "options": "Cost Center",
+ "permlevel": 0,
"search_index": 0
- },
+ },
{
- "fieldname": "debit",
- "fieldtype": "Currency",
- "label": "Debit Amt",
- "oldfieldname": "debit",
- "oldfieldtype": "Currency",
- "options": "Company:company:default_currency",
+ "fieldname": "debit",
+ "fieldtype": "Currency",
+ "label": "Debit Amt",
+ "oldfieldname": "debit",
+ "oldfieldtype": "Currency",
+ "options": "Company:company:default_currency",
"permlevel": 0
- },
+ },
{
- "fieldname": "credit",
- "fieldtype": "Currency",
- "label": "Credit Amt",
- "oldfieldname": "credit",
- "oldfieldtype": "Currency",
- "options": "Company:company:default_currency",
+ "fieldname": "credit",
+ "fieldtype": "Currency",
+ "label": "Credit Amt",
+ "oldfieldname": "credit",
+ "oldfieldtype": "Currency",
+ "options": "Company:company:default_currency",
"permlevel": 0
- },
+ },
{
- "fieldname": "against",
- "fieldtype": "Text",
- "in_filter": 1,
- "label": "Against",
- "oldfieldname": "against",
- "oldfieldtype": "Text",
+ "fieldname": "against",
+ "fieldtype": "Text",
+ "in_filter": 1,
+ "label": "Against",
+ "oldfieldname": "against",
+ "oldfieldtype": "Text",
"permlevel": 0
- },
+ },
{
- "fieldname": "against_voucher",
- "fieldtype": "Data",
- "in_filter": 1,
- "label": "Against Voucher",
- "oldfieldname": "against_voucher",
- "oldfieldtype": "Data",
- "permlevel": 0,
+ "fieldname": "against_voucher",
+ "fieldtype": "Data",
+ "in_filter": 1,
+ "label": "Against Voucher",
+ "oldfieldname": "against_voucher",
+ "oldfieldtype": "Data",
+ "permlevel": 0,
"search_index": 0
- },
+ },
{
- "fieldname": "against_voucher_type",
- "fieldtype": "Data",
- "in_filter": 0,
- "label": "Against Voucher Type",
- "oldfieldname": "against_voucher_type",
- "oldfieldtype": "Data",
- "permlevel": 0,
+ "fieldname": "against_voucher_type",
+ "fieldtype": "Data",
+ "in_filter": 0,
+ "label": "Against Voucher Type",
+ "oldfieldname": "against_voucher_type",
+ "oldfieldtype": "Data",
+ "permlevel": 0,
"search_index": 0
- },
+ },
{
- "fieldname": "voucher_type",
- "fieldtype": "Select",
- "in_filter": 1,
- "label": "Voucher Type",
- "oldfieldname": "voucher_type",
- "oldfieldtype": "Select",
- "options": "Journal Voucher\nSales Invoice\nPurchase Invoice",
- "permlevel": 0,
+ "fieldname": "voucher_type",
+ "fieldtype": "Select",
+ "in_filter": 1,
+ "label": "Voucher Type",
+ "oldfieldname": "voucher_type",
+ "oldfieldtype": "Select",
+ "options": "Journal Voucher\nSales Invoice\nPurchase Invoice\nPeriod Closing Voucher\nPurchase Receipt\nDelivery Note\nStock Entry\nStock Reconciliation",
+ "permlevel": 0,
"search_index": 0
- },
+ },
{
- "fieldname": "voucher_no",
- "fieldtype": "Data",
- "in_filter": 1,
- "label": "Voucher No",
- "oldfieldname": "voucher_no",
- "oldfieldtype": "Data",
- "permlevel": 0,
+ "fieldname": "voucher_no",
+ "fieldtype": "Data",
+ "in_filter": 1,
+ "label": "Voucher No",
+ "oldfieldname": "voucher_no",
+ "oldfieldtype": "Data",
+ "permlevel": 0,
"search_index": 1
- },
+ },
{
- "fieldname": "remarks",
- "fieldtype": "Text",
- "in_filter": 1,
- "label": "Remarks",
- "no_copy": 1,
- "oldfieldname": "remarks",
- "oldfieldtype": "Text",
- "permlevel": 0,
+ "fieldname": "remarks",
+ "fieldtype": "Text",
+ "in_filter": 1,
+ "label": "Remarks",
+ "no_copy": 1,
+ "oldfieldname": "remarks",
+ "oldfieldtype": "Text",
+ "permlevel": 0,
"search_index": 0
- },
+ },
{
- "fieldname": "is_opening",
- "fieldtype": "Select",
- "in_filter": 1,
- "label": "Is Opening",
- "oldfieldname": "is_opening",
- "oldfieldtype": "Select",
- "options": "No\nYes",
- "permlevel": 0,
+ "fieldname": "is_opening",
+ "fieldtype": "Select",
+ "in_filter": 1,
+ "label": "Is Opening",
+ "oldfieldname": "is_opening",
+ "oldfieldtype": "Select",
+ "options": "No\nYes",
+ "permlevel": 0,
"search_index": 0
- },
+ },
{
- "fieldname": "is_advance",
- "fieldtype": "Select",
- "in_filter": 0,
- "label": "Is Advance",
- "oldfieldname": "is_advance",
- "oldfieldtype": "Select",
- "options": "No\nYes",
- "permlevel": 0,
+ "fieldname": "is_advance",
+ "fieldtype": "Select",
+ "in_filter": 0,
+ "label": "Is Advance",
+ "oldfieldname": "is_advance",
+ "oldfieldtype": "Select",
+ "options": "No\nYes",
+ "permlevel": 0,
"search_index": 0
- },
+ },
{
- "fieldname": "fiscal_year",
- "fieldtype": "Link",
- "in_filter": 1,
- "label": "Fiscal Year",
- "oldfieldname": "fiscal_year",
- "oldfieldtype": "Select",
- "options": "Fiscal Year",
- "permlevel": 0,
+ "fieldname": "fiscal_year",
+ "fieldtype": "Link",
+ "in_filter": 1,
+ "label": "Fiscal Year",
+ "oldfieldname": "fiscal_year",
+ "oldfieldtype": "Select",
+ "options": "Fiscal Year",
+ "permlevel": 0,
"search_index": 0
- },
+ },
{
- "fieldname": "company",
- "fieldtype": "Link",
- "in_filter": 1,
- "label": "Company",
- "oldfieldname": "company",
- "oldfieldtype": "Link",
- "options": "Company",
- "permlevel": 0,
+ "fieldname": "company",
+ "fieldtype": "Link",
+ "in_filter": 1,
+ "label": "Company",
+ "oldfieldname": "company",
+ "oldfieldtype": "Link",
+ "options": "Company",
+ "permlevel": 0,
"search_index": 0
}
- ],
- "icon": "icon-list",
- "idx": 1,
- "in_create": 1,
- "modified": "2014-06-09 01:51:29.340077",
- "modified_by": "Administrator",
- "module": "Accounts",
- "name": "GL Entry",
- "owner": "Administrator",
+ ],
+ "icon": "icon-list",
+ "idx": 1,
+ "in_create": 1,
+ "modified": "2014-06-19 01:51:29.340077",
+ "modified_by": "Administrator",
+ "module": "Accounts",
+ "name": "GL Entry",
+ "owner": "Administrator",
"permissions": [
{
- "amend": 0,
- "apply_user_permissions": 1,
- "create": 0,
- "email": 1,
- "export": 1,
- "permlevel": 0,
- "print": 1,
- "read": 1,
- "report": 1,
- "role": "Accounts User",
- "submit": 0,
+ "amend": 0,
+ "apply_user_permissions": 1,
+ "create": 0,
+ "email": 1,
+ "export": 1,
+ "permlevel": 0,
+ "print": 1,
+ "read": 1,
+ "report": 1,
+ "role": "Accounts User",
+ "submit": 0,
"write": 0
- },
+ },
{
- "amend": 0,
- "create": 0,
- "email": 1,
- "export": 1,
- "permlevel": 0,
- "print": 1,
- "read": 1,
- "report": 1,
- "role": "Accounts Manager",
- "submit": 0,
+ "amend": 0,
+ "create": 0,
+ "email": 1,
+ "export": 1,
+ "permlevel": 0,
+ "print": 1,
+ "read": 1,
+ "report": 1,
+ "role": "Accounts Manager",
+ "submit": 0,
"write": 0
}
- ],
- "search_fields": "voucher_no,account,posting_date,against_voucher",
- "sort_field": "modified",
+ ],
+ "search_fields": "voucher_no,account,posting_date,against_voucher",
+ "sort_field": "modified",
"sort_order": "DESC"
-}
\ No newline at end of file
+}
diff --git a/erpnext/accounts/doctype/journal_voucher/journal_voucher.py b/erpnext/accounts/doctype/journal_voucher/journal_voucher.py
index d75101d..fc1916b 100644
--- a/erpnext/accounts/doctype/journal_voucher/journal_voucher.py
+++ b/erpnext/accounts/doctype/journal_voucher/journal_voucher.py
@@ -186,9 +186,14 @@
def set_print_format_fields(self):
for d in self.get('entries'):
- account_type, master_type = frappe.db.get_value("Account", d.account,
+ result = frappe.db.get_value("Account", d.account,
["account_type", "master_type"])
+ if not result:
+ continue
+
+ account_type, master_type = result
+
if master_type in ['Supplier', 'Customer']:
if not self.pay_to_recd_from:
self.pay_to_recd_from = frappe.db.get_value(master_type,
diff --git a/erpnext/accounts/doctype/purchase_invoice/test_records.json b/erpnext/accounts/doctype/purchase_invoice/test_records.json
index 67a705c..48fb45d 100644
--- a/erpnext/accounts/doctype/purchase_invoice/test_records.json
+++ b/erpnext/accounts/doctype/purchase_invoice/test_records.json
@@ -1,206 +1,206 @@
[
{
- "bill_no": "NA",
- "buying_price_list": "_Test Price List",
- "company": "_Test Company",
- "conversion_rate": 1,
- "credit_to": "_Test Supplier - _TC",
- "currency": "INR",
- "doctype": "Purchase Invoice",
+ "bill_no": "NA",
+ "buying_price_list": "_Test Price List",
+ "company": "_Test Company",
+ "conversion_rate": 1,
+ "credit_to": "_Test Supplier - _TC",
+ "currency": "INR",
+ "doctype": "Purchase Invoice",
"entries": [
{
- "amount": 500,
- "base_amount": 500,
- "base_rate": 50,
- "conversion_factor": 1.0,
- "cost_center": "_Test Cost Center - _TC",
- "doctype": "Purchase Invoice Item",
- "expense_account": "_Test Account Cost for Goods Sold - _TC",
- "item_code": "_Test Item Home Desktop 100",
- "item_name": "_Test Item Home Desktop 100",
- "item_tax_rate": "{\"_Test Account Excise Duty - _TC\": 10}",
- "parentfield": "entries",
- "qty": 10,
- "rate": 50,
+ "amount": 500,
+ "base_amount": 500,
+ "base_rate": 50,
+ "conversion_factor": 1.0,
+ "cost_center": "_Test Cost Center - _TC",
+ "doctype": "Purchase Invoice Item",
+ "expense_account": "_Test Account Cost for Goods Sold - _TC",
+ "item_code": "_Test Item Home Desktop 100",
+ "item_name": "_Test Item Home Desktop 100",
+ "item_tax_rate": "{\"_Test Account Excise Duty - _TC\": 10}",
+ "parentfield": "entries",
+ "qty": 10,
+ "rate": 50,
"uom": "_Test UOM"
- },
+ },
{
- "amount": 750,
- "base_amount": 750,
- "base_rate": 150,
- "conversion_factor": 1.0,
- "cost_center": "_Test Cost Center - _TC",
- "doctype": "Purchase Invoice Item",
- "expense_account": "_Test Account Cost for Goods Sold - _TC",
- "item_code": "_Test Item Home Desktop 200",
- "item_name": "_Test Item Home Desktop 200",
- "parentfield": "entries",
- "qty": 5,
- "rate": 150,
+ "amount": 750,
+ "base_amount": 750,
+ "base_rate": 150,
+ "conversion_factor": 1.0,
+ "cost_center": "_Test Cost Center - _TC",
+ "doctype": "Purchase Invoice Item",
+ "expense_account": "_Test Account Cost for Goods Sold - _TC",
+ "item_code": "_Test Item Home Desktop 200",
+ "item_name": "_Test Item Home Desktop 200",
+ "parentfield": "entries",
+ "qty": 5,
+ "rate": 150,
"uom": "_Test UOM"
}
- ],
- "fiscal_year": "_Test Fiscal Year 2013",
- "grand_total_import": 0,
- "naming_series": "BILL",
+ ],
+ "fiscal_year": "_Test Fiscal Year 2013",
+ "grand_total_import": 0,
+ "naming_series": "_T-BILL",
"other_charges": [
{
- "account_head": "_Test Account Shipping Charges - _TC",
- "add_deduct_tax": "Add",
- "category": "Valuation and Total",
- "charge_type": "Actual",
- "cost_center": "_Test Cost Center - _TC",
- "description": "Shipping Charges",
- "doctype": "Purchase Taxes and Charges",
- "parentfield": "other_charges",
+ "account_head": "_Test Account Shipping Charges - _TC",
+ "add_deduct_tax": "Add",
+ "category": "Valuation and Total",
+ "charge_type": "Actual",
+ "cost_center": "_Test Cost Center - _TC",
+ "description": "Shipping Charges",
+ "doctype": "Purchase Taxes and Charges",
+ "parentfield": "other_charges",
"rate": 100
- },
+ },
{
- "account_head": "_Test Account Customs Duty - _TC",
- "add_deduct_tax": "Add",
- "category": "Valuation",
- "charge_type": "On Net Total",
- "cost_center": "_Test Cost Center - _TC",
- "description": "Customs Duty",
- "doctype": "Purchase Taxes and Charges",
- "parentfield": "other_charges",
+ "account_head": "_Test Account Customs Duty - _TC",
+ "add_deduct_tax": "Add",
+ "category": "Valuation",
+ "charge_type": "On Net Total",
+ "cost_center": "_Test Cost Center - _TC",
+ "description": "Customs Duty",
+ "doctype": "Purchase Taxes and Charges",
+ "parentfield": "other_charges",
"rate": 10
- },
+ },
{
- "account_head": "_Test Account Excise Duty - _TC",
- "add_deduct_tax": "Add",
- "category": "Total",
- "charge_type": "On Net Total",
- "cost_center": "_Test Cost Center - _TC",
- "description": "Excise Duty",
- "doctype": "Purchase Taxes and Charges",
- "parentfield": "other_charges",
+ "account_head": "_Test Account Excise Duty - _TC",
+ "add_deduct_tax": "Add",
+ "category": "Total",
+ "charge_type": "On Net Total",
+ "cost_center": "_Test Cost Center - _TC",
+ "description": "Excise Duty",
+ "doctype": "Purchase Taxes and Charges",
+ "parentfield": "other_charges",
"rate": 12
- },
+ },
{
- "account_head": "_Test Account Education Cess - _TC",
- "add_deduct_tax": "Add",
- "category": "Total",
- "charge_type": "On Previous Row Amount",
- "cost_center": "_Test Cost Center - _TC",
- "description": "Education Cess",
- "doctype": "Purchase Taxes and Charges",
- "parentfield": "other_charges",
- "rate": 2,
+ "account_head": "_Test Account Education Cess - _TC",
+ "add_deduct_tax": "Add",
+ "category": "Total",
+ "charge_type": "On Previous Row Amount",
+ "cost_center": "_Test Cost Center - _TC",
+ "description": "Education Cess",
+ "doctype": "Purchase Taxes and Charges",
+ "parentfield": "other_charges",
+ "rate": 2,
"row_id": 3
- },
+ },
{
- "account_head": "_Test Account S&H Education Cess - _TC",
- "add_deduct_tax": "Add",
- "category": "Total",
- "charge_type": "On Previous Row Amount",
- "cost_center": "_Test Cost Center - _TC",
- "description": "S&H Education Cess",
- "doctype": "Purchase Taxes and Charges",
- "parentfield": "other_charges",
- "rate": 1,
+ "account_head": "_Test Account S&H Education Cess - _TC",
+ "add_deduct_tax": "Add",
+ "category": "Total",
+ "charge_type": "On Previous Row Amount",
+ "cost_center": "_Test Cost Center - _TC",
+ "description": "S&H Education Cess",
+ "doctype": "Purchase Taxes and Charges",
+ "parentfield": "other_charges",
+ "rate": 1,
"row_id": 3
- },
+ },
{
- "account_head": "_Test Account CST - _TC",
- "add_deduct_tax": "Add",
- "category": "Total",
- "charge_type": "On Previous Row Total",
- "cost_center": "_Test Cost Center - _TC",
- "description": "CST",
- "doctype": "Purchase Taxes and Charges",
- "parentfield": "other_charges",
- "rate": 2,
+ "account_head": "_Test Account CST - _TC",
+ "add_deduct_tax": "Add",
+ "category": "Total",
+ "charge_type": "On Previous Row Total",
+ "cost_center": "_Test Cost Center - _TC",
+ "description": "CST",
+ "doctype": "Purchase Taxes and Charges",
+ "parentfield": "other_charges",
+ "rate": 2,
"row_id": 5
- },
+ },
{
- "account_head": "_Test Account VAT - _TC",
- "add_deduct_tax": "Add",
- "category": "Total",
- "charge_type": "On Net Total",
- "cost_center": "_Test Cost Center - _TC",
- "description": "VAT",
- "doctype": "Purchase Taxes and Charges",
- "parentfield": "other_charges",
+ "account_head": "_Test Account VAT - _TC",
+ "add_deduct_tax": "Add",
+ "category": "Total",
+ "charge_type": "On Net Total",
+ "cost_center": "_Test Cost Center - _TC",
+ "description": "VAT",
+ "doctype": "Purchase Taxes and Charges",
+ "parentfield": "other_charges",
"rate": 12.5
- },
+ },
{
- "account_head": "_Test Account Discount - _TC",
- "add_deduct_tax": "Deduct",
- "category": "Total",
- "charge_type": "On Previous Row Total",
- "cost_center": "_Test Cost Center - _TC",
- "description": "Discount",
- "doctype": "Purchase Taxes and Charges",
- "parentfield": "other_charges",
- "rate": 10,
+ "account_head": "_Test Account Discount - _TC",
+ "add_deduct_tax": "Deduct",
+ "category": "Total",
+ "charge_type": "On Previous Row Total",
+ "cost_center": "_Test Cost Center - _TC",
+ "description": "Discount",
+ "doctype": "Purchase Taxes and Charges",
+ "parentfield": "other_charges",
+ "rate": 10,
"row_id": 7
}
- ],
- "posting_date": "2013-02-03",
+ ],
+ "posting_date": "2013-02-03",
"supplier_name": "_Test Supplier"
- },
+ },
{
- "bill_no": "NA",
- "buying_price_list": "_Test Price List",
- "company": "_Test Company",
- "conversion_rate": 1.0,
- "credit_to": "_Test Supplier - _TC",
- "currency": "INR",
- "doctype": "Purchase Invoice",
+ "bill_no": "NA",
+ "buying_price_list": "_Test Price List",
+ "company": "_Test Company",
+ "conversion_rate": 1.0,
+ "credit_to": "_Test Supplier - _TC",
+ "currency": "INR",
+ "doctype": "Purchase Invoice",
"entries": [
{
- "conversion_factor": 1.0,
- "cost_center": "_Test Cost Center - _TC",
- "doctype": "Purchase Invoice Item",
- "expense_account": "_Test Account Cost for Goods Sold - _TC",
- "item_code": "_Test Item",
- "item_name": "_Test Item",
- "parentfield": "entries",
- "qty": 10.0,
- "rate": 50.0,
+ "conversion_factor": 1.0,
+ "cost_center": "_Test Cost Center - _TC",
+ "doctype": "Purchase Invoice Item",
+ "expense_account": "_Test Account Cost for Goods Sold - _TC",
+ "item_code": "_Test Item",
+ "item_name": "_Test Item",
+ "parentfield": "entries",
+ "qty": 10.0,
+ "rate": 50.0,
"uom": "_Test UOM"
}
- ],
- "fiscal_year": "_Test Fiscal Year 2013",
- "grand_total_import": 0,
- "naming_series": "_T-Purchase Invoice-",
+ ],
+ "fiscal_year": "_Test Fiscal Year 2013",
+ "grand_total_import": 0,
+ "naming_series": "_T-Purchase Invoice-",
"other_charges": [
{
- "account_head": "_Test Account Shipping Charges - _TC",
- "add_deduct_tax": "Add",
- "category": "Valuation and Total",
- "charge_type": "Actual",
- "cost_center": "_Test Cost Center - _TC",
- "description": "Shipping Charges",
- "doctype": "Purchase Taxes and Charges",
- "parentfield": "other_charges",
+ "account_head": "_Test Account Shipping Charges - _TC",
+ "add_deduct_tax": "Add",
+ "category": "Valuation and Total",
+ "charge_type": "Actual",
+ "cost_center": "_Test Cost Center - _TC",
+ "description": "Shipping Charges",
+ "doctype": "Purchase Taxes and Charges",
+ "parentfield": "other_charges",
"rate": 100.0
- },
+ },
{
- "account_head": "_Test Account VAT - _TC",
- "add_deduct_tax": "Add",
- "category": "Total",
- "charge_type": "Actual",
- "cost_center": "_Test Cost Center - _TC",
- "description": "VAT",
- "doctype": "Purchase Taxes and Charges",
- "parentfield": "other_charges",
+ "account_head": "_Test Account VAT - _TC",
+ "add_deduct_tax": "Add",
+ "category": "Total",
+ "charge_type": "Actual",
+ "cost_center": "_Test Cost Center - _TC",
+ "description": "VAT",
+ "doctype": "Purchase Taxes and Charges",
+ "parentfield": "other_charges",
"rate": 120.0
- },
+ },
{
- "account_head": "_Test Account Customs Duty - _TC",
- "add_deduct_tax": "Add",
- "category": "Valuation",
- "charge_type": "Actual",
- "cost_center": "_Test Cost Center - _TC",
- "description": "Customs Duty",
- "doctype": "Purchase Taxes and Charges",
- "parentfield": "other_charges",
+ "account_head": "_Test Account Customs Duty - _TC",
+ "add_deduct_tax": "Add",
+ "category": "Valuation",
+ "charge_type": "Actual",
+ "cost_center": "_Test Cost Center - _TC",
+ "description": "Customs Duty",
+ "doctype": "Purchase Taxes and Charges",
+ "parentfield": "other_charges",
"rate": 150.0
}
- ],
- "posting_date": "2013-02-03",
+ ],
+ "posting_date": "2013-02-03",
"supplier_name": "_Test Supplier"
}
-]
\ No newline at end of file
+]
diff --git a/erpnext/accounts/party.py b/erpnext/accounts/party.py
index 9792da1..cd172f1 100644
--- a/erpnext/accounts/party.py
+++ b/erpnext/accounts/party.py
@@ -12,13 +12,14 @@
@frappe.whitelist()
def get_party_details(party=None, account=None, party_type="Customer", company=None,
- posting_date=None, price_list=None, currency=None):
+ posting_date=None, price_list=None, currency=None, doctype=None):
- return _get_party_details(party, account, party_type, company, posting_date, price_list, currency)
+ return _get_party_details(party, account, party_type,
+ company, posting_date, price_list, currency, doctype)
def _get_party_details(party=None, account=None, party_type="Customer", company=None,
- posting_date=None, price_list=None, currency=None, ignore_permissions=False):
- out = frappe._dict(set_account_and_due_date(party, account, party_type, company, posting_date))
+ posting_date=None, price_list=None, currency=None, doctype=None, ignore_permissions=False):
+ out = frappe._dict(set_account_and_due_date(party, account, party_type, company, posting_date, doctype))
party = out[party_type.lower()]
@@ -106,8 +107,8 @@
out["selling_price_list" if party.doctype=="Customer" else "buying_price_list"] = price_list
-def set_account_and_due_date(party, account, party_type, company, posting_date):
- if not posting_date:
+def set_account_and_due_date(party, account, party_type, company, posting_date, doctype):
+ if doctype not in ["Sales Invoice", "Purchase Invoice"]:
# not an invoice
return {
party_type.lower(): party
diff --git a/erpnext/home/doctype/feed/feed.json b/erpnext/home/doctype/feed/feed.json
index a401870..bef8aac 100644
--- a/erpnext/home/doctype/feed/feed.json
+++ b/erpnext/home/doctype/feed/feed.json
@@ -1,72 +1,73 @@
{
- "autoname": "hash",
- "creation": "2012-07-03 13:29:42",
- "docstatus": 0,
- "doctype": "DocType",
+ "autoname": "hash",
+ "creation": "2012-07-03 13:29:42",
+ "docstatus": 0,
+ "doctype": "DocType",
"fields": [
{
- "fieldname": "feed_type",
- "fieldtype": "Select",
- "in_list_view": 1,
- "label": "Feed Type",
+ "fieldname": "feed_type",
+ "fieldtype": "Select",
+ "in_list_view": 1,
+ "label": "Feed Type",
+ "options": "\nComment\nLogin",
"permlevel": 0
- },
+ },
{
- "fieldname": "doc_type",
- "fieldtype": "Data",
- "in_list_view": 1,
- "label": "Doc Type",
+ "fieldname": "doc_type",
+ "fieldtype": "Data",
+ "in_list_view": 1,
+ "label": "Doc Type",
"permlevel": 0
- },
+ },
{
- "fieldname": "doc_name",
- "fieldtype": "Data",
- "in_list_view": 1,
- "label": "Doc Name",
+ "fieldname": "doc_name",
+ "fieldtype": "Data",
+ "in_list_view": 1,
+ "label": "Doc Name",
"permlevel": 0
- },
+ },
{
- "fieldname": "subject",
- "fieldtype": "Data",
- "in_list_view": 1,
- "label": "Subject",
+ "fieldname": "subject",
+ "fieldtype": "Data",
+ "in_list_view": 1,
+ "label": "Subject",
"permlevel": 0
- },
+ },
{
- "fieldname": "color",
- "fieldtype": "Data",
- "in_list_view": 1,
- "label": "Color",
+ "fieldname": "color",
+ "fieldtype": "Data",
+ "in_list_view": 1,
+ "label": "Color",
"permlevel": 0
- },
+ },
{
- "fieldname": "full_name",
- "fieldtype": "Data",
- "label": "Full Name",
+ "fieldname": "full_name",
+ "fieldtype": "Data",
+ "label": "Full Name",
"permlevel": 0
}
- ],
- "icon": "icon-rss",
- "idx": 1,
- "modified": "2014-05-27 03:49:10.882587",
- "modified_by": "Administrator",
- "module": "Home",
- "name": "Feed",
- "owner": "Administrator",
+ ],
+ "icon": "icon-rss",
+ "idx": 1,
+ "modified": "2014-06-18 03:49:10.882587",
+ "modified_by": "Administrator",
+ "module": "Home",
+ "name": "Feed",
+ "owner": "Administrator",
"permissions": [
{
- "email": 1,
- "permlevel": 0,
- "print": 1,
- "read": 1,
- "report": 1,
+ "email": 1,
+ "permlevel": 0,
+ "print": 1,
+ "read": 1,
+ "report": 1,
"role": "System Manager"
- },
+ },
{
- "apply_user_permissions": 1,
- "permlevel": 0,
- "read": 1,
+ "apply_user_permissions": 1,
+ "permlevel": 0,
+ "read": 1,
"role": "All"
}
]
-}
\ No newline at end of file
+}
diff --git a/erpnext/hr/report/employee_leave_balance/employee_leave_balance.py b/erpnext/hr/report/employee_leave_balance/employee_leave_balance.py
index c1d8bcf..99b235e 100644
--- a/erpnext/hr/report/employee_leave_balance/employee_leave_balance.py
+++ b/erpnext/hr/report/employee_leave_balance/employee_leave_balance.py
@@ -24,17 +24,19 @@
else:
fiscal_years = frappe.db.sql_list("select name from `tabFiscal Year` order by name desc")
+ employee_names = [d.name for d in employees]
+
allocations = frappe.db.sql("""select employee, fiscal_year, leave_type, total_leaves_allocated
from `tabLeave Allocation`
where docstatus=1 and employee in (%s)""" %
- ','.join(['%s']*len(employees)), employees, as_dict=True)
+ ','.join(['%s']*len(employee_names)), employee_names, as_dict=True)
applications = frappe.db.sql("""select employee, fiscal_year, leave_type,
SUM(total_leave_days) as leaves
from `tabLeave Application`
where status="Approved" and docstatus = 1 and employee in (%s)
group by employee, fiscal_year, leave_type""" %
- ','.join(['%s']*len(employees)), employees, as_dict=True)
+ ','.join(['%s']*len(employee_names)), employee_names, as_dict=True)
columns = [
"Fiscal Year", "Employee:Link/Employee:150", "Employee Name::200", "Department::150"
diff --git a/erpnext/manufacturing/doctype/production_order/production_order.json b/erpnext/manufacturing/doctype/production_order/production_order.json
index b1b19e4..7e068cf 100644
--- a/erpnext/manufacturing/doctype/production_order/production_order.json
+++ b/erpnext/manufacturing/doctype/production_order/production_order.json
@@ -1,256 +1,256 @@
{
- "allow_import": 1,
- "autoname": "naming_series:",
- "creation": "2013-01-10 16:34:16",
- "docstatus": 0,
- "doctype": "DocType",
+ "allow_import": 1,
+ "autoname": "naming_series:",
+ "creation": "2013-01-10 16:34:16",
+ "docstatus": 0,
+ "doctype": "DocType",
"fields": [
{
- "fieldname": "item",
- "fieldtype": "Section Break",
- "label": "Item",
- "options": "icon-gift",
+ "fieldname": "item",
+ "fieldtype": "Section Break",
+ "label": "Item",
+ "options": "icon-gift",
"permlevel": 0
- },
+ },
{
- "default": "PRO",
- "fieldname": "naming_series",
- "fieldtype": "Select",
- "label": "Series",
- "options": "PRO-",
- "permlevel": 0,
+ "default": "PRO-",
+ "fieldname": "naming_series",
+ "fieldtype": "Select",
+ "label": "Series",
+ "options": "PRO-",
+ "permlevel": 0,
"reqd": 1
- },
+ },
{
- "depends_on": "eval:!doc.__islocal",
- "fieldname": "status",
- "fieldtype": "Select",
- "in_filter": 1,
- "in_list_view": 1,
- "label": "Status",
- "no_copy": 1,
- "oldfieldname": "status",
- "oldfieldtype": "Select",
- "options": "\nDraft\nSubmitted\nStopped\nIn Process\nCompleted\nCancelled",
- "permlevel": 0,
- "read_only": 1,
- "reqd": 1,
+ "depends_on": "eval:!doc.__islocal",
+ "fieldname": "status",
+ "fieldtype": "Select",
+ "in_filter": 1,
+ "in_list_view": 1,
+ "label": "Status",
+ "no_copy": 1,
+ "oldfieldname": "status",
+ "oldfieldtype": "Select",
+ "options": "\nDraft\nSubmitted\nStopped\nIn Process\nCompleted\nCancelled",
+ "permlevel": 0,
+ "read_only": 1,
+ "reqd": 1,
"search_index": 1
- },
+ },
{
- "fieldname": "production_item",
- "fieldtype": "Link",
- "in_filter": 1,
- "in_list_view": 1,
- "label": "Item To Manufacture",
- "oldfieldname": "production_item",
- "oldfieldtype": "Link",
- "options": "Item",
- "permlevel": 0,
- "read_only": 0,
+ "fieldname": "production_item",
+ "fieldtype": "Link",
+ "in_filter": 1,
+ "in_list_view": 1,
+ "label": "Item To Manufacture",
+ "oldfieldname": "production_item",
+ "oldfieldtype": "Link",
+ "options": "Item",
+ "permlevel": 0,
+ "read_only": 0,
"reqd": 1
- },
+ },
{
- "depends_on": "production_item",
- "description": "Bill of Material to be considered for manufacturing",
- "fieldname": "bom_no",
- "fieldtype": "Link",
- "in_list_view": 1,
- "label": "BOM No",
- "oldfieldname": "bom_no",
- "oldfieldtype": "Link",
- "options": "BOM",
- "permlevel": 0,
- "read_only": 0,
+ "depends_on": "production_item",
+ "description": "Bill of Material to be considered for manufacturing",
+ "fieldname": "bom_no",
+ "fieldtype": "Link",
+ "in_list_view": 1,
+ "label": "BOM No",
+ "oldfieldname": "bom_no",
+ "oldfieldtype": "Link",
+ "options": "BOM",
+ "permlevel": 0,
+ "read_only": 0,
"reqd": 1
- },
+ },
{
- "default": "1",
- "description": "If checked, BOM for sub-assembly items will be considered for getting raw materials. Otherwise, all sub-assembly items will be treated as a raw material.",
- "fieldname": "use_multi_level_bom",
- "fieldtype": "Check",
- "label": "Use Multi-Level BOM",
+ "default": "1",
+ "description": "If checked, BOM for sub-assembly items will be considered for getting raw materials. Otherwise, all sub-assembly items will be treated as a raw material.",
+ "fieldname": "use_multi_level_bom",
+ "fieldtype": "Check",
+ "label": "Use Multi-Level BOM",
"permlevel": 0
- },
+ },
{
- "fieldname": "column_break1",
- "fieldtype": "Column Break",
- "oldfieldtype": "Column Break",
- "permlevel": 0,
- "read_only": 0,
+ "fieldname": "column_break1",
+ "fieldtype": "Column Break",
+ "oldfieldtype": "Column Break",
+ "permlevel": 0,
+ "read_only": 0,
"width": "50%"
- },
+ },
{
- "description": "Manufacture against Sales Order",
- "fieldname": "sales_order",
- "fieldtype": "Link",
- "label": "Sales Order",
- "options": "Sales Order",
- "permlevel": 0,
+ "description": "Manufacture against Sales Order",
+ "fieldname": "sales_order",
+ "fieldtype": "Link",
+ "label": "Sales Order",
+ "options": "Sales Order",
+ "permlevel": 0,
"read_only": 0
- },
+ },
{
- "depends_on": "production_item",
- "fieldname": "qty",
- "fieldtype": "Float",
- "in_list_view": 1,
- "label": "Qty To Manufacture",
- "oldfieldname": "qty",
- "oldfieldtype": "Currency",
- "permlevel": 0,
- "read_only": 0,
+ "depends_on": "production_item",
+ "fieldname": "qty",
+ "fieldtype": "Float",
+ "in_list_view": 1,
+ "label": "Qty To Manufacture",
+ "oldfieldname": "qty",
+ "oldfieldtype": "Currency",
+ "permlevel": 0,
+ "read_only": 0,
"reqd": 1
- },
+ },
{
- "depends_on": "eval:doc.docstatus==1",
- "description": "Automatically updated via Stock Entry of type Manufacture/Repack",
- "fieldname": "produced_qty",
- "fieldtype": "Float",
- "label": "Manufactured Qty",
- "no_copy": 1,
- "oldfieldname": "produced_qty",
- "oldfieldtype": "Currency",
- "permlevel": 0,
+ "depends_on": "eval:doc.docstatus==1",
+ "description": "Automatically updated via Stock Entry of type Manufacture/Repack",
+ "fieldname": "produced_qty",
+ "fieldtype": "Float",
+ "label": "Manufactured Qty",
+ "no_copy": 1,
+ "oldfieldname": "produced_qty",
+ "oldfieldtype": "Currency",
+ "permlevel": 0,
"read_only": 1
- },
+ },
{
- "depends_on": "sales_order",
- "fieldname": "expected_delivery_date",
- "fieldtype": "Date",
- "label": "Expected Delivery Date",
- "permlevel": 0,
+ "depends_on": "sales_order",
+ "fieldname": "expected_delivery_date",
+ "fieldtype": "Date",
+ "label": "Expected Delivery Date",
+ "permlevel": 0,
"read_only": 1
- },
+ },
{
- "fieldname": "warehouses",
- "fieldtype": "Section Break",
- "label": "Warehouses",
- "options": "icon-building",
+ "fieldname": "warehouses",
+ "fieldtype": "Section Break",
+ "label": "Warehouses",
+ "options": "icon-building",
"permlevel": 0
- },
+ },
{
- "depends_on": "production_item",
- "description": "Manufactured quantity will be updated in this warehouse",
- "fieldname": "fg_warehouse",
- "fieldtype": "Link",
- "in_list_view": 0,
- "label": "For Warehouse",
- "options": "Warehouse",
- "permlevel": 0,
- "read_only": 0,
+ "depends_on": "production_item",
+ "description": "Manufactured quantity will be updated in this warehouse",
+ "fieldname": "fg_warehouse",
+ "fieldtype": "Link",
+ "in_list_view": 0,
+ "label": "For Warehouse",
+ "options": "Warehouse",
+ "permlevel": 0,
+ "read_only": 0,
"reqd": 0
- },
+ },
{
- "fieldname": "column_break_12",
- "fieldtype": "Column Break",
+ "fieldname": "column_break_12",
+ "fieldtype": "Column Break",
"permlevel": 0
- },
+ },
{
- "fieldname": "wip_warehouse",
- "fieldtype": "Link",
- "label": "Work-in-Progress Warehouse",
- "options": "Warehouse",
- "permlevel": 0,
+ "fieldname": "wip_warehouse",
+ "fieldtype": "Link",
+ "label": "Work-in-Progress Warehouse",
+ "options": "Warehouse",
+ "permlevel": 0,
"reqd": 0
- },
+ },
{
- "fieldname": "more_info",
- "fieldtype": "Section Break",
- "label": "More Info",
- "options": "icon-file-text",
- "permlevel": 0,
+ "fieldname": "more_info",
+ "fieldtype": "Section Break",
+ "label": "More Info",
+ "options": "icon-file-text",
+ "permlevel": 0,
"read_only": 0
- },
+ },
{
- "fieldname": "description",
- "fieldtype": "Small Text",
- "label": "Item Description",
- "permlevel": 0,
+ "fieldname": "description",
+ "fieldtype": "Small Text",
+ "label": "Item Description",
+ "permlevel": 0,
"read_only": 1
- },
+ },
{
- "fieldname": "project_name",
- "fieldtype": "Link",
- "in_filter": 1,
- "label": "Project Name",
- "oldfieldname": "project_name",
- "oldfieldtype": "Link",
- "options": "Project",
- "permlevel": 0,
+ "fieldname": "project_name",
+ "fieldtype": "Link",
+ "in_filter": 1,
+ "label": "Project Name",
+ "oldfieldname": "project_name",
+ "oldfieldtype": "Link",
+ "options": "Project",
+ "permlevel": 0,
"read_only": 0
- },
+ },
{
- "fieldname": "column_break2",
- "fieldtype": "Column Break",
- "permlevel": 0,
- "read_only": 0,
+ "fieldname": "column_break2",
+ "fieldtype": "Column Break",
+ "permlevel": 0,
+ "read_only": 0,
"width": "50%"
- },
+ },
{
- "depends_on": "production_item",
- "fieldname": "stock_uom",
- "fieldtype": "Link",
- "label": "Stock UOM",
- "oldfieldname": "stock_uom",
- "oldfieldtype": "Data",
- "options": "UOM",
- "permlevel": 0,
+ "depends_on": "production_item",
+ "fieldname": "stock_uom",
+ "fieldtype": "Link",
+ "label": "Stock UOM",
+ "oldfieldname": "stock_uom",
+ "oldfieldtype": "Data",
+ "options": "UOM",
+ "permlevel": 0,
"read_only": 1
- },
+ },
{
- "fieldname": "company",
- "fieldtype": "Link",
- "label": "Company",
- "oldfieldname": "company",
- "oldfieldtype": "Link",
- "options": "Company",
- "permlevel": 0,
- "read_only": 0,
+ "fieldname": "company",
+ "fieldtype": "Link",
+ "label": "Company",
+ "oldfieldname": "company",
+ "oldfieldtype": "Link",
+ "options": "Company",
+ "permlevel": 0,
+ "read_only": 0,
"reqd": 1
- },
+ },
{
- "fieldname": "amended_from",
- "fieldtype": "Data",
- "ignore_user_permissions": 1,
- "label": "Amended From",
- "no_copy": 1,
- "oldfieldname": "amended_from",
- "oldfieldtype": "Data",
- "permlevel": 0,
+ "fieldname": "amended_from",
+ "fieldtype": "Data",
+ "ignore_user_permissions": 1,
+ "label": "Amended From",
+ "no_copy": 1,
+ "oldfieldname": "amended_from",
+ "oldfieldtype": "Data",
+ "permlevel": 0,
"read_only": 1
}
- ],
- "icon": "icon-cogs",
- "idx": 1,
- "in_create": 0,
- "is_submittable": 1,
- "modified": "2014-05-27 03:49:15.008942",
- "modified_by": "Administrator",
- "module": "Manufacturing",
- "name": "Production Order",
- "owner": "Administrator",
+ ],
+ "icon": "icon-cogs",
+ "idx": 1,
+ "in_create": 0,
+ "is_submittable": 1,
+ "modified": "2014-05-27 03:49:15.008942",
+ "modified_by": "Administrator",
+ "module": "Manufacturing",
+ "name": "Production Order",
+ "owner": "Administrator",
"permissions": [
{
- "amend": 1,
- "apply_user_permissions": 1,
- "cancel": 1,
- "create": 1,
- "delete": 1,
- "email": 1,
- "permlevel": 0,
- "print": 1,
- "read": 1,
- "report": 1,
- "role": "Manufacturing User",
- "submit": 1,
+ "amend": 1,
+ "apply_user_permissions": 1,
+ "cancel": 1,
+ "create": 1,
+ "delete": 1,
+ "email": 1,
+ "permlevel": 0,
+ "print": 1,
+ "read": 1,
+ "report": 1,
+ "role": "Manufacturing User",
+ "submit": 1,
"write": 1
- },
+ },
{
- "apply_user_permissions": 1,
- "permlevel": 0,
- "read": 1,
- "report": 1,
+ "apply_user_permissions": 1,
+ "permlevel": 0,
+ "read": 1,
+ "report": 1,
"role": "Material User"
}
]
-}
\ No newline at end of file
+}
diff --git a/erpnext/public/js/utils/party.js b/erpnext/public/js/utils/party.js
index 40db97f..c9b1206 100644
--- a/erpnext/public/js/utils/party.js
+++ b/erpnext/public/js/utils/party.js
@@ -25,6 +25,7 @@
args.currency = frm.doc.currency;
args.company = frm.doc.company;
+ args.doctype = frm.doc.doctype;
frappe.call({
method: method,
args: args,
diff --git a/erpnext/selling/doctype/lead/test_records.json b/erpnext/selling/doctype/lead/test_records.json
index ce94604..01b0a99 100644
--- a/erpnext/selling/doctype/lead/test_records.json
+++ b/erpnext/selling/doctype/lead/test_records.json
@@ -16,7 +16,7 @@
"doctype": "Lead",
"email_id": "test_lead2@example.com",
"lead_name": "_Test Lead 2",
- "status": "Contacted"
+ "status": "Lead"
},
{
"doctype": "Lead",
diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py
index 1b66c65..24da577 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.py
+++ b/erpnext/selling/doctype/sales_order/sales_order.py
@@ -279,13 +279,9 @@
target.amount = (flt(source.qty) - flt(source.delivered_qty)) * flt(source.rate)
target.qty = flt(source.qty) - flt(source.delivered_qty)
- doclist = get_mapped_doc("Sales Order", source_name, {
+ target_doc = get_mapped_doc("Sales Order", source_name, {
"Sales Order": {
"doctype": "Delivery Note",
- "field_map": {
- "shipping_address": "address_display",
- "shipping_address_name": "customer_address",
- },
"validation": {
"docstatus": ["=", 1]
}
@@ -310,7 +306,7 @@
}
}, target_doc, set_missing_values)
- return doclist
+ return target_doc
@frappe.whitelist()
def make_sales_invoice(source_name, target_doc=None):
diff --git a/erpnext/setup/doctype/currency/currency.json b/erpnext/setup/doctype/currency/currency.json
index 26fd14e..ee7be19 100644
--- a/erpnext/setup/doctype/currency/currency.json
+++ b/erpnext/setup/doctype/currency/currency.json
@@ -1,117 +1,117 @@
{
- "autoname": "field:currency_name",
- "creation": "2013-01-28 10:06:02",
- "description": "**Currency** Master",
- "docstatus": 0,
- "doctype": "DocType",
+ "autoname": "field:currency_name",
+ "creation": "2013-01-28 10:06:02",
+ "description": "**Currency** Master",
+ "docstatus": 0,
+ "doctype": "DocType",
"fields": [
{
- "fieldname": "currency_name",
- "fieldtype": "Data",
- "label": "Currency Name",
- "oldfieldname": "currency_name",
- "oldfieldtype": "Data",
- "permlevel": 0,
+ "fieldname": "currency_name",
+ "fieldtype": "Data",
+ "label": "Currency Name",
+ "oldfieldname": "currency_name",
+ "oldfieldtype": "Data",
+ "permlevel": 0,
"reqd": 1
- },
+ },
{
- "fieldname": "enabled",
- "fieldtype": "Check",
- "in_list_view": 1,
- "label": "Enabled",
+ "fieldname": "enabled",
+ "fieldtype": "Check",
+ "in_list_view": 1,
+ "label": "Enabled",
"permlevel": 0
- },
+ },
{
- "description": "Sub-currency. For e.g. \"Cent\"",
- "fieldname": "fraction",
- "fieldtype": "Data",
- "in_list_view": 1,
- "label": "Fraction",
+ "description": "Sub-currency. For e.g. \"Cent\"",
+ "fieldname": "fraction",
+ "fieldtype": "Data",
+ "in_list_view": 1,
+ "label": "Fraction",
"permlevel": 0
- },
+ },
{
- "description": "1 Currency = [?] Fraction\nFor e.g. 1 USD = 100 Cent",
- "fieldname": "fraction_units",
- "fieldtype": "Int",
- "in_list_view": 1,
- "label": "Fraction Units",
+ "description": "1 Currency = [?] Fraction\nFor e.g. 1 USD = 100 Cent",
+ "fieldname": "fraction_units",
+ "fieldtype": "Int",
+ "in_list_view": 1,
+ "label": "Fraction Units",
"permlevel": 0
- },
+ },
{
- "description": "A symbol for this currency. For e.g. $",
- "fieldname": "symbol",
- "fieldtype": "Data",
- "in_list_view": 1,
- "label": "Symbol",
+ "description": "A symbol for this currency. For e.g. $",
+ "fieldname": "symbol",
+ "fieldtype": "Data",
+ "in_list_view": 1,
+ "label": "Symbol",
"permlevel": 0
- },
+ },
{
- "description": "How should this currency be formatted? If not set, will use system defaults",
- "fieldname": "number_format",
- "fieldtype": "Select",
- "in_list_view": 1,
- "label": "Number Format",
- "options": "\n#,###.##\n#.###,##\n# ###.##\n#,###.###\n#,##,###.##\n#.###\n#,###",
+ "description": "How should this currency be formatted? If not set, will use system defaults",
+ "fieldname": "number_format",
+ "fieldtype": "Select",
+ "in_list_view": 1,
+ "label": "Number Format",
+ "options": "\n#,###.##\n#.###,##\n# ###.##\n# ###,##\n#'###.##\n#, ###.##\n#,##,###.##\n#,###.###\n#.###\n#,###",
"permlevel": 0
}
- ],
- "icon": "icon-bitcoin",
- "idx": 1,
- "in_create": 0,
- "modified": "2014-05-27 03:49:09.038451",
- "modified_by": "Administrator",
- "module": "Setup",
- "name": "Currency",
- "owner": "Administrator",
+ ],
+ "icon": "icon-bitcoin",
+ "idx": 1,
+ "in_create": 0,
+ "modified": "2014-06-18 03:49:09.038451",
+ "modified_by": "Administrator",
+ "module": "Setup",
+ "name": "Currency",
+ "owner": "Administrator",
"permissions": [
{
- "create": 1,
- "delete": 1,
- "email": 1,
- "permlevel": 0,
- "print": 1,
- "read": 1,
- "report": 1,
- "role": "Accounts Manager",
- "submit": 0,
+ "create": 1,
+ "delete": 1,
+ "email": 1,
+ "permlevel": 0,
+ "print": 1,
+ "read": 1,
+ "report": 1,
+ "role": "Accounts Manager",
+ "submit": 0,
"write": 1
- },
+ },
{
- "amend": 0,
- "create": 1,
- "delete": 1,
- "email": 1,
- "permlevel": 0,
- "print": 1,
- "read": 1,
- "report": 1,
- "role": "Sales Master Manager",
- "submit": 0,
+ "amend": 0,
+ "create": 1,
+ "delete": 1,
+ "email": 1,
+ "permlevel": 0,
+ "print": 1,
+ "read": 1,
+ "report": 1,
+ "role": "Sales Master Manager",
+ "submit": 0,
"write": 1
- },
+ },
{
- "amend": 0,
- "create": 1,
- "delete": 0,
- "email": 1,
- "permlevel": 0,
- "print": 1,
- "read": 1,
- "report": 1,
- "role": "Purchase Master Manager",
- "submit": 0,
+ "amend": 0,
+ "create": 1,
+ "delete": 0,
+ "email": 1,
+ "permlevel": 0,
+ "print": 1,
+ "read": 1,
+ "report": 1,
+ "role": "Purchase Master Manager",
+ "submit": 0,
"write": 1
- },
+ },
{
- "apply_user_permissions": 1,
- "delete": 0,
- "email": 1,
- "permlevel": 0,
- "print": 1,
- "read": 1,
- "report": 1,
+ "apply_user_permissions": 1,
+ "delete": 0,
+ "email": 1,
+ "permlevel": 0,
+ "print": 1,
+ "read": 1,
+ "report": 1,
"role": "All"
}
- ],
+ ],
"read_only": 0
-}
\ No newline at end of file
+}
diff --git a/erpnext/setup/doctype/currency/currency.py b/erpnext/setup/doctype/currency/currency.py
index 5be618b..abfbe19 100644
--- a/erpnext/setup/doctype/currency/currency.py
+++ b/erpnext/setup/doctype/currency/currency.py
@@ -17,8 +17,5 @@
company_currency = frappe.db.get_value("Company", company, "default_currency")
if not conversion_rate:
- throw(_('%(conversion_rate_label)s is mandatory. Maybe Currency Exchange record is not created for %(from_currency)s to %(to_currency)s') % {
- "conversion_rate_label": conversion_rate_label,
- "from_currency": currency,
- "to_currency": company_currency
- })
+ throw(_("{0} is mandatory. Maybe Currency Exchange record is not created for {1} to {2}.").format(
+ conversion_rate_label, currency, company_currency))
diff --git a/erpnext/stock/doctype/serial_no/serial_no.py b/erpnext/stock/doctype/serial_no/serial_no.py
index ff4d519..fe4af21 100644
--- a/erpnext/stock/doctype/serial_no/serial_no.py
+++ b/erpnext/stock/doctype/serial_no/serial_no.py
@@ -278,13 +278,16 @@
def make_serial_no(serial_no, sle):
sr = frappe.new_doc("Serial No")
+ sr.warehouse = None
+ sr.dont_update_if_missing.append("warehouse")
sr.ignore_permissions = True
+
sr.serial_no = serial_no
sr.item_code = sle.item_code
- sr.warehouse = None
sr.company = sle.company
sr.via_stock_ledger = True
sr.insert()
+
sr.warehouse = sle.warehouse
sr.status = "Available"
sr.save()
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.js b/erpnext/stock/doctype/stock_entry/stock_entry.js
index a42a865..9597392 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.js
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.js
@@ -241,14 +241,14 @@
customer: function() {
return this.frm.call({
method: "erpnext.accounts.party.get_party_details",
- args: { party: this.frm.doc.customer, party_type:"Customer" }
+ args: { party: this.frm.doc.customer, party_type:"Customer", doctype: this.frm.doc.doctype }
});
},
supplier: function() {
return this.frm.call({
method: "erpnext.accounts.party.get_party_details",
- args: { party: this.frm.doc.supplier, party_type:"Supplier" }
+ args: { party: this.frm.doc.supplier, party_type:"Supplier", doctype: this.frm.doc.doctype }
});
},
@@ -359,16 +359,17 @@
cur_frm.cscript.s_warehouse = function(doc, cdt, cdn) {
var d = locals[cdt][cdn];
- args = {
- 'item_code' : d.item_code,
- 'warehouse' : cstr(d.s_warehouse) || cstr(d.t_warehouse),
- 'transfer_qty' : d.transfer_qty,
- 'serial_no' : d.serial_no,
- 'bom_no' : d.bom_no,
- 'qty' : d.s_warehouse ? -1* d.qty : d.qty
+ if(!d.bom_no) {
+ args = {
+ 'item_code' : d.item_code,
+ 'warehouse' : cstr(d.s_warehouse) || cstr(d.t_warehouse),
+ 'transfer_qty' : d.transfer_qty,
+ 'serial_no' : d.serial_no,
+ 'qty' : d.s_warehouse ? -1* d.qty : d.qty
+ }
+ return get_server_fields('get_warehouse_details', JSON.stringify(args),
+ 'mtn_details', doc, cdt, cdn, 1);
}
- return get_server_fields('get_warehouse_details', JSON.stringify(args),
- 'mtn_details', doc, cdt, cdn, 1);
}
cur_frm.cscript.t_warehouse = cur_frm.cscript.s_warehouse;
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py
index 3df78c8..297542b 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.py
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.py
@@ -228,7 +228,7 @@
raw_material_cost += flt(d.amount)
# set incoming rate for fg item
- if self.production_order and self.purpose == "Manufacture/Repack":
+ if self.purpose == "Manufacture/Repack":
for d in self.get("mtn_details"):
if d.bom_no:
if not flt(d.incoming_rate):
@@ -239,29 +239,25 @@
def get_incoming_rate(self, args):
incoming_rate = 0
- if self.purpose == "Sales Return" and \
- (self.delivery_note_no or self.sales_invoice_no):
- sle = frappe.db.sql("""select name, posting_date, posting_time,
- actual_qty, stock_value, warehouse from `tabStock Ledger Entry`
- where voucher_type = %s and voucher_no = %s and
- item_code = %s limit 1""",
- ((self.delivery_note_no and "Delivery Note" or "Sales Invoice"),
- self.delivery_note_no or self.sales_invoice_no, args.item_code), as_dict=1)
- if sle:
- args.update({
- "posting_date": sle[0].posting_date,
- "posting_time": sle[0].posting_time,
- "sle": sle[0].name,
- "warehouse": sle[0].warehouse,
- })
- previous_sle = get_previous_sle(args)
- incoming_rate = (flt(sle[0].stock_value) - flt(previous_sle.get("stock_value"))) / \
- flt(sle[0].actual_qty)
+ if self.purpose == "Sales Return":
+ incoming_rate = self.get_incoming_rate_for_sales_return(args)
else:
incoming_rate = get_incoming_rate(args)
return incoming_rate
+ def get_incoming_rate_for_sales_return(self, args):
+ incoming_rate = 0.0
+ if (self.delivery_note_no or self.sales_invoice_no) and args.get("item_code"):
+ incoming_rate = frappe.db.sql("""select abs(ifnull(stock_value_difference, 0) / actual_qty)
+ from `tabStock Ledger Entry`
+ where voucher_type = %s and voucher_no = %s and item_code = %s limit 1""",
+ ((self.delivery_note_no and "Delivery Note" or "Sales Invoice"),
+ self.delivery_note_no or self.sales_invoice_no, args.item_code))
+ incoming_rate = incoming_rate[0][0] if incoming_rate else 0.0
+
+ return incoming_rate
+
def validate_incoming_rate(self):
for d in self.get('mtn_details'):
if d.t_warehouse:
diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py
index cdf5aa1..c5c1280 100644
--- a/erpnext/stock/get_item_details.py
+++ b/erpnext/stock/get_item_details.py
@@ -229,7 +229,7 @@
if pos_settings:
for fieldname in ("income_account", "cost_center", "warehouse", "expense_account"):
- if not args.get(fieldname):
+ if not args.get(fieldname) and pos_settings.get(fieldname):
res[fieldname] = pos_settings.get(fieldname)
if res.get("warehouse"):
diff --git a/erpnext/support/doctype/newsletter/newsletter.py b/erpnext/support/doctype/newsletter/newsletter.py
index 9072700..88040e2 100644
--- a/erpnext/support/doctype/newsletter/newsletter.py
+++ b/erpnext/support/doctype/newsletter/newsletter.py
@@ -125,7 +125,7 @@
"doctype": "Lead",
"email_id": email_id,
"lead_name": real_name or email_id,
- "status": "Contacted",
+ "status": "Lead",
"naming_series": get_default_naming_series("Lead"),
"company": frappe.db.get_default("company"),
"source": "Email"