mirror of
https://github.com/frappe/erpnext.git
synced 2026-09-18 10:57:56 +00:00
[ux] fixed primary action
This commit is contained in:
committed by
Anand Doshi
parent
d91cefb23d
commit
995185d02d
@@ -4,8 +4,6 @@
|
||||
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
||||
if(doc.abbr && !doc.__islocal) {
|
||||
cur_frm.set_df_property("abbr", "read_only", 1);
|
||||
if(in_list(user_roles, "System Manager"))
|
||||
cur_frm.add_custom_button("Replace Abbreviation", cur_frm.cscript.replace_abbr)
|
||||
}
|
||||
|
||||
if(!doc.__islocal) {
|
||||
@@ -14,7 +12,7 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.cscript.replace_abbr = function() {
|
||||
cur_frm.cscript.change_abbr = function() {
|
||||
var dialog = new frappe.ui.Dialog({
|
||||
title: "Replace Abbr",
|
||||
fields: [
|
||||
|
||||
@@ -39,6 +39,13 @@
|
||||
"read_only": 0,
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"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",
|
||||
@@ -349,7 +356,7 @@
|
||||
],
|
||||
"icon": "icon-building",
|
||||
"idx": 1,
|
||||
"modified": "2014-07-17 19:30:24.487672",
|
||||
"modified": "2014-08-07 05:20:47.711849",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Setup",
|
||||
"name": "Company",
|
||||
|
||||
@@ -35,12 +35,12 @@ class Company(Document):
|
||||
self.default_currency != self.previous_default_currency and \
|
||||
self.check_if_transactions_exist():
|
||||
frappe.throw(_("Cannot change company's default currency, because there are existing transactions. Transactions must be cancelled to change the default currency."))
|
||||
|
||||
|
||||
self.validate_default_accounts()
|
||||
|
||||
|
||||
def validate_default_accounts(self):
|
||||
for field in ["default_bank_account", "default_cash_account", "receivables_group", "payables_group",
|
||||
"default_expense_account", "default_income_account", "stock_received_but_not_billed",
|
||||
for field in ["default_bank_account", "default_cash_account", "receivables_group", "payables_group",
|
||||
"default_expense_account", "default_income_account", "stock_received_but_not_billed",
|
||||
"stock_adjustment_account", "expenses_included_in_valuation"]:
|
||||
if self.get(field):
|
||||
for_company = frappe.db.get_value("Account", self.get(field), "company")
|
||||
@@ -127,7 +127,7 @@ class Company(Document):
|
||||
_set_default_account("expenses_included_in_valuation", "Expenses Included In Valuation")
|
||||
|
||||
if not self.default_income_account:
|
||||
self.db_set("default_income_account", frappe.db.get_value("Account",
|
||||
self.db_set("default_income_account", frappe.db.get_value("Account",
|
||||
{"account_name": _("Sales"), "company": self.name}))
|
||||
|
||||
def create_default_cost_center(self):
|
||||
@@ -277,6 +277,8 @@ class Company(Document):
|
||||
|
||||
@frappe.whitelist()
|
||||
def replace_abbr(company, old, new):
|
||||
frappe.only_for("System Manager")
|
||||
|
||||
frappe.db.set_value("Company", company, "abbr", new)
|
||||
|
||||
def _rename_record(dt):
|
||||
|
||||
@@ -28,7 +28,7 @@ cur_frm.cscript.refresh = function(doc, dt, dn) {
|
||||
} else {
|
||||
msgprint(save_msg);
|
||||
}
|
||||
}, 1);
|
||||
}, "icon-eye-open", "btn-default");
|
||||
cur_frm.add_custom_button(__('Send Now'), function() {
|
||||
doc = locals[dt][dn];
|
||||
if(doc.__unsaved != 1) {
|
||||
@@ -44,7 +44,7 @@ cur_frm.cscript.refresh = function(doc, dt, dn) {
|
||||
} else {
|
||||
msgprint(save_msg);
|
||||
}
|
||||
}, 1);
|
||||
}, "icon-envelope", "btn-default");
|
||||
}
|
||||
|
||||
cur_frm.cscript.addremove_recipients = function(doc, dt, dn) {
|
||||
|
||||
Reference in New Issue
Block a user