Skip to content

Only update syncable fields on open deals#389

Merged
DanJezeph15 merged 14 commits intomainfrom
sync_paid_inv_count_deal
Feb 6, 2026
Merged

Only update syncable fields on open deals#389
DanJezeph15 merged 14 commits intomainfrom
sync_paid_inv_count_deal

Conversation

@tejas7777
Copy link
Contributor

@tejas7777 tejas7777 commented Jan 28, 2026

Issue Close: #387

We now allow paid_invoice_count to be synced on existing open deals.

Added a partial sync function to only sync the specified syncable deal field (For this PR only paid_invoice_count and later saved card date in next PR). For the partial sync, we avoid re GETing the deal as we already know what we want to set and directly send PATCH instead.

@tejas7777 tejas7777 self-assigned this Jan 28, 2026
deal_data = _deal_to_pd_data(deal, db)
pd_deal_id = deal.pd_deal_id

if only_sync_deal_fields and company:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The whole point of doing it here is to avoid the GET requests to PD since we already know the value of the field we are going to set.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also as explained in the inline comment below, let me know if cleaner way about it!

# Get from company
value = company.tc2_cligency_url if company else None
elif field_name == 'paid_invoice_count':
value = company.paid_invoice_count if company else None
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Existing deals will have value set to 0, so we from here onwards, need to pick this specific field from the company instead.

@tejas7777 tejas7777 assigned Pager07 and unassigned tejas7777 Jan 28, 2026
@Pager07 Pager07 assigned tejas7777 and unassigned Pager07 Jan 29, 2026
Copy link
Contributor

@Pager07 Pager07 left a comment

Choose a reason for hiding this comment

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

few comment else lgtm

@tejas7777 tejas7777 assigned DanJezeph15 and unassigned tejas7777 Jan 29, 2026
@DanJezeph15 DanJezeph15 assigned tejas7777 and unassigned DanJezeph15 Jan 30, 2026
@tejas7777 tejas7777 assigned DanJezeph15 and unassigned tejas7777 Feb 3, 2026
Copy link
Contributor

@DanJezeph15 DanJezeph15 left a comment

Choose a reason for hiding this comment

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

Last comments from me.

Else lgtm!

@DanJezeph15 DanJezeph15 assigned tejas7777 and unassigned DanJezeph15 Feb 4, 2026
@tejas7777 tejas7777 assigned DanJezeph15 and unassigned tejas7777 Feb 5, 2026
Copy link
Contributor

@DanJezeph15 DanJezeph15 left a comment

Choose a reason for hiding this comment

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

lgtm!

@DanJezeph15 DanJezeph15 merged commit 6785702 into main Feb 6, 2026
1 check passed
@DanJezeph15 DanJezeph15 deleted the sync_paid_inv_count_deal branch February 6, 2026 11:12
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.

3 participants