Skip to content

Commit

Permalink
Merge branch 'develop' into expense_account_pr
Browse files Browse the repository at this point in the history
  • Loading branch information
s-aga-r committed Aug 18, 2022
2 parents 46bcd73 + 8704ca7 commit f1d450d
Show file tree
Hide file tree
Showing 7 changed files with 137 additions and 7 deletions.
4 changes: 4 additions & 0 deletions erpnext/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,10 @@
"Purchase Order",
"Purchase Receipt",
"Sales Order",
"Subcontracting Order",
"Subcontracting Order Item",
"Subcontracting Receipt",
"Subcontracting Receipt Item",
]

# get matching queries for Bank Reconciliation
Expand Down
3 changes: 2 additions & 1 deletion erpnext/patches.txt
Original file line number Diff line number Diff line change
Expand Up @@ -310,4 +310,5 @@ erpnext.patches.v14_0.crm_ux_cleanup
erpnext.patches.v14_0.remove_india_localisation # 14-07-2022
erpnext.patches.v13_0.fix_number_and_frequency_for_monthly_depreciation
erpnext.patches.v14_0.remove_hr_and_payroll_modules # 20-07-2022
erpnext.patches.v14_0.fix_crm_no_of_employees
erpnext.patches.v14_0.fix_crm_no_of_employees
erpnext.patches.v14_0.create_accounting_dimensions_in_subcontracting_doctypes
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
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 [
"Subcontracting Order",
"Subcontracting Order Item",
"Subcontracting Receipt",
"Subcontracting Receipt Item",
]:

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,
}

try:
create_custom_field(doctype, df, ignore_validate=True)
frappe.clear_cache(doctype=doctype)
except Exception:
pass

count += 1
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
"transaction_date",
"schedule_date",
"amended_from",
"accounting_dimensions_section",
"cost_center",
"dimension_col_break",
"project",
"address_and_contact_section",
"supplier_address",
"address_display",
Expand Down Expand Up @@ -422,12 +426,34 @@
"fieldtype": "Select",
"label": "Distribute Additional Costs Based On ",
"options": "Qty\nAmount"
},
{
"collapsible": 1,
"fieldname": "accounting_dimensions_section",
"fieldtype": "Section Break",
"label": "Accounting Dimensions"
},
{
"fieldname": "cost_center",
"fieldtype": "Link",
"label": "Cost Center",
"options": "Cost Center"
},
{
"fieldname": "dimension_col_break",
"fieldtype": "Column Break"
},
{
"fieldname": "project",
"fieldtype": "Link",
"label": "Project",
"options": "Project"
}
],
"icon": "fa fa-file-text",
"is_submittable": 1,
"links": [],
"modified": "2022-04-11 21:02:44.097841",
"modified": "2022-08-15 14:08:49.204218",
"modified_by": "Administrator",
"module": "Subcontracting",
"name": "Subcontracting Order",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@
"manufacture_section",
"manufacturer",
"manufacturer_part_no",
"accounting_dimensions_section",
"cost_center",
"dimension_col_break",
"project",
"section_break_34",
"page_break"
],
Expand Down Expand Up @@ -304,13 +308,35 @@
"no_copy": 1,
"print_hide": 1,
"read_only": 1
},
{
"collapsible": 1,
"fieldname": "accounting_dimensions_section",
"fieldtype": "Section Break",
"label": "Accounting Dimensions"
},
{
"fieldname": "cost_center",
"fieldtype": "Link",
"label": "Cost Center",
"options": "Cost Center"
},
{
"fieldname": "dimension_col_break",
"fieldtype": "Column Break"
},
{
"fieldname": "project",
"fieldtype": "Link",
"label": "Project",
"options": "Project"
}
],
"idx": 1,
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2022-04-11 21:28:06.585338",
"modified": "2022-08-15 14:25:45.177703",
"modified_by": "Administrator",
"module": "Subcontracting",
"name": "Subcontracting Order Item",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
"posting_time",
"is_return",
"return_against",
"accounting_dimensions_section",
"cost_center",
"dimension_col_break",
"project",
"section_addresses",
"supplier_address",
"contact_person",
Expand Down Expand Up @@ -569,11 +573,33 @@
{
"fieldname": "section_break_47",
"fieldtype": "Section Break"
},
{
"collapsible": 1,
"fieldname": "accounting_dimensions_section",
"fieldtype": "Section Break",
"label": "Accounting Dimensions "
},
{
"fieldname": "cost_center",
"fieldtype": "Link",
"label": "Cost Center",
"options": "Cost Center"
},
{
"fieldname": "dimension_col_break",
"fieldtype": "Column Break"
},
{
"fieldname": "project",
"fieldtype": "Link",
"label": "Project",
"options": "Project"
}
],
"is_submittable": 1,
"links": [],
"modified": "2022-04-18 13:15:12.011682",
"modified": "2022-08-15 14:30:29.447307",
"modified_by": "Administrator",
"module": "Subcontracting",
"name": "Subcontracting Receipt",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@
"accounting_details_section",
"expense_account",
"accounting_dimensions_section",
"project",
"dimension_col_break",
"cost_center",
"dimension_col_break",
"project",
"section_break_80",
"page_break"
],
Expand Down Expand Up @@ -465,7 +465,7 @@
"idx": 1,
"istable": 1,
"links": [],
"modified": "2022-08-15 11:34:00.970042",
"modified": "2022-08-15 14:51:10.613347",
"modified_by": "Administrator",
"module": "Subcontracting",
"name": "Subcontracting Receipt Item",
Expand Down

0 comments on commit f1d450d

Please sign in to comment.