mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-31 10:49:09 +00:00
feat: add company links to Email Account and Communication (#49721)
Co-authored-by: barredterra <14891507+barredterra@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
6cf24feffc
commit
22e4c7446e
@@ -261,6 +261,7 @@ execute:frappe.rename_doc("Report", "TDS Payable Monthly", "Tax Withholding Deta
|
|||||||
erpnext.patches.v14_0.update_proprietorship_to_individual
|
erpnext.patches.v14_0.update_proprietorship_to_individual
|
||||||
erpnext.patches.v15_0.rename_subcontracting_fields
|
erpnext.patches.v15_0.rename_subcontracting_fields
|
||||||
erpnext.patches.v15_0.unset_incorrect_additional_discount_percentage
|
erpnext.patches.v15_0.unset_incorrect_additional_discount_percentage
|
||||||
|
erpnext.patches.v16_0.create_company_custom_fields
|
||||||
|
|
||||||
[post_model_sync]
|
[post_model_sync]
|
||||||
erpnext.patches.v15_0.rename_gross_purchase_amount_to_net_purchase_amount
|
erpnext.patches.v15_0.rename_gross_purchase_amount_to_net_purchase_amount
|
||||||
|
|||||||
6
erpnext/patches/v16_0/create_company_custom_fields.py
Normal file
6
erpnext/patches/v16_0/create_company_custom_fields.py
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
from erpnext.setup.install import create_custom_company_links
|
||||||
|
|
||||||
|
|
||||||
|
def execute():
|
||||||
|
"""Add link fields to Company in Email Account and Communication."""
|
||||||
|
create_custom_company_links()
|
||||||
@@ -23,6 +23,7 @@ def after_install():
|
|||||||
set_single_defaults()
|
set_single_defaults()
|
||||||
create_print_setting_custom_fields()
|
create_print_setting_custom_fields()
|
||||||
create_marketgin_campagin_custom_fields()
|
create_marketgin_campagin_custom_fields()
|
||||||
|
create_custom_company_links()
|
||||||
add_all_roles_to("Administrator")
|
add_all_roles_to("Administrator")
|
||||||
create_default_success_action()
|
create_default_success_action()
|
||||||
create_incoterms()
|
create_incoterms()
|
||||||
@@ -139,6 +140,39 @@ def create_default_success_action():
|
|||||||
doc.insert(ignore_permissions=True)
|
doc.insert(ignore_permissions=True)
|
||||||
|
|
||||||
|
|
||||||
|
def create_custom_company_links():
|
||||||
|
"""Add link fields to Company in Email Account and Communication.
|
||||||
|
|
||||||
|
These DocTypes are provided by the Frappe Framework but need to be associated
|
||||||
|
with a company in ERPNext to allow for multitenancy. I.e. one company should
|
||||||
|
not be able to access emails and communications from another company.
|
||||||
|
"""
|
||||||
|
create_custom_fields(
|
||||||
|
{
|
||||||
|
"Email Account": [
|
||||||
|
{
|
||||||
|
"label": _("Company"),
|
||||||
|
"fieldname": "company",
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"options": "Company",
|
||||||
|
"insert_after": "email_id",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
"Communication": [
|
||||||
|
{
|
||||||
|
"label": _("Company"),
|
||||||
|
"fieldname": "company",
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"options": "Company",
|
||||||
|
"insert_after": "email_account",
|
||||||
|
"fetch_from": "email_account.company",
|
||||||
|
"read_only": 1,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def add_company_to_session_defaults():
|
def add_company_to_session_defaults():
|
||||||
settings = frappe.get_single("Session Default Settings")
|
settings = frappe.get_single("Session Default Settings")
|
||||||
settings.append("session_defaults", {"ref_doctype": "Company"})
|
settings.append("session_defaults", {"ref_doctype": "Company"})
|
||||||
|
|||||||
@@ -233,6 +233,8 @@
|
|||||||
"options": "Project"
|
"options": "Project"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"fetch_from": "email_account.company",
|
||||||
|
"fetch_if_empty": 1,
|
||||||
"fieldname": "company",
|
"fieldname": "company",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"label": "Company",
|
"label": "Company",
|
||||||
@@ -391,7 +393,7 @@
|
|||||||
"icon": "fa fa-ticket",
|
"icon": "fa fa-ticket",
|
||||||
"idx": 7,
|
"idx": 7,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2025-02-18 21:18:52.797745",
|
"modified": "2025-09-25 11:10:53.556731",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Support",
|
"module": "Support",
|
||||||
"name": "Issue",
|
"name": "Issue",
|
||||||
@@ -421,4 +423,4 @@
|
|||||||
"title_field": "subject",
|
"title_field": "subject",
|
||||||
"track_changes": 1,
|
"track_changes": 1,
|
||||||
"track_seen": 1
|
"track_seen": 1
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user