export: add factur-x 1.07.2
This commit is contained in:
parent
3d703e300e
commit
764cacc091
5 changed files with 259 additions and 10 deletions
|
@ -46,6 +46,52 @@ class EdocTestCase(ModuleTestCase):
|
|||
{'identifiers': [('delete', [party.identifiers[0].id])]}]
|
||||
)
|
||||
|
||||
@with_transaction()
|
||||
def test_xrechn_export_facturx(self):
|
||||
""" run export - factur-x
|
||||
"""
|
||||
pool = Pool()
|
||||
Template = pool.get('edocument.facturxext.invoice')
|
||||
Identifier = pool.get('party.identifier')
|
||||
Party = pool.get('party.party')
|
||||
Bank = pool.get('bank')
|
||||
BankAccount = pool.get('bank.account')
|
||||
BankNumber = pool.get('bank.account.number')
|
||||
|
||||
invoice = get_invoice()
|
||||
invoice.payment_term_date = date.today()
|
||||
invoice.party.get_xrechnung_route_id = Mock(
|
||||
return_value='xrechn-route-id-123')
|
||||
invoice.company.party.bank_accounts = [
|
||||
Mock(
|
||||
spec=BankAccount,
|
||||
currency=invoice.currency,
|
||||
bank=Mock(spec=Bank, party=Mock(spec=Party, name='Bank')),
|
||||
owners=[invoice.company.party],
|
||||
numbers=[Mock(spec=BankNumber, type='other', number='123456')],
|
||||
)]
|
||||
invoice.description = 'description of invoice'
|
||||
invoice.comment = 'note line 1\nnote line 2'
|
||||
invoice.taxes[0].tax.rate = Decimal('0.1')
|
||||
invoice.identifiers = [
|
||||
Mock(
|
||||
spec=Identifier,
|
||||
type='edoc_route_id',
|
||||
code='xrechn-route-id-123')
|
||||
]
|
||||
|
||||
template = Template(invoice)
|
||||
|
||||
schema_file = os.path.join(
|
||||
os.path.dirname(__file__),
|
||||
'Factur-X_1.07.2_EXTENDED',
|
||||
'Factur-X_1.07.2_EXTENDED.xsd')
|
||||
|
||||
invoice_string = template.render('Factur-X-1.07.2-extended')
|
||||
invoice_xml = etree.fromstring(invoice_string)
|
||||
schema = etree.XMLSchema(etree.parse(schema_file))
|
||||
schema.assertValid(invoice_xml)
|
||||
|
||||
@with_transaction()
|
||||
def test_xrechn_export_xml_invoice(self):
|
||||
""" run export - invoice
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue