Add basic support for receiving from multiple invoice files
This commit is contained in:
parent
2b7ebedb22
commit
dfa4178204
10 changed files with 295 additions and 40 deletions
|
@ -2,7 +2,7 @@
|
|||
################################################################################
|
||||
#
|
||||
# Rattail -- Retail Software Framework
|
||||
# Copyright © 2010-2022 Lance Edgar
|
||||
# Copyright © 2010-2023 Lance Edgar
|
||||
#
|
||||
# This file is part of Rattail.
|
||||
#
|
||||
|
@ -362,6 +362,7 @@ class BatchMasterView(MasterView):
|
|||
f.remove('params')
|
||||
else:
|
||||
f.set_readonly('params')
|
||||
f.set_renderer('params', self.render_params)
|
||||
|
||||
# created
|
||||
f.set_readonly('created')
|
||||
|
@ -419,6 +420,16 @@ class BatchMasterView(MasterView):
|
|||
f.remove_fields('executed',
|
||||
'executed_by')
|
||||
|
||||
def render_params(self, batch, field):
|
||||
params = self.get_visible_params(batch)
|
||||
if not params:
|
||||
return
|
||||
|
||||
return params
|
||||
|
||||
def get_visible_params(self, batch):
|
||||
return dict(batch.params or {})
|
||||
|
||||
def render_complete(self, batch, field):
|
||||
permission_prefix = self.get_permission_prefix()
|
||||
use_buefy = self.get_use_buefy()
|
||||
|
@ -515,11 +526,21 @@ class BatchMasterView(MasterView):
|
|||
return batch
|
||||
|
||||
def process_uploads(self, batch, form, uploads):
|
||||
for key, upload in six.iteritems(uploads):
|
||||
|
||||
def process(upload, key):
|
||||
self.handler.set_input_file(batch, upload['temp_path'], attr=key)
|
||||
os.remove(upload['temp_path'])
|
||||
os.rmdir(upload['tempdir'])
|
||||
|
||||
for key, upload in six.iteritems(uploads):
|
||||
if isinstance(upload, dict):
|
||||
process(upload, key)
|
||||
else:
|
||||
uploads = upload
|
||||
for upload in uploads:
|
||||
if isinstance(upload, dict):
|
||||
process(upload, key)
|
||||
|
||||
def get_batch_kwargs(self, batch, **kwargs):
|
||||
"""
|
||||
Return a kwargs dict for use with ``self.handler.make_batch()``, using
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue