Add configuration option to store invoice report cache in filestore

issue5693
review28461002
This commit is contained in:
Cédric Krier committed 2016-07-29 11:02:28 +02:00
1 parent d402aaf364
commit 5bec617621
3 files changed
+24 -1

No files matched your search

+1
View File
@@ -1,3 +1,4 @@
* Add configuration option to store invoice report cache in filestore
* Manage readonly state on Invoice Line and Tax Line
* Rename account.invoice.payment_term.line.relativedelta
into account.invoice.payment_term.line.delta
+12
View File
@@ -123,4 +123,16 @@ computed terms base on an amount and a date.
.. note:: The last line of payment term must be a remainder.
Configuration
*************
The account_invoice module uses the section `account_invoice` to retrieve some
parameters:
- `filestore`: a boolean value to store invoice report cache in the FileStore.
The default value is `False`.
- `store_prefix`: the prefix to use with the FileStore. The default value is
`None`.
.. _`python-dateutil library`: http://labix.org/python-dateutil#head-72c4689ec5608067d118b9143cef6bdffb6dad4e
+11 -1
View File
@@ -21,6 +21,7 @@ from trytond.tools import reduce_ids, grouped_slice
from trytond.transaction import Transaction
from trytond.pool import Pool
from trytond.rpc import RPC
from trytond.config import config
from trytond.modules.account.tax import TaxableMixin
from trytond.modules.product import price_digits
@@ -55,6 +56,13 @@ STATES = [
('cancel', 'Canceled'),
]
if config.getboolean('account_invoice', 'filestore', default=False):
file_id = 'invoice_report_cache_id'
store_prefix = config.get('account_invoice', 'store_prefix', default=None)
else:
file_id = None
store_prefix = None
class Invoice(Workflow, ModelSQL, ModelView, TaxableMixin):
'Invoice'
@@ -169,7 +177,9 @@ class Invoice(Workflow, ModelSQL, ModelView, TaxableMixin):
amount_to_pay = fields.Function(fields.Numeric('Amount to Pay',
digits=(16, Eval('currency_digits', 2)),
depends=['currency_digits']), 'get_amount_to_pay')
invoice_report_cache = fields.Binary('Invoice Report', readonly=True)
invoice_report_cache = fields.Binary('Invoice Report', readonly=True,
file_id=file_id, store_prefix=store_prefix)
invoice_report_cache_id = fields.Char('Invoice Report ID', readonly=True)
invoice_report_format = fields.Char('Invoice Report Format', readonly=True)
@classmethod