Skip to Content
Menu
This question has been flagged
2 Replies
1071 Views

Management wants to be included in PDF report the person who approved and when did they approved it, also when did the manager approved it?


Here in qweb, i find it difficult to pull an information like that. 

Avatar
Discard
Best Answer

Hello Anton, 

In your expense report these fields are available or not if these fields available in case you can add into PDF.

If this fields not available in that case kindly add these fields into backend (database) and based on that you can add into PDF. 

approve_id = fields.Many2one('res.users', string='Approved By')
approve_date_time = fields.Datetime(string='Approval Time')

def _get_approval(self):
​for res in self:
​res.approve_id = self.env.uid
​res.approve_date_time = datetime.now()

Thanks. 


Avatar
Discard
Author

Is there any way to do this in studio only? We are refraining to modify the backend code due to we are waiting for Odoo 18.

Yes you can achieve using odoo sutdio.

First you can add the fields using odoo studio and after you can add one automation rule base on your conditions.
Automation rule will help you to add the approval user and time input.
Add the custom field in your pdf.
Thanks.

Best Answer

You can archive this by tracking, 

Example :  We have a Approve Button, by tracking that button using following fields,

button_click_time = fields.Datetime(string="Button Click Time", readonly=True, tracking=True)
button_clicked_by = fields.Many2one('res.users', string="Button Clicked By", readonly=True, tracking=True)

And add this function for the approve button,

def action_approve_button(self):
self.button_click_time = datetime.now()
self.button_clicked_by = self.env.user.id

By this we can easily show the data in a report.

Check and Clarify your doubts.

Avatar
Discard
Author

Is there any way to do this in studio only? We are refraining to modify the backend code.

Related Posts Replies Views Activity
1
Apr 24
1237
2
Jul 21
4375
1
Dec 24
1079
1
Jun 24
1209
1
Jul 21
3133