Add root account
This commit is contained in:
parent
3edc453506
commit
a1ec7f1eed
@ -232,7 +232,7 @@ erpnext.AccountsChart = Class.extend({
|
|||||||
$(fd.tax_rate.wrapper).toggle(false);
|
$(fd.tax_rate.wrapper).toggle(false);
|
||||||
$(fd.warehouse.wrapper).toggle(false);
|
$(fd.warehouse.wrapper).toggle(false);
|
||||||
} else {
|
} else {
|
||||||
$(fd.account_type.wrapper).toggle(true);
|
$(fd.account_type.wrapper).toggle(node.root ? false : true);
|
||||||
fd.account_type.$input.trigger("change");
|
fd.account_type.$input.trigger("change");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -243,9 +243,6 @@ erpnext.AccountsChart = Class.extend({
|
|||||||
$(fd.warehouse.wrapper).toggle(fd.account_type.get_value()==='Warehouse');
|
$(fd.warehouse.wrapper).toggle(fd.account_type.get_value()==='Warehouse');
|
||||||
})
|
})
|
||||||
|
|
||||||
// root type if root
|
|
||||||
$(fd.root_type.wrapper).toggle(node.root);
|
|
||||||
|
|
||||||
// create
|
// create
|
||||||
d.set_primary_action(__("Create New"), function() {
|
d.set_primary_action(__("Create New"), function() {
|
||||||
var btn = this;
|
var btn = this;
|
||||||
@ -262,10 +259,10 @@ erpnext.AccountsChart = Class.extend({
|
|||||||
v.company = me.company;
|
v.company = me.company;
|
||||||
|
|
||||||
if(node.root) {
|
if(node.root) {
|
||||||
v.is_root = true;
|
v.is_root = 1;
|
||||||
v.parent_account = null;
|
v.parent_account = null;
|
||||||
} else {
|
} else {
|
||||||
v.is_root = false;
|
v.is_root = 0;
|
||||||
v.root_type = null;
|
v.root_type = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -289,6 +286,11 @@ erpnext.AccountsChart = Class.extend({
|
|||||||
}
|
}
|
||||||
|
|
||||||
$(fd.is_group.input).prop("checked", false).change();
|
$(fd.is_group.input).prop("checked", false).change();
|
||||||
|
|
||||||
|
// In case of root, show root type and hide account_type, is_group
|
||||||
|
$(fd.root_type.wrapper).toggle(node.root);
|
||||||
|
$(fd.is_group.wrapper).toggle(!node.root);
|
||||||
|
|
||||||
d.show();
|
d.show();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import frappe
|
import frappe
|
||||||
from frappe.utils import nowdate, cstr, flt, now, getdate, add_months
|
from frappe.utils import nowdate, cstr, flt, cint, now, getdate, add_months
|
||||||
from frappe import throw, _
|
from frappe import throw, _
|
||||||
from frappe.utils import formatdate
|
from frappe.utils import formatdate
|
||||||
import frappe.desk.reportview
|
import frappe.desk.reportview
|
||||||
@ -134,7 +134,8 @@ def add_ac(args=None):
|
|||||||
ac.update(args)
|
ac.update(args)
|
||||||
ac.old_parent = ""
|
ac.old_parent = ""
|
||||||
ac.freeze_account = "No"
|
ac.freeze_account = "No"
|
||||||
if ac.get("is_root"):
|
if cint(ac.get("is_root")):
|
||||||
|
ac.parent_account = None
|
||||||
ac.flags.ignore_mandatory = True
|
ac.flags.ignore_mandatory = True
|
||||||
ac.insert()
|
ac.insert()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user