跳至內容
選單
此問題已被標幟
2 回覆
1498 瀏覽次數

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. 

頭像
捨棄
最佳答案

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. 


頭像
捨棄
作者

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.

最佳答案

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.

頭像
捨棄
作者

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

相關帖文 回覆 瀏覽次數 活動
1
4月 24
1631
2
7月 21
4822
1
12月 24
1666
1
6月 24
1625
1
7月 21
3444