Se adiciona xml de AllowanceCharge para documento

FossilOrigin-Name: 93cd9530bb2f63a2803b8a32a5aceeeda015eff2d26c96e95a13dbb9193cad82
This commit is contained in:
bit4bit
2020-12-02 18:46:18 +00:00
parent e571009945
commit 1143b26988
4 changed files with 94 additions and 39 deletions

View File

@@ -61,7 +61,7 @@ def test_FAU10():
]
)
))
inv.add_allownace_charge(form.AllowanceCharge(amount=form.Amount(19.0)))
inv.add_allowance_charge(form.AllowanceCharge(amount=form.Amount(19.0)))
inv.calculate()
assert inv.invoice_legal_monetary_total.line_extension_amount == form.Amount(100.0)
@@ -89,7 +89,7 @@ def test_FAU14():
]
)
))
inv.add_allownace_charge(form.AllowanceCharge(amount=form.Amount(19.0)))
inv.add_allowance_charge(form.AllowanceCharge(amount=form.Amount(19.0)))
inv.add_prepaid_payment(form.PrePaidPayment(paid_amount = form.Amount(50.0)))
inv.calculate()

View File

@@ -6,9 +6,13 @@
"""Tests for `facho` package."""
import pytest
from datetime import datetime
from facho.fe import form
from facho.fe import form_xml
from fixtures import *
def test_import_DIANInvoiceXML():
try:
form_xml.DIANInvoiceXML
@@ -27,3 +31,29 @@ def test_import_DIANCreditNoteXML():
form_xml.DIANCreditNoteXML
except AttributeError:
pytest.fail("unexpected not found")
def test_FAU10(simple_invoice_without_lines):
inv = simple_invoice_without_lines
inv.add_invoice_line(form.InvoiceLine(
quantity = form.Quantity(1, '94'),
description = 'producto facho',
item = form.StandardItem(9999),
price = form.Price(
amount = form.Amount(100.0),
type_code = '01',
type = 'x'
),
tax = form.TaxTotal(
subtotals = [
form.TaxSubTotal(
percent = 19.0,
)
]
)
))
inv.add_allowance_charge(form.AllowanceCharge(amount=form.Amount(19.0)))
xml = form_xml.DIANInvoiceXML(inv)
assert xml.get_element_text('./cac:AllowanceCharge/cbc:ID') == '1'
assert xml.get_element_text('./cac:AllowanceCharge/cbc:ChargeIndicator') == 'true'
assert xml.get_element_text('./cac:AllowanceCharge/cbc:Amount') == '19.0'