diff --git a/facho/fe/form/__init__.py b/facho/fe/form/__init__.py index fd1f21c..395c748 100644 --- a/facho/fe/form/__init__.py +++ b/facho/fe/form/__init__.py @@ -116,12 +116,12 @@ class Amount: class Quantity: def __init__(self, val, code): - if not isinstance(val, int): - raise ValueError('val expected int') + if type(val) not in [float, int]: + raise ValueError('val expected int or float') if code not in codelist.UnidadesMedida: raise ValueError("code [%s] not found" % (code)) - self.value = val + self.value = Amount(val) self.code = code def __mul__(self, other): diff --git a/tests/test_fe_form.py b/tests/test_fe_form.py index b74707f..2c01b96 100644 --- a/tests/test_fe_form.py +++ b/tests/test_fe_form.py @@ -112,7 +112,7 @@ def test_invoice_cufe(simple_invoice_without_lines): simple_invoice.invoice_supplier.ident = form.PartyIdentification('700085371', '5', '31') simple_invoice.invoice_customer.ident = form.PartyIdentification('800199436', '5', '31') simple_invoice.add_invoice_line(form.InvoiceLine( - quantity = form.Quantity(1, '94'), + quantity = form.Quantity(1.00, '94'), description = 'producto', item = form.StandardItem(111), price = form.Price(form.Amount(1_500_000), '01', ''),