From 6679a45d32bc18be7a75b9ef64ce7a194fe9b65b Mon Sep 17 00:00:00 2001 From: augusto-weiss Date: Thu, 1 Jun 2023 18:53:33 +0000 Subject: [PATCH] [TMP] account_ux: add method to access invoice document by API MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit closes ingadhoc/account-financial-tools#412 Signed-off-by: Juan José Scarafía --- account_ux/models/account_move.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/account_ux/models/account_move.py b/account_ux/models/account_move.py index 226b848e2..3127ac9e0 100644 --- a/account_ux/models/account_move.py +++ b/account_ux/models/account_move.py @@ -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) @@ -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)