diff --git a/l10n_it_fatturapa_in/tests/data/IT05979361218_014.xml b/l10n_it_fatturapa_in/tests/data/IT05979361218_014.xml new file mode 100644 index 000000000000..ac699e8d4871 --- /dev/null +++ b/l10n_it_fatturapa_in/tests/data/IT05979361218_014.xml @@ -0,0 +1,92 @@ + + + + + + IT + 05979361218 + + 006 + FPA12 + UFPQ1O + + + + + IT + 05979361218 + + + SOCIETA' ALPHA BETA SRL + + RF02 + + + VIALE ROMA 543B + 07100 + SASSARI + SS + IT + + + + + 80213330584 + + AMMINISTRAZIONE BETA + + + + VIA TORINO 38-B + 00145 + ROMA + RM + IT + + + + + + + TD01 + EUR + 2019-05-11 + 852S1 + 16.60 + Rif ordine 908 + + + + + 1 + USB4 + 0.00 + Pz. + 18.07 + 0.00 + 0.00 + N4 + + + 2 + USB + Pz. + 16.60 + 16.60 + 0.00 + N4 + + + 0.00 + N4 + 16.60 + 0.00 + I + Esenzione Art.8 comma 1 DPR 633/72 + + + + diff --git a/l10n_it_fatturapa_in/tests/test_import_fatturapa_xml.py b/l10n_it_fatturapa_in/tests/test_import_fatturapa_xml.py index f39edf1410e2..32a02a18974f 100644 --- a/l10n_it_fatturapa_in/tests/test_import_fatturapa_xml.py +++ b/l10n_it_fatturapa_in/tests/test_import_fatturapa_xml.py @@ -480,6 +480,13 @@ def test_25_xml_import(self): self.assertEqual(invoice.e_invoice_amount_tax, 0.0) self.assertEqual(invoice.e_invoice_amount_total, 34.32) + def test_26_xml_import(self): + res = self.run_wizard('test26', 'IT05979361218_014.xml') + invoice_id = res.get('domain')[0][2][0] + invoice = self.invoice_model.browse(invoice_id) + self.assertEqual(invoice.invoice_line_ids[0].quantity, 0) + self.assertEqual(invoice.invoice_line_ids[1].quantity, 1) + def test_31_xml_import(self): res = self.run_wizard('test31', 'IT01234567890_FPR05.xml') invoice_id = res.get('domain')[0][2][0] diff --git a/l10n_it_fatturapa_in/wizard/wizard_import_fatturapa.py b/l10n_it_fatturapa_in/wizard/wizard_import_fatturapa.py index fbd4da2fd3fa..d23add1f89f2 100644 --- a/l10n_it_fatturapa_in/wizard/wizard_import_fatturapa.py +++ b/l10n_it_fatturapa_in/wizard/wizard_import_fatturapa.py @@ -426,7 +426,9 @@ def _prepareInvoiceLine(self, credit_account_id, line, wt_found=False): 'account_id': credit_account_id, 'price_unit': float(line.PrezzoUnitario), }) - if line.Quantita: + if line.Quantita is None: + retLine['quantity'] = 1.0 + else: retLine['quantity'] = float(line.Quantita) if ( float(line.PrezzoUnitario) and