fix: form layout and naming fixes

This commit is contained in:
Deepesh Garg 2020-11-25 13:44:52 +05:30
parent 6c17b84cae
commit df065f7044
5 changed files with 25 additions and 22 deletions

View File

@ -2,7 +2,6 @@
// For license information, please see license.txt // For license information, please see license.txt
frappe.ui.form.on('Accounting Dimension', { frappe.ui.form.on('Accounting Dimension', {
refresh: function(frm) { refresh: function(frm) {
frm.set_query('document_type', () => { frm.set_query('document_type', () => {
let invalid_doctypes = frappe.model.core_doctypes_list; let invalid_doctypes = frappe.model.core_doctypes_list;

View File

@ -203,7 +203,7 @@ def get_dimension_with_children(doctype, dimension):
return all_dimensions return all_dimensions
@frappe.whitelist() @frappe.whitelist()
def get_dimension_filters(with_costcenter_and_project=False): def get_dimensions(with_cost_center_and_project=False):
dimension_filters = frappe.db.sql(""" dimension_filters = frappe.db.sql("""
SELECT label, fieldname, document_type SELECT label, fieldname, document_type
FROM `tabAccounting Dimension` FROM `tabAccounting Dimension`
@ -214,7 +214,7 @@ def get_dimension_filters(with_costcenter_and_project=False):
FROM `tabAccounting Dimension Detail` c, `tabAccounting Dimension` p FROM `tabAccounting Dimension Detail` c, `tabAccounting Dimension` p
WHERE c.parent = p.name""", as_dict=1) WHERE c.parent = p.name""", as_dict=1)
if with_costcenter_and_project: if with_cost_center_and_project:
dimension_filters.extend([ dimension_filters.extend([
{ {
'fieldname': 'cost_center', 'fieldname': 'cost_center',

View File

@ -2,10 +2,15 @@
// For license information, please see license.txt // For license information, please see license.txt
frappe.ui.form.on('Accounting Dimension Filter', { frappe.ui.form.on('Accounting Dimension Filter', {
refresh: function(frm, cdt, cdn) {
if (frm.doc.accounting_dimension) {
frm.set_df_property('dimensions', 'label', frm.doc.accounting_dimension, cdn, 'dimension_value');
}
},
onload: function(frm) { onload: function(frm) {
frm.set_query('applicable_on_account', 'accounts', function() { frm.set_query('applicable_on_account', 'accounts', function() {
return { return {
filters : { filters: {
'company': frm.doc.company 'company': frm.doc.company
} }
}; };

View File

@ -7,10 +7,10 @@
"engine": "InnoDB", "engine": "InnoDB",
"field_order": [ "field_order": [
"accounting_dimension", "accounting_dimension",
"allow_or_restrict", "disabled",
"column_break_2", "column_break_2",
"company", "company",
"disabled", "allow_or_restrict",
"section_break_4", "section_break_4",
"accounts", "accounts",
"column_break_6", "column_break_6",
@ -57,7 +57,7 @@
{ {
"fieldname": "accounts", "fieldname": "accounts",
"fieldtype": "Table", "fieldtype": "Table",
"label": "Accounts", "label": "Applicable On Account",
"options": "Applicable On Account", "options": "Applicable On Account",
"reqd": 1, "reqd": 1,
"show_days": 1, "show_days": 1,
@ -67,7 +67,7 @@
"depends_on": "eval:doc.accounting_dimension", "depends_on": "eval:doc.accounting_dimension",
"fieldname": "dimensions", "fieldname": "dimensions",
"fieldtype": "Table", "fieldtype": "Table",
"label": "Dimensions", "label": "Applicable Dimension",
"options": "Allowed Dimension", "options": "Allowed Dimension",
"reqd": 1, "reqd": 1,
"show_days": 1, "show_days": 1,
@ -93,7 +93,7 @@
], ],
"index_web_pages_for_search": 1, "index_web_pages_for_search": 1,
"links": [], "links": [],
"modified": "2020-11-16 17:27:40.292860", "modified": "2020-11-24 12:34:42.458713",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Accounting Dimension Filter", "name": "Accounting Dimension Filter",

View File

@ -29,19 +29,18 @@ class AccountingDimensionFilter(Document):
account.idx, frappe.bold(account.applicable_on_account), frappe.bold(self.accounting_dimension))) account.idx, frappe.bold(account.applicable_on_account), frappe.bold(self.accounting_dimension)))
def get_dimension_filter_map(): def get_dimension_filter_map():
filters = frappe.db.sql( filters = frappe.db.sql("""
""" SELECT SELECT
a.applicable_on_account, d.dimension_value, p.accounting_dimension, a.applicable_on_account, d.dimension_value, p.accounting_dimension,
p.allow_or_restrict, a.is_mandatory p.allow_or_restrict, a.is_mandatory
FROM FROM
`tabApplicable On Account` a, `tabAllowed Dimension` d, `tabApplicable On Account` a, `tabAllowed Dimension` d,
`tabAccounting Dimension Filter` p `tabAccounting Dimension Filter` p
WHERE WHERE
p.name = a.parent p.name = a.parent
AND p.disabled = 0 AND p.disabled = 0
AND p.name = d.parent AND p.name = d.parent
""", as_dict=1)
""", as_dict=1)
dimension_filter_map = {} dimension_filter_map = {}