Merge pull request #30806 from deepeshgarg007/accounting_dimension_consistency
fix: Consistent accounting dimensions across Sales and Purchase docs
This commit is contained in:
commit
6a953d9297
@ -23,6 +23,10 @@
|
|||||||
"order_confirmation_no",
|
"order_confirmation_no",
|
||||||
"order_confirmation_date",
|
"order_confirmation_date",
|
||||||
"amended_from",
|
"amended_from",
|
||||||
|
"accounting_dimensions_section",
|
||||||
|
"cost_center",
|
||||||
|
"dimension_col_break",
|
||||||
|
"project",
|
||||||
"drop_ship",
|
"drop_ship",
|
||||||
"customer",
|
"customer",
|
||||||
"customer_name",
|
"customer_name",
|
||||||
@ -1137,16 +1141,39 @@
|
|||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"label": "Tax Withholding Category",
|
"label": "Tax Withholding Category",
|
||||||
"options": "Tax Withholding Category"
|
"options": "Tax Withholding Category"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"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",
|
"icon": "fa fa-file-text",
|
||||||
"idx": 105,
|
"idx": 105,
|
||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2021-09-28 13:10:47.955401",
|
"modified": "2022-04-26 12:16:38.694276",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Buying",
|
"module": "Buying",
|
||||||
"name": "Purchase Order",
|
"name": "Purchase Order",
|
||||||
|
"naming_rule": "By \"Naming Series\" field",
|
||||||
"owner": "Administrator",
|
"owner": "Administrator",
|
||||||
"permissions": [
|
"permissions": [
|
||||||
{
|
{
|
||||||
@ -1193,6 +1220,7 @@
|
|||||||
"show_name_in_global_search": 1,
|
"show_name_in_global_search": 1,
|
||||||
"sort_field": "modified",
|
"sort_field": "modified",
|
||||||
"sort_order": "DESC",
|
"sort_order": "DESC",
|
||||||
|
"states": [],
|
||||||
"timeline_field": "supplier",
|
"timeline_field": "supplier",
|
||||||
"title_field": "supplier_name",
|
"title_field": "supplier_name",
|
||||||
"track_changes": 1
|
"track_changes": 1
|
||||||
|
@ -551,6 +551,9 @@ accounting_dimension_doctypes = [
|
|||||||
"Subscription Plan",
|
"Subscription Plan",
|
||||||
"POS Invoice",
|
"POS Invoice",
|
||||||
"POS Invoice Item",
|
"POS Invoice Item",
|
||||||
|
"Purchase Order",
|
||||||
|
"Purchase Receipt",
|
||||||
|
"Sales Order",
|
||||||
]
|
]
|
||||||
|
|
||||||
regional_overrides = {
|
regional_overrides = {
|
||||||
|
@ -367,3 +367,4 @@ erpnext.patches.v13_0.create_gst_custom_fields_in_quotation
|
|||||||
erpnext.patches.v13_0.copy_custom_field_filters_to_website_item
|
erpnext.patches.v13_0.copy_custom_field_filters_to_website_item
|
||||||
erpnext.patches.v14_0.discount_accounting_separation
|
erpnext.patches.v14_0.discount_accounting_separation
|
||||||
erpnext.patches.v14_0.delete_employee_transfer_property_doctype
|
erpnext.patches.v14_0.delete_employee_transfer_property_doctype
|
||||||
|
erpnext.patches.v13_0.create_accounting_dimensions_in_orders
|
@ -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
|
@ -25,6 +25,10 @@
|
|||||||
"po_no",
|
"po_no",
|
||||||
"po_date",
|
"po_date",
|
||||||
"tax_id",
|
"tax_id",
|
||||||
|
"accounting_dimensions_section",
|
||||||
|
"cost_center",
|
||||||
|
"dimension_col_break",
|
||||||
|
"project",
|
||||||
"contact_info",
|
"contact_info",
|
||||||
"customer_address",
|
"customer_address",
|
||||||
"address_display",
|
"address_display",
|
||||||
@ -113,7 +117,6 @@
|
|||||||
"is_internal_customer",
|
"is_internal_customer",
|
||||||
"represents_company",
|
"represents_company",
|
||||||
"inter_company_order_reference",
|
"inter_company_order_reference",
|
||||||
"project",
|
|
||||||
"party_account_currency",
|
"party_account_currency",
|
||||||
"column_break_77",
|
"column_break_77",
|
||||||
"source",
|
"source",
|
||||||
@ -1522,13 +1525,29 @@
|
|||||||
"label": "% Picked",
|
"label": "% Picked",
|
||||||
"no_copy": 1,
|
"no_copy": 1,
|
||||||
"read_only": 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"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"icon": "fa fa-file-text",
|
"icon": "fa fa-file-text",
|
||||||
"idx": 105,
|
"idx": 105,
|
||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2022-04-21 08:16:48.316074",
|
"modified": "2022-04-26 14:38:18.350207",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Selling",
|
"module": "Selling",
|
||||||
"name": "Sales Order",
|
"name": "Sales Order",
|
||||||
|
@ -23,6 +23,10 @@
|
|||||||
"is_return",
|
"is_return",
|
||||||
"issue_credit_note",
|
"issue_credit_note",
|
||||||
"return_against",
|
"return_against",
|
||||||
|
"accounting_dimensions_section",
|
||||||
|
"cost_center",
|
||||||
|
"dimension_col_break",
|
||||||
|
"project",
|
||||||
"customer_po_details",
|
"customer_po_details",
|
||||||
"po_no",
|
"po_no",
|
||||||
"column_break_17",
|
"column_break_17",
|
||||||
@ -115,7 +119,6 @@
|
|||||||
"driver_name",
|
"driver_name",
|
||||||
"lr_date",
|
"lr_date",
|
||||||
"more_info",
|
"more_info",
|
||||||
"project",
|
|
||||||
"campaign",
|
"campaign",
|
||||||
"source",
|
"source",
|
||||||
"column_break5",
|
"column_break5",
|
||||||
@ -1309,13 +1312,29 @@
|
|||||||
"fieldtype": "Currency",
|
"fieldtype": "Currency",
|
||||||
"label": "Amount Eligible for Commission",
|
"label": "Amount Eligible for Commission",
|
||||||
"read_only": 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"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"icon": "fa fa-truck",
|
"icon": "fa fa-truck",
|
||||||
"idx": 146,
|
"idx": 146,
|
||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2022-03-10 14:29:13.428984",
|
"modified": "2022-04-26 14:48:08.781837",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Stock",
|
"module": "Stock",
|
||||||
"name": "Delivery Note",
|
"name": "Delivery Note",
|
||||||
@ -1380,6 +1399,7 @@
|
|||||||
"show_name_in_global_search": 1,
|
"show_name_in_global_search": 1,
|
||||||
"sort_field": "modified",
|
"sort_field": "modified",
|
||||||
"sort_order": "DESC",
|
"sort_order": "DESC",
|
||||||
|
"states": [],
|
||||||
"timeline_field": "customer",
|
"timeline_field": "customer",
|
||||||
"title_field": "title",
|
"title_field": "title",
|
||||||
"track_changes": 1,
|
"track_changes": 1,
|
||||||
|
@ -24,6 +24,10 @@
|
|||||||
"apply_putaway_rule",
|
"apply_putaway_rule",
|
||||||
"is_return",
|
"is_return",
|
||||||
"return_against",
|
"return_against",
|
||||||
|
"accounting_dimensions_section",
|
||||||
|
"cost_center",
|
||||||
|
"dimension_col_break",
|
||||||
|
"project",
|
||||||
"section_addresses",
|
"section_addresses",
|
||||||
"supplier_address",
|
"supplier_address",
|
||||||
"contact_person",
|
"contact_person",
|
||||||
@ -107,7 +111,6 @@
|
|||||||
"bill_no",
|
"bill_no",
|
||||||
"bill_date",
|
"bill_date",
|
||||||
"more_info",
|
"more_info",
|
||||||
"project",
|
|
||||||
"status",
|
"status",
|
||||||
"amended_from",
|
"amended_from",
|
||||||
"range",
|
"range",
|
||||||
@ -1143,13 +1146,29 @@
|
|||||||
"label": "Represents Company",
|
"label": "Represents Company",
|
||||||
"options": "Company",
|
"options": "Company",
|
||||||
"read_only": 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"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"icon": "fa fa-truck",
|
"icon": "fa fa-truck",
|
||||||
"idx": 261,
|
"idx": 261,
|
||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2022-04-10 22:50:37.761362",
|
"modified": "2022-04-26 13:41:32.625197",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Stock",
|
"module": "Stock",
|
||||||
"name": "Purchase Receipt",
|
"name": "Purchase Receipt",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user