Fixes for making stock entry against Pro Order (#12721)

This commit is contained in:
Nabin Hait
2018-02-01 10:51:27 +05:30
committed by GitHub
parent 9f29f60707
commit 7ba092eaf9
5 changed files with 16 additions and 12 deletions

View File

@@ -430,7 +430,7 @@ def get_stock_ledger_entries(previous_sle, operator=None, order="desc", limit=No
}, previous_sle, as_dict=1, debug=debug)
def get_valuation_rate(item_code, warehouse, voucher_type, voucher_no,
allow_zero_rate=False, currency=None, company=None):
allow_zero_rate=False, currency=None, company=None, raise_error_if_no_rate=True):
# Get valuation rate from last sle for the same item and warehouse
if not company:
company = erpnext.get_default_company()
@@ -465,7 +465,7 @@ def get_valuation_rate(item_code, warehouse, voucher_type, voucher_no,
dict(item_code=item_code, buying=1, currency=currency),
'price_list_rate')
if not allow_zero_rate and not valuation_rate \
if not allow_zero_rate and not valuation_rate and raise_error_if_no_rate \
and cint(erpnext.is_perpetual_inventory_enabled(company)):
frappe.local.message_log = []
frappe.throw(_("Valuation rate not found for the Item {0}, which is required to do accounting entries for {1} {2}. If the item is transacting as a zero valuation rate item in the {1}, please mention that in the {1} Item table. Otherwise, please create an incoming stock transaction for the item or mention valuation rate in the Item record, and then try submiting/cancelling this entry").format(item_code, voucher_type, voucher_no))