|
from odoo import api, fields, models
|
|
|
|
|
|
class DonationTaxReceipt(models.Model):
|
|
_inherit = "donation.tax.receipt"
|
|
|
|
template_rf_id=fields.Many2one('opendons.template_rf', 'RF template')
|
|
html_content=fields.Html('html content',compute='_html_content_rf')
|
|
html_content_print=fields.Html('html content print')
|
|
|
|
def get_portal_url(self):
|
|
return "my/taxreceipt/print?id="+str(self.id)
|
|
def action_print_rf(self):
|
|
self.ensure_one()
|
|
|
|
|
|
html_content_print=self.html_content
|
|
html_content_print=html_content_print.replace('{{partner_id.name}}',self.partner_id.name)
|
|
html_content_print=html_content_print.replace('{{partner_id.firstname}}',self.partner_id.firstname)
|
|
self.html_content_print=html_content_print
|
|
|
|
#self.env['donation.tax_receipt'].write(vals)
|
|
#res=super(donation_tax_receipt, self).write(vals)
|
|
return self.env.ref("opendons.report_donation_tax_receipt").report_action(self)
|
|
#return True
|
|
|
|
def _html_content_rf(self):
|
|
self.html_content=self.template_rf_id.html_content
|
|
|
|
def update_print_pdf(self):
|
|
html_content_print=self.html_content
|
|
html_content_print=html_content_print.replace('{{partner_id.name}}',self.partner_id.name)
|
|
html_content_print=html_content_print.replace('{{partner_id.firstname}}',self.partner_id.firstname)
|
|
self.html_content_print=html_content_print
|