diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py index 5e0d9c3caa..2abc187dab 100644 --- a/erpnext/accounts/utils.py +++ b/erpnext/accounts/utils.py @@ -413,3 +413,8 @@ def get_outstanding_invoices(amount_query, account, party_type, party): }) return all_outstanding_vouchers + +@frappe.whitelist() +def get_letter_head(company): + return frappe.db.get_value("Company",company,"default_letter_head") + diff --git a/erpnext/public/js/transaction.js b/erpnext/public/js/transaction.js index 7943552238..a261649813 100644 --- a/erpnext/public/js/transaction.js +++ b/erpnext/public/js/transaction.js @@ -230,6 +230,8 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({ if (this.frm.doc.posting_date) var date = this.frm.doc.posting_date; else var date = this.frm.doc.transaction_date; erpnext.get_fiscal_year(this.frm.doc.company, date, fn); + + erpnext.get_letter_head(this.frm.doc.company); }, transaction_date: function() { diff --git a/erpnext/public/js/utils.js b/erpnext/public/js/utils.js index f716723c52..5528322b1a 100644 --- a/erpnext/public/js/utils.js +++ b/erpnext/public/js/utils.js @@ -99,6 +99,20 @@ $.extend(erpnext, { d.show(); }); }, + + get_letter_head: function(company) { + frappe.call({ + type:"GET", + method: "erpnext.accounts.utils.get_letter_head", + args: { + "company": company + }, + callback: function(r) { + if (!r.exe) cur_frm.set_value("letter_head", r.message); + } + }); + }, + }); diff --git a/erpnext/setup/doctype/company/company.json b/erpnext/setup/doctype/company/company.json index 05e49ba567..2a1ceff6b4 100644 --- a/erpnext/setup/doctype/company/company.json +++ b/erpnext/setup/doctype/company/company.json @@ -1,396 +1,404 @@ { - "allow_import": 1, - "allow_rename": 1, - "autoname": "field:company_name", - "creation": "2013-04-10 08:35:39", - "description": "Legal Entity / Subsidiary with a separate Chart of Accounts belonging to the Organization.", - "docstatus": 0, - "doctype": "DocType", - "document_type": "Master", + "allow_import": 1, + "allow_rename": 1, + "autoname": "field:company_name", + "creation": "2013-04-10 08:35:39", + "description": "Legal Entity / Subsidiary with a separate Chart of Accounts belonging to the Organization.", + "docstatus": 0, + "doctype": "DocType", + "document_type": "Master", "fields": [ { - "fieldname": "details", - "fieldtype": "Section Break", - "label": "Company Details", - "oldfieldtype": "Section Break", - "permlevel": 0, + "fieldname": "details", + "fieldtype": "Section Break", + "label": "Company Details", + "oldfieldtype": "Section Break", + "permlevel": 0, "read_only": 0 - }, + }, { - "fieldname": "company_name", - "fieldtype": "Data", - "label": "Company", - "no_copy": 0, - "oldfieldname": "company_name", - "oldfieldtype": "Data", - "permlevel": 0, - "read_only": 0, + "fieldname": "company_name", + "fieldtype": "Data", + "label": "Company", + "no_copy": 0, + "oldfieldname": "company_name", + "oldfieldtype": "Data", + "permlevel": 0, + "read_only": 0, "reqd": 1 - }, + }, { - "description": "Please Enter Abbreviation or Short Name properly as it will be added as Suffix to all Account Heads.", - "fieldname": "abbr", - "fieldtype": "Data", - "label": "Abbr", - "no_copy": 0, - "oldfieldname": "abbr", - "oldfieldtype": "Data", - "permlevel": 0, - "read_only": 0, + "description": "Please Enter Abbreviation or Short Name properly as it will be added as Suffix to all Account Heads.", + "fieldname": "abbr", + "fieldtype": "Data", + "label": "Abbr", + "no_copy": 0, + "oldfieldname": "abbr", + "oldfieldtype": "Data", + "permlevel": 0, + "read_only": 0, "reqd": 1 - }, + }, { - "depends_on": "eval:!doc.__islocal && in_list(user_roles, \"System Manager\")", - "fieldname": "change_abbr", - "fieldtype": "Button", - "label": "Change Abbreviation", + "depends_on": "eval:!doc.__islocal && in_list(user_roles, \"System Manager\")", + "fieldname": "change_abbr", + "fieldtype": "Button", + "label": "Change Abbreviation", "permlevel": 0 - }, + }, { - "fieldname": "cb0", - "fieldtype": "Column Break", - "permlevel": 0, + "fieldname": "cb0", + "fieldtype": "Column Break", + "permlevel": 0, "read_only": 0 - }, + }, { - "fieldname": "domain", - "fieldtype": "Select", - "label": "Domain", - "options": "Distribution\nManufacturing\nRetail\nServices", - "permlevel": 0, + "fieldname": "domain", + "fieldtype": "Select", + "label": "Domain", + "options": "Distribution\nManufacturing\nRetail\nServices", + "permlevel": 0, "reqd": 0 - }, + }, { - "fieldname": "charts_section", - "fieldtype": "Section Break", - "hidden": 0, - "label": "Chart of Accounts", + "fieldname": "charts_section", + "fieldtype": "Section Break", + "hidden": 0, + "label": "Chart of Accounts", "permlevel": 0 - }, + }, { - "fieldname": "country", - "fieldtype": "Link", - "in_list_view": 1, - "label": "Country", - "options": "Country", - "permlevel": 0, + "fieldname": "country", + "fieldtype": "Link", + "in_list_view": 1, + "label": "Country", + "options": "Country", + "permlevel": 0, "reqd": 1 - }, + }, { - "fieldname": "chart_of_accounts", - "fieldtype": "Select", - "hidden": 0, - "ignore_user_permissions": 1, - "label": "Chart of Accounts", - "options": "", + "fieldname": "chart_of_accounts", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 1, + "label": "Chart of Accounts", + "options": "", "permlevel": 0 - }, + }, { - "fieldname": "default_settings", - "fieldtype": "Section Break", - "label": "Default Settings", - "oldfieldtype": "Section Break", - "permlevel": 0, + "fieldname": "default_settings", + "fieldtype": "Section Break", + "label": "Default Settings", + "oldfieldtype": "Section Break", + "permlevel": 0, "read_only": 0 - }, + }, { - "depends_on": "eval:!doc.__islocal", - "fieldname": "default_bank_account", - "fieldtype": "Link", - "ignore_user_permissions": 1, - "label": "Default Bank Account", - "no_copy": 1, - "oldfieldname": "default_bank_account", - "oldfieldtype": "Link", - "options": "Account", - "permlevel": 0, + "depends_on": "eval:!doc.__islocal", + "fieldname": "default_bank_account", + "fieldtype": "Link", + "ignore_user_permissions": 1, + "label": "Default Bank Account", + "no_copy": 1, + "oldfieldname": "default_bank_account", + "oldfieldtype": "Link", + "options": "Account", + "permlevel": 0, "read_only": 0 - }, + }, { - "fieldname": "default_cash_account", - "fieldtype": "Link", - "ignore_user_permissions": 1, - "label": "Default Cash Account", - "no_copy": 1, - "options": "Account", - "permlevel": 0, + "fieldname": "default_cash_account", + "fieldtype": "Link", + "ignore_user_permissions": 1, + "label": "Default Cash Account", + "no_copy": 1, + "options": "Account", + "permlevel": 0, "read_only": 0 - }, + }, { - "depends_on": "eval:!doc.__islocal", - "fieldname": "default_receivable_account", - "fieldtype": "Link", - "ignore_user_permissions": 1, - "label": "Default Receivable Account", - "no_copy": 1, - "oldfieldname": "receivables_group", - "oldfieldtype": "Link", - "options": "Account", - "permlevel": 0, + "depends_on": "eval:!doc.__islocal", + "fieldname": "default_receivable_account", + "fieldtype": "Link", + "ignore_user_permissions": 1, + "label": "Default Receivable Account", + "no_copy": 1, + "oldfieldname": "receivables_group", + "oldfieldtype": "Link", + "options": "Account", + "permlevel": 0, "read_only": 0 - }, + }, { - "depends_on": "eval:!doc.__islocal", - "fieldname": "default_payable_account", - "fieldtype": "Link", - "ignore_user_permissions": 1, - "label": "Default Payable Account", - "no_copy": 1, - "oldfieldname": "payables_group", - "oldfieldtype": "Link", - "options": "Account", - "permlevel": 0, + "depends_on": "eval:!doc.__islocal", + "fieldname": "default_payable_account", + "fieldtype": "Link", + "ignore_user_permissions": 1, + "label": "Default Payable Account", + "no_copy": 1, + "oldfieldname": "payables_group", + "oldfieldtype": "Link", + "options": "Account", + "permlevel": 0, "read_only": 0 - }, + }, { - "fieldname": "default_expense_account", - "fieldtype": "Link", - "ignore_user_permissions": 1, - "label": "Default Expense Account", - "no_copy": 1, - "options": "Account", + "fieldname": "default_expense_account", + "fieldtype": "Link", + "ignore_user_permissions": 1, + "label": "Default Expense Account", + "no_copy": 1, + "options": "Account", "permlevel": 0 - }, + }, { - "fieldname": "default_income_account", - "fieldtype": "Link", - "ignore_user_permissions": 1, - "label": "Default Income Account", - "no_copy": 1, - "options": "Account", + "fieldname": "default_income_account", + "fieldtype": "Link", + "ignore_user_permissions": 1, + "label": "Default Income Account", + "no_copy": 1, + "options": "Account", "permlevel": 0 - }, + }, { - "fieldname": "default_holiday_list", - "fieldtype": "Link", - "label": "Default Holiday List", - "options": "Holiday List", - "permlevel": 0, + "fieldname": "default_holiday_list", + "fieldtype": "Link", + "label": "Default Holiday List", + "options": "Holiday List", + "permlevel": 0, "precision": "" - }, + }, { - "fieldname": "column_break0", - "fieldtype": "Column Break", - "oldfieldtype": "Column Break", - "permlevel": 0, - "read_only": 0, + "fieldname": "column_break0", + "fieldtype": "Column Break", + "oldfieldtype": "Column Break", + "permlevel": 0, + "read_only": 0, "width": "50%" - }, + }, { - "fieldname": "default_currency", - "fieldtype": "Link", - "ignore_user_permissions": 1, - "label": "Default Currency", - "options": "Currency", - "permlevel": 0, - "read_only": 0, + "fieldname": "default_currency", + "fieldtype": "Link", + "ignore_user_permissions": 1, + "label": "Default Currency", + "options": "Currency", + "permlevel": 0, + "read_only": 0, "reqd": 1 - }, + }, { - "depends_on": "eval:!doc.__islocal", - "fieldname": "cost_center", - "fieldtype": "Link", - "ignore_user_permissions": 1, - "label": "Cost Center", - "no_copy": 1, - "options": "Cost Center", + "fieldname": "default_letter_head", + "fieldtype": "Link", + "label": "Default Letter Head", + "options": "Letter Head", + "permlevel": 0, + "precision": "" + }, + { + "depends_on": "eval:!doc.__islocal", + "fieldname": "cost_center", + "fieldtype": "Link", + "ignore_user_permissions": 1, + "label": "Cost Center", + "no_copy": 1, + "options": "Cost Center", "permlevel": 0 - }, + }, { - "depends_on": "eval:!doc.__islocal", - "fieldname": "credit_days", - "fieldtype": "Int", - "label": "Credit Days", - "oldfieldname": "credit_days", - "oldfieldtype": "Int", - "permlevel": 0, + "depends_on": "eval:!doc.__islocal", + "fieldname": "credit_days", + "fieldtype": "Int", + "label": "Credit Days", + "oldfieldname": "credit_days", + "oldfieldtype": "Int", + "permlevel": 0, "read_only": 0 - }, + }, { - "depends_on": "eval:!doc.__islocal", - "fieldname": "credit_limit", - "fieldtype": "Currency", - "label": "Credit Limit", - "oldfieldname": "credit_limit", - "oldfieldtype": "Currency", - "options": "default_currency", - "permlevel": 0, + "depends_on": "eval:!doc.__islocal", + "fieldname": "credit_limit", + "fieldtype": "Currency", + "label": "Credit Limit", + "oldfieldname": "credit_limit", + "oldfieldtype": "Currency", + "options": "default_currency", + "permlevel": 0, "read_only": 0 - }, + }, { - "depends_on": "eval:!doc.__islocal", - "fieldname": "yearly_bgt_flag", - "fieldtype": "Select", - "label": "If Yearly Budget Exceeded", - "oldfieldname": "yearly_bgt_flag", - "oldfieldtype": "Select", - "options": "\nWarn\nIgnore\nStop", - "permlevel": 0, + "depends_on": "eval:!doc.__islocal", + "fieldname": "yearly_bgt_flag", + "fieldtype": "Select", + "label": "If Yearly Budget Exceeded", + "oldfieldname": "yearly_bgt_flag", + "oldfieldtype": "Select", + "options": "\nWarn\nIgnore\nStop", + "permlevel": 0, "read_only": 0 - }, + }, { - "depends_on": "eval:!doc.__islocal", - "fieldname": "monthly_bgt_flag", - "fieldtype": "Select", - "label": "If Monthly Budget Exceeded", - "oldfieldname": "monthly_bgt_flag", - "oldfieldtype": "Select", - "options": "\nWarn\nIgnore\nStop", - "permlevel": 0, + "depends_on": "eval:!doc.__islocal", + "fieldname": "monthly_bgt_flag", + "fieldtype": "Select", + "label": "If Monthly Budget Exceeded", + "oldfieldname": "monthly_bgt_flag", + "oldfieldtype": "Select", + "options": "\nWarn\nIgnore\nStop", + "permlevel": 0, "read_only": 0 - }, + }, { - "depends_on": "eval:!doc.__islocal", - "fieldname": "auto_accounting_for_stock_settings", - "fieldtype": "Section Break", - "label": "Auto Accounting For Stock Settings", - "permlevel": 0, + "depends_on": "eval:!doc.__islocal", + "fieldname": "auto_accounting_for_stock_settings", + "fieldtype": "Section Break", + "label": "Auto Accounting For Stock Settings", + "permlevel": 0, "read_only": 0 - }, + }, { - "fieldname": "stock_received_but_not_billed", - "fieldtype": "Link", - "ignore_user_permissions": 1, - "label": "Stock Received But Not Billed", - "no_copy": 1, - "options": "Account", - "permlevel": 0, + "fieldname": "stock_received_but_not_billed", + "fieldtype": "Link", + "ignore_user_permissions": 1, + "label": "Stock Received But Not Billed", + "no_copy": 1, + "options": "Account", + "permlevel": 0, "read_only": 0 - }, + }, { - "fieldname": "stock_adjustment_account", - "fieldtype": "Link", - "ignore_user_permissions": 1, - "label": "Stock Adjustment Account", - "no_copy": 1, - "options": "Account", - "permlevel": 0, + "fieldname": "stock_adjustment_account", + "fieldtype": "Link", + "ignore_user_permissions": 1, + "label": "Stock Adjustment Account", + "no_copy": 1, + "options": "Account", + "permlevel": 0, "read_only": 0 - }, + }, { - "fieldname": "expenses_included_in_valuation", - "fieldtype": "Link", - "ignore_user_permissions": 1, - "label": "Expenses Included In Valuation", - "no_copy": 1, - "options": "Account", - "permlevel": 0, + "fieldname": "expenses_included_in_valuation", + "fieldtype": "Link", + "ignore_user_permissions": 1, + "label": "Expenses Included In Valuation", + "no_copy": 1, + "options": "Account", + "permlevel": 0, "read_only": 0 - }, + }, { - "description": "For reference only.", - "fieldname": "company_info", - "fieldtype": "Section Break", - "label": "Company Info", - "permlevel": 0, + "description": "For reference only.", + "fieldname": "company_info", + "fieldtype": "Section Break", + "label": "Company Info", + "permlevel": 0, "read_only": 0 - }, + }, { - "fieldname": "address", - "fieldtype": "Small Text", - "label": "Address", - "oldfieldname": "address", - "oldfieldtype": "Small Text", - "permlevel": 0, + "fieldname": "address", + "fieldtype": "Small Text", + "label": "Address", + "oldfieldname": "address", + "oldfieldtype": "Small Text", + "permlevel": 0, "read_only": 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%" - }, + }, { - "fieldname": "phone_no", - "fieldtype": "Data", - "label": "Phone No", - "oldfieldname": "phone_no", - "oldfieldtype": "Data", - "options": "Phone", - "permlevel": 0, + "fieldname": "phone_no", + "fieldtype": "Data", + "label": "Phone No", + "oldfieldname": "phone_no", + "oldfieldtype": "Data", + "options": "Phone", + "permlevel": 0, "read_only": 0 - }, + }, { - "fieldname": "fax", - "fieldtype": "Data", - "label": "Fax", - "oldfieldname": "fax", - "oldfieldtype": "Data", - "options": "Phone", - "permlevel": 0, + "fieldname": "fax", + "fieldtype": "Data", + "label": "Fax", + "oldfieldname": "fax", + "oldfieldtype": "Data", + "options": "Phone", + "permlevel": 0, "read_only": 0 - }, + }, { - "fieldname": "email", - "fieldtype": "Data", - "label": "Email", - "oldfieldname": "email", - "oldfieldtype": "Data", - "options": "Email", - "permlevel": 0, + "fieldname": "email", + "fieldtype": "Data", + "label": "Email", + "oldfieldname": "email", + "oldfieldtype": "Data", + "options": "Email", + "permlevel": 0, "read_only": 0 - }, + }, { - "fieldname": "website", - "fieldtype": "Data", - "label": "Website", - "oldfieldname": "website", - "oldfieldtype": "Data", - "permlevel": 0, + "fieldname": "website", + "fieldtype": "Data", + "label": "Website", + "oldfieldname": "website", + "oldfieldtype": "Data", + "permlevel": 0, "read_only": 0 - }, + }, { - "description": "Company registration numbers for your reference. Example: VAT Registration Numbers etc.", - "fieldname": "registration_info", - "fieldtype": "Section Break", - "label": "Registration Info", - "oldfieldtype": "Section Break", - "permlevel": 0, - "read_only": 0, + "description": "Company registration numbers for your reference. Example: VAT Registration Numbers etc.", + "fieldname": "registration_info", + "fieldtype": "Section Break", + "label": "Registration Info", + "oldfieldtype": "Section Break", + "permlevel": 0, + "read_only": 0, "width": "50%" - }, + }, { - "description": "Company registration numbers for your reference. Tax numbers etc.", - "fieldname": "registration_details", - "fieldtype": "Code", - "label": "Registration Details", - "oldfieldname": "registration_details", - "oldfieldtype": "Code", - "permlevel": 0, + "description": "Company registration numbers for your reference. Tax numbers etc.", + "fieldname": "registration_details", + "fieldtype": "Code", + "label": "Registration Details", + "oldfieldname": "registration_details", + "oldfieldtype": "Code", + "permlevel": 0, "read_only": 0 } - ], - "icon": "icon-building", - "idx": 1, - "modified": "2014-11-27 18:15:48.909416", - "modified_by": "Administrator", - "module": "Setup", - "name": "Company", - "owner": "Administrator", + ], + "icon": "icon-building", + "idx": 1, + "modified": "2014-12-15 11:14:12.090020", + "modified_by": "Administrator", + "module": "Setup", + "name": "Company", + "owner": "Administrator", "permissions": [ { - "amend": 0, - "create": 1, - "delete": 1, - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "System Manager", - "submit": 0, + "amend": 0, + "create": 1, + "delete": 1, + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "submit": 0, "write": 1 - }, + }, { - "apply_user_permissions": 1, - "delete": 0, - "email": 1, - "permlevel": 0, - "print": 1, - "read": 1, + "apply_user_permissions": 1, + "delete": 0, + "email": 1, + "permlevel": 0, + "print": 1, + "read": 1, "role": "All" } ] -} \ No newline at end of file +}