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
frappe.ui.form.on('Accounting Dimension', {
refresh: function(frm) {
frm.set_query('document_type', () => {
let invalid_doctypes = frappe.model.core_doctypes_list;

View File

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

View File

@ -2,10 +2,15 @@
// For license information, please see license.txt
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) {
frm.set_query('applicable_on_account', 'accounts', function() {
return {
filters : {
filters: {
'company': frm.doc.company
}
};

View File

@ -7,10 +7,10 @@
"engine": "InnoDB",
"field_order": [
"accounting_dimension",
"allow_or_restrict",
"disabled",
"column_break_2",
"company",
"disabled",
"allow_or_restrict",
"section_break_4",
"accounts",
"column_break_6",
@ -57,7 +57,7 @@
{
"fieldname": "accounts",
"fieldtype": "Table",
"label": "Accounts",
"label": "Applicable On Account",
"options": "Applicable On Account",
"reqd": 1,
"show_days": 1,
@ -67,7 +67,7 @@
"depends_on": "eval:doc.accounting_dimension",
"fieldname": "dimensions",
"fieldtype": "Table",
"label": "Dimensions",
"label": "Applicable Dimension",
"options": "Allowed Dimension",
"reqd": 1,
"show_days": 1,
@ -93,7 +93,7 @@
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2020-11-16 17:27:40.292860",
"modified": "2020-11-24 12:34:42.458713",
"modified_by": "Administrator",
"module": "Accounts",
"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)))
def get_dimension_filter_map():
filters = frappe.db.sql(
""" SELECT
a.applicable_on_account, d.dimension_value, p.accounting_dimension,
p.allow_or_restrict, a.is_mandatory
FROM
`tabApplicable On Account` a, `tabAllowed Dimension` d,
`tabAccounting Dimension Filter` p
WHERE
p.name = a.parent
AND p.disabled = 0
AND p.name = d.parent
""", as_dict=1)
filters = frappe.db.sql("""
SELECT
a.applicable_on_account, d.dimension_value, p.accounting_dimension,
p.allow_or_restrict, a.is_mandatory
FROM
`tabApplicable On Account` a, `tabAllowed Dimension` d,
`tabAccounting Dimension Filter` p
WHERE
p.name = a.parent
AND p.disabled = 0
AND p.name = d.parent
""", as_dict=1)
dimension_filter_map = {}