Hi,
For this you can add a Boolean field to the product model that will be used to mark the products, let's call this field to_be_printed.
When generating the report, filter the products based on the to_be_printed field. You can use Odoo's domain notation to filter the products that are marked to be printed. When printing the report, only the products that are marked to be printed will be printed.
<tree>
<field name="product_id"/>
<field name="product_qty"/>
<field name="product_uom"/>
<field name="price_unit"/>
<field name="amount" sum="Total"/>
<field name="date"/>
<field name="delivery_status" sum="Total"/>
<field name="to_be_printed" widget="boolean_toggle"/>
</tree>
<report ...>
...
<xpath expr="//button[@name='print_report']" position="before">
<button name="action_mark_to_be_printed" string="Mark to be Printed"/>
</xpath>
...
</report>
we have added a Boolean field to the report's tree view that corresponds to the to_be_printed field in the product model. We have also added a button to the report's action menu that triggers an action to mark the products as to be printed. When the button is clicked, it triggers the action_mark_to_be_printed method that sets the to_be_printed field of the selected products to True. You can use Odoo's recordset API to update the products.
def action_mark_to_be_printed(self):
self.write({'to_be_printed': True})
return {'type': 'ir.actions.do_nothing'}
Finally, when generating the report, filter the products based on the to_be_printed field using Odoo's domain notation.
<record id="report_products_to_be_printed" model="ir.actions.report">
<field name="name">Products To Be Printed</field>
<field name="model">my_module.product</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">my_module.products_to_be_printed</field>
<field name="print_report_name">Products To Be Printed</field>
<field name="multi">True</field>
<field name="paperformat_id" ref="report.paperformat_a4"/>
<field name="context">{'active_test': False, 'to_be_printed': True}</field>
</record>
we have added a context to the report's action that filters the products based on the to_be_printed field. When the report is generated, only the products that are marked to be printed will be printed.
Regards