company wise letter head feature added

This commit is contained in:
Neil Trini Lasrado 2014-12-15 15:49:40 +05:30 committed by Nabin Hait
parent b0b7e7fdf8
commit 31a92bd9d9
4 changed files with 341 additions and 312 deletions

View File

@ -413,3 +413,8 @@ def get_outstanding_invoices(amount_query, account, party_type, party):
}) })
return all_outstanding_vouchers return all_outstanding_vouchers
@frappe.whitelist()
def get_letter_head(company):
return frappe.db.get_value("Company",company,"default_letter_head")

View File

@ -230,6 +230,8 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({
if (this.frm.doc.posting_date) var date = this.frm.doc.posting_date; if (this.frm.doc.posting_date) var date = this.frm.doc.posting_date;
else var date = this.frm.doc.transaction_date; else var date = this.frm.doc.transaction_date;
erpnext.get_fiscal_year(this.frm.doc.company, date, fn); erpnext.get_fiscal_year(this.frm.doc.company, date, fn);
erpnext.get_letter_head(this.frm.doc.company);
}, },
transaction_date: function() { transaction_date: function() {

View File

@ -99,6 +99,20 @@ $.extend(erpnext, {
d.show(); 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);
}
});
},
}); });

View File

@ -1,396 +1,404 @@
{ {
"allow_import": 1, "allow_import": 1,
"allow_rename": 1, "allow_rename": 1,
"autoname": "field:company_name", "autoname": "field:company_name",
"creation": "2013-04-10 08:35:39", "creation": "2013-04-10 08:35:39",
"description": "Legal Entity / Subsidiary with a separate Chart of Accounts belonging to the Organization.", "description": "Legal Entity / Subsidiary with a separate Chart of Accounts belonging to the Organization.",
"docstatus": 0, "docstatus": 0,
"doctype": "DocType", "doctype": "DocType",
"document_type": "Master", "document_type": "Master",
"fields": [ "fields": [
{ {
"fieldname": "details", "fieldname": "details",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Company Details", "label": "Company Details",
"oldfieldtype": "Section Break", "oldfieldtype": "Section Break",
"permlevel": 0, "permlevel": 0,
"read_only": 0 "read_only": 0
}, },
{ {
"fieldname": "company_name", "fieldname": "company_name",
"fieldtype": "Data", "fieldtype": "Data",
"label": "Company", "label": "Company",
"no_copy": 0, "no_copy": 0,
"oldfieldname": "company_name", "oldfieldname": "company_name",
"oldfieldtype": "Data", "oldfieldtype": "Data",
"permlevel": 0, "permlevel": 0,
"read_only": 0, "read_only": 0,
"reqd": 1 "reqd": 1
}, },
{ {
"description": "Please Enter Abbreviation or Short Name properly as it will be added as Suffix to all Account Heads.", "description": "Please Enter Abbreviation or Short Name properly as it will be added as Suffix to all Account Heads.",
"fieldname": "abbr", "fieldname": "abbr",
"fieldtype": "Data", "fieldtype": "Data",
"label": "Abbr", "label": "Abbr",
"no_copy": 0, "no_copy": 0,
"oldfieldname": "abbr", "oldfieldname": "abbr",
"oldfieldtype": "Data", "oldfieldtype": "Data",
"permlevel": 0, "permlevel": 0,
"read_only": 0, "read_only": 0,
"reqd": 1 "reqd": 1
}, },
{ {
"depends_on": "eval:!doc.__islocal && in_list(user_roles, \"System Manager\")", "depends_on": "eval:!doc.__islocal && in_list(user_roles, \"System Manager\")",
"fieldname": "change_abbr", "fieldname": "change_abbr",
"fieldtype": "Button", "fieldtype": "Button",
"label": "Change Abbreviation", "label": "Change Abbreviation",
"permlevel": 0 "permlevel": 0
}, },
{ {
"fieldname": "cb0", "fieldname": "cb0",
"fieldtype": "Column Break", "fieldtype": "Column Break",
"permlevel": 0, "permlevel": 0,
"read_only": 0 "read_only": 0
}, },
{ {
"fieldname": "domain", "fieldname": "domain",
"fieldtype": "Select", "fieldtype": "Select",
"label": "Domain", "label": "Domain",
"options": "Distribution\nManufacturing\nRetail\nServices", "options": "Distribution\nManufacturing\nRetail\nServices",
"permlevel": 0, "permlevel": 0,
"reqd": 0 "reqd": 0
}, },
{ {
"fieldname": "charts_section", "fieldname": "charts_section",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
"label": "Chart of Accounts", "label": "Chart of Accounts",
"permlevel": 0 "permlevel": 0
}, },
{ {
"fieldname": "country", "fieldname": "country",
"fieldtype": "Link", "fieldtype": "Link",
"in_list_view": 1, "in_list_view": 1,
"label": "Country", "label": "Country",
"options": "Country", "options": "Country",
"permlevel": 0, "permlevel": 0,
"reqd": 1 "reqd": 1
}, },
{ {
"fieldname": "chart_of_accounts", "fieldname": "chart_of_accounts",
"fieldtype": "Select", "fieldtype": "Select",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 1, "ignore_user_permissions": 1,
"label": "Chart of Accounts", "label": "Chart of Accounts",
"options": "", "options": "",
"permlevel": 0 "permlevel": 0
}, },
{ {
"fieldname": "default_settings", "fieldname": "default_settings",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Default Settings", "label": "Default Settings",
"oldfieldtype": "Section Break", "oldfieldtype": "Section Break",
"permlevel": 0, "permlevel": 0,
"read_only": 0 "read_only": 0
}, },
{ {
"depends_on": "eval:!doc.__islocal", "depends_on": "eval:!doc.__islocal",
"fieldname": "default_bank_account", "fieldname": "default_bank_account",
"fieldtype": "Link", "fieldtype": "Link",
"ignore_user_permissions": 1, "ignore_user_permissions": 1,
"label": "Default Bank Account", "label": "Default Bank Account",
"no_copy": 1, "no_copy": 1,
"oldfieldname": "default_bank_account", "oldfieldname": "default_bank_account",
"oldfieldtype": "Link", "oldfieldtype": "Link",
"options": "Account", "options": "Account",
"permlevel": 0, "permlevel": 0,
"read_only": 0 "read_only": 0
}, },
{ {
"fieldname": "default_cash_account", "fieldname": "default_cash_account",
"fieldtype": "Link", "fieldtype": "Link",
"ignore_user_permissions": 1, "ignore_user_permissions": 1,
"label": "Default Cash Account", "label": "Default Cash Account",
"no_copy": 1, "no_copy": 1,
"options": "Account", "options": "Account",
"permlevel": 0, "permlevel": 0,
"read_only": 0 "read_only": 0
}, },
{ {
"depends_on": "eval:!doc.__islocal", "depends_on": "eval:!doc.__islocal",
"fieldname": "default_receivable_account", "fieldname": "default_receivable_account",
"fieldtype": "Link", "fieldtype": "Link",
"ignore_user_permissions": 1, "ignore_user_permissions": 1,
"label": "Default Receivable Account", "label": "Default Receivable Account",
"no_copy": 1, "no_copy": 1,
"oldfieldname": "receivables_group", "oldfieldname": "receivables_group",
"oldfieldtype": "Link", "oldfieldtype": "Link",
"options": "Account", "options": "Account",
"permlevel": 0, "permlevel": 0,
"read_only": 0 "read_only": 0
}, },
{ {
"depends_on": "eval:!doc.__islocal", "depends_on": "eval:!doc.__islocal",
"fieldname": "default_payable_account", "fieldname": "default_payable_account",
"fieldtype": "Link", "fieldtype": "Link",
"ignore_user_permissions": 1, "ignore_user_permissions": 1,
"label": "Default Payable Account", "label": "Default Payable Account",
"no_copy": 1, "no_copy": 1,
"oldfieldname": "payables_group", "oldfieldname": "payables_group",
"oldfieldtype": "Link", "oldfieldtype": "Link",
"options": "Account", "options": "Account",
"permlevel": 0, "permlevel": 0,
"read_only": 0 "read_only": 0
}, },
{ {
"fieldname": "default_expense_account", "fieldname": "default_expense_account",
"fieldtype": "Link", "fieldtype": "Link",
"ignore_user_permissions": 1, "ignore_user_permissions": 1,
"label": "Default Expense Account", "label": "Default Expense Account",
"no_copy": 1, "no_copy": 1,
"options": "Account", "options": "Account",
"permlevel": 0 "permlevel": 0
}, },
{ {
"fieldname": "default_income_account", "fieldname": "default_income_account",
"fieldtype": "Link", "fieldtype": "Link",
"ignore_user_permissions": 1, "ignore_user_permissions": 1,
"label": "Default Income Account", "label": "Default Income Account",
"no_copy": 1, "no_copy": 1,
"options": "Account", "options": "Account",
"permlevel": 0 "permlevel": 0
}, },
{ {
"fieldname": "default_holiday_list", "fieldname": "default_holiday_list",
"fieldtype": "Link", "fieldtype": "Link",
"label": "Default Holiday List", "label": "Default Holiday List",
"options": "Holiday List", "options": "Holiday List",
"permlevel": 0, "permlevel": 0,
"precision": "" "precision": ""
}, },
{ {
"fieldname": "column_break0", "fieldname": "column_break0",
"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%"
}, },
{ {
"fieldname": "default_currency", "fieldname": "default_currency",
"fieldtype": "Link", "fieldtype": "Link",
"ignore_user_permissions": 1, "ignore_user_permissions": 1,
"label": "Default Currency", "label": "Default Currency",
"options": "Currency", "options": "Currency",
"permlevel": 0, "permlevel": 0,
"read_only": 0, "read_only": 0,
"reqd": 1 "reqd": 1
}, },
{ {
"depends_on": "eval:!doc.__islocal", "fieldname": "default_letter_head",
"fieldname": "cost_center", "fieldtype": "Link",
"fieldtype": "Link", "label": "Default Letter Head",
"ignore_user_permissions": 1, "options": "Letter Head",
"label": "Cost Center", "permlevel": 0,
"no_copy": 1, "precision": ""
"options": "Cost Center", },
{
"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 "permlevel": 0
}, },
{ {
"depends_on": "eval:!doc.__islocal", "depends_on": "eval:!doc.__islocal",
"fieldname": "credit_days", "fieldname": "credit_days",
"fieldtype": "Int", "fieldtype": "Int",
"label": "Credit Days", "label": "Credit Days",
"oldfieldname": "credit_days", "oldfieldname": "credit_days",
"oldfieldtype": "Int", "oldfieldtype": "Int",
"permlevel": 0, "permlevel": 0,
"read_only": 0 "read_only": 0
}, },
{ {
"depends_on": "eval:!doc.__islocal", "depends_on": "eval:!doc.__islocal",
"fieldname": "credit_limit", "fieldname": "credit_limit",
"fieldtype": "Currency", "fieldtype": "Currency",
"label": "Credit Limit", "label": "Credit Limit",
"oldfieldname": "credit_limit", "oldfieldname": "credit_limit",
"oldfieldtype": "Currency", "oldfieldtype": "Currency",
"options": "default_currency", "options": "default_currency",
"permlevel": 0, "permlevel": 0,
"read_only": 0 "read_only": 0
}, },
{ {
"depends_on": "eval:!doc.__islocal", "depends_on": "eval:!doc.__islocal",
"fieldname": "yearly_bgt_flag", "fieldname": "yearly_bgt_flag",
"fieldtype": "Select", "fieldtype": "Select",
"label": "If Yearly Budget Exceeded", "label": "If Yearly Budget Exceeded",
"oldfieldname": "yearly_bgt_flag", "oldfieldname": "yearly_bgt_flag",
"oldfieldtype": "Select", "oldfieldtype": "Select",
"options": "\nWarn\nIgnore\nStop", "options": "\nWarn\nIgnore\nStop",
"permlevel": 0, "permlevel": 0,
"read_only": 0 "read_only": 0
}, },
{ {
"depends_on": "eval:!doc.__islocal", "depends_on": "eval:!doc.__islocal",
"fieldname": "monthly_bgt_flag", "fieldname": "monthly_bgt_flag",
"fieldtype": "Select", "fieldtype": "Select",
"label": "If Monthly Budget Exceeded", "label": "If Monthly Budget Exceeded",
"oldfieldname": "monthly_bgt_flag", "oldfieldname": "monthly_bgt_flag",
"oldfieldtype": "Select", "oldfieldtype": "Select",
"options": "\nWarn\nIgnore\nStop", "options": "\nWarn\nIgnore\nStop",
"permlevel": 0, "permlevel": 0,
"read_only": 0 "read_only": 0
}, },
{ {
"depends_on": "eval:!doc.__islocal", "depends_on": "eval:!doc.__islocal",
"fieldname": "auto_accounting_for_stock_settings", "fieldname": "auto_accounting_for_stock_settings",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Auto Accounting For Stock Settings", "label": "Auto Accounting For Stock Settings",
"permlevel": 0, "permlevel": 0,
"read_only": 0 "read_only": 0
}, },
{ {
"fieldname": "stock_received_but_not_billed", "fieldname": "stock_received_but_not_billed",
"fieldtype": "Link", "fieldtype": "Link",
"ignore_user_permissions": 1, "ignore_user_permissions": 1,
"label": "Stock Received But Not Billed", "label": "Stock Received But Not Billed",
"no_copy": 1, "no_copy": 1,
"options": "Account", "options": "Account",
"permlevel": 0, "permlevel": 0,
"read_only": 0 "read_only": 0
}, },
{ {
"fieldname": "stock_adjustment_account", "fieldname": "stock_adjustment_account",
"fieldtype": "Link", "fieldtype": "Link",
"ignore_user_permissions": 1, "ignore_user_permissions": 1,
"label": "Stock Adjustment Account", "label": "Stock Adjustment Account",
"no_copy": 1, "no_copy": 1,
"options": "Account", "options": "Account",
"permlevel": 0, "permlevel": 0,
"read_only": 0 "read_only": 0
}, },
{ {
"fieldname": "expenses_included_in_valuation", "fieldname": "expenses_included_in_valuation",
"fieldtype": "Link", "fieldtype": "Link",
"ignore_user_permissions": 1, "ignore_user_permissions": 1,
"label": "Expenses Included In Valuation", "label": "Expenses Included In Valuation",
"no_copy": 1, "no_copy": 1,
"options": "Account", "options": "Account",
"permlevel": 0, "permlevel": 0,
"read_only": 0 "read_only": 0
}, },
{ {
"description": "For reference only.", "description": "For reference only.",
"fieldname": "company_info", "fieldname": "company_info",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Company Info", "label": "Company Info",
"permlevel": 0, "permlevel": 0,
"read_only": 0 "read_only": 0
}, },
{ {
"fieldname": "address", "fieldname": "address",
"fieldtype": "Small Text", "fieldtype": "Small Text",
"label": "Address", "label": "Address",
"oldfieldname": "address", "oldfieldname": "address",
"oldfieldtype": "Small Text", "oldfieldtype": "Small Text",
"permlevel": 0, "permlevel": 0,
"read_only": 0 "read_only": 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%"
}, },
{ {
"fieldname": "phone_no", "fieldname": "phone_no",
"fieldtype": "Data", "fieldtype": "Data",
"label": "Phone No", "label": "Phone No",
"oldfieldname": "phone_no", "oldfieldname": "phone_no",
"oldfieldtype": "Data", "oldfieldtype": "Data",
"options": "Phone", "options": "Phone",
"permlevel": 0, "permlevel": 0,
"read_only": 0 "read_only": 0
}, },
{ {
"fieldname": "fax", "fieldname": "fax",
"fieldtype": "Data", "fieldtype": "Data",
"label": "Fax", "label": "Fax",
"oldfieldname": "fax", "oldfieldname": "fax",
"oldfieldtype": "Data", "oldfieldtype": "Data",
"options": "Phone", "options": "Phone",
"permlevel": 0, "permlevel": 0,
"read_only": 0 "read_only": 0
}, },
{ {
"fieldname": "email", "fieldname": "email",
"fieldtype": "Data", "fieldtype": "Data",
"label": "Email", "label": "Email",
"oldfieldname": "email", "oldfieldname": "email",
"oldfieldtype": "Data", "oldfieldtype": "Data",
"options": "Email", "options": "Email",
"permlevel": 0, "permlevel": 0,
"read_only": 0 "read_only": 0
}, },
{ {
"fieldname": "website", "fieldname": "website",
"fieldtype": "Data", "fieldtype": "Data",
"label": "Website", "label": "Website",
"oldfieldname": "website", "oldfieldname": "website",
"oldfieldtype": "Data", "oldfieldtype": "Data",
"permlevel": 0, "permlevel": 0,
"read_only": 0 "read_only": 0
}, },
{ {
"description": "Company registration numbers for your reference. Example: VAT Registration Numbers etc.", "description": "Company registration numbers for your reference. Example: VAT Registration Numbers etc.",
"fieldname": "registration_info", "fieldname": "registration_info",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Registration Info", "label": "Registration Info",
"oldfieldtype": "Section Break", "oldfieldtype": "Section Break",
"permlevel": 0, "permlevel": 0,
"read_only": 0, "read_only": 0,
"width": "50%" "width": "50%"
}, },
{ {
"description": "Company registration numbers for your reference. Tax numbers etc.", "description": "Company registration numbers for your reference. Tax numbers etc.",
"fieldname": "registration_details", "fieldname": "registration_details",
"fieldtype": "Code", "fieldtype": "Code",
"label": "Registration Details", "label": "Registration Details",
"oldfieldname": "registration_details", "oldfieldname": "registration_details",
"oldfieldtype": "Code", "oldfieldtype": "Code",
"permlevel": 0, "permlevel": 0,
"read_only": 0 "read_only": 0
} }
], ],
"icon": "icon-building", "icon": "icon-building",
"idx": 1, "idx": 1,
"modified": "2014-11-27 18:15:48.909416", "modified": "2014-12-15 11:14:12.090020",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Setup", "module": "Setup",
"name": "Company", "name": "Company",
"owner": "Administrator", "owner": "Administrator",
"permissions": [ "permissions": [
{ {
"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": "System Manager", "role": "System 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,
"role": "All" "role": "All"
} }
] ]
} }