Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resource Tax Group: refactored imports #315

Merged
merged 16 commits into from
Mar 4, 2024

Conversation

Hrishabh17
Copy link
Contributor

@Hrishabh17 Hrishabh17 commented Mar 1, 2024

Summary by CodeRabbit

  • New Features
    • Included import tax code mapping settings based on workspace general settings.
    • Updated scheduling logic to include import_tax_codes alongside import_customers.
    • Added functionality to automatically create suppliers as merchants based on settings.
  • Bug Fixes
    • Adjusted conditions for scheduling tasks to ensure they align with updated import settings.
  • Refactor
    • Removed outdated tax groups and custom field mappings functionalities.
    • Streamlined handling of workspace general settings and import tasks.
  • Chores
    • Removed unused functions related to tax groups and custom field mappings.

Copy link

coderabbitai bot commented Mar 1, 2024

Walkthrough

The recent updates across various components focus on refining and simplifying the import and mapping functionalities related to tax codes, customers, suppliers, and custom field mappings. Notably, the integration now leans towards accommodating workspace settings for importing tax codes and suppliers, while eliminating previously supported functionalities like tax group uploads and custom field mappings. These changes aim to streamline operations based on user settings, enhancing efficiency and customization in the process.

Changes

File Paths Summary
apps/mappings/queue.py Added conditional block for import tax code mapping settings based on workspace settings.
apps/mappings/schedules.py Updated task scheduling logic to include import_tax_codes alongside import_customers.
apps/mappings/tasks.py Removed functions related to tax groups; added auto_create_suppliers_as_merchants.
apps/workspaces/apis/import_settings/triggers.py Removed call to schedule_tax_groups_creation; adjusted to focus on workspace general settings.
apps/xero/actions.py Removed custom field mappings; added importing suppliers as merchants based on settings.

🐰✨

In the realm of code, where changes abide,
A rabbit hopped through, with a gentle stride.
"Tax codes and suppliers," it softly said,
"Now dance in harmony, no thread to dread."
With a whisk of its tail, under moon's bright gaze,
It vanished in the night, leaving trails of grace.
🌌🚀

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share

Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit-tests for this file.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit tests for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

@Hrishabh17 Hrishabh17 requested a review from ashwin1111 March 1, 2024 06:51
task_settings['import_tax'] = {
'destination_field': 'TAX_CODE',
'destination_sync_methods': [SYNC_METHODS['TAX_CODE']],
'is_auto_sync_enabled': is_auto_sync_allowed(workspace_general_settings, None),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can sent it False by default since we know this block is only for tax

@Hrishabh17 Hrishabh17 changed the base branch from refactor-imports-custom-expense to imports-refactor-master March 4, 2024 14:56
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 8ac1c16 and bb31918.
Files selected for processing (5)
  • apps/mappings/queue.py (1 hunks)
  • apps/mappings/schedules.py (1 hunks)
  • apps/mappings/tasks.py (1 hunks)
  • apps/workspaces/apis/import_settings/triggers.py (2 hunks)
  • apps/xero/actions.py (1 hunks)
Additional comments: 5
apps/mappings/schedules.py (1)
  • 25-25: The addition of workspace_general_settings_instance.import_tax_codes in the condition for scheduling tasks aligns with the PR's objective to enhance the application's ability to dynamically import tax codes based on workspace general settings. This change ensures that tasks related to importing tax codes are scheduled when the setting is enabled, contributing to the flexibility and efficiency of the import process.
apps/workspaces/apis/import_settings/triggers.py (1)
  • 3-8: > 📝 NOTE

This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [1-1]

The removal of the call to schedule_tax_groups_creation in post_save_workspace_general_settings simplifies the handling of workspace general settings and import tasks. This change is consistent with the PR's goal to streamline the import process by adjusting functionalities related to tax groups. By focusing on essential tasks and removing outdated functions, the application's import process becomes more efficient and easier to manage.

apps/xero/actions.py (1)
  • 79-84: > 📝 NOTE

This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [1-1]

The removal of logic related to custom field mappings in the refersh_xero_dimension function and the shift towards importing suppliers as merchants based on workspace settings are significant changes that align with the PR's objectives. This adjustment emphasizes the application's focus on importing essential data, such as suppliers, which enhances the flexibility and user experience in managing imports from external sources like Xero.

apps/mappings/queue.py (1)
  • 139-146: The addition of a conditional block to include import tax code mapping settings based on the workspace_general_settings.import_tax_codes setting is a crucial enhancement. This change ensures that tax code import tasks are constructed and executed only when the setting is enabled, aligning with the PR's goal to make the import process more adaptable to user settings. It's a positive step towards improving the application's flexibility in handling tax codes and supplier information.
apps/mappings/tasks.py (1)
  • 286-291: > 📝 NOTE

This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [1-1]

The removal of functions related to uploading tax groups to Fyle (upload_tax_groups_to_fyle, create_fyle_tax_group_payload, and auto_create_tax_codes_mappings) and the addition of the auto_create_suppliers_as_merchants function are significant changes that support the PR's objectives. These adjustments streamline the import process by removing outdated functionalities and focusing on importing suppliers as merchants, which is more aligned with the updated workspace settings. This shift enhances the application's efficiency and adaptability in managing imports.

@Hrishabh17 Hrishabh17 merged commit 457537b into imports-refactor-master Mar 4, 2024
1 check passed
Hrishabh17 added a commit that referenced this pull request Mar 12, 2024
* Added integrations_imports submodule, made changes in settings (#310)

* Refactor imports for Project resource (#311)

* Added integrations_imports submodule, made changes in settings

* Resource Project: Added new flow for the Project Import

* Typo Fix

* Resource Project: removed old import logic for Project

* Resource Project: added cluster import, fixed minor typo, added new supplier field

* Refactor imports for project and cost_center (#314)

* Added integrations_imports submodule, made changes in settings

* Resource Project: Added new flow for the Project Import

* Typo Fix

* Resource Project: removed old import logic for Project

* Resource Project: added cluster import, fixed minor typo, added new supplier field

* Refactor imports costcenter (#312)

* Resource Cost_Center: refactored imports

* Refactor imports for Project resource (#311)

* Added integrations_imports submodule, made changes in settings

* Resource Project: Added new flow for the Project Import

* Typo Fix

* Resource Project: removed old import logic for Project

* Resource Project: added cluster import, fixed minor typo, added new supplier field

* Refactor imports custom expense (#313)

* Added integrations_imports submodule, made changes in settings

* Resource Project: Added new flow for the Project Import

* Typo Fix

* Resource Project: removed old import logic for Project

* Resource Cost_Center: refactored imports

* Resource Custom Expense Field: refactored imports

* Resource Project: added cluster import, fixed minor typo, added new supplier field

* Resource Tax Group: refactored imports (#315)

* Added integrations_imports submodule, made changes in settings

* Resource Project: Added new flow for the Project Import

* Typo Fix

* Resource Project: removed old import logic for Project

* Resource Cost_Center: refactored imports

* Resource Custom Expense Field: refactored imports

* Resource Project: added cluster import, fixed minor typo, added new supplier field

* Resource Tax Group: refactored imports

* Resource Tax Group: changed to is_auto_sync to False by default

* Resource Category: refactored imports (#316)

* Added integrations_imports submodule, made changes in settings

* Resource Project: Added new flow for the Project Import

* Typo Fix

* Resource Project: removed old import logic for Project

* Resource Cost_Center: refactored imports

* Resource Custom Expense Field: refactored imports

* Resource Tax Group: refactored imports

* Resource Category: refactored imports

* Resource Category: changed is_auto_sync_enabled to True by default

* Refactor imports supplier (#318)

* Added integrations_imports submodule, made changes in settings

* Resource Project: Added new flow for the Project Import

* Typo Fix

* Resource Project: removed old import logic for Project

* Resource Cost_Center: refactored imports

* Resource Custom Expense Field: refactored imports

* Resource Tax Group: refactored imports

* Resource Category: refactored imports

* Added RetryException handler and bumped the sdk versions (#306)

* Set tasks limit to 1L (#317)

* Set tasks limit to 1L

* set timeout

* Modified the import schedule creation condition

---------

Co-authored-by: ruuushhh <[email protected]>

* Refactor old flow (#321)

* Added integrations_imports submodule, made changes in settings

* Resource Project: Added new flow for the Project Import

* Typo Fix

* Resource Project: removed old import logic for Project

* Resource Cost_Center: refactored imports

* Resource Custom Expense Field: refactored imports

* Resource Tax Group: refactored imports

* Resource Category: refactored imports

* Added RetryException handler and bumped the sdk versions (#306)

* Set tasks limit to 1L (#317)

* Set tasks limit to 1L

* set timeout

* Modified the import schedule creation condition

* Removed dead code, add few test cases, added script for adding new schedule for different workspaces

* Added post deploy sql script to dump old schedules and delete

---------

Co-authored-by: ruuushhh <[email protected]>

* Merged changes from master

* Update delete workspace func (#319)

* Update delete workspace func

* Fix comments

* upate workspace last synced fix (#320)

* Modified the workflow for submodule

* Decreased the coverage to 88%

---------

Co-authored-by: ruuushhh <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants