Deprecate Probability field on Opportunity (#6207)
Closes #5735. The field probability on opportunity will - - stop being created for new workspaces (after this PR is merged) - have "isCustom" value set to true and be displayed as such in the settings (after this PR is merged + sync-metadata is run on workspace) - still show in the views (all the time) This field is deprecated as a standard field but not replaced by another one, so we are not adding the `(deprecated)` suffix in the label.
This commit is contained in:
@ -466,23 +466,6 @@ export const getObjectMetadataItemsMock = () => {
|
||||
fromRelationMetadata: null,
|
||||
toRelationMetadata: null,
|
||||
},
|
||||
{
|
||||
__typename: 'field',
|
||||
id: '20202020-3b9c-4e58-a3d2-c617d3b596b1',
|
||||
type: 'TEXT',
|
||||
name: 'probability',
|
||||
label: 'Probability',
|
||||
description: 'Opportunity probability',
|
||||
icon: 'IconProgressCheck',
|
||||
isCustom: false,
|
||||
isActive: true,
|
||||
isSystem: false,
|
||||
isNullable: true,
|
||||
createdAt: '2023-11-30T11:13:15.308Z',
|
||||
updatedAt: '2023-11-30T11:13:15.308Z',
|
||||
fromRelationMetadata: null,
|
||||
toRelationMetadata: null,
|
||||
},
|
||||
{
|
||||
__typename: 'fieldEdge',
|
||||
node: {
|
||||
|
||||
@ -27,7 +27,6 @@ export const query = gql`
|
||||
updatedAt
|
||||
companyId
|
||||
stage
|
||||
probability
|
||||
closeDate
|
||||
amount {
|
||||
amountMicros
|
||||
@ -53,7 +52,6 @@ export const query = gql`
|
||||
updatedAt
|
||||
companyId
|
||||
stage
|
||||
probability
|
||||
closeDate
|
||||
amount {
|
||||
amountMicros
|
||||
|
||||
@ -25,7 +25,6 @@ export const query = gql`
|
||||
updatedAt
|
||||
companyId
|
||||
stage
|
||||
probability
|
||||
closeDate
|
||||
amount {
|
||||
amountMicros
|
||||
@ -50,7 +49,6 @@ export const query = gql`
|
||||
updatedAt
|
||||
companyId
|
||||
stage
|
||||
probability
|
||||
closeDate
|
||||
amount {
|
||||
amountMicros
|
||||
|
||||
@ -415,7 +415,6 @@ export const SIGN_IN_BACKGROUND_MOCK_COMPANIES = [
|
||||
node: {
|
||||
__typename: 'Opportunity',
|
||||
id: '53f66647-0543-4cc2-9f96-95cc699960f2',
|
||||
probability: '0.5',
|
||||
pointOfContactId: '93c72d2e-f517-42fd-80ae-14173b3b70ae',
|
||||
stage: 'NEW',
|
||||
amount: {
|
||||
@ -633,7 +632,6 @@ export const SIGN_IN_BACKGROUND_MOCK_COMPANIES = [
|
||||
node: {
|
||||
__typename: 'Opportunity',
|
||||
id: '81ab695d-2f89-406f-90ea-180f433b2445',
|
||||
probability: '0.5',
|
||||
stage: 'NEW',
|
||||
pointOfContactId: '9b324a88-6784-4449-afdf-dc62cb8702f2',
|
||||
amount: {
|
||||
@ -653,7 +651,6 @@ export const SIGN_IN_BACKGROUND_MOCK_COMPANIES = [
|
||||
node: {
|
||||
__typename: 'Opportunity',
|
||||
id: '9b059852-35b1-4045-9cde-42f715148954',
|
||||
probability: '0.5',
|
||||
stage: 'NEW',
|
||||
pointOfContactId: '98406e26-80f1-4dff-b570-a74942528de3',
|
||||
amount: {
|
||||
@ -1221,7 +1218,6 @@ export const SIGN_IN_BACKGROUND_MOCK_COMPANIES = [
|
||||
node: {
|
||||
__typename: 'Opportunity',
|
||||
id: '7c887ee3-be10-412b-a663-16bd3c2228e1',
|
||||
probability: '0.5',
|
||||
stage: 'NEW',
|
||||
pointOfContactId: '86083141-1c0e-494c-a1b6-85b1c6fefaa5',
|
||||
amount: {
|
||||
|
||||
@ -5567,29 +5567,6 @@ export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery =
|
||||
"toRelationMetadata": null
|
||||
}
|
||||
},
|
||||
{
|
||||
"__typename": "fieldEdge",
|
||||
"node": {
|
||||
"__typename": "field",
|
||||
"id": "dd99cf8d-a10c-4d41-8469-6b5e03e5ae2e",
|
||||
"type": "TEXT",
|
||||
"name": "probability",
|
||||
"label": "Probability",
|
||||
"description": "Opportunity probability",
|
||||
"icon": "IconProgressCheck",
|
||||
"isCustom": false,
|
||||
"isActive": true,
|
||||
"isSystem": false,
|
||||
"isNullable": false,
|
||||
"createdAt": "2024-06-07T09:05:12.599Z",
|
||||
"updatedAt": "2024-06-07T09:05:12.599Z",
|
||||
"defaultValue": "'0'",
|
||||
"options": null,
|
||||
"relationDefinition": null,
|
||||
"fromRelationMetadata": null,
|
||||
"toRelationMetadata": null
|
||||
}
|
||||
},
|
||||
{
|
||||
"__typename": "fieldEdge",
|
||||
"node": {
|
||||
|
||||
@ -142,14 +142,6 @@ export const mockedViewFieldsData = [
|
||||
isVisible: true,
|
||||
size: 180,
|
||||
},
|
||||
{
|
||||
id: 'e5a731bb-82b9-4abe-ad22-1ddea94722f9',
|
||||
fieldMetadataId: 'probability',
|
||||
viewId: mockedViewsData[2].id,
|
||||
position: 1,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
},
|
||||
{
|
||||
id: '3159acd8-463f-458d-bf9a-af8ac6f57dc0',
|
||||
fieldMetadataId: 'closeDate',
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { EntityManager } from 'typeorm';
|
||||
|
||||
import { DEV_SEED_PERSON_IDS } from 'src/database/typeorm-seeds/workspace/people';
|
||||
import { DEV_SEED_COMPANY_IDS } from 'src/database/typeorm-seeds/workspace/companies';
|
||||
import { DEV_SEED_PERSON_IDS } from 'src/database/typeorm-seeds/workspace/people';
|
||||
|
||||
const tableName = 'opportunity';
|
||||
|
||||
@ -25,7 +25,6 @@ export const seedOpportunity = async (
|
||||
'amountAmountMicros',
|
||||
'amountCurrencyCode',
|
||||
'closeDate',
|
||||
'probability',
|
||||
'stage',
|
||||
'position',
|
||||
'pointOfContactId',
|
||||
@ -39,7 +38,6 @@ export const seedOpportunity = async (
|
||||
amountAmountMicros: 100000,
|
||||
amountCurrencyCode: 'USD',
|
||||
closeDate: new Date(),
|
||||
probability: 0.5,
|
||||
stage: 'NEW',
|
||||
position: 1,
|
||||
pointOfContactId: DEV_SEED_PERSON_IDS.CHRISTOPH,
|
||||
@ -51,7 +49,6 @@ export const seedOpportunity = async (
|
||||
amountAmountMicros: 2000000,
|
||||
amountCurrencyCode: 'USD',
|
||||
closeDate: new Date(),
|
||||
probability: 0.5,
|
||||
stage: 'MEETING',
|
||||
position: 2,
|
||||
pointOfContactId: DEV_SEED_PERSON_IDS.CHRISTOPHER_G,
|
||||
@ -63,7 +60,6 @@ export const seedOpportunity = async (
|
||||
amountAmountMicros: 300000,
|
||||
amountCurrencyCode: 'USD',
|
||||
closeDate: new Date(),
|
||||
probability: 0.5,
|
||||
stage: 'PROPOSAL',
|
||||
position: 3,
|
||||
pointOfContactId: DEV_SEED_PERSON_IDS.NICHOLAS,
|
||||
@ -75,7 +71,6 @@ export const seedOpportunity = async (
|
||||
amountAmountMicros: 4000000,
|
||||
amountCurrencyCode: 'USD',
|
||||
closeDate: new Date(),
|
||||
probability: 0.5,
|
||||
stage: 'PROPOSAL',
|
||||
position: 4,
|
||||
pointOfContactId: DEV_SEED_PERSON_IDS.MATTHEW,
|
||||
|
||||
@ -3,12 +3,6 @@ import { v4 } from 'uuid';
|
||||
|
||||
const tableName = 'opportunity';
|
||||
|
||||
const getRandomProbability = () => {
|
||||
const firstDigit = Math.floor(Math.random() * 9) + 1;
|
||||
|
||||
return firstDigit / 10;
|
||||
};
|
||||
|
||||
const getRandomStage = () => {
|
||||
const stages = ['NEW', 'SCREENING', 'MEETING', 'PROPOSAL', 'CUSTOMER'];
|
||||
|
||||
@ -28,7 +22,6 @@ const generateOpportunities = (companies) => {
|
||||
amountCurrencyCode: 'USD',
|
||||
closeDate: new Date(),
|
||||
stage: getRandomStage(),
|
||||
probability: getRandomProbability(),
|
||||
pointOfContactId: company.personId,
|
||||
companyId: company.id,
|
||||
}));
|
||||
@ -56,7 +49,6 @@ export const opportunityPrefillDemoData = async (
|
||||
'amountCurrencyCode',
|
||||
'closeDate',
|
||||
'stage',
|
||||
'probability',
|
||||
'pointOfContactId',
|
||||
'companyId',
|
||||
'position',
|
||||
|
||||
@ -47,16 +47,6 @@ export const viewOpportunityFields = (
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
objectMetadataMap[STANDARD_OBJECT_IDS.opportunity].fields[
|
||||
OPPORTUNITY_STANDARD_FIELD_IDS.probability
|
||||
],
|
||||
viewId: viewId,
|
||||
position: 4,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
},
|
||||
{
|
||||
fieldMetadataId:
|
||||
objectMetadataMap[STANDARD_OBJECT_IDS.opportunity].fields[
|
||||
|
||||
@ -251,7 +251,7 @@ export const OPPORTUNITY_STANDARD_FIELD_IDS = {
|
||||
name: '20202020-8609-4f65-a2d9-44009eb422b5',
|
||||
amount: '20202020-583e-4642-8533-db761d5fa82f',
|
||||
closeDate: '20202020-527e-44d6-b1ac-c4158d307b97',
|
||||
probability: '20202020-69d4-45f3-9703-690b09fafcf0',
|
||||
probabilityDeprecated: '20202020-69d4-45f3-9703-690b09fafcf0',
|
||||
stage: '20202020-6f76-477d-8551-28cd65b2b4b9',
|
||||
position: '20202020-806d-493a-bbc6-6313e62958e2',
|
||||
pointOfContact: '20202020-8dfb-42fc-92b6-01afb759ed16',
|
||||
|
||||
@ -96,18 +96,6 @@ export class CompanyWorkspaceEntity extends BaseWorkspaceEntity {
|
||||
@WorkspaceIsNullable()
|
||||
annualRecurringRevenue: CurrencyMetadata | null;
|
||||
|
||||
@WorkspaceField({
|
||||
standardId: COMPANY_STANDARD_FIELD_IDS.address_deprecated,
|
||||
type: FieldMetadataType.TEXT,
|
||||
label: 'Address (deprecated) ',
|
||||
description:
|
||||
"This standard field has been deprecated and migrated as a custom field. Please consider using the new 'address' field type.",
|
||||
icon: 'IconMap',
|
||||
})
|
||||
@WorkspaceIsDeprecated()
|
||||
@WorkspaceIsNullable()
|
||||
address_old: string;
|
||||
|
||||
@WorkspaceField({
|
||||
standardId: COMPANY_STANDARD_FIELD_IDS.address,
|
||||
type: FieldMetadataType.ADDRESS,
|
||||
@ -231,4 +219,16 @@ export class CompanyWorkspaceEntity extends BaseWorkspaceEntity {
|
||||
@WorkspaceIsNullable()
|
||||
@WorkspaceIsSystem()
|
||||
timelineActivities: Relation<TimelineActivityWorkspaceEntity[]>;
|
||||
|
||||
@WorkspaceField({
|
||||
standardId: COMPANY_STANDARD_FIELD_IDS.address_deprecated,
|
||||
type: FieldMetadataType.TEXT,
|
||||
label: 'Address (deprecated) ',
|
||||
description:
|
||||
'Address of the company - deprecated in favor of new address field',
|
||||
icon: 'IconMap',
|
||||
})
|
||||
@WorkspaceIsDeprecated()
|
||||
@WorkspaceIsNullable()
|
||||
addressOld: string;
|
||||
}
|
||||
|
||||
@ -6,6 +6,15 @@ import {
|
||||
RelationMetadataType,
|
||||
RelationOnDeleteAction,
|
||||
} from 'src/engine/metadata-modules/relation-metadata/relation-metadata.entity';
|
||||
import { BaseWorkspaceEntity } from 'src/engine/twenty-orm/base.workspace-entity';
|
||||
import { WorkspaceEntity } from 'src/engine/twenty-orm/decorators/workspace-entity.decorator';
|
||||
import { WorkspaceField } from 'src/engine/twenty-orm/decorators/workspace-field.decorator';
|
||||
import { WorkspaceIsDeprecated } from 'src/engine/twenty-orm/decorators/workspace-is-deprecated.decorator';
|
||||
import { WorkspaceIsNotAuditLogged } from 'src/engine/twenty-orm/decorators/workspace-is-not-audit-logged.decorator';
|
||||
import { WorkspaceIsNullable } from 'src/engine/twenty-orm/decorators/workspace-is-nullable.decorator';
|
||||
import { WorkspaceIsSystem } from 'src/engine/twenty-orm/decorators/workspace-is-system.decorator';
|
||||
import { WorkspaceJoinColumn } from 'src/engine/twenty-orm/decorators/workspace-join-column.decorator';
|
||||
import { WorkspaceRelation } from 'src/engine/twenty-orm/decorators/workspace-relation.decorator';
|
||||
import { OPPORTUNITY_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
||||
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
|
||||
import { ActivityTargetWorkspaceEntity } from 'src/modules/activity/standard-objects/activity-target.workspace-entity';
|
||||
@ -14,14 +23,6 @@ import { CompanyWorkspaceEntity } from 'src/modules/company/standard-objects/com
|
||||
import { FavoriteWorkspaceEntity } from 'src/modules/favorite/standard-objects/favorite.workspace-entity';
|
||||
import { PersonWorkspaceEntity } from 'src/modules/person/standard-objects/person.workspace-entity';
|
||||
import { TimelineActivityWorkspaceEntity } from 'src/modules/timeline/standard-objects/timeline-activity.workspace-entity';
|
||||
import { BaseWorkspaceEntity } from 'src/engine/twenty-orm/base.workspace-entity';
|
||||
import { WorkspaceEntity } from 'src/engine/twenty-orm/decorators/workspace-entity.decorator';
|
||||
import { WorkspaceIsNotAuditLogged } from 'src/engine/twenty-orm/decorators/workspace-is-not-audit-logged.decorator';
|
||||
import { WorkspaceField } from 'src/engine/twenty-orm/decorators/workspace-field.decorator';
|
||||
import { WorkspaceIsNullable } from 'src/engine/twenty-orm/decorators/workspace-is-nullable.decorator';
|
||||
import { WorkspaceIsSystem } from 'src/engine/twenty-orm/decorators/workspace-is-system.decorator';
|
||||
import { WorkspaceRelation } from 'src/engine/twenty-orm/decorators/workspace-relation.decorator';
|
||||
import { WorkspaceJoinColumn } from 'src/engine/twenty-orm/decorators/workspace-join-column.decorator';
|
||||
|
||||
@WorkspaceEntity({
|
||||
standardId: STANDARD_OBJECT_IDS.opportunity,
|
||||
@ -62,16 +63,6 @@ export class OpportunityWorkspaceEntity extends BaseWorkspaceEntity {
|
||||
@WorkspaceIsNullable()
|
||||
closeDate: Date | null;
|
||||
|
||||
@WorkspaceField({
|
||||
standardId: OPPORTUNITY_STANDARD_FIELD_IDS.probability,
|
||||
type: FieldMetadataType.TEXT,
|
||||
label: 'Probability',
|
||||
description: 'Opportunity probability',
|
||||
icon: 'IconProgressCheck',
|
||||
defaultValue: "'0'",
|
||||
})
|
||||
probability: string;
|
||||
|
||||
@WorkspaceField({
|
||||
standardId: OPPORTUNITY_STANDARD_FIELD_IDS.stage,
|
||||
type: FieldMetadataType.SELECT,
|
||||
@ -185,4 +176,15 @@ export class OpportunityWorkspaceEntity extends BaseWorkspaceEntity {
|
||||
})
|
||||
@WorkspaceIsNullable()
|
||||
timelineActivities: Relation<TimelineActivityWorkspaceEntity[]>;
|
||||
|
||||
@WorkspaceField({
|
||||
standardId: OPPORTUNITY_STANDARD_FIELD_IDS.probabilityDeprecated,
|
||||
type: FieldMetadataType.TEXT,
|
||||
label: 'Probability',
|
||||
description: 'Opportunity probability',
|
||||
icon: 'IconProgressCheck',
|
||||
defaultValue: "'0'",
|
||||
})
|
||||
@WorkspaceIsDeprecated()
|
||||
probability: string;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user