mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-25 07:54:46 +00:00
chore: migrate Address/Contact custom fields from JSON fixtures to install (backport #55084) (#55087)
fixtures to install (backport #55084)
This commit is contained in:
@@ -1,126 +0,0 @@
|
|||||||
{
|
|
||||||
"custom_fields": [
|
|
||||||
{
|
|
||||||
"_assign": null,
|
|
||||||
"_comments": null,
|
|
||||||
"_liked_by": null,
|
|
||||||
"_user_tags": null,
|
|
||||||
"allow_in_quick_entry": 0,
|
|
||||||
"allow_on_submit": 0,
|
|
||||||
"bold": 0,
|
|
||||||
"collapsible": 0,
|
|
||||||
"collapsible_depends_on": null,
|
|
||||||
"columns": 0,
|
|
||||||
"creation": "2018-12-28 22:29:21.828090",
|
|
||||||
"default": null,
|
|
||||||
"depends_on": null,
|
|
||||||
"description": null,
|
|
||||||
"docstatus": 0,
|
|
||||||
"dt": "Address",
|
|
||||||
"fetch_from": null,
|
|
||||||
"fetch_if_empty": 0,
|
|
||||||
"fieldname": "tax_category",
|
|
||||||
"fieldtype": "Link",
|
|
||||||
"hidden": 0,
|
|
||||||
"hide_border": 0,
|
|
||||||
"hide_days": 0,
|
|
||||||
"hide_seconds": 0,
|
|
||||||
"idx": 15,
|
|
||||||
"ignore_user_permissions": 0,
|
|
||||||
"ignore_xss_filter": 0,
|
|
||||||
"in_global_search": 0,
|
|
||||||
"in_list_view": 0,
|
|
||||||
"in_preview": 0,
|
|
||||||
"in_standard_filter": 0,
|
|
||||||
"insert_after": "fax",
|
|
||||||
"label": "Tax Category",
|
|
||||||
"length": 0,
|
|
||||||
"mandatory_depends_on": null,
|
|
||||||
"modified": "2018-12-28 22:29:21.828090",
|
|
||||||
"modified_by": "Administrator",
|
|
||||||
"name": "Address-tax_category",
|
|
||||||
"no_copy": 0,
|
|
||||||
"options": "Tax Category",
|
|
||||||
"owner": "Administrator",
|
|
||||||
"parent": null,
|
|
||||||
"parentfield": null,
|
|
||||||
"parenttype": null,
|
|
||||||
"permlevel": 0,
|
|
||||||
"precision": "",
|
|
||||||
"print_hide": 0,
|
|
||||||
"print_hide_if_no_value": 0,
|
|
||||||
"print_width": null,
|
|
||||||
"read_only": 0,
|
|
||||||
"read_only_depends_on": null,
|
|
||||||
"report_hide": 0,
|
|
||||||
"reqd": 0,
|
|
||||||
"search_index": 0,
|
|
||||||
"translatable": 0,
|
|
||||||
"unique": 0,
|
|
||||||
"width": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"_assign": null,
|
|
||||||
"_comments": null,
|
|
||||||
"_liked_by": null,
|
|
||||||
"_user_tags": null,
|
|
||||||
"allow_in_quick_entry": 0,
|
|
||||||
"allow_on_submit": 0,
|
|
||||||
"bold": 0,
|
|
||||||
"collapsible": 0,
|
|
||||||
"collapsible_depends_on": null,
|
|
||||||
"columns": 0,
|
|
||||||
"creation": "2020-10-14 17:41:40.878179",
|
|
||||||
"default": "0",
|
|
||||||
"depends_on": null,
|
|
||||||
"description": null,
|
|
||||||
"docstatus": 0,
|
|
||||||
"dt": "Address",
|
|
||||||
"fetch_from": null,
|
|
||||||
"fetch_if_empty": 0,
|
|
||||||
"fieldname": "is_your_company_address",
|
|
||||||
"fieldtype": "Check",
|
|
||||||
"hidden": 0,
|
|
||||||
"hide_border": 0,
|
|
||||||
"hide_days": 0,
|
|
||||||
"hide_seconds": 0,
|
|
||||||
"idx": 20,
|
|
||||||
"ignore_user_permissions": 0,
|
|
||||||
"ignore_xss_filter": 0,
|
|
||||||
"in_global_search": 0,
|
|
||||||
"in_list_view": 0,
|
|
||||||
"in_preview": 0,
|
|
||||||
"in_standard_filter": 0,
|
|
||||||
"insert_after": "linked_with",
|
|
||||||
"label": "Is Your Company Address",
|
|
||||||
"length": 0,
|
|
||||||
"mandatory_depends_on": null,
|
|
||||||
"modified": "2020-10-14 17:41:40.878179",
|
|
||||||
"modified_by": "Administrator",
|
|
||||||
"name": "Address-is_your_company_address",
|
|
||||||
"no_copy": 0,
|
|
||||||
"options": null,
|
|
||||||
"owner": "Administrator",
|
|
||||||
"parent": null,
|
|
||||||
"parentfield": null,
|
|
||||||
"parenttype": null,
|
|
||||||
"permlevel": 0,
|
|
||||||
"precision": "",
|
|
||||||
"print_hide": 0,
|
|
||||||
"print_hide_if_no_value": 0,
|
|
||||||
"print_width": null,
|
|
||||||
"read_only": 0,
|
|
||||||
"read_only_depends_on": null,
|
|
||||||
"report_hide": 0,
|
|
||||||
"reqd": 0,
|
|
||||||
"search_index": 0,
|
|
||||||
"translatable": 0,
|
|
||||||
"unique": 0,
|
|
||||||
"width": null
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"custom_perms": [],
|
|
||||||
"doctype": "Address",
|
|
||||||
"property_setters": [],
|
|
||||||
"sync_on_migrate": 1
|
|
||||||
}
|
|
||||||
@@ -1,60 +0,0 @@
|
|||||||
{
|
|
||||||
"custom_fields": [
|
|
||||||
{
|
|
||||||
"_assign": null,
|
|
||||||
"_comments": null,
|
|
||||||
"_liked_by": null,
|
|
||||||
"_user_tags": null,
|
|
||||||
"allow_on_submit": 0,
|
|
||||||
"bold": 0,
|
|
||||||
"collapsible": 0,
|
|
||||||
"collapsible_depends_on": null,
|
|
||||||
"columns": 0,
|
|
||||||
"creation": "2019-12-02 11:00:03.432994",
|
|
||||||
"default": null,
|
|
||||||
"depends_on": null,
|
|
||||||
"description": null,
|
|
||||||
"docstatus": 0,
|
|
||||||
"dt": "Contact",
|
|
||||||
"fetch_from": null,
|
|
||||||
"fetch_if_empty": 0,
|
|
||||||
"fieldname": "is_billing_contact",
|
|
||||||
"fieldtype": "Check",
|
|
||||||
"hidden": 0,
|
|
||||||
"idx": 27,
|
|
||||||
"ignore_user_permissions": 0,
|
|
||||||
"ignore_xss_filter": 0,
|
|
||||||
"in_global_search": 0,
|
|
||||||
"in_list_view": 0,
|
|
||||||
"in_standard_filter": 0,
|
|
||||||
"insert_after": "is_primary_contact",
|
|
||||||
"label": "Is Billing Contact",
|
|
||||||
"length": 0,
|
|
||||||
"modified": "2019-12-02 11:00:03.432994",
|
|
||||||
"modified_by": "Administrator",
|
|
||||||
"name": "Contact-is_billing_contact",
|
|
||||||
"no_copy": 0,
|
|
||||||
"options": null,
|
|
||||||
"owner": "Administrator",
|
|
||||||
"parent": null,
|
|
||||||
"parentfield": null,
|
|
||||||
"parenttype": null,
|
|
||||||
"permlevel": 0,
|
|
||||||
"precision": "",
|
|
||||||
"print_hide": 0,
|
|
||||||
"print_hide_if_no_value": 0,
|
|
||||||
"print_width": null,
|
|
||||||
"read_only": 0,
|
|
||||||
"report_hide": 0,
|
|
||||||
"reqd": 0,
|
|
||||||
"search_index": 0,
|
|
||||||
"translatable": 0,
|
|
||||||
"unique": 0,
|
|
||||||
"width": null
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"custom_perms": [],
|
|
||||||
"doctype": "Contact",
|
|
||||||
"property_setters": [],
|
|
||||||
"sync_on_migrate": 1
|
|
||||||
}
|
|
||||||
@@ -434,3 +434,4 @@ erpnext.patches.v16_0.add_portal_redirects
|
|||||||
erpnext.patches.v16_0.update_order_qty_and_requested_qty_based_on_mr_and_po
|
erpnext.patches.v16_0.update_order_qty_and_requested_qty_based_on_mr_and_po
|
||||||
erpnext.patches.v16_0.depends_on_inv_dimensions
|
erpnext.patches.v16_0.depends_on_inv_dimensions
|
||||||
erpnext.patches.v16_0.clear_procedures_from_receivable_report
|
erpnext.patches.v16_0.clear_procedures_from_receivable_report
|
||||||
|
erpnext.patches.v16_0.migrate_address_contact_custom_fields
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
import frappe
|
||||||
|
|
||||||
|
from erpnext.setup.install import create_address_and_contact_custom_fields
|
||||||
|
|
||||||
|
|
||||||
|
def execute():
|
||||||
|
"""Replace fixture-based custom fields on Address and Contact with programmatic ones."""
|
||||||
|
for custom_field in (
|
||||||
|
"Address-tax_category",
|
||||||
|
"Address-is_your_company_address",
|
||||||
|
"Contact-is_billing_contact",
|
||||||
|
):
|
||||||
|
if frappe.db.exists("Custom Field", custom_field):
|
||||||
|
frappe.delete_doc("Custom Field", custom_field, ignore_missing=True, force=True)
|
||||||
|
|
||||||
|
create_address_and_contact_custom_fields()
|
||||||
@@ -24,6 +24,7 @@ def after_install():
|
|||||||
|
|
||||||
set_single_defaults()
|
set_single_defaults()
|
||||||
create_print_setting_custom_fields()
|
create_print_setting_custom_fields()
|
||||||
|
create_address_and_contact_custom_fields()
|
||||||
create_custom_company_links()
|
create_custom_company_links()
|
||||||
add_all_roles_to("Administrator")
|
add_all_roles_to("Administrator")
|
||||||
create_default_success_action()
|
create_default_success_action()
|
||||||
@@ -132,6 +133,37 @@ def create_print_setting_custom_fields():
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def create_address_and_contact_custom_fields():
|
||||||
|
create_custom_fields(
|
||||||
|
{
|
||||||
|
"Address": [
|
||||||
|
{
|
||||||
|
"label": _("Tax Category"),
|
||||||
|
"fieldname": "tax_category",
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"options": "Tax Category",
|
||||||
|
"insert_after": "fax",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": _("Is Your Company Address"),
|
||||||
|
"fieldname": "is_your_company_address",
|
||||||
|
"fieldtype": "Check",
|
||||||
|
"default": "0",
|
||||||
|
"insert_after": "linked_with",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
"Contact": [
|
||||||
|
{
|
||||||
|
"label": _("Is Billing Contact"),
|
||||||
|
"fieldname": "is_billing_contact",
|
||||||
|
"fieldtype": "Check",
|
||||||
|
"insert_after": "is_primary_contact",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def create_custom_company_links():
|
def create_custom_company_links():
|
||||||
"""Add link fields to Company in Email Account and Communication.
|
"""Add link fields to Company in Email Account and Communication.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user