fix: changed is_erpnext_in_same_site to is_erpnext_in_different site

This commit is contained in:
Shariq Ansari 2024-09-16 14:30:33 +05:30
parent 2e49844ea0
commit 16a8671744
3 changed files with 27 additions and 22 deletions

View File

@ -6,7 +6,7 @@
"engine": "InnoDB",
"field_order": [
"enabled",
"is_erpnext_in_the_current_site",
"is_erpnext_in_different_site",
"column_break_vfru",
"erpnext_company",
"section_break_oubd",
@ -17,18 +17,18 @@
],
"fields": [
{
"depends_on": "eval:doc.enabled && !doc.is_erpnext_in_the_current_site",
"depends_on": "eval:doc.enabled && doc.is_erpnext_in_different_site",
"fieldname": "api_key",
"fieldtype": "Data",
"label": "API Key",
"mandatory_depends_on": "eval:!doc.is_erpnext_in_the_current_site"
"mandatory_depends_on": "eval:!doc.is_erpnext_in_different_site"
},
{
"depends_on": "eval:doc.enabled && !doc.is_erpnext_in_the_current_site",
"depends_on": "eval:doc.enabled && doc.is_erpnext_in_different_site",
"fieldname": "api_secret",
"fieldtype": "Data",
"label": "API Secret",
"mandatory_depends_on": "eval:!doc.is_erpnext_in_the_current_site"
"mandatory_depends_on": "eval:!doc.is_erpnext_in_different_site"
},
{
"depends_on": "enabled",
@ -40,11 +40,11 @@
"fieldtype": "Column Break"
},
{
"depends_on": "eval:doc.enabled && !doc.is_erpnext_in_the_current_site",
"depends_on": "eval:doc.enabled && doc.is_erpnext_in_different_site",
"fieldname": "erpnext_site_url",
"fieldtype": "Data",
"label": "ERPNext Site URL",
"mandatory_depends_on": "eval:!doc.is_erpnext_in_the_current_site"
"mandatory_depends_on": "eval:!doc.is_erpnext_in_different_site"
},
{
"depends_on": "enabled",
@ -57,24 +57,24 @@
"fieldname": "column_break_vfru",
"fieldtype": "Column Break"
},
{
"default": "0",
"depends_on": "enabled",
"fieldname": "is_erpnext_in_the_current_site",
"fieldtype": "Check",
"label": "Is ERPNext in the current site?"
},
{
"default": "0",
"fieldname": "enabled",
"fieldtype": "Check",
"label": "Enabled"
},
{
"default": "0",
"depends_on": "enabled",
"fieldname": "is_erpnext_in_different_site",
"fieldtype": "Check",
"label": "Is ERPNext installed on a different site?"
}
],
"index_web_pages_for_search": 1,
"issingle": 1,
"links": [],
"modified": "2024-09-13 15:06:23.317262",
"modified": "2024-09-16 13:51:35.141503",
"modified_by": "Administrator",
"module": "FCRM",
"name": "ERPNext CRM Settings",

View File

@ -18,12 +18,12 @@ class ERPNextCRMSettings(Document):
self.create_crm_form_script()
def validate_if_erpnext_installed(self):
if self.is_erpnext_in_the_current_site:
if not self.is_erpnext_in_different_site:
if "erpnext" not in frappe.get_installed_apps():
frappe.throw(_("ERPNext is not installed in the current site"))
def add_quotation_to_option(self):
if self.is_erpnext_in_the_current_site:
if not self.is_erpnext_in_different_site:
if not frappe.db.exists("Property Setter", {"name": "Quotation-quotation_to-link_filters"}):
make_property_setter(
doctype="Quotation",
@ -35,7 +35,7 @@ class ERPNextCRMSettings(Document):
)
def create_custom_fields(self):
if self.is_erpnext_in_the_current_site:
if not self.is_erpnext_in_different_site:
from erpnext.crm.frappe_crm_api import create_custom_fields_for_frappe_crm
create_custom_fields_for_frappe_crm()
else:
@ -80,7 +80,7 @@ def get_quotation_url(crm_deal, organization):
if not erpnext_crm_settings.enabled:
frappe.throw(_("ERPNext is not integrated with the CRM"))
if erpnext_crm_settings.is_erpnext_in_the_current_site:
if not erpnext_crm_settings.is_erpnext_in_different_site:
quotation_url = get_url_to_form("Quotation")
return f"{quotation_url}/new?quotation_to=CRM Deal&crm_deal={crm_deal}&party_name={crm_deal}"
else:
@ -147,7 +147,7 @@ def create_customer_in_erpnext(doc, method):
"crm_deal": doc.name,
"contacts": json.dumps(contacts),
}
if erpnext_crm_settings.is_erpnext_in_the_current_site:
if not erpnext_crm_settings.is_erpnext_in_different_site:
from erpnext.crm.frappe_crm_api import create_customer
create_customer(customer)
else:

View File

@ -1,6 +1,11 @@
<template>
<SettingsPage doctype="ERPNext CRM Settings" :title="__('ERPNext Settings')" class="p-8" />
<SettingsPage
doctype="ERPNext CRM Settings"
:title="__('ERPNext Settings')"
:successMessage="__('ERPNext Settings updated')"
class="p-8"
/>
</template>
<script setup>
import SettingsPage from '@/components/Settings/SettingsPage.vue'
import SettingsPage from '@/components/Settings/SettingsPage.vue'
</script>