Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
2 Răspunsuri
894 Vizualizări

i have a graph generate by kanban_graph in the view of user but i want to print this user view. i don't know how i can done it

Imagine profil
Abandonează
Cel mai bun răspuns

Hi landro,


To print a Kanban view in a QWeb template in Odoo, you can use the t-foreach directive to iterate over the records and display them in the desired format. Here's a general outline of how you can achieve this:


Retrieve Records in Controller:

In your Odoo controller, retrieve the records that you want to display in the Kanban view. You may need to apply any necessary domain or filter conditions to fetch the specific records you need.


Pass Records to QWeb Template:

Pass the retrieved records to your QWeb template as part of the rendering context.


Render Records in QWeb Template:

In your QWeb template, use the t-foreach directive to iterate over the records and display them in the desired format.

Customize the HTML structure and CSS styles to represent the Kanban view as you want it to appear in the printout.

Please find code in comment. 

In this example, records represents the list of records passed to the template from the controller. You'll need to replace record.name, record.description, etc., with the actual field names of the records you want to display.


Once you've created the QWeb template, you can generate a printout of the Kanban view by accessing the corresponding URL in your browser and printing the page. Make sure to include any necessary CSS styles to ensure that the printed output matches the desired layout and appearance.

Feel free to contact me if needed

Hope this will help you.

Thanks & Regards,
Email:   odoo@aktivsoftware.com           

Skype: kalpeshmaheshwari

Imagine profil
Abandonează

Please find code example here :-

EXAMPLE:

<?xml version="1.0"?>
<template id="kanban_print_template" inherit_id="web.external_layout">
<xpath expr="//div[@class='container']" position="inside">
<div class="kanban-print">
<t t-foreach="records" t-as="record">
<!-- Customize HTML structure to represent each record in the Kanban view -->
<div class="kanban-record">
<!-- Display fields and information from each record -->
<p>Record Name: <t t-esc="record.name"/></p>
<p>Record Description: <t t-esc="record.description"/></p>
<!-- Add more fields as needed -->
</div>
</t>
</div>
</xpath>
</template>

Autor Cel mai bun răspuns

thanks

Imagine profil
Abandonează