Adaptación a v0.10.0
This commit is contained in:
parent
f40f58c035
commit
d53699a242
@ -75,6 +75,12 @@ def load_config() -> Dict[str, Any]:
|
||||
"CTE_IS_COMPANY": _required("CTE_IS_COMPANY"),
|
||||
"CTE_SYNC_RESULT_OK": _required("CTE_SYNC_RESULT_OK"),
|
||||
"CTE_SYNC_RESULT_FAIL": _required("CTE_SYNC_RESULT_FAIL"),
|
||||
"CTE_TAX_MODE": _required("CTE_TAX_MODE"), # single
|
||||
"CTE_DEFAULT_IVA_CODE": _required("CTE_DEFAULT_IVA_CODE"),
|
||||
"CTE_USES_EQUIVALENCE_SURCHARGE": _required("CTE_USES_EQUIVALENCE_SURCHARGE"),
|
||||
"CTE_DEFAULT_REC_CODE": os.getenv("CTE_DEFAULT_REC_CODE"),
|
||||
"CTE_USES_RETENTION": _required("CTE_USES_RETENTION"),
|
||||
"CTE_DEFAULT_RETENTION_CODE": os.getenv("CTE_DEFAULT_RETENTION_CODE"),
|
||||
|
||||
# Verifactu (requeridas)
|
||||
"VERIFACTU_BASE_URL": _required("VERIFACTU_BASE_URL"),
|
||||
|
||||
@ -97,14 +97,19 @@ def normalize_header_invoice_fields(fd: Dict[str, Any]) -> Dict[str, Any]:
|
||||
"is_proforma": config["CTE_IS_PROFORMA"],
|
||||
"status": config["CTE_STATUS_INVOICE"],
|
||||
|
||||
#
|
||||
"tax_mode": config['CTE_TAX_MODE'],
|
||||
"default_iva_code": config['CTE_DEFAULT_IVA_CODE'],
|
||||
"uses_equivalence_surcharge": config['CTE_USES_EQUIVALENCE_SURCHARGE'],
|
||||
"default_rec_code": config['CTE_DEFAULT_REC_CODE'],
|
||||
"uses_retention": config['CTE_USES_RETENTION'],
|
||||
"default_retention_code": config['CTE_DEFAULT_RETENTION_CODE'],
|
||||
|
||||
"series": config['CTE_SERIE'],
|
||||
|
||||
"factuges_id": int(fd['ID_FACTURA']),
|
||||
"reference": fd['REFERENCIA'],
|
||||
# Se asigna la fecha de la subida que es cuando se va a presentar a la AEAT
|
||||
"invoice_date": date.today().strftime("%Y-%m-%d"),
|
||||
"proforma_date": date.today().strftime("%Y-%m-%d"),
|
||||
"operation_date": str(fd['FECHA_FACTURA']),
|
||||
"description": textwrap.shorten(
|
||||
f"{str(fd['REFERENCIA'])} - {str(fd.get('NOMBRE')) or ''}", width=50, placeholder="…"),
|
||||
|
||||
@ -272,7 +272,7 @@ def insert_invoice_header(
|
||||
"Inserting invoice %s %s %s %s %s",
|
||||
invoice_id,
|
||||
hif.get("reference"),
|
||||
hif.get("invoice_date"),
|
||||
hif.get("proforma_date"),
|
||||
hif.get("operation_date"),
|
||||
config["CTE_STATUS_INVOICE"],
|
||||
)
|
||||
@ -285,7 +285,7 @@ def insert_invoice_header(
|
||||
hif.get("is_proforma"),
|
||||
hif.get("series"),
|
||||
hif.get("reference"),
|
||||
hif.get("invoice_date"),
|
||||
hif.get("proforma_date"),
|
||||
hif.get("operation_date"),
|
||||
hif.get("description"),
|
||||
hif.get("notes"),
|
||||
@ -326,7 +326,7 @@ def insert_verifactu_record(
|
||||
"Inserting verifactu record %s %s %s",
|
||||
id,
|
||||
hif.get("reference"),
|
||||
hif.get("invoice_date"),
|
||||
hif.get("proforma_date"),
|
||||
)
|
||||
cur.execute( # type: ignore
|
||||
SQL.INSERT_VERIFACTU_RECORD,
|
||||
|
||||
@ -258,7 +258,7 @@ def insert_verifactu_record(
|
||||
"Inserting verifactu record %s %s %s",
|
||||
id,
|
||||
hif.get("reference"),
|
||||
hif.get("invoice_date"),
|
||||
hif.get("proforma_date"),
|
||||
)
|
||||
cur.execute( # type: ignore
|
||||
SQL.INSERT_VERIFACTU_RECORD,
|
||||
|
||||
@ -22,7 +22,7 @@ def create_invoice_header(
|
||||
"series": hif.get("series"),
|
||||
"reference": hif.get("reference"),
|
||||
"description": hif.get("description"),
|
||||
"invoice_date": hif.get("invoice_date"),
|
||||
"proforma_date": hif.get("proforma_date"),
|
||||
"operation_date": hif.get("operation_date"),
|
||||
"notes": none_to_empty(hif.get("notes")),
|
||||
"language_code": cf.get("language_code"),
|
||||
@ -36,6 +36,15 @@ def create_invoice_header(
|
||||
"payment_method_id": str(payment_method_id),
|
||||
"payment_method_description": payment_method_description,
|
||||
|
||||
"tax_config": {
|
||||
"tax_mode": hif.get("tax_mode"),
|
||||
"default_iva_code": hif.get("default_iva_code"),
|
||||
"uses_equivalence_surcharge": hif.get("uses_equivalence_surcharge"),
|
||||
"default_rec_code": hif.get("default_rec_code"),
|
||||
"uses_retention": hif.get("uses_retention"),
|
||||
"default_retention_code": hif.get("default_retention_code"),
|
||||
},
|
||||
|
||||
"customer": {
|
||||
"is_company": cf["is_company"],
|
||||
"name": cf["name"],
|
||||
|
||||
@ -22,7 +22,14 @@ FACTUGES_USER = sysdba
|
||||
FACTUGES_PASSWORD = masterkey
|
||||
CTE_COMPANY_ID = '5e4dc5b3-96b9-4968-9490-14bd032fec5f'
|
||||
VERIFACTU_API_KEY = vf_test_ei8WYAvEq5dhSdEyQVjgCS8NZaNpEK2BljSHSUXf+Y0=
|
||||
|
||||
CTE_SERIE = 'F25/'
|
||||
CTE_TAX_MODE = 'single'
|
||||
CTE_DEFAULT_IVA_CODE = "iva_21"
|
||||
CTE_USES_EQUIVALENCE_SURCHARGE = 0
|
||||
CTE_USES_RETENTION = 0
|
||||
|
||||
|
||||
|
||||
#DESARROLLO ACANA
|
||||
#FACTUGES_HOST = 192.168.0.109
|
||||
|
||||
@ -24,6 +24,7 @@ CTE_STATUS_VERIFACTU = 'Pendiente'
|
||||
CTE_LANGUAGE_CODE = 'es'
|
||||
CTE_COUNTRY_CODE = 'es'
|
||||
CTE_IS_COMPANY = 1
|
||||
CTE_TAX_MODE = 'single'
|
||||
CTE_SYNC_RESULT_OK = 1
|
||||
CTE_SYNC_RESULT_FAIL = 2
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user