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: Raise Error on over receipt/consumption for sub-contracted PR #23195

Merged

Conversation

marination
Copy link
Collaborator

@marination marination commented Aug 28, 2020

Issue:

  • Create a sub contracted Purchase Order

  • Create two Draft Purchase Receipts that fully receive this very PO

  • Submit the Receipts one by one. The first receipt should receive/consume the PO items/supplied items fully

  • The second receipt will break as there is no fg_yet_to_be_received (Finish goods yet to be received) in the PO:

      File ".../apps/erpnext/erpnext/controllers/buying_controller.py", line 301, in 
      update_raw_materials_supplied_based_on_stock_entries
           qty = (rm_qty_to_be_consumed / fg_yet_to_be_received) * item.qty
     TypeError: unsupported operand type(s) for /: 'float' and 'NoneType'
    
  • This happens on backflush based on materials transferred for subcontracting

Fix:

  • Alert the user that an over receipt is taking place as this issue often occurs due to two different users creating PRs against the same PO
    Screenshot 2020-08-28 at 12 14 53 PM
  • While looping if there's no PO against this item (accidentally or intentionally) don't proceed to create any qty maps as they will all be empty

Note

  • There is still one problematic case not handled here i.e. Returning a sub-contracted Purchase Receipt. That will be done in a separate PR after more clarity in it's design

@rohitwaghchaure rohitwaghchaure added the needs-tests This PR needs automated unit-tests. label Aug 28, 2020
@marination
Copy link
Collaborator Author

Screenshot 2020-08-28 at 2 22 42 PM

@marination marination removed the needs-tests This PR needs automated unit-tests. label Aug 28, 2020
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