8848digital / Assets

MIT License
0 stars 2 forks source link

An error occurs during the import of asset data. #59

Closed deepdoshi79 closed 3 weeks ago

deepdoshi79 commented 3 weeks ago

Information about bug

An error occurs during the import of asset data. when trying to import asset data with the purchase invoice and the Gross purchase amount below error is occurring image

Module

assets

Version

Assets: v0.0.1 (pre-prod)

ERPNext: v15.34.0 (pre-prod)

Frappe Framework: v15.41.0 (pre-prod)

Installation method

None

Relevant log output / Stack trace / Full Error Message.

Traceback (most recent call last):
  File "apps/frappe/frappe/core/doctype/data_import/importer.py", line 149, in import_data
    doc = self.process_doc(doc)
  File "apps/frappe/frappe/core/doctype/data_import/importer.py", line 251, in process_doc
    return self.insert_record(doc)
  File "apps/frappe/frappe/core/doctype/data_import/importer.py", line 270, in insert_record
    new_doc.insert()
  File "apps/frappe/frappe/model/document.py", line 291, in insert
    self.run_before_save_methods()
  File "apps/frappe/frappe/model/document.py", line 1091, in run_before_save_methods
    self.run_method("validate")
  File "apps/frappe/frappe/model/document.py", line 962, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 1322, in composer
    return composed(self, method, *args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 1304, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "apps/frappe/frappe/model/document.py", line 959, in fn
    return method_object(*args, **kwargs)
  File "apps/assets/assets/assets/doctype/asset/asset.py", line 131, in validate
    self.validate_gross_and_purchase_amount()
  File "apps/assets/assets/assets/doctype/asset/asset.py", line 384, in validate_gross_and_purchase_amount
    frappe.throw(error_message, title=_("Invalid Gross Purchase Amount"))
  File "apps/frappe/frappe/__init__.py", line 652, in throw
    msgprint(
  File "apps/frappe/frappe/__init__.py", line 617, in msgprint
    _raise_exception()
  File "apps/frappe/frappe/__init__.py", line 568, in _raise_exception
    raise exc
frappe.exceptions.ValidationError: Gross Purchase Amount should be equal to purchase amount of one single Asset.
Please do not book expense of multiple assets against one single Asset.
tohidmalik002 commented 3 weeks ago

Purchase Amount field is also required in template along with Gross Purchase Amount

deepdoshi79 commented 3 weeks ago

Functionality working after entering purchase amount field in data import file