Merge remote-tracking branch 'frappe/develop' into wip-4.1

This commit is contained in:
Anand Doshi 2014-06-19 17:44:33 +05:30
commit 861747ec26
19 changed files with 753 additions and 750 deletions

View File

@ -14,9 +14,13 @@ install:
- sudo apt-get update - sudo apt-get update
- sudo apt-get purge -y mysql-common - sudo apt-get purge -y mysql-common
- sudo apt-get install mariadb-server mariadb-common libmariadbclient-dev - 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 . - 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: script:
- cd ./test_sites/ - cd ./test_sites/
- frappe --use test_site - frappe --use test_site
@ -25,7 +29,3 @@ script:
- frappe -b - frappe -b
- frappe --serve_test & - frappe --serve_test &
- frappe --verbose --run_tests --app erpnext - 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

View File

@ -91,7 +91,7 @@
"label": "Account Type", "label": "Account Type",
"oldfieldname": "account_type", "oldfieldname": "account_type",
"oldfieldtype": "Select", "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, "permlevel": 0,
"search_index": 0 "search_index": 0
}, },
@ -210,7 +210,7 @@
"icon": "icon-money", "icon": "icon-money",
"idx": 1, "idx": 1,
"in_create": 1, "in_create": 1,
"modified": "2014-06-03 18:27:58.109303", "modified": "2014-06-19 18:27:58.109303",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Account", "name": "Account",

View File

@ -1,226 +1,226 @@
{ {
"autoname": "GL.#######", "autoname": "GL.#######",
"creation": "2013-01-10 16:34:06", "creation": "2013-01-10 16:34:06",
"docstatus": 0, "docstatus": 0,
"doctype": "DocType", "doctype": "DocType",
"fields": [ "fields": [
{ {
"fieldname": "posting_date", "fieldname": "posting_date",
"fieldtype": "Date", "fieldtype": "Date",
"in_filter": 1, "in_filter": 1,
"in_list_view": 1, "in_list_view": 1,
"label": "Posting Date", "label": "Posting Date",
"oldfieldname": "posting_date", "oldfieldname": "posting_date",
"oldfieldtype": "Date", "oldfieldtype": "Date",
"permlevel": 0, "permlevel": 0,
"search_index": 1 "search_index": 1
}, },
{ {
"fieldname": "transaction_date", "fieldname": "transaction_date",
"fieldtype": "Date", "fieldtype": "Date",
"in_list_view": 1, "in_list_view": 1,
"label": "Transaction Date", "label": "Transaction Date",
"oldfieldname": "transaction_date", "oldfieldname": "transaction_date",
"oldfieldtype": "Date", "oldfieldtype": "Date",
"permlevel": 0 "permlevel": 0
}, },
{ {
"fieldname": "aging_date", "fieldname": "aging_date",
"fieldtype": "Date", "fieldtype": "Date",
"in_filter": 1, "in_filter": 1,
"in_list_view": 1, "in_list_view": 1,
"label": "Aging Date", "label": "Aging Date",
"oldfieldname": "aging_date", "oldfieldname": "aging_date",
"oldfieldtype": "Date", "oldfieldtype": "Date",
"permlevel": 0, "permlevel": 0,
"search_index": 0 "search_index": 0
}, },
{ {
"fieldname": "account", "fieldname": "account",
"fieldtype": "Link", "fieldtype": "Link",
"in_filter": 1, "in_filter": 1,
"in_list_view": 1, "in_list_view": 1,
"label": "Account", "label": "Account",
"oldfieldname": "account", "oldfieldname": "account",
"oldfieldtype": "Link", "oldfieldtype": "Link",
"options": "Account", "options": "Account",
"permlevel": 0, "permlevel": 0,
"search_index": 1 "search_index": 1
}, },
{ {
"fieldname": "cost_center", "fieldname": "cost_center",
"fieldtype": "Link", "fieldtype": "Link",
"in_filter": 1, "in_filter": 1,
"in_list_view": 1, "in_list_view": 1,
"label": "Cost Center", "label": "Cost Center",
"oldfieldname": "cost_center", "oldfieldname": "cost_center",
"oldfieldtype": "Link", "oldfieldtype": "Link",
"options": "Cost Center", "options": "Cost Center",
"permlevel": 0, "permlevel": 0,
"search_index": 0 "search_index": 0
}, },
{ {
"fieldname": "debit", "fieldname": "debit",
"fieldtype": "Currency", "fieldtype": "Currency",
"label": "Debit Amt", "label": "Debit Amt",
"oldfieldname": "debit", "oldfieldname": "debit",
"oldfieldtype": "Currency", "oldfieldtype": "Currency",
"options": "Company:company:default_currency", "options": "Company:company:default_currency",
"permlevel": 0 "permlevel": 0
}, },
{ {
"fieldname": "credit", "fieldname": "credit",
"fieldtype": "Currency", "fieldtype": "Currency",
"label": "Credit Amt", "label": "Credit Amt",
"oldfieldname": "credit", "oldfieldname": "credit",
"oldfieldtype": "Currency", "oldfieldtype": "Currency",
"options": "Company:company:default_currency", "options": "Company:company:default_currency",
"permlevel": 0 "permlevel": 0
}, },
{ {
"fieldname": "against", "fieldname": "against",
"fieldtype": "Text", "fieldtype": "Text",
"in_filter": 1, "in_filter": 1,
"label": "Against", "label": "Against",
"oldfieldname": "against", "oldfieldname": "against",
"oldfieldtype": "Text", "oldfieldtype": "Text",
"permlevel": 0 "permlevel": 0
}, },
{ {
"fieldname": "against_voucher", "fieldname": "against_voucher",
"fieldtype": "Data", "fieldtype": "Data",
"in_filter": 1, "in_filter": 1,
"label": "Against Voucher", "label": "Against Voucher",
"oldfieldname": "against_voucher", "oldfieldname": "against_voucher",
"oldfieldtype": "Data", "oldfieldtype": "Data",
"permlevel": 0, "permlevel": 0,
"search_index": 0 "search_index": 0
}, },
{ {
"fieldname": "against_voucher_type", "fieldname": "against_voucher_type",
"fieldtype": "Data", "fieldtype": "Data",
"in_filter": 0, "in_filter": 0,
"label": "Against Voucher Type", "label": "Against Voucher Type",
"oldfieldname": "against_voucher_type", "oldfieldname": "against_voucher_type",
"oldfieldtype": "Data", "oldfieldtype": "Data",
"permlevel": 0, "permlevel": 0,
"search_index": 0 "search_index": 0
}, },
{ {
"fieldname": "voucher_type", "fieldname": "voucher_type",
"fieldtype": "Select", "fieldtype": "Select",
"in_filter": 1, "in_filter": 1,
"label": "Voucher Type", "label": "Voucher Type",
"oldfieldname": "voucher_type", "oldfieldname": "voucher_type",
"oldfieldtype": "Select", "oldfieldtype": "Select",
"options": "Journal Voucher\nSales Invoice\nPurchase Invoice", "options": "Journal Voucher\nSales Invoice\nPurchase Invoice\nPeriod Closing Voucher\nPurchase Receipt\nDelivery Note\nStock Entry\nStock Reconciliation",
"permlevel": 0, "permlevel": 0,
"search_index": 0 "search_index": 0
}, },
{ {
"fieldname": "voucher_no", "fieldname": "voucher_no",
"fieldtype": "Data", "fieldtype": "Data",
"in_filter": 1, "in_filter": 1,
"label": "Voucher No", "label": "Voucher No",
"oldfieldname": "voucher_no", "oldfieldname": "voucher_no",
"oldfieldtype": "Data", "oldfieldtype": "Data",
"permlevel": 0, "permlevel": 0,
"search_index": 1 "search_index": 1
}, },
{ {
"fieldname": "remarks", "fieldname": "remarks",
"fieldtype": "Text", "fieldtype": "Text",
"in_filter": 1, "in_filter": 1,
"label": "Remarks", "label": "Remarks",
"no_copy": 1, "no_copy": 1,
"oldfieldname": "remarks", "oldfieldname": "remarks",
"oldfieldtype": "Text", "oldfieldtype": "Text",
"permlevel": 0, "permlevel": 0,
"search_index": 0 "search_index": 0
}, },
{ {
"fieldname": "is_opening", "fieldname": "is_opening",
"fieldtype": "Select", "fieldtype": "Select",
"in_filter": 1, "in_filter": 1,
"label": "Is Opening", "label": "Is Opening",
"oldfieldname": "is_opening", "oldfieldname": "is_opening",
"oldfieldtype": "Select", "oldfieldtype": "Select",
"options": "No\nYes", "options": "No\nYes",
"permlevel": 0, "permlevel": 0,
"search_index": 0 "search_index": 0
}, },
{ {
"fieldname": "is_advance", "fieldname": "is_advance",
"fieldtype": "Select", "fieldtype": "Select",
"in_filter": 0, "in_filter": 0,
"label": "Is Advance", "label": "Is Advance",
"oldfieldname": "is_advance", "oldfieldname": "is_advance",
"oldfieldtype": "Select", "oldfieldtype": "Select",
"options": "No\nYes", "options": "No\nYes",
"permlevel": 0, "permlevel": 0,
"search_index": 0 "search_index": 0
}, },
{ {
"fieldname": "fiscal_year", "fieldname": "fiscal_year",
"fieldtype": "Link", "fieldtype": "Link",
"in_filter": 1, "in_filter": 1,
"label": "Fiscal Year", "label": "Fiscal Year",
"oldfieldname": "fiscal_year", "oldfieldname": "fiscal_year",
"oldfieldtype": "Select", "oldfieldtype": "Select",
"options": "Fiscal Year", "options": "Fiscal Year",
"permlevel": 0, "permlevel": 0,
"search_index": 0 "search_index": 0
}, },
{ {
"fieldname": "company", "fieldname": "company",
"fieldtype": "Link", "fieldtype": "Link",
"in_filter": 1, "in_filter": 1,
"label": "Company", "label": "Company",
"oldfieldname": "company", "oldfieldname": "company",
"oldfieldtype": "Link", "oldfieldtype": "Link",
"options": "Company", "options": "Company",
"permlevel": 0, "permlevel": 0,
"search_index": 0 "search_index": 0
} }
], ],
"icon": "icon-list", "icon": "icon-list",
"idx": 1, "idx": 1,
"in_create": 1, "in_create": 1,
"modified": "2014-06-09 01:51:29.340077", "modified": "2014-06-19 01:51:29.340077",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "GL Entry", "name": "GL Entry",
"owner": "Administrator", "owner": "Administrator",
"permissions": [ "permissions": [
{ {
"amend": 0, "amend": 0,
"apply_user_permissions": 1, "apply_user_permissions": 1,
"create": 0, "create": 0,
"email": 1, "email": 1,
"export": 1, "export": 1,
"permlevel": 0, "permlevel": 0,
"print": 1, "print": 1,
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "Accounts User", "role": "Accounts User",
"submit": 0, "submit": 0,
"write": 0 "write": 0
}, },
{ {
"amend": 0, "amend": 0,
"create": 0, "create": 0,
"email": 1, "email": 1,
"export": 1, "export": 1,
"permlevel": 0, "permlevel": 0,
"print": 1, "print": 1,
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "Accounts Manager", "role": "Accounts Manager",
"submit": 0, "submit": 0,
"write": 0 "write": 0
} }
], ],
"search_fields": "voucher_no,account,posting_date,against_voucher", "search_fields": "voucher_no,account,posting_date,against_voucher",
"sort_field": "modified", "sort_field": "modified",
"sort_order": "DESC" "sort_order": "DESC"
} }

View File

@ -186,9 +186,14 @@ class JournalVoucher(AccountsController):
def set_print_format_fields(self): def set_print_format_fields(self):
for d in self.get('entries'): 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"]) ["account_type", "master_type"])
if not result:
continue
account_type, master_type = result
if master_type in ['Supplier', 'Customer']: if master_type in ['Supplier', 'Customer']:
if not self.pay_to_recd_from: if not self.pay_to_recd_from:
self.pay_to_recd_from = frappe.db.get_value(master_type, self.pay_to_recd_from = frappe.db.get_value(master_type,

View File

@ -1,206 +1,206 @@
[ [
{ {
"bill_no": "NA", "bill_no": "NA",
"buying_price_list": "_Test Price List", "buying_price_list": "_Test Price List",
"company": "_Test Company", "company": "_Test Company",
"conversion_rate": 1, "conversion_rate": 1,
"credit_to": "_Test Supplier - _TC", "credit_to": "_Test Supplier - _TC",
"currency": "INR", "currency": "INR",
"doctype": "Purchase Invoice", "doctype": "Purchase Invoice",
"entries": [ "entries": [
{ {
"amount": 500, "amount": 500,
"base_amount": 500, "base_amount": 500,
"base_rate": 50, "base_rate": 50,
"conversion_factor": 1.0, "conversion_factor": 1.0,
"cost_center": "_Test Cost Center - _TC", "cost_center": "_Test Cost Center - _TC",
"doctype": "Purchase Invoice Item", "doctype": "Purchase Invoice Item",
"expense_account": "_Test Account Cost for Goods Sold - _TC", "expense_account": "_Test Account Cost for Goods Sold - _TC",
"item_code": "_Test Item Home Desktop 100", "item_code": "_Test Item Home Desktop 100",
"item_name": "_Test Item Home Desktop 100", "item_name": "_Test Item Home Desktop 100",
"item_tax_rate": "{\"_Test Account Excise Duty - _TC\": 10}", "item_tax_rate": "{\"_Test Account Excise Duty - _TC\": 10}",
"parentfield": "entries", "parentfield": "entries",
"qty": 10, "qty": 10,
"rate": 50, "rate": 50,
"uom": "_Test UOM" "uom": "_Test UOM"
}, },
{ {
"amount": 750, "amount": 750,
"base_amount": 750, "base_amount": 750,
"base_rate": 150, "base_rate": 150,
"conversion_factor": 1.0, "conversion_factor": 1.0,
"cost_center": "_Test Cost Center - _TC", "cost_center": "_Test Cost Center - _TC",
"doctype": "Purchase Invoice Item", "doctype": "Purchase Invoice Item",
"expense_account": "_Test Account Cost for Goods Sold - _TC", "expense_account": "_Test Account Cost for Goods Sold - _TC",
"item_code": "_Test Item Home Desktop 200", "item_code": "_Test Item Home Desktop 200",
"item_name": "_Test Item Home Desktop 200", "item_name": "_Test Item Home Desktop 200",
"parentfield": "entries", "parentfield": "entries",
"qty": 5, "qty": 5,
"rate": 150, "rate": 150,
"uom": "_Test UOM" "uom": "_Test UOM"
} }
], ],
"fiscal_year": "_Test Fiscal Year 2013", "fiscal_year": "_Test Fiscal Year 2013",
"grand_total_import": 0, "grand_total_import": 0,
"naming_series": "BILL", "naming_series": "_T-BILL",
"other_charges": [ "other_charges": [
{ {
"account_head": "_Test Account Shipping Charges - _TC", "account_head": "_Test Account Shipping Charges - _TC",
"add_deduct_tax": "Add", "add_deduct_tax": "Add",
"category": "Valuation and Total", "category": "Valuation and Total",
"charge_type": "Actual", "charge_type": "Actual",
"cost_center": "_Test Cost Center - _TC", "cost_center": "_Test Cost Center - _TC",
"description": "Shipping Charges", "description": "Shipping Charges",
"doctype": "Purchase Taxes and Charges", "doctype": "Purchase Taxes and Charges",
"parentfield": "other_charges", "parentfield": "other_charges",
"rate": 100 "rate": 100
}, },
{ {
"account_head": "_Test Account Customs Duty - _TC", "account_head": "_Test Account Customs Duty - _TC",
"add_deduct_tax": "Add", "add_deduct_tax": "Add",
"category": "Valuation", "category": "Valuation",
"charge_type": "On Net Total", "charge_type": "On Net Total",
"cost_center": "_Test Cost Center - _TC", "cost_center": "_Test Cost Center - _TC",
"description": "Customs Duty", "description": "Customs Duty",
"doctype": "Purchase Taxes and Charges", "doctype": "Purchase Taxes and Charges",
"parentfield": "other_charges", "parentfield": "other_charges",
"rate": 10 "rate": 10
}, },
{ {
"account_head": "_Test Account Excise Duty - _TC", "account_head": "_Test Account Excise Duty - _TC",
"add_deduct_tax": "Add", "add_deduct_tax": "Add",
"category": "Total", "category": "Total",
"charge_type": "On Net Total", "charge_type": "On Net Total",
"cost_center": "_Test Cost Center - _TC", "cost_center": "_Test Cost Center - _TC",
"description": "Excise Duty", "description": "Excise Duty",
"doctype": "Purchase Taxes and Charges", "doctype": "Purchase Taxes and Charges",
"parentfield": "other_charges", "parentfield": "other_charges",
"rate": 12 "rate": 12
}, },
{ {
"account_head": "_Test Account Education Cess - _TC", "account_head": "_Test Account Education Cess - _TC",
"add_deduct_tax": "Add", "add_deduct_tax": "Add",
"category": "Total", "category": "Total",
"charge_type": "On Previous Row Amount", "charge_type": "On Previous Row Amount",
"cost_center": "_Test Cost Center - _TC", "cost_center": "_Test Cost Center - _TC",
"description": "Education Cess", "description": "Education Cess",
"doctype": "Purchase Taxes and Charges", "doctype": "Purchase Taxes and Charges",
"parentfield": "other_charges", "parentfield": "other_charges",
"rate": 2, "rate": 2,
"row_id": 3 "row_id": 3
}, },
{ {
"account_head": "_Test Account S&H Education Cess - _TC", "account_head": "_Test Account S&H Education Cess - _TC",
"add_deduct_tax": "Add", "add_deduct_tax": "Add",
"category": "Total", "category": "Total",
"charge_type": "On Previous Row Amount", "charge_type": "On Previous Row Amount",
"cost_center": "_Test Cost Center - _TC", "cost_center": "_Test Cost Center - _TC",
"description": "S&H Education Cess", "description": "S&H Education Cess",
"doctype": "Purchase Taxes and Charges", "doctype": "Purchase Taxes and Charges",
"parentfield": "other_charges", "parentfield": "other_charges",
"rate": 1, "rate": 1,
"row_id": 3 "row_id": 3
}, },
{ {
"account_head": "_Test Account CST - _TC", "account_head": "_Test Account CST - _TC",
"add_deduct_tax": "Add", "add_deduct_tax": "Add",
"category": "Total", "category": "Total",
"charge_type": "On Previous Row Total", "charge_type": "On Previous Row Total",
"cost_center": "_Test Cost Center - _TC", "cost_center": "_Test Cost Center - _TC",
"description": "CST", "description": "CST",
"doctype": "Purchase Taxes and Charges", "doctype": "Purchase Taxes and Charges",
"parentfield": "other_charges", "parentfield": "other_charges",
"rate": 2, "rate": 2,
"row_id": 5 "row_id": 5
}, },
{ {
"account_head": "_Test Account VAT - _TC", "account_head": "_Test Account VAT - _TC",
"add_deduct_tax": "Add", "add_deduct_tax": "Add",
"category": "Total", "category": "Total",
"charge_type": "On Net Total", "charge_type": "On Net Total",
"cost_center": "_Test Cost Center - _TC", "cost_center": "_Test Cost Center - _TC",
"description": "VAT", "description": "VAT",
"doctype": "Purchase Taxes and Charges", "doctype": "Purchase Taxes and Charges",
"parentfield": "other_charges", "parentfield": "other_charges",
"rate": 12.5 "rate": 12.5
}, },
{ {
"account_head": "_Test Account Discount - _TC", "account_head": "_Test Account Discount - _TC",
"add_deduct_tax": "Deduct", "add_deduct_tax": "Deduct",
"category": "Total", "category": "Total",
"charge_type": "On Previous Row Total", "charge_type": "On Previous Row Total",
"cost_center": "_Test Cost Center - _TC", "cost_center": "_Test Cost Center - _TC",
"description": "Discount", "description": "Discount",
"doctype": "Purchase Taxes and Charges", "doctype": "Purchase Taxes and Charges",
"parentfield": "other_charges", "parentfield": "other_charges",
"rate": 10, "rate": 10,
"row_id": 7 "row_id": 7
} }
], ],
"posting_date": "2013-02-03", "posting_date": "2013-02-03",
"supplier_name": "_Test Supplier" "supplier_name": "_Test Supplier"
}, },
{ {
"bill_no": "NA", "bill_no": "NA",
"buying_price_list": "_Test Price List", "buying_price_list": "_Test Price List",
"company": "_Test Company", "company": "_Test Company",
"conversion_rate": 1.0, "conversion_rate": 1.0,
"credit_to": "_Test Supplier - _TC", "credit_to": "_Test Supplier - _TC",
"currency": "INR", "currency": "INR",
"doctype": "Purchase Invoice", "doctype": "Purchase Invoice",
"entries": [ "entries": [
{ {
"conversion_factor": 1.0, "conversion_factor": 1.0,
"cost_center": "_Test Cost Center - _TC", "cost_center": "_Test Cost Center - _TC",
"doctype": "Purchase Invoice Item", "doctype": "Purchase Invoice Item",
"expense_account": "_Test Account Cost for Goods Sold - _TC", "expense_account": "_Test Account Cost for Goods Sold - _TC",
"item_code": "_Test Item", "item_code": "_Test Item",
"item_name": "_Test Item", "item_name": "_Test Item",
"parentfield": "entries", "parentfield": "entries",
"qty": 10.0, "qty": 10.0,
"rate": 50.0, "rate": 50.0,
"uom": "_Test UOM" "uom": "_Test UOM"
} }
], ],
"fiscal_year": "_Test Fiscal Year 2013", "fiscal_year": "_Test Fiscal Year 2013",
"grand_total_import": 0, "grand_total_import": 0,
"naming_series": "_T-Purchase Invoice-", "naming_series": "_T-Purchase Invoice-",
"other_charges": [ "other_charges": [
{ {
"account_head": "_Test Account Shipping Charges - _TC", "account_head": "_Test Account Shipping Charges - _TC",
"add_deduct_tax": "Add", "add_deduct_tax": "Add",
"category": "Valuation and Total", "category": "Valuation and Total",
"charge_type": "Actual", "charge_type": "Actual",
"cost_center": "_Test Cost Center - _TC", "cost_center": "_Test Cost Center - _TC",
"description": "Shipping Charges", "description": "Shipping Charges",
"doctype": "Purchase Taxes and Charges", "doctype": "Purchase Taxes and Charges",
"parentfield": "other_charges", "parentfield": "other_charges",
"rate": 100.0 "rate": 100.0
}, },
{ {
"account_head": "_Test Account VAT - _TC", "account_head": "_Test Account VAT - _TC",
"add_deduct_tax": "Add", "add_deduct_tax": "Add",
"category": "Total", "category": "Total",
"charge_type": "Actual", "charge_type": "Actual",
"cost_center": "_Test Cost Center - _TC", "cost_center": "_Test Cost Center - _TC",
"description": "VAT", "description": "VAT",
"doctype": "Purchase Taxes and Charges", "doctype": "Purchase Taxes and Charges",
"parentfield": "other_charges", "parentfield": "other_charges",
"rate": 120.0 "rate": 120.0
}, },
{ {
"account_head": "_Test Account Customs Duty - _TC", "account_head": "_Test Account Customs Duty - _TC",
"add_deduct_tax": "Add", "add_deduct_tax": "Add",
"category": "Valuation", "category": "Valuation",
"charge_type": "Actual", "charge_type": "Actual",
"cost_center": "_Test Cost Center - _TC", "cost_center": "_Test Cost Center - _TC",
"description": "Customs Duty", "description": "Customs Duty",
"doctype": "Purchase Taxes and Charges", "doctype": "Purchase Taxes and Charges",
"parentfield": "other_charges", "parentfield": "other_charges",
"rate": 150.0 "rate": 150.0
} }
], ],
"posting_date": "2013-02-03", "posting_date": "2013-02-03",
"supplier_name": "_Test Supplier" "supplier_name": "_Test Supplier"
} }
] ]

View File

@ -12,13 +12,14 @@ from erpnext.utilities.doctype.contact.contact import get_contact_details
@frappe.whitelist() @frappe.whitelist()
def get_party_details(party=None, account=None, party_type="Customer", company=None, 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, def _get_party_details(party=None, account=None, party_type="Customer", company=None,
posting_date=None, price_list=None, currency=None, ignore_permissions=False): 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)) out = frappe._dict(set_account_and_due_date(party, account, party_type, company, posting_date, doctype))
party = out[party_type.lower()] party = out[party_type.lower()]
@ -106,8 +107,8 @@ def set_price_list(out, party, party_type, given_price_list):
out["selling_price_list" if party.doctype=="Customer" else "buying_price_list"] = price_list 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): def set_account_and_due_date(party, account, party_type, company, posting_date, doctype):
if not posting_date: if doctype not in ["Sales Invoice", "Purchase Invoice"]:
# not an invoice # not an invoice
return { return {
party_type.lower(): party party_type.lower(): party

View File

@ -1,72 +1,73 @@
{ {
"autoname": "hash", "autoname": "hash",
"creation": "2012-07-03 13:29:42", "creation": "2012-07-03 13:29:42",
"docstatus": 0, "docstatus": 0,
"doctype": "DocType", "doctype": "DocType",
"fields": [ "fields": [
{ {
"fieldname": "feed_type", "fieldname": "feed_type",
"fieldtype": "Select", "fieldtype": "Select",
"in_list_view": 1, "in_list_view": 1,
"label": "Feed Type", "label": "Feed Type",
"options": "\nComment\nLogin",
"permlevel": 0 "permlevel": 0
}, },
{ {
"fieldname": "doc_type", "fieldname": "doc_type",
"fieldtype": "Data", "fieldtype": "Data",
"in_list_view": 1, "in_list_view": 1,
"label": "Doc Type", "label": "Doc Type",
"permlevel": 0 "permlevel": 0
}, },
{ {
"fieldname": "doc_name", "fieldname": "doc_name",
"fieldtype": "Data", "fieldtype": "Data",
"in_list_view": 1, "in_list_view": 1,
"label": "Doc Name", "label": "Doc Name",
"permlevel": 0 "permlevel": 0
}, },
{ {
"fieldname": "subject", "fieldname": "subject",
"fieldtype": "Data", "fieldtype": "Data",
"in_list_view": 1, "in_list_view": 1,
"label": "Subject", "label": "Subject",
"permlevel": 0 "permlevel": 0
}, },
{ {
"fieldname": "color", "fieldname": "color",
"fieldtype": "Data", "fieldtype": "Data",
"in_list_view": 1, "in_list_view": 1,
"label": "Color", "label": "Color",
"permlevel": 0 "permlevel": 0
}, },
{ {
"fieldname": "full_name", "fieldname": "full_name",
"fieldtype": "Data", "fieldtype": "Data",
"label": "Full Name", "label": "Full Name",
"permlevel": 0 "permlevel": 0
} }
], ],
"icon": "icon-rss", "icon": "icon-rss",
"idx": 1, "idx": 1,
"modified": "2014-05-27 03:49:10.882587", "modified": "2014-06-18 03:49:10.882587",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Home", "module": "Home",
"name": "Feed", "name": "Feed",
"owner": "Administrator", "owner": "Administrator",
"permissions": [ "permissions": [
{ {
"email": 1, "email": 1,
"permlevel": 0, "permlevel": 0,
"print": 1, "print": 1,
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "System Manager" "role": "System Manager"
}, },
{ {
"apply_user_permissions": 1, "apply_user_permissions": 1,
"permlevel": 0, "permlevel": 0,
"read": 1, "read": 1,
"role": "All" "role": "All"
} }
] ]
} }

View File

@ -24,17 +24,19 @@ def execute(filters=None):
else: else:
fiscal_years = frappe.db.sql_list("select name from `tabFiscal Year` order by name desc") 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 allocations = frappe.db.sql("""select employee, fiscal_year, leave_type, total_leaves_allocated
from `tabLeave Allocation` from `tabLeave Allocation`
where docstatus=1 and employee in (%s)""" % 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, applications = frappe.db.sql("""select employee, fiscal_year, leave_type,
SUM(total_leave_days) as leaves SUM(total_leave_days) as leaves
from `tabLeave Application` from `tabLeave Application`
where status="Approved" and docstatus = 1 and employee in (%s) where status="Approved" and docstatus = 1 and employee in (%s)
group by employee, fiscal_year, leave_type""" % 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 = [ columns = [
"Fiscal Year", "Employee:Link/Employee:150", "Employee Name::200", "Department::150" "Fiscal Year", "Employee:Link/Employee:150", "Employee Name::200", "Department::150"

View File

@ -1,256 +1,256 @@
{ {
"allow_import": 1, "allow_import": 1,
"autoname": "naming_series:", "autoname": "naming_series:",
"creation": "2013-01-10 16:34:16", "creation": "2013-01-10 16:34:16",
"docstatus": 0, "docstatus": 0,
"doctype": "DocType", "doctype": "DocType",
"fields": [ "fields": [
{ {
"fieldname": "item", "fieldname": "item",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Item", "label": "Item",
"options": "icon-gift", "options": "icon-gift",
"permlevel": 0 "permlevel": 0
}, },
{ {
"default": "PRO", "default": "PRO-",
"fieldname": "naming_series", "fieldname": "naming_series",
"fieldtype": "Select", "fieldtype": "Select",
"label": "Series", "label": "Series",
"options": "PRO-", "options": "PRO-",
"permlevel": 0, "permlevel": 0,
"reqd": 1 "reqd": 1
}, },
{ {
"depends_on": "eval:!doc.__islocal", "depends_on": "eval:!doc.__islocal",
"fieldname": "status", "fieldname": "status",
"fieldtype": "Select", "fieldtype": "Select",
"in_filter": 1, "in_filter": 1,
"in_list_view": 1, "in_list_view": 1,
"label": "Status", "label": "Status",
"no_copy": 1, "no_copy": 1,
"oldfieldname": "status", "oldfieldname": "status",
"oldfieldtype": "Select", "oldfieldtype": "Select",
"options": "\nDraft\nSubmitted\nStopped\nIn Process\nCompleted\nCancelled", "options": "\nDraft\nSubmitted\nStopped\nIn Process\nCompleted\nCancelled",
"permlevel": 0, "permlevel": 0,
"read_only": 1, "read_only": 1,
"reqd": 1, "reqd": 1,
"search_index": 1 "search_index": 1
}, },
{ {
"fieldname": "production_item", "fieldname": "production_item",
"fieldtype": "Link", "fieldtype": "Link",
"in_filter": 1, "in_filter": 1,
"in_list_view": 1, "in_list_view": 1,
"label": "Item To Manufacture", "label": "Item To Manufacture",
"oldfieldname": "production_item", "oldfieldname": "production_item",
"oldfieldtype": "Link", "oldfieldtype": "Link",
"options": "Item", "options": "Item",
"permlevel": 0, "permlevel": 0,
"read_only": 0, "read_only": 0,
"reqd": 1 "reqd": 1
}, },
{ {
"depends_on": "production_item", "depends_on": "production_item",
"description": "Bill of Material to be considered for manufacturing", "description": "Bill of Material to be considered for manufacturing",
"fieldname": "bom_no", "fieldname": "bom_no",
"fieldtype": "Link", "fieldtype": "Link",
"in_list_view": 1, "in_list_view": 1,
"label": "BOM No", "label": "BOM No",
"oldfieldname": "bom_no", "oldfieldname": "bom_no",
"oldfieldtype": "Link", "oldfieldtype": "Link",
"options": "BOM", "options": "BOM",
"permlevel": 0, "permlevel": 0,
"read_only": 0, "read_only": 0,
"reqd": 1 "reqd": 1
}, },
{ {
"default": "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.", "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", "fieldname": "use_multi_level_bom",
"fieldtype": "Check", "fieldtype": "Check",
"label": "Use Multi-Level BOM", "label": "Use Multi-Level BOM",
"permlevel": 0 "permlevel": 0
}, },
{ {
"fieldname": "column_break1", "fieldname": "column_break1",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"oldfieldtype": "Column Break", "oldfieldtype": "Column Break",
"permlevel": 0, "permlevel": 0,
"read_only": 0, "read_only": 0,
"width": "50%" "width": "50%"
}, },
{ {
"description": "Manufacture against Sales Order", "description": "Manufacture against Sales Order",
"fieldname": "sales_order", "fieldname": "sales_order",
"fieldtype": "Link", "fieldtype": "Link",
"label": "Sales Order", "label": "Sales Order",
"options": "Sales Order", "options": "Sales Order",
"permlevel": 0, "permlevel": 0,
"read_only": 0 "read_only": 0
}, },
{ {
"depends_on": "production_item", "depends_on": "production_item",
"fieldname": "qty", "fieldname": "qty",
"fieldtype": "Float", "fieldtype": "Float",
"in_list_view": 1, "in_list_view": 1,
"label": "Qty To Manufacture", "label": "Qty To Manufacture",
"oldfieldname": "qty", "oldfieldname": "qty",
"oldfieldtype": "Currency", "oldfieldtype": "Currency",
"permlevel": 0, "permlevel": 0,
"read_only": 0, "read_only": 0,
"reqd": 1 "reqd": 1
}, },
{ {
"depends_on": "eval:doc.docstatus==1", "depends_on": "eval:doc.docstatus==1",
"description": "Automatically updated via Stock Entry of type Manufacture/Repack", "description": "Automatically updated via Stock Entry of type Manufacture/Repack",
"fieldname": "produced_qty", "fieldname": "produced_qty",
"fieldtype": "Float", "fieldtype": "Float",
"label": "Manufactured Qty", "label": "Manufactured Qty",
"no_copy": 1, "no_copy": 1,
"oldfieldname": "produced_qty", "oldfieldname": "produced_qty",
"oldfieldtype": "Currency", "oldfieldtype": "Currency",
"permlevel": 0, "permlevel": 0,
"read_only": 1 "read_only": 1
}, },
{ {
"depends_on": "sales_order", "depends_on": "sales_order",
"fieldname": "expected_delivery_date", "fieldname": "expected_delivery_date",
"fieldtype": "Date", "fieldtype": "Date",
"label": "Expected Delivery Date", "label": "Expected Delivery Date",
"permlevel": 0, "permlevel": 0,
"read_only": 1 "read_only": 1
}, },
{ {
"fieldname": "warehouses", "fieldname": "warehouses",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Warehouses", "label": "Warehouses",
"options": "icon-building", "options": "icon-building",
"permlevel": 0 "permlevel": 0
}, },
{ {
"depends_on": "production_item", "depends_on": "production_item",
"description": "Manufactured quantity will be updated in this warehouse", "description": "Manufactured quantity will be updated in this warehouse",
"fieldname": "fg_warehouse", "fieldname": "fg_warehouse",
"fieldtype": "Link", "fieldtype": "Link",
"in_list_view": 0, "in_list_view": 0,
"label": "For Warehouse", "label": "For Warehouse",
"options": "Warehouse", "options": "Warehouse",
"permlevel": 0, "permlevel": 0,
"read_only": 0, "read_only": 0,
"reqd": 0 "reqd": 0
}, },
{ {
"fieldname": "column_break_12", "fieldname": "column_break_12",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"permlevel": 0 "permlevel": 0
}, },
{ {
"fieldname": "wip_warehouse", "fieldname": "wip_warehouse",
"fieldtype": "Link", "fieldtype": "Link",
"label": "Work-in-Progress Warehouse", "label": "Work-in-Progress Warehouse",
"options": "Warehouse", "options": "Warehouse",
"permlevel": 0, "permlevel": 0,
"reqd": 0 "reqd": 0
}, },
{ {
"fieldname": "more_info", "fieldname": "more_info",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "More Info", "label": "More Info",
"options": "icon-file-text", "options": "icon-file-text",
"permlevel": 0, "permlevel": 0,
"read_only": 0 "read_only": 0
}, },
{ {
"fieldname": "description", "fieldname": "description",
"fieldtype": "Small Text", "fieldtype": "Small Text",
"label": "Item Description", "label": "Item Description",
"permlevel": 0, "permlevel": 0,
"read_only": 1 "read_only": 1
}, },
{ {
"fieldname": "project_name", "fieldname": "project_name",
"fieldtype": "Link", "fieldtype": "Link",
"in_filter": 1, "in_filter": 1,
"label": "Project Name", "label": "Project Name",
"oldfieldname": "project_name", "oldfieldname": "project_name",
"oldfieldtype": "Link", "oldfieldtype": "Link",
"options": "Project", "options": "Project",
"permlevel": 0, "permlevel": 0,
"read_only": 0 "read_only": 0
}, },
{ {
"fieldname": "column_break2", "fieldname": "column_break2",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"permlevel": 0, "permlevel": 0,
"read_only": 0, "read_only": 0,
"width": "50%" "width": "50%"
}, },
{ {
"depends_on": "production_item", "depends_on": "production_item",
"fieldname": "stock_uom", "fieldname": "stock_uom",
"fieldtype": "Link", "fieldtype": "Link",
"label": "Stock UOM", "label": "Stock UOM",
"oldfieldname": "stock_uom", "oldfieldname": "stock_uom",
"oldfieldtype": "Data", "oldfieldtype": "Data",
"options": "UOM", "options": "UOM",
"permlevel": 0, "permlevel": 0,
"read_only": 1 "read_only": 1
}, },
{ {
"fieldname": "company", "fieldname": "company",
"fieldtype": "Link", "fieldtype": "Link",
"label": "Company", "label": "Company",
"oldfieldname": "company", "oldfieldname": "company",
"oldfieldtype": "Link", "oldfieldtype": "Link",
"options": "Company", "options": "Company",
"permlevel": 0, "permlevel": 0,
"read_only": 0, "read_only": 0,
"reqd": 1 "reqd": 1
}, },
{ {
"fieldname": "amended_from", "fieldname": "amended_from",
"fieldtype": "Data", "fieldtype": "Data",
"ignore_user_permissions": 1, "ignore_user_permissions": 1,
"label": "Amended From", "label": "Amended From",
"no_copy": 1, "no_copy": 1,
"oldfieldname": "amended_from", "oldfieldname": "amended_from",
"oldfieldtype": "Data", "oldfieldtype": "Data",
"permlevel": 0, "permlevel": 0,
"read_only": 1 "read_only": 1
} }
], ],
"icon": "icon-cogs", "icon": "icon-cogs",
"idx": 1, "idx": 1,
"in_create": 0, "in_create": 0,
"is_submittable": 1, "is_submittable": 1,
"modified": "2014-05-27 03:49:15.008942", "modified": "2014-05-27 03:49:15.008942",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Manufacturing", "module": "Manufacturing",
"name": "Production Order", "name": "Production Order",
"owner": "Administrator", "owner": "Administrator",
"permissions": [ "permissions": [
{ {
"amend": 1, "amend": 1,
"apply_user_permissions": 1, "apply_user_permissions": 1,
"cancel": 1, "cancel": 1,
"create": 1, "create": 1,
"delete": 1, "delete": 1,
"email": 1, "email": 1,
"permlevel": 0, "permlevel": 0,
"print": 1, "print": 1,
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "Manufacturing User", "role": "Manufacturing User",
"submit": 1, "submit": 1,
"write": 1 "write": 1
}, },
{ {
"apply_user_permissions": 1, "apply_user_permissions": 1,
"permlevel": 0, "permlevel": 0,
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "Material User" "role": "Material User"
} }
] ]
} }

View File

@ -25,6 +25,7 @@ erpnext.utils.get_party_details = function(frm, method, args, callback) {
args.currency = frm.doc.currency; args.currency = frm.doc.currency;
args.company = frm.doc.company; args.company = frm.doc.company;
args.doctype = frm.doc.doctype;
frappe.call({ frappe.call({
method: method, method: method,
args: args, args: args,

View File

@ -16,7 +16,7 @@
"doctype": "Lead", "doctype": "Lead",
"email_id": "test_lead2@example.com", "email_id": "test_lead2@example.com",
"lead_name": "_Test Lead 2", "lead_name": "_Test Lead 2",
"status": "Contacted" "status": "Lead"
}, },
{ {
"doctype": "Lead", "doctype": "Lead",

View File

@ -279,13 +279,9 @@ def make_delivery_note(source_name, target_doc=None):
target.amount = (flt(source.qty) - flt(source.delivered_qty)) * flt(source.rate) target.amount = (flt(source.qty) - flt(source.delivered_qty)) * flt(source.rate)
target.qty = flt(source.qty) - flt(source.delivered_qty) 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": { "Sales Order": {
"doctype": "Delivery Note", "doctype": "Delivery Note",
"field_map": {
"shipping_address": "address_display",
"shipping_address_name": "customer_address",
},
"validation": { "validation": {
"docstatus": ["=", 1] "docstatus": ["=", 1]
} }
@ -310,7 +306,7 @@ def make_delivery_note(source_name, target_doc=None):
} }
}, target_doc, set_missing_values) }, target_doc, set_missing_values)
return doclist return target_doc
@frappe.whitelist() @frappe.whitelist()
def make_sales_invoice(source_name, target_doc=None): def make_sales_invoice(source_name, target_doc=None):

View File

@ -1,117 +1,117 @@
{ {
"autoname": "field:currency_name", "autoname": "field:currency_name",
"creation": "2013-01-28 10:06:02", "creation": "2013-01-28 10:06:02",
"description": "**Currency** Master", "description": "**Currency** Master",
"docstatus": 0, "docstatus": 0,
"doctype": "DocType", "doctype": "DocType",
"fields": [ "fields": [
{ {
"fieldname": "currency_name", "fieldname": "currency_name",
"fieldtype": "Data", "fieldtype": "Data",
"label": "Currency Name", "label": "Currency Name",
"oldfieldname": "currency_name", "oldfieldname": "currency_name",
"oldfieldtype": "Data", "oldfieldtype": "Data",
"permlevel": 0, "permlevel": 0,
"reqd": 1 "reqd": 1
}, },
{ {
"fieldname": "enabled", "fieldname": "enabled",
"fieldtype": "Check", "fieldtype": "Check",
"in_list_view": 1, "in_list_view": 1,
"label": "Enabled", "label": "Enabled",
"permlevel": 0 "permlevel": 0
}, },
{ {
"description": "Sub-currency. For e.g. \"Cent\"", "description": "Sub-currency. For e.g. \"Cent\"",
"fieldname": "fraction", "fieldname": "fraction",
"fieldtype": "Data", "fieldtype": "Data",
"in_list_view": 1, "in_list_view": 1,
"label": "Fraction", "label": "Fraction",
"permlevel": 0 "permlevel": 0
}, },
{ {
"description": "1 Currency = [?] Fraction\nFor e.g. 1 USD = 100 Cent", "description": "1 Currency = [?] Fraction\nFor e.g. 1 USD = 100 Cent",
"fieldname": "fraction_units", "fieldname": "fraction_units",
"fieldtype": "Int", "fieldtype": "Int",
"in_list_view": 1, "in_list_view": 1,
"label": "Fraction Units", "label": "Fraction Units",
"permlevel": 0 "permlevel": 0
}, },
{ {
"description": "A symbol for this currency. For e.g. $", "description": "A symbol for this currency. For e.g. $",
"fieldname": "symbol", "fieldname": "symbol",
"fieldtype": "Data", "fieldtype": "Data",
"in_list_view": 1, "in_list_view": 1,
"label": "Symbol", "label": "Symbol",
"permlevel": 0 "permlevel": 0
}, },
{ {
"description": "How should this currency be formatted? If not set, will use system defaults", "description": "How should this currency be formatted? If not set, will use system defaults",
"fieldname": "number_format", "fieldname": "number_format",
"fieldtype": "Select", "fieldtype": "Select",
"in_list_view": 1, "in_list_view": 1,
"label": "Number Format", "label": "Number Format",
"options": "\n#,###.##\n#.###,##\n# ###.##\n#,###.###\n#,##,###.##\n#.###\n#,###", "options": "\n#,###.##\n#.###,##\n# ###.##\n# ###,##\n#'###.##\n#, ###.##\n#,##,###.##\n#,###.###\n#.###\n#,###",
"permlevel": 0 "permlevel": 0
} }
], ],
"icon": "icon-bitcoin", "icon": "icon-bitcoin",
"idx": 1, "idx": 1,
"in_create": 0, "in_create": 0,
"modified": "2014-05-27 03:49:09.038451", "modified": "2014-06-18 03:49:09.038451",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Setup", "module": "Setup",
"name": "Currency", "name": "Currency",
"owner": "Administrator", "owner": "Administrator",
"permissions": [ "permissions": [
{ {
"create": 1, "create": 1,
"delete": 1, "delete": 1,
"email": 1, "email": 1,
"permlevel": 0, "permlevel": 0,
"print": 1, "print": 1,
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "Accounts Manager", "role": "Accounts Manager",
"submit": 0, "submit": 0,
"write": 1 "write": 1
}, },
{ {
"amend": 0, "amend": 0,
"create": 1, "create": 1,
"delete": 1, "delete": 1,
"email": 1, "email": 1,
"permlevel": 0, "permlevel": 0,
"print": 1, "print": 1,
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "Sales Master Manager", "role": "Sales Master Manager",
"submit": 0, "submit": 0,
"write": 1 "write": 1
}, },
{ {
"amend": 0, "amend": 0,
"create": 1, "create": 1,
"delete": 0, "delete": 0,
"email": 1, "email": 1,
"permlevel": 0, "permlevel": 0,
"print": 1, "print": 1,
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "Purchase Master Manager", "role": "Purchase Master Manager",
"submit": 0, "submit": 0,
"write": 1 "write": 1
}, },
{ {
"apply_user_permissions": 1, "apply_user_permissions": 1,
"delete": 0, "delete": 0,
"email": 1, "email": 1,
"permlevel": 0, "permlevel": 0,
"print": 1, "print": 1,
"read": 1, "read": 1,
"report": 1, "report": 1,
"role": "All" "role": "All"
} }
], ],
"read_only": 0 "read_only": 0
} }

View File

@ -17,8 +17,5 @@ def validate_conversion_rate(currency, conversion_rate, conversion_rate_label, c
company_currency = frappe.db.get_value("Company", company, "default_currency") company_currency = frappe.db.get_value("Company", company, "default_currency")
if not conversion_rate: 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') % { throw(_("{0} is mandatory. Maybe Currency Exchange record is not created for {1} to {2}.").format(
"conversion_rate_label": conversion_rate_label, conversion_rate_label, currency, company_currency))
"from_currency": currency,
"to_currency": company_currency
})

View File

@ -278,13 +278,16 @@ def get_serial_nos(serial_no):
def make_serial_no(serial_no, sle): def make_serial_no(serial_no, sle):
sr = frappe.new_doc("Serial No") sr = frappe.new_doc("Serial No")
sr.warehouse = None
sr.dont_update_if_missing.append("warehouse")
sr.ignore_permissions = True sr.ignore_permissions = True
sr.serial_no = serial_no sr.serial_no = serial_no
sr.item_code = sle.item_code sr.item_code = sle.item_code
sr.warehouse = None
sr.company = sle.company sr.company = sle.company
sr.via_stock_ledger = True sr.via_stock_ledger = True
sr.insert() sr.insert()
sr.warehouse = sle.warehouse sr.warehouse = sle.warehouse
sr.status = "Available" sr.status = "Available"
sr.save() sr.save()

View File

@ -241,14 +241,14 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({
customer: function() { customer: function() {
return this.frm.call({ return this.frm.call({
method: "erpnext.accounts.party.get_party_details", 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() { supplier: function() {
return this.frm.call({ return this.frm.call({
method: "erpnext.accounts.party.get_party_details", 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.item_code = function(doc, cdt, cdn) {
cur_frm.cscript.s_warehouse = function(doc, cdt, cdn) { cur_frm.cscript.s_warehouse = function(doc, cdt, cdn) {
var d = locals[cdt][cdn]; var d = locals[cdt][cdn];
args = { if(!d.bom_no) {
'item_code' : d.item_code, args = {
'warehouse' : cstr(d.s_warehouse) || cstr(d.t_warehouse), 'item_code' : d.item_code,
'transfer_qty' : d.transfer_qty, 'warehouse' : cstr(d.s_warehouse) || cstr(d.t_warehouse),
'serial_no' : d.serial_no, 'transfer_qty' : d.transfer_qty,
'bom_no' : d.bom_no, 'serial_no' : d.serial_no,
'qty' : d.s_warehouse ? -1* d.qty : d.qty '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; cur_frm.cscript.t_warehouse = cur_frm.cscript.s_warehouse;

View File

@ -228,7 +228,7 @@ class StockEntry(StockController):
raw_material_cost += flt(d.amount) raw_material_cost += flt(d.amount)
# set incoming rate for fg item # 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"): for d in self.get("mtn_details"):
if d.bom_no: if d.bom_no:
if not flt(d.incoming_rate): if not flt(d.incoming_rate):
@ -239,29 +239,25 @@ class StockEntry(StockController):
def get_incoming_rate(self, args): def get_incoming_rate(self, args):
incoming_rate = 0 incoming_rate = 0
if self.purpose == "Sales Return" and \ if self.purpose == "Sales Return":
(self.delivery_note_no or self.sales_invoice_no): incoming_rate = self.get_incoming_rate_for_sales_return(args)
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)
else: else:
incoming_rate = get_incoming_rate(args) incoming_rate = get_incoming_rate(args)
return incoming_rate 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): def validate_incoming_rate(self):
for d in self.get('mtn_details'): for d in self.get('mtn_details'):
if d.t_warehouse: if d.t_warehouse:

View File

@ -229,7 +229,7 @@ def get_pos_settings_item_details(company, args, pos_settings=None):
if pos_settings: if pos_settings:
for fieldname in ("income_account", "cost_center", "warehouse", "expense_account"): 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) res[fieldname] = pos_settings.get(fieldname)
if res.get("warehouse"): if res.get("warehouse"):

View File

@ -125,7 +125,7 @@ def create_lead(email_id):
"doctype": "Lead", "doctype": "Lead",
"email_id": email_id, "email_id": email_id,
"lead_name": real_name or email_id, "lead_name": real_name or email_id,
"status": "Contacted", "status": "Lead",
"naming_series": get_default_naming_series("Lead"), "naming_series": get_default_naming_series("Lead"),
"company": frappe.db.get_default("company"), "company": frappe.db.get_default("company"),
"source": "Email" "source": "Email"