fix: rate of stock uom division by zero error (#24829)

This commit is contained in:
Anupam Kumar 2021-03-10 12:04:54 +05:30 committed by GitHub
parent 20cc2bb0d8
commit 77eaf2939a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -406,7 +406,8 @@ class StockController(AccountsController):
def set_rate_of_stock_uom(self):
if self.doctype in ["Purchase Receipt", "Purchase Invoice", "Purchase Order", "Sales Invoice", "Sales Order", "Delivery Note", "Quotation"]:
for d in self.get("items"):
d.stock_uom_rate = d.rate / d.conversion_factor
if d.conversion_factor:
d.stock_uom_rate = d.rate / d.conversion_factor
def validate_internal_transfer(self):
if self.doctype in ('Sales Invoice', 'Delivery Note', 'Purchase Invoice', 'Purchase Receipt') \