senaite / senaite.core

Enterprise Open Source Laboratory System (LIMS)
https://senaite.com
GNU General Public License v2.0
254 stars 145 forks source link

Fixed InvalidOperation: Invalid literal for Decimal: '' #2587

Closed Lunga001 closed 3 months ago

Lunga001 commented 3 months ago

Description of the issue/feature this PR addresses

Linked issue: https://github.com/senaite/senaite.core/issues/

Current behavior before PR

Geting an error running upgrade script 2642

(39 additional frame(s) were not displayed)
  File ".../src/senaite.core/src/senaite/core/upgrade/v02_06_000.py", line 2025, in migrate_labproduct_to_dx
    destination._setObject(target_id, target)
  File "...src/senaite.core/src/senaite/core/catalog/catalog_multiplex_processor.py", line 100, in reindex
    obj, idxs=indexes, update_metadata=update_metadata)
  File ".../src/senaite.core/src/senaite/core/patches/catalog.py", line 66, in catalog_object
    update_metadata, pghandler=pghandler)
  File "...src/senaite.core/src/senaite/core/catalog/indexer/senaitesetup.py", line 97, in price_total
    return instance.getTotalPrice()
  File "...src/senaite.core/src/senaite/core/content/labproduct.py", line 213, in getTotalPrice
    vat = Decimal(self.getVAT())

Desired behavior after PR is merged

Upgrade script to run without the error

--

I confirm I have tested this PR thoroughly and coded it according to PEP8 and Plone's Python styleguide standards.