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: slow stock reposting #31631

Merged

Conversation

rohitwaghchaure
Copy link
Collaborator

@rohitwaghchaure rohitwaghchaure commented Jul 19, 2022

  1. Slow Stock Reposting

Recently we have made changes which would enqueue the same item with different warehouse so that system won't throw the timeout error. This changes causing the slow reposting issue.

To fix this issue, before enqueue check whether the same item and warehouse exists in the queue or not and if it's exists then check the posting date. If the posting date is less than the current posting date then update the posting date.

def update_distinct_item_warehouses(self, dependant_sle):
		key = (dependant_sle.item_code, dependant_sle.warehouse)
		val = frappe._dict({"sle": dependant_sle})
		if key not in self.distinct_item_warehouses:
			self.distinct_item_warehouses[key] = val
			self.new_items_found = True
		else:
			existing_sle_posting_date = (
				self.distinct_item_warehouses[key].get("sle", {}).get("posting_date")
			)
			if getdate(dependant_sle.posting_date) < getdate(existing_sle_posting_date):
				val.sle_changed = True
				self.distinct_item_warehouses[key] = val
				self.new_items_found = True
  1. Item and Warehouse reposting

In case of item and warehouse based reposting, system partially repost with status as Completed. The cause for this issue is if because of timeout the system has reposted Repost Item Valuation partially and when the reposting runs again system failed to pick the correct items which has to be repost.

Screenshot 2022-07-19 at 12 59 14 PM

@rohitwaghchaure
Copy link
Collaborator Author

@mergify backport version-13-hotfix

@mergify
Copy link
Contributor

mergify bot commented Jul 19, 2022

backport version-13-hotfix

🟠 Waiting for conditions to match

  • merged [:pushpin: backport requirement]

@rohitwaghchaure rohitwaghchaure merged commit 60dbd6a into frappe:develop Jul 19, 2022
@mergify
Copy link
Contributor

mergify bot commented Jul 19, 2022

backport version-13-hotfix

✅ Backports have been created

rohitwaghchaure added a commit that referenced this pull request Jul 19, 2022
…-31631

fix: slow stock reposting (backport #31631)
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.

1 participant