add: creditnote
This commit is contained in:
parent
c4571a28b9
commit
28a96bc7c9
4 changed files with 259 additions and 6 deletions
|
@ -15,8 +15,8 @@ class EdocTestCase(ModuleTestCase):
|
|||
module = 'edocument_xrechnung'
|
||||
|
||||
@with_transaction()
|
||||
def test_xrechn_export_xml(self):
|
||||
""" run export
|
||||
def test_xrechn_export_xml_invoice(self):
|
||||
""" run export - invoice
|
||||
"""
|
||||
pool = Pool()
|
||||
Template = pool.get('edocument.xrechnung.invoice')
|
||||
|
@ -49,7 +49,56 @@ class EdocTestCase(ModuleTestCase):
|
|||
|
||||
template = Template(invoice)
|
||||
invoice_string = template.render('XRechnung-2.2')
|
||||
with open('xrechnung-test.xml', 'wt') as fhdl:
|
||||
with open('xrechnung-test-invoice.xml', 'wt') as fhdl:
|
||||
fhdl.write(invoice_string.decode('utf8'))
|
||||
|
||||
@with_transaction()
|
||||
def test_xrechn_export_xml_creditnote(self):
|
||||
""" run export - creditnote
|
||||
"""
|
||||
pool = Pool()
|
||||
Template = pool.get('edocument.xrechnung.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()
|
||||
|
||||
# credit note
|
||||
invoice.lines[0].quantity = -1
|
||||
invoice.lines[0].amount = Decimal('-100.0')
|
||||
invoice.taxes[0].base = Decimal('-100.0')
|
||||
invoice.taxes[0].amount = Decimal('-10.0')
|
||||
invoice.untaxed_amount = Decimal('-100.0')
|
||||
invoice.tax_amount = Decimal('-10.0')
|
||||
invoice.total_amount = Decimal('-110.0')
|
||||
invoice.lines_to_pay[0].debit = Decimal('-110.0')
|
||||
|
||||
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)
|
||||
invoice_string = template.render('XRechnung-2.2')
|
||||
with open('xrechnung-test-creditnote.xml', 'wt') as fhdl:
|
||||
fhdl.write(invoice_string.decode('utf8'))
|
||||
|
||||
# end EdocTestCase
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue