diff --git a/modules/account_fr_chorus/account.py b/modules/account_fr_chorus/account.py
index a1b6b6a81c..8a32bb5149 100644
--- a/modules/account_fr_chorus/account.py
+++ b/modules/account_fr_chorus/account.py
@@ -36,6 +36,14 @@ EDOC2FILENAME = {
'edocument.uncefact.invoice': 'UNCEFACT-%s.xml',
}
TIMEOUT = config.getfloat('account_fr_chorus', 'requests_timeout', default=300)
+if config.getboolean('account_fr_chorus', 'filestore', default=False):
+ file_id = 'data_file_id'
+ store_prefix = config.get(
+ 'account_payment_sepa', 'store_prefix', default=None)
+else:
+ file_id = None
+ store_prefix = None
+
logger = logging.getLogger(__name__)
@@ -181,8 +189,13 @@ class InvoiceChorus(ModelSQL, ModelView, _SyntaxMixin, metaclass=PoolMeta):
['posted'])),
])
syntax = fields.Selection('get_syntaxes', "Syntax", required=True)
+ filename = fields.Function(fields.Char("Filename"), 'get_filename')
number = fields.Char("Number", readonly=True, strip=False)
date = fields.Date("Date", readonly=True)
+ data = fields.Binary(
+ "Data", filename='filename',
+ file_id=file_id, store_prefix=store_prefix, readonly=True)
+ data_file_id = fields.Char("Data File ID", readonly=True)
@classmethod
def __setup__(cls):
@@ -202,6 +215,10 @@ class InvoiceChorus(ModelSQL, ModelView, _SyntaxMixin, metaclass=PoolMeta):
config = Configuration(1)
return config.chorus_syntax
+ def get_filename(self, name):
+ filename = EDOC2FILENAME[self.syntax] % self.invoice.number
+ return filename.replace('/', '-')
+
@classmethod
def order_number(cls, tables):
table, _ = tables[None]
@@ -281,12 +298,10 @@ class InvoiceChorus(ModelSQL, ModelView, _SyntaxMixin, metaclass=PoolMeta):
pool = Pool()
Doc = pool.get(self.syntax)
with Transaction().set_context(account_fr_chorus=True):
- data = Doc(self.invoice).render(None)
- filename = EDOC2FILENAME[self.syntax] % self.invoice.number
- filename = filename.replace('/', '-')
+ self.data = Doc(self.invoice).render(None)
return {
- 'fichierFlux': base64.b64encode(data).decode('ascii'),
- 'nomFichier': filename,
+ 'fichierFlux': base64.b64encode(self.data).decode('ascii'),
+ 'nomFichier': self.filename,
'syntaxeFlux': EDOC2SYNTAX[self.syntax],
'avecSignature': False,
}
diff --git a/modules/account_fr_chorus/view/invoice_chorus_form.xml b/modules/account_fr_chorus/view/invoice_chorus_form.xml
index b75c9be876..0714a563e6 100644
--- a/modules/account_fr_chorus/view/invoice_chorus_form.xml
+++ b/modules/account_fr_chorus/view/invoice_chorus_form.xml
@@ -10,4 +10,7 @@ this repository contains the full copyright notices and license terms. -->
+
+
+
diff --git a/modules/account_fr_chorus/view/invoice_chorus_list.xml b/modules/account_fr_chorus/view/invoice_chorus_list.xml
index e0e5eba885..dc0249f6d4 100644
--- a/modules/account_fr_chorus/view/invoice_chorus_list.xml
+++ b/modules/account_fr_chorus/view/invoice_chorus_list.xml
@@ -6,4 +6,5 @@ this repository contains the full copyright notices and license terms. -->
+