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

fix: Unlink PO on cancelling SO #27609

Merged
merged 9 commits into from
Oct 29, 2021

Conversation

GangaManoj
Copy link
Contributor

Problem:

  • On cancelling a Sales Order, Purchase Orders linked with it also get cancelled.

Fix:

  • Unlink associated Purchase Orders on cancelling Sales Orders.

@stale
Copy link

stale bot commented Oct 13, 2021

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed within a week if no further activity occurs, but it only takes a comment to keep a contribution alive :) Also, even if it is closed, you can always reopen the PR when you're ready. Thank you for contributing.

@@ -815,6 +816,57 @@ def on_cancel(self):
if frappe.db.get_single_value('Accounts Settings', 'unlink_advance_payment_on_cancelation_of_order'):
unlink_ref_doc_from_payment_entries(self)

if self.doctype == "Sales Order":
Copy link
Member

Choose a reason for hiding this comment

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

We can also create Purchase Order from Sales Order as well. Shouldn't this be other way round as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There doesn't seem to be an option to do that.

Screenshot 2021-10-28 at 7 20 19 PM


print("SO Items: ", so_items)

linked_po = frappe.get_all(
Copy link
Member

Choose a reason for hiding this comment

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

As far as I know, set_value only updates one record at a time, can you try with multiple items as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah, it worked perfectly when I tried it on the console, which is why this is so baffling.

@codecov
Copy link

codecov bot commented Oct 28, 2021

Codecov Report

Merging #27609 (051aaa7) into develop (98f4b90) will increase coverage by 8.90%.
The diff coverage is 80.00%.

@@             Coverage Diff             @@
##           develop   #27609      +/-   ##
===========================================
+ Coverage    46.50%   55.41%   +8.90%     
===========================================
  Files         1248     1248              
  Lines        67681    67691      +10     
===========================================
+ Hits         31475    37508    +6033     
+ Misses       36206    30183    -6023     
Impacted Files Coverage Δ
erpnext/controllers/accounts_controller.py 83.53% <80.00%> (+6.06%) ⬆️
...e/asset_value_adjustment/asset_value_adjustment.py 87.80% <0.00%> (-3.66%) ⬇️
...ype/account/chart_of_accounts/chart_of_accounts.py 77.55% <0.00%> (-0.69%) ⬇️
...stock/doctype/purchase_receipt/purchase_receipt.py 90.61% <0.00%> (+0.26%) ⬆️
erpnext/projects/doctype/project/project.py 54.25% <0.00%> (+0.35%) ⬆️
erpnext/accounts/doctype/account/account.py 71.09% <0.00%> (+0.39%) ⬆️
erpnext/projects/doctype/task/task.py 64.44% <0.00%> (+0.44%) ⬆️
erpnext/controllers/buying_controller.py 86.42% <0.00%> (+0.47%) ⬆️
...next/accounts/doctype/subscription/subscription.py 82.58% <0.00%> (+0.56%) ⬆️
...cturing/doctype/production_plan/production_plan.py 69.56% <0.00%> (+0.59%) ⬆️
... and 183 more

@deepeshgarg007
Copy link
Member

@Mergifyio backport version-13-hotfix

@deepeshgarg007 deepeshgarg007 merged commit 28c116a into frappe:develop Oct 29, 2021
@mergify
Copy link
Contributor

mergify bot commented Oct 29, 2021

backport version-13-hotfix

✅ Backports have been created

deepeshgarg007 added a commit that referenced this pull request Oct 29, 2021
…-27609

fix: Unlink PO on cancelling SO (backport #27609)
asoral pushed a commit to asoral/erpnext that referenced this pull request Nov 12, 2021
…fix/pr-27609

fix: Unlink PO on cancelling SO (backport frappe#27609)
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.

None yet

3 participants