I have a report that generates product labels for a certain recordset. How can I call a python function from my custom module before/after the report has been generated?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Accounting
- Inventory
- PoS
- Project management
- MRP
This question has been flagged
1
Reply
3698
Views
To answer my own question. Say I want to keep track when a certain record is printed or not:
You can define a new function in the model's .py file:
def set_record_printed(self):
self.ensure_one()
self.printed = True
self.timestamp_printed = fields.Datetime.now()
Where self will be the record on which you want to execute the function.
Then in the report QWeb template just call that function on each record.
<t t-esc="product.set_record_printed()"/>
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign upRelated Posts | Replies | Views | Activity | |
---|---|---|---|---|
|
1
May 20
|
5244 | ||
|
2
Apr 23
|
8523 | ||
|
2
Dec 24
|
3376 | ||
|
1
Nov 24
|
108 | ||
|
0
Aug 24
|
235 |