main #7
@@ -3695,13 +3695,19 @@ class InvoiceReport(Report):
|
|||||||
Invoice = pool.get('account.invoice')
|
Invoice = pool.get('account.invoice')
|
||||||
# Re-instantiate because records are TranslateModel
|
# Re-instantiate because records are TranslateModel
|
||||||
invoice, = Invoice.browse(records)
|
invoice, = Invoice.browse(records)
|
||||||
if invoice.invoice_report_cache:
|
report_path = cls._get_action_report_path(action)
|
||||||
|
use_cache = (
|
||||||
|
report_path in (None, 'account_invoice/invoice.fodt')
|
||||||
|
and invoice.invoice_report_cache
|
||||||
|
)
|
||||||
|
if use_cache:
|
||||||
return (
|
return (
|
||||||
invoice.invoice_report_format,
|
invoice.invoice_report_format,
|
||||||
invoice.invoice_report_cache)
|
invoice.invoice_report_cache)
|
||||||
else:
|
else:
|
||||||
result = super()._execute(records, header, data, action)
|
result = super()._execute(records, header, data, action)
|
||||||
if invoice.invoice_report_versioned:
|
if (invoice.invoice_report_versioned
|
||||||
|
and report_path in (None, 'account_invoice/invoice.fodt')):
|
||||||
format_, data = result
|
format_, data = result
|
||||||
if isinstance(data, str):
|
if isinstance(data, str):
|
||||||
data = bytes(data, 'utf-8')
|
data = bytes(data, 'utf-8')
|
||||||
@@ -3718,6 +3724,12 @@ class InvoiceReport(Report):
|
|||||||
with Transaction().set_context(language=False):
|
with Transaction().set_context(language=False):
|
||||||
return super().render(*args, **kwargs)
|
return super().render(*args, **kwargs)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def _get_action_report_path(action):
|
||||||
|
if isinstance(action, dict):
|
||||||
|
return action.get('report')
|
||||||
|
return getattr(action, 'report', None)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def execute(cls, ids, data):
|
def execute(cls, ids, data):
|
||||||
pool = Pool()
|
pool = Pool()
|
||||||
|
|||||||
Reference in New Issue
Block a user