mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-31 10:49:09 +00:00
Merge branch 'develop' into education_sepration
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
import frappe
|
||||
from frappe.custom.doctype.custom_field.custom_field import create_custom_field
|
||||
|
||||
|
||||
def execute():
|
||||
accounting_dimensions = frappe.db.get_all(
|
||||
"Accounting Dimension", fields=["fieldname", "label", "document_type", "disabled"]
|
||||
)
|
||||
|
||||
if not accounting_dimensions:
|
||||
return
|
||||
|
||||
count = 1
|
||||
for d in accounting_dimensions:
|
||||
|
||||
if count % 2 == 0:
|
||||
insert_after_field = "dimension_col_break"
|
||||
else:
|
||||
insert_after_field = "accounting_dimensions_section"
|
||||
|
||||
for doctype in ["Purchase Order", "Purchase Receipt", "Sales Order"]:
|
||||
|
||||
field = frappe.db.get_value("Custom Field", {"dt": doctype, "fieldname": d.fieldname})
|
||||
|
||||
if field:
|
||||
continue
|
||||
|
||||
df = {
|
||||
"fieldname": d.fieldname,
|
||||
"label": d.label,
|
||||
"fieldtype": "Link",
|
||||
"options": d.document_type,
|
||||
"insert_after": insert_after_field,
|
||||
}
|
||||
|
||||
create_custom_field(doctype, df, ignore_validate=False)
|
||||
frappe.clear_cache(doctype=doctype)
|
||||
|
||||
count += 1
|
||||
@@ -2,8 +2,10 @@ import frappe
|
||||
|
||||
|
||||
def execute():
|
||||
doc = frappe.get_doc("Accounts Settings")
|
||||
discount_account = doc.enable_discount_accounting
|
||||
data = frappe.db.sql(
|
||||
'select value from tabSingles where doctype="Accounts Settings" and field="enable_discount_accounting"'
|
||||
)
|
||||
discount_account = data and int(data[0][0]) or 0
|
||||
if discount_account:
|
||||
for doctype in ["Buying Settings", "Selling Settings"]:
|
||||
frappe.db.set_value(doctype, doctype, "enable_discount_accounting", 1, update_modified=False)
|
||||
|
||||
Reference in New Issue
Block a user