fix: Usability fixes in accounting dimensions
This commit is contained in:
parent
5ea542b08b
commit
a85db66146
@ -38,6 +38,7 @@
|
||||
"default": "0",
|
||||
"fieldname": "disabled",
|
||||
"fieldtype": "Check",
|
||||
"hidden": 1,
|
||||
"label": "Disable",
|
||||
"read_only": 1
|
||||
},
|
||||
@ -54,7 +55,7 @@
|
||||
"label": "Mandatory For Profit and Loss Account"
|
||||
}
|
||||
],
|
||||
"modified": "2019-07-07 18:56:19.517450",
|
||||
"modified": "2019-07-14 17:25:01.307948",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Accounting Dimension",
|
||||
|
@ -155,7 +155,7 @@ def get_doctypes_with_dimensions():
|
||||
return doclist
|
||||
|
||||
def get_accounting_dimensions(as_list=True):
|
||||
accounting_dimensions = frappe.get_all("Accounting Dimension", fields=["label", "fieldname", "mandatory_for_pl", "mandatory_for_bs", "disabled"])
|
||||
accounting_dimensions = frappe.get_all("Accounting Dimension", fields=["label", "fieldname", "mandatory_for_pl", "mandatory_for_bs", "disabled"], filters={"disabled": 0})
|
||||
|
||||
if as_list:
|
||||
return [d.fieldname for d in accounting_dimensions]
|
||||
|
@ -91,13 +91,13 @@ class GLEntry(Document):
|
||||
if account_type == "Profit and Loss" \
|
||||
and dimension.mandatory_for_pl and not dimension.disabled:
|
||||
if not self.get(dimension.fieldname):
|
||||
frappe.throw(_("{0} is required for 'Profit and Loss' account {1}.")
|
||||
frappe.throw(_("Accounitng Dimension <b>{0}</b> is required for 'Profit and Loss' account {1}.")
|
||||
.format(dimension.label, self.account))
|
||||
|
||||
if account_type == "Balance Sheet" \
|
||||
and dimension.mandatory_for_bs and not dimension.disabled:
|
||||
if not self.get(dimension.fieldname):
|
||||
frappe.throw(_("{0} is required for 'Balance Sheet' account {1}.")
|
||||
frappe.throw(_("Accounitng Dimension <b>{0}</b> is required for 'Balance Sheet' account {1}.")
|
||||
.format(dimension.label, self.account))
|
||||
|
||||
|
||||
|
@ -620,3 +620,4 @@ execute:frappe.delete_doc("DocType", "Project Task")
|
||||
erpnext.patches.v11_1.update_default_supplier_in_item_defaults
|
||||
erpnext.patches.v12_0.update_due_date_in_gle
|
||||
erpnext.patches.v12_0.add_default_buying_selling_terms_in_company
|
||||
erpnext.patches.v12_0.update_ewaybill_field_position
|
||||
|
27
erpnext/patches/v12_0/update_ewaybill_field_position.py
Normal file
27
erpnext/patches/v12_0/update_ewaybill_field_position.py
Normal file
@ -0,0 +1,27 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from erpnext.regional.india.setup import make_custom_fields
|
||||
|
||||
def execute():
|
||||
company = frappe.get_all('Company', filters = {'country': 'India'})
|
||||
|
||||
if not company:
|
||||
return
|
||||
|
||||
field = frappe.db.get_value("Custom Field", {"dt": "Sales Invoice", "fieldname": "ewaybill"})
|
||||
|
||||
ewaybill_field = frappe.get_doc("Custom Field", field)
|
||||
|
||||
ewaybill_field.flags.ignore_validate = True
|
||||
|
||||
ewaybill_field.update({
|
||||
'fieldname': 'ewaybill',
|
||||
'label': 'e-Way Bill No.',
|
||||
'fieldtype': 'Data',
|
||||
'depends_on': 'eval:(doc.docstatus === 1)',
|
||||
'allow_on_submit': 1,
|
||||
'insert_after': 'tax_id',
|
||||
'translatable': 0
|
||||
})
|
||||
|
||||
ewaybill_field.save()
|
@ -354,7 +354,7 @@ def make_custom_fields(update=True):
|
||||
'fieldtype': 'Data',
|
||||
'depends_on': 'eval:(doc.docstatus === 1)',
|
||||
'allow_on_submit': 1,
|
||||
'insert_after': 'project',
|
||||
'insert_after': 'tax_id',
|
||||
'translatable': 0
|
||||
}
|
||||
]
|
||||
|
@ -33,3 +33,14 @@ frappe.query_reports["Customer Credit Balance"] = {
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
erpnext.dimension_filters.then((dimensions) => {
|
||||
dimensions.forEach((dimension) => {
|
||||
frappe.query_reports["Customer Credit Balance"].filters.push({
|
||||
"fieldname": dimension["fieldname"],
|
||||
"label": __(dimension["label"]),
|
||||
"fieldtype": "Link",
|
||||
"options": dimension["document_type"]
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -6,6 +6,7 @@ import frappe
|
||||
from frappe import _
|
||||
from frappe.utils import flt
|
||||
from erpnext.selling.doctype.customer.customer import get_customer_outstanding, get_credit_limit
|
||||
from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import get_accounting_dimensions
|
||||
|
||||
def execute(filters=None):
|
||||
if not filters: filters = {}
|
||||
@ -13,6 +14,12 @@ def execute(filters=None):
|
||||
customer_naming_type = frappe.db.get_value("Selling Settings", None, "cust_master_name")
|
||||
columns = get_columns(customer_naming_type)
|
||||
|
||||
accounting_dimensions = get_accounting_dimensions()
|
||||
|
||||
if accounting_dimensions:
|
||||
for dimension in accounting_dimensions:
|
||||
additional_conditions += """ and {0} in (%({0})s) """.format(dimension)
|
||||
|
||||
data = []
|
||||
|
||||
customer_list = get_details(filters)
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user