Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

210
Views
Cómo exportar xlsx en Odoo14 Web

Cómo exportar datos xlsx desde el portal del sitio web my/order

Agregué un botón en el portal de pedidos de venta Mi cuenta -> Página de pedidos de ventas como este

 <!-- Add the Export Button --> <template id="portal_my_orders_inherit_export" inherit_id="sale.portal_my_orders" customize_show="True"> <xpath expr="//t[@t-call='portal.portal_searchbar']" position="before"> <button class="btn btn-primary mb-2 sale_export_btn_class" id="sale_export_btn_id" type="button"> Export Sale </button> </xpath> </template>

Cuando hago clic en este botón, exporto un archivo xlsx con todas las órdenes de venta del usuario registrado

Por favor ayúdame a resolver esto.

Gracias.

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

El informe xlsx es un controlador, debe llamarlo desde su botón o crear un widget que responda a su botón de evento onClick para llamar al controlador y devolver la respuesta al navegador con el informe dentro.

Espero que esta respuesta pueda ser útil para usted.

about 4 years ago · Juan Pablo Isaza Report

0

Puede usar una etiqueta <a> y definir una función de controlador para representar y descargar el informe XLSX.

A continuación, suponemos que ya creó un informe XLSX utilizando el módulo report_xlsx

Ejemplo:

 <a role="button" t-if="orders" t-att-href="'/my/export_orders?order_ids=%s' % orders.ids" class="btn btn-primary mb-2 mt-2" target="_blank" >

Modifique el controlador del portal de clientes para definir la ruta /my/export_orders

 class CustomerPortalExtended(CustomerPortal): @http.route('/my/export_orders', type='http', auth="user", website=True) def export_orders(self, **kw): order_ids = ast.literal_eval(kw['order_ids']) report_sudo = request.env.ref(report_name).with_user(SUPERUSER_ID) report = report_sudo._render_xlsx(order_ids, {})[0] report_http_headers = [ ('Content-Type', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'), ('Content-Length', len(report)), ('Content-Disposition', content_disposition("Orders.xlsx")) ] return request.make_response(report, headers=report_http_headers)
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!