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: Sales Order Connections Tabs do not show linked Material Request or "+" button (intoduce by #33304) #33690

Merged
merged 2 commits into from
Jan 17, 2023

Conversation

FHenry
Copy link
Contributor

@FHenry FHenry commented Jan 16, 2023

ERPNext develop, versoin-14, version-13

How to reproduce :
Create a Sales order
Create a Material request from the sales order (use create blue button as "+" is missing) => Go to Connections tabs => Go back to originated Sales Order
Check Sales Order Connections Tab, the materials Request is not here.

Before PR:

Before.mp4

After PR:

After.mp4

Note To Reviewer:

  • I don't know why @s-aga-r have (or I have) different result, but I test from fresh install without any custom app or customization in version-13, version-14 and develop, and this PR broke exactly what it should to fix
  • Linters error is not related with this change.

@github-actions github-actions bot added the needs-tests This PR needs automated unit-tests. label Jan 16, 2023
@FHenry
Copy link
Contributor Author

FHenry commented Jan 16, 2023

When Sales Order is displayed
There is the Frappe API Rest Call
/api/method/frappe.desk.notifications.get_open_count
 
doctype | Sales Order
name | SAL-ORD-2023-00001
items | ["Sales Invoice","Pick List","Delivery Note","Maintenance Visit","Material Request","Purchase Order","Project","Work Order","Quotation","Auto Repeat","Payment Entry","Payment Request","Journal Entry"]

URI param "items" already include Material Request, The is no need to specify it into get_data() on sales_order_dashboard.py.

Either Add "Material Request": ["items", "material_request"], in get_data() on sales_order_dashboard.py is strange, shouldn't it be "Material Request": ["items", "sales_order"], but there is no need as frappe already manage it with "transaction" section ? (manage by frappe/model/meta.py : add_doctype_links()

That can explain why result of API call didn't return at all Material Request count as the field material_request don't exists into Material Request Item

{
	"message": {
		"count": [
			{
				"name": "Sales Invoice",
				"count": 0
			},
			{
				"name": "Pick List",
				"count": 0
			},
			{
				"name": "Delivery Note",
				"count": 0
			},
			{
				"name": "Maintenance Visit",
				"count": 0
			},
			{
				"name": "Purchase Order",
				"count": 0
			},
			{
				"name": "Project",
				"count": 0
			},
			{
				"name": "Work Order",
				"count": 0
			},
			{
				"name": "Auto Repeat",
				"count": 0
			},
			{
				"name": "Payment Entry",
				"count": 0
			},
			{
				"name": "Payment Request",
				"count": 0
			},
			{
				"name": "Journal Entry",
				"count": 0
			}
		]
	}
}

 

@s-aga-r
Copy link
Contributor

s-aga-r commented Jan 17, 2023

@FHenry there are two flows, I have added the fix for the Internal Transfer but it breaks the SO --> MR [MR link in SO]. AFAIK the material_request and material_request_item fields not getting updated when a Material Request gets submitted. To fix this we need to update the same on submit of MR.

@s-aga-r s-aga-r merged commit e4cf0dc into frappe:develop Jan 17, 2023
s-aga-r added a commit that referenced this pull request Jan 17, 2023
…-33690

fix: Sales Order Connections Tabs do not show linked Material Request or "+" button  (intoduce by #33304) (backport #33690)
s-aga-r added a commit that referenced this pull request Jan 17, 2023
…-33690

fix: Sales Order Connections Tabs do not show linked Material Request or "+" button  (intoduce by #33304) (backport #33690)
@FHenry FHenry deleted the dev_fix_bug_from_78b438f6 branch January 17, 2023 06:36
@FHenry
Copy link
Contributor Author

FHenry commented Jan 17, 2023

@s-aga-r Ok, Thank you very much for clarification.

So that a similar problem than this issue #27874
We actually can't have more than 1 way to count related linked elements

@s-aga-r
Copy link
Contributor

s-aga-r commented Jan 17, 2023

@s-aga-r Ok, Thank you very much for clarification.

So that a similar problem than this issue #27874 We actually can't have more than 1 way to count related linked elements

@FHenry will be able to see the MR ref(s) in SO if we set the material_request and 'material_request_item' in SO on submission of MR, but I am not sure about the + button will be visible or not. Will try it locally and raise a PR if it works.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
backport version-13-hotfix backport version-14-hotfix backport to version 14 needs-tests This PR needs automated unit-tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants