#!/usr/bin/env python # -*- coding: utf-8 -*- # This file is part of facho. The COPYRIGHT file at the top level of # this repository contains the full copyright notices and license terms. """Nuevo esquema para modelar segun decreto""" from datetime import datetime import pytest import facho.fe.model as model import facho.fe.form as form def test_simple_invoice(): invoice = model.Invoice() invoice.id = '323200000129' invoice.issue = datetime.strptime('2019-01-16 10:53:10-05:00', '%Y-%m-%d %H:%M:%S%z') invoice.supplier.party.id = '700085371' invoice.customer.party.id = '800199436' line = invoice.lines.create() line.quantity = form.Quantity(1, '94') subtotal = line.taxtotal.subtotals.create() subtotal.percent = 19.0 # TODO(bit4bit) el orden de los elementos # en el xml lo debe determinar la declaracion en los modelos line.price = form.Amount(5_000) assert '3232000001292019-01-16T10:53:10-05:0010:5310-05:007000853718001994361.019.001IVA5000.0' == invoice.to_xml()