Skip to content

Commit

Permalink
[TMP] account_ux: add method to access invoice document by API
Browse files Browse the repository at this point in the history
closes #412

Signed-off-by: Juan José Scarafía <jjs@adhoc.com.ar>
  • Loading branch information
augusto-weiss committed Jun 5, 2023
1 parent 35ec65a commit 6679a45
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions account_ux/models/account_move.py
Expand Up @@ -16,6 +16,11 @@ class AccountMove(models.Model):
)
other_currency = fields.Boolean(compute='_compute_other_currency')

def get_invoice_report(self):
self.ensure_one()
bin_data, __ = self.env['ir.actions.report']._render_qweb_pdf('account.account_invoices', self.id)
return bin_data, __

@api.depends('company_currency_id', 'currency_id')
def _compute_other_currency(self):
other_currency = self.filtered(lambda x: x.company_currency_id != x.currency_id)
Expand Down Expand Up @@ -119,9 +124,3 @@ def get_accounting_rate(company_currency, amount, amount_currency, currency):
amount_residual = self.env['account.move.line'].browse(item['id']).amount_residual
item['amount'] = move.currency_id.round(amount_residual * rate)


class IrActionsReport(models.Model):
_inherit = 'ir.actions.report'

def render_qweb_pdf(self, report_ref, res_ids=None, data=None):
return super()._render_qweb_pdf(report_ref, res_ids=res_ids, data=data)

0 comments on commit 6679a45

Please sign in to comment.