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: float division by zero #39967

Merged

Conversation

rohitwaghchaure
Copy link
Collaborator

Issue

  File "apps/frappe/frappe/model/document.py", line 1300, in composer
    return composed(self, method, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 1282, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
                              ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 937, in fn
    return method_object(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/erpnext/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.py", line 153, in on_submit
    self.update_stock_ledger()
  File "apps/erpnext/erpnext/controllers/subcontracting_controller.py", line 865, in update_stock_ledger
    self.make_sl_entries(
  File "apps/erpnext/erpnext/controllers/stock_controller.py", line 645, in make_sl_entries
    make_sl_entries(sl_entries, allow_negative_stock, via_landed_cost_voucher)
  File "apps/erpnext/erpnext/stock/stock_ledger.py", line 107, in make_sl_entries
    repost_current_voucher(args, allow_negative_stock, via_landed_cost_voucher)
  File "apps/erpnext/erpnext/stock/stock_ledger.py", line 123, in repost_current_voucher
    update_entries_after(
  File "apps/erpnext/erpnext/stock/stock_ledger.py", line 545, in __init__
    self.build()
  File "apps/erpnext/erpnext/stock/stock_ledger.py", line 593, in build
    self.process_sle_against_current_timestamp()
  File "apps/erpnext/erpnext/stock/stock_ledger.py", line 616, in process_sle_against_current_timestamp
    self.process_sle(sle)
  File "apps/erpnext/erpnext/stock/stock_ledger.py", line 747, in process_sle
    self.calculate_valuation_for_serial_batch_bundle(sle)
  File "apps/erpnext/erpnext/stock/stock_ledger.py", line 903, in calculate_valuation_for_serial_batch_bundle
    self.wh_data.valuation_rate = flt(self.wh_data.stock_value, precision) / flt(
                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ZeroDivisionError: float division by zero

@github-actions github-actions bot added needs-tests This PR needs automated unit-tests. stock labels Feb 19, 2024
@rohitwaghchaure rohitwaghchaure merged commit fa1113f into frappe:develop Feb 20, 2024
14 checks passed
rohitwaghchaure added a commit that referenced this pull request Feb 20, 2024
…-39967

fix: float division by zero (backport #39967)
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
backport version-15-hotfix needs-tests This PR needs automated unit-tests. stock
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant