Fix #60 se extendiente tipo de operacion a otros documentos.
FossilOrigin-Name: 299c70b2dc438aa24b00bdd015144404be425b6bb0afecf8d31ba68d48928e78
This commit is contained in:
parent
b024533934
commit
48908a597d
@ -89,6 +89,8 @@ TipoImpuesto = CodeList(path_for_codelist('TipoImpuesto-2.1.gc'), 'code', 'name'
|
|||||||
CodigoPrecioReferencia = CodeList(path_for_codelist('CodigoPrecioReferencia-2.1.gc'), 'code', 'name')
|
CodigoPrecioReferencia = CodeList(path_for_codelist('CodigoPrecioReferencia-2.1.gc'), 'code', 'name')
|
||||||
MediosPago = CodeList(path_for_codelist('MediosPago-2.1.gc'), 'code', 'name')
|
MediosPago = CodeList(path_for_codelist('MediosPago-2.1.gc'), 'code', 'name')
|
||||||
RegimenFiscal = CodeList(path_for_codelist('RegimenFiscal-2.1.custom.gc'), 'code', 'name')
|
RegimenFiscal = CodeList(path_for_codelist('RegimenFiscal-2.1.custom.gc'), 'code', 'name')
|
||||||
|
TipoOperacionNC = CodeList(path_for_codelist('TipoOperacionNC-2.1.gc'), 'code', 'name')
|
||||||
|
TipoOperacionND = CodeList(path_for_codelist('TipoOperacionND-2.1 - copia.gc'), 'code', 'name')
|
||||||
TipoOperacionF = CodeList(path_for_codelist('TipoOperacionF-2.1.gc'), 'code', 'name')\
|
TipoOperacionF = CodeList(path_for_codelist('TipoOperacionF-2.1.gc'), 'code', 'name')\
|
||||||
.update(CodeList(path_for_codelist('TipoOperacionF-2.1.custom.gc'), 'code', 'name'))
|
.update(CodeList(path_for_codelist('TipoOperacionF-2.1.custom.gc'), 'code', 'name'))
|
||||||
Municipio = CodeList(path_for_codelist('Municipio-2.1.gc'), 'code', 'name')
|
Municipio = CodeList(path_for_codelist('Municipio-2.1.gc'), 'code', 'name')
|
||||||
|
@ -436,8 +436,11 @@ class Invoice:
|
|||||||
def set_payment_mean(self, payment_mean: PaymentMean):
|
def set_payment_mean(self, payment_mean: PaymentMean):
|
||||||
self.invoice_payment_mean = payment_mean
|
self.invoice_payment_mean = payment_mean
|
||||||
|
|
||||||
|
def _get_codelist_tipo_operacion(self):
|
||||||
|
return codelist.TipoOperacionF
|
||||||
|
|
||||||
def set_operation_type(self, operation):
|
def set_operation_type(self, operation):
|
||||||
if operation not in codelist.TipoOperacionF:
|
if operation not in self._get_codelist_tipo_operacion():
|
||||||
raise ValueError("operation not found")
|
raise ValueError("operation not found")
|
||||||
|
|
||||||
self.invoice_operation_type = operation
|
self.invoice_operation_type = operation
|
||||||
@ -514,6 +517,9 @@ class CreditNote(Invoice):
|
|||||||
raise TypeError('invoice_document_reference invalid type')
|
raise TypeError('invoice_document_reference invalid type')
|
||||||
self.invoice_billing_reference = invoice_document_reference
|
self.invoice_billing_reference = invoice_document_reference
|
||||||
|
|
||||||
|
def _get_codelist_tipo_operacion(self):
|
||||||
|
return codelist.TipoOperacionNC
|
||||||
|
|
||||||
|
|
||||||
class DebitNote(Invoice):
|
class DebitNote(Invoice):
|
||||||
def __init__(self, invoice_document_reference: BillingReference):
|
def __init__(self, invoice_document_reference: BillingReference):
|
||||||
@ -522,3 +528,6 @@ class DebitNote(Invoice):
|
|||||||
if not isinstance(invoice_document_reference, BillingReference):
|
if not isinstance(invoice_document_reference, BillingReference):
|
||||||
raise TypeError('invoice_document_reference invalid type')
|
raise TypeError('invoice_document_reference invalid type')
|
||||||
self.invoice_billing_reference = invoice_document_reference
|
self.invoice_billing_reference = invoice_document_reference
|
||||||
|
|
||||||
|
def _get_codelist_tipo_operacion(self):
|
||||||
|
return codelist.TipoOperacionND
|
||||||
|
@ -20,7 +20,7 @@ def simple_debit_note_without_lines():
|
|||||||
inv.set_period(datetime.now(), datetime.now())
|
inv.set_period(datetime.now(), datetime.now())
|
||||||
inv.set_issue(datetime.now())
|
inv.set_issue(datetime.now())
|
||||||
inv.set_ident('ABC123')
|
inv.set_ident('ABC123')
|
||||||
inv.set_operation_type('10')
|
inv.set_operation_type('30')
|
||||||
inv.set_payment_mean(form.PaymentMean(form.PaymentMean.DEBIT, '41', datetime.now(), '1234'))
|
inv.set_payment_mean(form.PaymentMean(form.PaymentMean.DEBIT, '41', datetime.now(), '1234'))
|
||||||
inv.set_supplier(form.Party(
|
inv.set_supplier(form.Party(
|
||||||
name = 'facho-supplier',
|
name = 'facho-supplier',
|
||||||
@ -52,7 +52,7 @@ def simple_credit_note_without_lines():
|
|||||||
inv.set_period(datetime.now(), datetime.now())
|
inv.set_period(datetime.now(), datetime.now())
|
||||||
inv.set_issue(datetime.now())
|
inv.set_issue(datetime.now())
|
||||||
inv.set_ident('ABC123')
|
inv.set_ident('ABC123')
|
||||||
inv.set_operation_type('10')
|
inv.set_operation_type('20')
|
||||||
inv.set_payment_mean(form.PaymentMean(form.PaymentMean.DEBIT, '41', datetime.now(), '1234'))
|
inv.set_payment_mean(form.PaymentMean(form.PaymentMean.DEBIT, '41', datetime.now(), '1234'))
|
||||||
inv.set_supplier(form.Party(
|
inv.set_supplier(form.Party(
|
||||||
name = 'facho-supplier',
|
name = 'facho-supplier',
|
||||||
|
@ -93,3 +93,42 @@ def test_FAU14():
|
|||||||
wants = form.Amount(119.0 + 19.0 - 50.0)
|
wants = form.Amount(119.0 + 19.0 - 50.0)
|
||||||
|
|
||||||
assert inv.invoice_legal_monetary_total.payable_amount == wants, "got %s want %s" % (inv.invoice_legal_monetary_total.payable_amount, wants)
|
assert inv.invoice_legal_monetary_total.payable_amount == wants, "got %s want %s" % (inv.invoice_legal_monetary_total.payable_amount, wants)
|
||||||
|
|
||||||
|
|
||||||
|
def test_invalid_tipo_operacion_nota_debito():
|
||||||
|
reference = form.InvoiceDocumentReference(
|
||||||
|
ident = '11111',
|
||||||
|
uuid = '21312312',
|
||||||
|
date = '2020-05-05'
|
||||||
|
)
|
||||||
|
inv = form.DebitNote(reference)
|
||||||
|
with pytest.raises(ValueError):
|
||||||
|
inv.set_operation_type(22)
|
||||||
|
|
||||||
|
def test_valid_tipo_operacion_nota_debito():
|
||||||
|
reference = form.InvoiceDocumentReference(
|
||||||
|
ident = '11111',
|
||||||
|
uuid = '21312312',
|
||||||
|
date = '2020-05-05'
|
||||||
|
)
|
||||||
|
inv = form.DebitNote(reference)
|
||||||
|
inv.set_operation_type('30')
|
||||||
|
|
||||||
|
def test_invalid_tipo_operacion_nota_credito():
|
||||||
|
reference = form.InvoiceDocumentReference(
|
||||||
|
ident = '11111',
|
||||||
|
uuid = '21312312',
|
||||||
|
date = '2020-05-05'
|
||||||
|
)
|
||||||
|
inv = form.DebitNote(reference)
|
||||||
|
with pytest.raises(ValueError):
|
||||||
|
inv.set_operation_type('990')
|
||||||
|
|
||||||
|
def test_valid_tipo_operacion_nota_credito():
|
||||||
|
reference = form.InvoiceDocumentReference(
|
||||||
|
ident = '11111',
|
||||||
|
uuid = '21312312',
|
||||||
|
date = '2020-05-05'
|
||||||
|
)
|
||||||
|
inv = form.CreditNote(reference)
|
||||||
|
inv.set_operation_type('20')
|
||||||
|
Loading…
Reference in New Issue
Block a user