Skip to content
Snippets Groups Projects
Commit 4b9e59ee authored by Jordi Isidro Llobet's avatar Jordi Isidro Llobet
Browse files

comentaris + id_billing_run

parent d85e43c4
No related branches found
No related tags found
No related merge requests found
...@@ -160,13 +160,13 @@ def read_invoices( ...@@ -160,13 +160,13 @@ def read_invoices(
# Es registra que es volen generar factures per un billing_run_id i es crida a odoo per que registri els valors # Es registra que es volen generar factures per un billing_run_id i es crida a odoo per que registri els valors
@app.post("/invoices_oc/", tags=["Data", "Invoice"]) @app.post("/invoices_oc/", tags=["Data", "Invoice"], description="Es registra que es volen generar factures per un billing_run_id i es crida a odoo per que registri els valors i crei una factura en estat esborrany.")
def send_invoice_contracts( def send_invoice_contracts(
contractinvoice: schemas.ApiContractInvoiceCreate, contractinvoice: schemas.ApiContractInvoiceCreate,
current_user: schemas.ApiUser = Depends(get_current_active_user), current_user: schemas.ApiUser = Depends(get_current_active_user),
db: Session = Depends(get_db) db: Session = Depends(get_db)
): ):
values = crud.get_invoices_oc(db, billing_run_uuid=contractinvoice.billing_run_uuid) values = crud.get_invoices_oc(db, id_billing_run=contractinvoice.id_billing_run)
return values return values
...@@ -193,8 +193,8 @@ def read_invoices_oc_pdf( ...@@ -193,8 +193,8 @@ def read_invoices_oc_pdf(
# Odoo ho invoca quan s'ha de generar una factura pdf. # Odoo ho invoca quan s'ha de generar una factura pdf.
# Aquest procés insereix a external.invoice_generator la factura a generar, però el proceś de generació es fa a través d'airflow # Aquest procés insereix a external.invoice_generator la factura a generar, però el proceś de generació es fa a través d'airflow
# Al acabar el procés d'airflow s'ha de cridar a Odoo informant de la ubicació del pdf # A l'acabar el procés d'airflow s'ha de cridar a Odoo informant de la ubicació del pdf
@app.get("/invoices_oc_generate_pdf/", tags=["Data", "Invoice"]) @app.get("/invoices_oc_generate_pdf/", tags=["Data", "Invoice"], description="Odoo ho invoca quan s'ha de generar una factura pdf. <br> Aquest procés insereix a external.invoice_generator la factura a generar, però el proceś de generació es fa a través d'airflow. A l'acabar el procés d'airflow s'ha de cridar a Odoo informant de la ubicació del pdf.")
def invoice_genrate_pdf( def invoice_genrate_pdf(
invoice: str, invoice: str,
current_user: schemas.ApiUser = Depends(get_current_active_user), current_user: schemas.ApiUser = Depends(get_current_active_user),
......
...@@ -64,8 +64,8 @@ def start_invoices_oc(db): ...@@ -64,8 +64,8 @@ def start_invoices_oc(db):
db.commit() db.commit()
return [] return []
def get_invoices_oc(db, billing_run_uuid): def get_invoices_oc(db, id_billing_run):
registries = get_invoice_oc(db, billing_run_uuid) registries = get_invoice_oc(db, id_billing_run)
return registries return registries
def get_invoices_oc_lines(db, invoice): def get_invoices_oc_lines(db, invoice):
......
...@@ -44,7 +44,7 @@ class ApiUser(Base): ...@@ -44,7 +44,7 @@ class ApiUser(Base):
] ]
} }
''' '''
def get_invoice_oc(con, billing_run_uuid): def get_invoice_oc(con, id_billing_run):
statement = """ statement = """
select oi.description_cat, oi.code select oi.description_cat, oi.code
...@@ -57,7 +57,7 @@ def get_invoice_oc(con, billing_run_uuid): ...@@ -57,7 +57,7 @@ def get_invoice_oc(con, billing_run_uuid):
join odoo_contract_contract occ on oi.odoo_code = occ.code join odoo_contract_contract occ on oi.odoo_code = occ.code
join odoo_contract_group ocg on occ.contract_group_id = ocg.id join odoo_contract_group ocg on occ.contract_group_id = ocg.id
where 1=1 where 1=1
and billing_run_uuid='""" + billing_run_uuid + "' " + \ and id_billing_run='""" + id_billing_run + "' " + \
"""group by oi.description_cat, oi.code, oi.tax_percent , oi.billing_run_uuid, ocg.code """group by oi.description_cat, oi.code, oi.tax_percent , oi.billing_run_uuid, ocg.code
, oi.tax_code, oi.billing_account_code , oi.tax_code, oi.billing_account_code
having sum(oi.amount_without_tax)<>0""" having sum(oi.amount_without_tax)<>0"""
......
...@@ -30,4 +30,4 @@ class ApiUser(ApiUserBase): ...@@ -30,4 +30,4 @@ class ApiUser(ApiUserBase):
class ApiContractInvoiceCreate(BaseModel): class ApiContractInvoiceCreate(BaseModel):
billing_run_uuid: str id_billing_run: str
\ No newline at end of file \ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment