Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
2611 Weergaven

I created a method for re-rendering PDFs and called it in write method after super() to update the pdf preview based on the value of a field. The problem is that while everything works as it should on my local machine, the live server shows nothing no error logs or pop-up messages and simply does not update the preview.

for display preview i'm using 


class="o_attachment_preview" options="{'preview_priority_type': 'pdf'}"/>


pdf update method 


def _pdf_preview_update(self):
report_action = "user_detail_report"
if
report_action:
report = self.env.ref(f'custom_module.{report_action}')
try:
pdf = report._render_qweb_pdf(self.ids)
data_record = base64.b64encode(pdf[0])
self.message_main_attachment_id.write({"datas": data_record})
except Exception as e:
_logger.error(_(f"Failed to update pdf : {e}")




write method:

def write(self, vals):
res = super(MrpBom, self).write(vals)
if self.message_main_attachment_id:
self._pdf_preview_update()
return res

Avatar
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
1
dec. 23
2517
2
aug. 23
2233
1
dec. 23
3907
1
jul. 23
2818
0
mei 23
2641