examples/generate-invoice-invoice.py: se actualiza fix #45
FossilOrigin-Name: f31372da32308fd90fee477c7afd6f2d925d23761c5e7cb6223c3c00ed6bc645
This commit is contained in:
		@@ -3,38 +3,70 @@ from facho.fe import fe
 | 
			
		||||
from datetime import datetime
 | 
			
		||||
 | 
			
		||||
def extensions(inv):
 | 
			
		||||
    security_code = fe.DianXMLExtensionSoftwareSecurityCode('', '123', inv.invoice_ident)
 | 
			
		||||
    cufe = fe.DianXMLExtensionCUFE(inv)
 | 
			
		||||
    return [security_code, cufe]
 | 
			
		||||
    nit = form.PartyIdentification('nit', '5', '31')
 | 
			
		||||
    security_code = fe.DianXMLExtensionSoftwareSecurityCode('id software', 'pin', inv.invoice_ident)
 | 
			
		||||
    authorization_provider = fe.DianXMLExtensionAuthorizationProvider()
 | 
			
		||||
    cufe = fe.DianXMLExtensionCUFE(inv, fe.DianXMLExtensionCUFE.AMBIENTE_PRUEBAS,
 | 
			
		||||
                                   'clave tecnica')
 | 
			
		||||
    software_provider = fe.DianXMLExtensionSoftwareProvider(nit, nit.dv, 'id software')
 | 
			
		||||
    inv_authorization = fe.DianXMLExtensionInvoiceAuthorization('invoice autorization',
 | 
			
		||||
                                                                datetime(2019, 1, 19),
 | 
			
		||||
                                                                datetime(2030, 1, 19),
 | 
			
		||||
                                                                'SETP', 990000001, 995000000)
 | 
			
		||||
    return [security_code, authorization_provider, cufe, software_provider, inv_authorization]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def invoice():
 | 
			
		||||
    inv = form.Invoice()
 | 
			
		||||
    inv.set_period(datetime.now(), datetime.now())
 | 
			
		||||
    inv.set_issue(datetime.now())
 | 
			
		||||
    inv.set_ident('ABC123')
 | 
			
		||||
    inv.set_ident('SETP990003033')
 | 
			
		||||
    inv.set_operation_type('10')
 | 
			
		||||
    inv.set_supplier(form.Party(
 | 
			
		||||
        name = 'facho-supplier',
 | 
			
		||||
        ident = 123,
 | 
			
		||||
        responsability_code = 'No aplica',
 | 
			
		||||
        organization_code = 'Persona Natural'
 | 
			
		||||
        legal_name = 'FACHO SOS',
 | 
			
		||||
        name = 'FACHO SOS',
 | 
			
		||||
        ident = form.PartyIdentification('900579212', '5', '31'),
 | 
			
		||||
        responsability_code = form.Responsability(['O-07', 'O-09', 'O-14', 'O-48']),
 | 
			
		||||
        responsability_regime_code = '48',
 | 
			
		||||
        organization_code = '1',
 | 
			
		||||
        email = "sdds@sd.com",
 | 
			
		||||
        address = form.Address(
 | 
			
		||||
            '', '', form.City('05001', 'Medellín'),
 | 
			
		||||
            form.Country('CO', 'Colombia'),
 | 
			
		||||
            form.CountrySubentity('05', 'Antioquia'))
 | 
			
		||||
    ))
 | 
			
		||||
    inv.set_customer(form.Party(
 | 
			
		||||
        legal_name = 'facho-customer',
 | 
			
		||||
        name = 'facho-customer',
 | 
			
		||||
        ident = 321,
 | 
			
		||||
        responsability_code = 'No aplica',
 | 
			
		||||
        organization_code = 'Persona Natural'
 | 
			
		||||
        ident = form.PartyIdentification('999999999', '', '13'),
 | 
			
		||||
        responsability_code = form.Responsability(['R-99-PN']),
 | 
			
		||||
        responsability_regime_code = '49',
 | 
			
		||||
        organization_code = '2',
 | 
			
		||||
        email = "sdds@sd.com",
 | 
			
		||||
        address = form.Address(
 | 
			
		||||
            '', '', form.City('05001', 'Medellín'),
 | 
			
		||||
            form.Country('CO', 'Colombia'),
 | 
			
		||||
            form.CountrySubentity('05', 'Antioquia'))
 | 
			
		||||
    ))
 | 
			
		||||
    inv.set_payment_mean(form.PaymentMean(
 | 
			
		||||
        id = '1',
 | 
			
		||||
        code = '10',
 | 
			
		||||
        due_at = datetime.now(),
 | 
			
		||||
        payment_id = '1'
 | 
			
		||||
    ))
 | 
			
		||||
    inv.add_invoice_line(form.InvoiceLine(
 | 
			
		||||
        quantity = 1,
 | 
			
		||||
        description = 'producto facho',
 | 
			
		||||
        item_ident = 9999,
 | 
			
		||||
        price_amount = 100.0,
 | 
			
		||||
        item = form.StandardItem('test', 9999),
 | 
			
		||||
        price = form.Price(
 | 
			
		||||
            amount = form.Amount(100.00),
 | 
			
		||||
            type_code = '01',
 | 
			
		||||
            type = 'x'
 | 
			
		||||
        ),
 | 
			
		||||
        tax = form.TaxTotal(
 | 
			
		||||
            tax_amount = 0.0,
 | 
			
		||||
            taxable_amount = 0.0,
 | 
			
		||||
            subtotals = [
 | 
			
		||||
                form.TaxSubTotal(
 | 
			
		||||
                    percent = 19.0,
 | 
			
		||||
                    percent = 19.00,
 | 
			
		||||
                )
 | 
			
		||||
            ]
 | 
			
		||||
        )
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user