Skip to content

Conversation

@Ashutosh619-sudo
Copy link
Contributor

@Ashutosh619-sudo Ashutosh619-sudo commented Jan 19, 2026

Description

Please add PR description here, add screenshots if needed

Clickup

Please add link here
https://app.clickup.com/

Summary by CodeRabbit

  • New Features
    • Organization settings are automatically synchronized when creating a new workspace, ensuring workspace regional and formatting settings match your organization.
  • Tests
    • Added coverage verifying workspace organization settings are updated correctly after synchronization.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 19, 2026

Walkthrough

Adds sync_org_settings(workspace_id) to fetch org_settings via PlatformConnector and persist regional_settings to the Workspace; invoked during the workspace creation POST flow; exceptions are caught and logged.

Changes

Cohort / File(s) Summary
Org settings sync task
apps/workspaces/tasks.py
Added public function sync_org_settings(workspace_id) that retrieves the workspace credential, uses PlatformConnector to fetch org_settings, updates Workspace.org_settings with regional_settings, saves (update_fields=['org_settings','updated_at']), and logs exceptions.
Workspace creation flow
apps/workspaces/views.py
Imported and invoked sync_org_settings(workspace_id=workspace.id) in the POST path of WorkspaceView immediately after workspace creation.
Tests
tests/test_workspaces/test_tasks.py
Added test_sync_org_settings which mocks PlatformConnector to return regional_settings and asserts Workspace.org_settings is updated accordingly.

Sequence Diagram(s)

sequenceDiagram
    participant View as WorkspaceView
    participant Task as sync_org_settings
    participant Cred as FyleCredential
    participant Platform as PlatformConnector
    participant DB as Workspace Model

    View->>Task: call sync_org_settings(workspace_id)
    Task->>Cred: get credential for workspace_id
    Task->>Platform: instantiate with credential\nfetch org_settings
    Platform-->>Task: org_settings (including regional_settings)
    Task->>DB: load Workspace, set org_settings.regional_settings
    Task->>DB: save(update_fields=['org_settings','updated_at'])
    Task-->>View: return/complete
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I hopped to sync the workspace light,
Fetching locales by platform night,
I tucked in timezone, date and more,
Saved them gently—softly stored.
A tiny hop for config bliss!

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is incomplete with only template placeholders and no actual content describing the changes, motivation, or context. Replace placeholder text with a detailed description of the changes, explain why org settings sync is needed during workspace creation, and provide a valid ClickUp link.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately reflects the main change: adding organization settings synchronization during workspace creation.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link

Coverage

Coverage Report
FileStmtsMissCoverMissing
apps
   exceptions.py471177%27, 33, 39–44, 50, 56–61, 67, 73, 79–80
apps/fyle
   actions.py124794%214, 263, 319–323
   constants.py10100% 
   helpers.py2352291%50–57, 66, 146–162, 376, 470, 477–480, 483–484
   models.py3322194%313–315, 319–321, 325–327, 331–333, 337–339, 343–345, 406, 510–531, 554, 571
   queue.py500100% 
   serializers.py410100% 
   signals.py35683%22, 55–56, 69–71
   tasks.py4957385%135–136, 139–140, 143–144, 166–167, 201–211, 223–228, 271–274, 295–299, 309–317, 355–356, 450–497, 781–785
   views.py1721591%84–91, 145, 245–246, 290–291, 316–320, 413–417
apps/internal
   actions.py39295%26–27
   helpers.py361364%18–35
   serializers.py300100% 
   views.py83199%39
apps/internal/services
   e2e_setup.py590100% 
   fixture_factory.py59395%218–220
apps/mappings
   constants.py20100% 
   exceptions.py71692%69–71, 79–81
   helpers.py300100% 
   models.py500100% 
   schedules.py150100% 
   serializers.py100100% 
   signals.py1111487%90–92, 127, 179–184, 190–194, 200–203, 209–210
   tasks.py1732983%117–118, 141–142, 145, 209–226, 254, 257, 260, 266, 269, 275, 314–316, 327, 399
   utils.py340100% 
   views.py46491%34–35, 114–115
apps/sage_intacct
   actions.py29486%21–22, 49–50
   connector.py8052597%133, 309, 321, 327, 403, 1414, 1713, 1840–1841, 1892–1893, 1914–1915, 1944–1945, 1953–1964, 1996–1997, 2017–2018
   dependent_fields.py2904286%345, 381–384, 413–422, 424–425, 427–429, 431–432, 434–435, 437–438, 442–444, 488, 508, 548–550, 596–598, 646–652, 656–657
   enums.py250100% 
   helpers.py56689%38–41, 58, 95
   models.py9396293%69–70, 220, 327, 334, 378, 399–416, 475, 487, 537, 543, 578, 628–630, 644–657, 668, 704, 756–757, 831, 870, 1070, 1164–1167, 1200, 1265, 1366–1386, 1464, 1480, 1590, 1936–1938, 2000
   queue.py1711691%45, 53, 58, 105, 130–133, 173, 187, 205–208, 243, 267–270, 305, 330–333
   serializers.py350100% 
   tasks.py139118587%90, 104, 137, 173–174, 178–181, 183, 186, 236, 270–271, 390–391, 397, 400, 443–444, 485–490, 555, 561, 569, 735–736, 756–757, 817–818, 822, 841, 856, 861, 866, 873, 879, 882–884, 887–890, 893–895, 915, 955–956, 1037–1038, 1042, 1063, 1078, 1084, 1087–1090, 1097, 1100–1102, 1105–1108, 1111–1113, 1132–1136, 1176–1177, 1251–1252, 1254, 1275, 1290, 1296, 1299–1302, 1309, 1312–1314, 1317–1320, 1323–1325, 1345–1349, 1388–1389, 1464–1465, 1468, 1489, 1504, 1510, 1516, 1523, 1529, 1532–1534, 1537–1540, 1543–1545, 1564, 1616–1617, 1678, 1690–1699, 1741, 1744–1749, 1752–1756, 1921–1925, 2021–2022, 2228–2238, 2241, 2250–2255, 2289–2291, 2325–2328, 2396–2400, 2409, 2498–2503, 2516, 2531, 2546
   utils.py8904795%98, 110, 113, 538–539, 718–722, 867, 878, 1186, 1202–1208, 1217–1218, 1696–1706, 1944–1948, 1976–1980, 2008–2012, 2056–2060, 2114–2118, 2139, 2148, 2157, 2166–2167, 2178, 2201–2203
   views.py1453377%127–129, 134–135, 141–142, 185–188, 258–288, 299–314, 327–331
apps/sage_intacct/errors
   errors.py20100% 
   helpers.py47198%80
apps/sage_intacct/exports
   ap_payments.py130100% 
   bills.py280100% 
   charge_card_transactions.py220100% 
   expense_reports.py280100% 
   helpers.py56296%68, 141
   journal_entries.py76889%177–180, 316–319
   reimbursements.py130100% 
apps/tasks
   models.py690100% 
   serializers.py60100% 
   views.py370100% 
apps/users
   helpers.py120100% 
   models.py530100% 
   views.py170100% 
apps/workspaces
   actions.py46980%65, 84–85, 103, 122–133, 147
   enums.py60100% 
   helpers.py80100% 
   models.py1760100% 
   permissions.py34974%33, 59–67
   serializers.py43198%54
   signals.py310100% 
   tasks.py1751293%53–59, 187–194, 235, 267–268, 379, 418–422
   utils.py90100% 
   views.py320997%107–109, 136–139, 665–666
apps/workspaces/apis/advanced_settings
   serializers.py80396%260, 263, 266
   triggers.py100100% 
   views.py110100% 
apps/workspaces/apis/errors
   serializers.py200100% 
   views.py150100% 
apps/workspaces/apis/export_settings
   helpers.py730100% 
   serializers.py103397%267, 270, 273
   triggers.py39295%32–33
   views.py110100% 
apps/workspaces/apis/import_settings
   serializers.py1411887%232–238, 243–249, 257–265, 283, 286, 314, 317–318, 326
   triggers.py47198%31
   views.py330100% 
fyle_integrations_imports
   dataclasses.py310100% 
   models.py230100% 
   queues.py34585%24, 99, 136, 148–149
   signals.py100100% 
   tasks.py1247837%68–105, 114–120, 133–202, 206–221, 246–249, 251, 253, 258
fyle_integrations_imports/modules
   base.py1881095%75, 91–92, 95, 126, 230–231, 237–238, 351
   categories.py1773381%80, 96, 99–100, 103–104, 272–273, 283, 296, 298, 342, 351–355, 364–410
   cost_centers.py961288%132–133, 152–153, 162, 178, 180, 226, 235–239
   expense_custom_fields.py121794%83–88, 247, 263, 265, 294
   merchants.py1062576%80–83, 111–129, 155–162, 179–180, 190, 203, 205, 235, 238–242
   projects.py88990%109–110, 120, 144, 191, 205–209
   tax_groups.py180100% 
   webhook_attributes.py130695%98, 100–102, 213–214
workers
   actions.py210100% 
   helpers.py420100% 
   worker.py56591%44–45, 77–78, 125
TOTAL1033191591% 

Tests Skipped Failures Errors Time
714 0 💤 0 ❌ 0 🔥 50.126s ⏱️

@github-actions
Copy link

Failure. Coverage is below 90%.

Diff Coverage
Diff: origin/master..HEAD, staged and unstaged changes

apps/workspaces/tasks.py (70.0%): Missing lines 418-419,422
apps/workspaces/views.py (100%)

Total: 12 lines
Missing: 3 lines
Coverage: 75%

@github-actions github-actions bot added size/M Medium PR and removed size/S Small PR labels Jan 19, 2026
@github-actions
Copy link

Coverage

Coverage Report
FileStmtsMissCoverMissing
apps
   exceptions.py471177%27, 33, 39–44, 50, 56–61, 67, 73, 79–80
apps/fyle
   actions.py124794%214, 263, 319–323
   constants.py10100% 
   helpers.py2352291%50–57, 66, 146–162, 376, 470, 477–480, 483–484
   models.py3322194%313–315, 319–321, 325–327, 331–333, 337–339, 343–345, 406, 510–531, 554, 571
   queue.py500100% 
   serializers.py410100% 
   signals.py35683%22, 55–56, 69–71
   tasks.py4957385%135–136, 139–140, 143–144, 166–167, 201–211, 223–228, 271–274, 295–299, 309–317, 355–356, 450–497, 781–785
   views.py1721591%84–91, 145, 245–246, 290–291, 316–320, 413–417
apps/internal
   actions.py39295%26–27
   helpers.py361364%18–35
   serializers.py300100% 
   views.py83199%39
apps/internal/services
   e2e_setup.py590100% 
   fixture_factory.py59395%218–220
apps/mappings
   constants.py20100% 
   exceptions.py71692%69–71, 79–81
   helpers.py300100% 
   models.py500100% 
   schedules.py150100% 
   serializers.py100100% 
   signals.py1111487%90–92, 127, 179–184, 190–194, 200–203, 209–210
   tasks.py1732983%117–118, 141–142, 145, 209–226, 254, 257, 260, 266, 269, 275, 314–316, 327, 399
   utils.py340100% 
   views.py46491%34–35, 114–115
apps/sage_intacct
   actions.py29486%21–22, 49–50
   connector.py8052597%133, 309, 321, 327, 403, 1414, 1713, 1840–1841, 1892–1893, 1914–1915, 1944–1945, 1953–1964, 1996–1997, 2017–2018
   dependent_fields.py2904286%345, 381–384, 413–422, 424–425, 427–429, 431–432, 434–435, 437–438, 442–444, 488, 508, 548–550, 596–598, 646–652, 656–657
   enums.py250100% 
   helpers.py56689%38–41, 58, 95
   models.py9396293%69–70, 220, 327, 334, 378, 399–416, 475, 487, 537, 543, 578, 628–630, 644–657, 668, 704, 756–757, 831, 870, 1070, 1164–1167, 1200, 1265, 1366–1386, 1464, 1480, 1590, 1936–1938, 2000
   queue.py1711691%45, 53, 58, 105, 130–133, 173, 187, 205–208, 243, 267–270, 305, 330–333
   serializers.py350100% 
   tasks.py139118587%90, 104, 137, 173–174, 178–181, 183, 186, 236, 270–271, 390–391, 397, 400, 443–444, 485–490, 555, 561, 569, 735–736, 756–757, 817–818, 822, 841, 856, 861, 866, 873, 879, 882–884, 887–890, 893–895, 915, 955–956, 1037–1038, 1042, 1063, 1078, 1084, 1087–1090, 1097, 1100–1102, 1105–1108, 1111–1113, 1132–1136, 1176–1177, 1251–1252, 1254, 1275, 1290, 1296, 1299–1302, 1309, 1312–1314, 1317–1320, 1323–1325, 1345–1349, 1388–1389, 1464–1465, 1468, 1489, 1504, 1510, 1516, 1523, 1529, 1532–1534, 1537–1540, 1543–1545, 1564, 1616–1617, 1678, 1690–1699, 1741, 1744–1749, 1752–1756, 1921–1925, 2021–2022, 2228–2238, 2241, 2250–2255, 2289–2291, 2325–2328, 2396–2400, 2409, 2498–2503, 2516, 2531, 2546
   utils.py8904795%98, 110, 113, 538–539, 718–722, 867, 878, 1186, 1202–1208, 1217–1218, 1696–1706, 1944–1948, 1976–1980, 2008–2012, 2056–2060, 2114–2118, 2139, 2148, 2157, 2166–2167, 2178, 2201–2203
   views.py1453377%127–129, 134–135, 141–142, 185–188, 258–288, 299–314, 327–331
apps/sage_intacct/errors
   errors.py20100% 
   helpers.py47198%80
apps/sage_intacct/exports
   ap_payments.py130100% 
   bills.py280100% 
   charge_card_transactions.py220100% 
   expense_reports.py280100% 
   helpers.py56296%68, 141
   journal_entries.py76889%177–180, 316–319
   reimbursements.py130100% 
apps/tasks
   models.py690100% 
   serializers.py60100% 
   views.py370100% 
apps/users
   helpers.py120100% 
   models.py530100% 
   views.py170100% 
apps/workspaces
   actions.py46980%65, 84–85, 103, 122–133, 147
   enums.py60100% 
   helpers.py80100% 
   models.py1760100% 
   permissions.py34974%33, 59–67
   serializers.py43198%54
   signals.py310100% 
   tasks.py175995%53–59, 187–194, 235, 267–268, 379
   utils.py90100% 
   views.py320997%107–109, 136–139, 665–666
apps/workspaces/apis/advanced_settings
   serializers.py80396%260, 263, 266
   triggers.py100100% 
   views.py110100% 
apps/workspaces/apis/errors
   serializers.py200100% 
   views.py150100% 
apps/workspaces/apis/export_settings
   helpers.py730100% 
   serializers.py103397%267, 270, 273
   triggers.py39295%32–33
   views.py110100% 
apps/workspaces/apis/import_settings
   serializers.py1411887%232–238, 243–249, 257–265, 283, 286, 314, 317–318, 326
   triggers.py47198%31
   views.py330100% 
fyle_integrations_imports
   dataclasses.py310100% 
   models.py230100% 
   queues.py34585%24, 99, 136, 148–149
   signals.py100100% 
   tasks.py1247837%68–105, 114–120, 133–202, 206–221, 246–249, 251, 253, 258
fyle_integrations_imports/modules
   base.py1881095%75, 91–92, 95, 126, 230–231, 237–238, 351
   categories.py1773381%80, 96, 99–100, 103–104, 272–273, 283, 296, 298, 342, 351–355, 364–410
   cost_centers.py961288%132–133, 152–153, 162, 178, 180, 226, 235–239
   expense_custom_fields.py121794%83–88, 247, 263, 265, 294
   merchants.py1062576%80–83, 111–129, 155–162, 179–180, 190, 203, 205, 235, 238–242
   projects.py88990%109–110, 120, 144, 191, 205–209
   tax_groups.py180100% 
   webhook_attributes.py130695%98, 100–102, 213–214
workers
   actions.py210100% 
   helpers.py420100% 
   worker.py56591%44–45, 77–78, 125
TOTAL1033191291% 

Tests Skipped Failures Errors Time
715 0 💤 0 ❌ 0 🔥 49.414s ⏱️

@github-actions
Copy link


Diff Coverage
Diff: origin/master..HEAD, staged and unstaged changes

apps/workspaces/tasks.py (100%)
apps/workspaces/views.py (100%)

Total: 12 lines
Missing: 0 lines
Coverage: 100%

@Ashutosh619-sudo Ashutosh619-sudo merged commit fe84ab0 into master Jan 19, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M Medium PR

Development

Successfully merging this pull request may close these issues.

2 participants