mirror of
https://github.com/OCA/account-reconcile.git
synced 2025-01-20 12:27:39 +02:00
[FIX][12.0][account_move_transactionid_import] s/transaction_ref/ref
Remove 'ref' from account.move.line preparation As 'ref' is related to account.move.ref it is not needed Fix multi move import multi_move_import on the parser allows to generate 1 account.move for each line in the imported file, instead of having all the lines on the same account.move
This commit is contained in:
committed by
Florian da Costa
parent
02df602eef
commit
63858eafa4
@@ -245,7 +245,6 @@ class AccountJournal(models.Model):
|
||||
'debit_cash_basic': values['debit'],
|
||||
'credit_cash_basic': values['credit'],
|
||||
'balance_cash_basic': values['debit'] - values['credit'],
|
||||
'ref': move.ref,
|
||||
'user_type_id': account.user_type_id.id,
|
||||
'reconciled': False,
|
||||
})
|
||||
@@ -277,11 +276,13 @@ class AccountJournal(models.Model):
|
||||
parser = new_move_parser(self, ftype=ftype, move_ref=filename)
|
||||
res = self.env['account.move']
|
||||
for result_row_list in parser.parse(file_stream):
|
||||
move = self._move_import(parser, file_stream, ftype=ftype)
|
||||
move = self._move_import(
|
||||
parser, file_stream, result_row_list=result_row_list, ftype=ftype
|
||||
)
|
||||
res |= move
|
||||
return res
|
||||
|
||||
def _move_import(self, parser, file_stream, ftype="csv"):
|
||||
def _move_import(self, parser, file_stream, result_row_list=None, ftype="csv"):
|
||||
"""Create a bank statement with the given profile and parser. It will
|
||||
fulfill the bank statement with the values of the file provided, but
|
||||
will not complete data (like finding the partner, or the right
|
||||
@@ -296,6 +297,7 @@ class AccountJournal(models.Model):
|
||||
move_obj = self.env['account.move']
|
||||
move_line_obj = self.env['account.move.line']
|
||||
attachment_obj = self.env['ir.attachment']
|
||||
if result_row_list is None:
|
||||
result_row_list = parser.result_row_list
|
||||
# Check all key are present in account.bank.statement.line!!
|
||||
if not result_row_list:
|
||||
|
||||
@@ -57,6 +57,8 @@ class FileParser(AccountMoveImportParser):
|
||||
# Set in _parse_xls, from the contents of the file
|
||||
self.dialect = dialect
|
||||
self.move_ref = move_ref
|
||||
self.parsed_file = None
|
||||
self.current_line = 0
|
||||
|
||||
def _custom_format(self, *args, **kwargs):
|
||||
"""No other work on data are needed in this parser."""
|
||||
@@ -70,12 +72,23 @@ class FileParser(AccountMoveImportParser):
|
||||
"""Launch the parsing through .csv, .xls or .xlsx depending on the
|
||||
given ftype
|
||||
"""
|
||||
res = None
|
||||
if self.parsed_file is None:
|
||||
if self.ftype == 'csv':
|
||||
res = self._parse_csv()
|
||||
self.parsed_file = self._parse_csv()
|
||||
else:
|
||||
res = self._parse_xls()
|
||||
self.result_row_list = res
|
||||
self.parsed_file = self._parse_xls()
|
||||
if self.support_multi_moves:
|
||||
if len(self.parsed_file) <= self.current_line:
|
||||
return False
|
||||
else:
|
||||
print(self.current_line)
|
||||
self.result_row_list = self.parsed_file[
|
||||
self.current_line:self.current_line + 1
|
||||
]
|
||||
self.current_line += 1
|
||||
return True
|
||||
else:
|
||||
self.result_row_list = self.parsed_file
|
||||
return True
|
||||
|
||||
def _validate(self, *args, **kwargs):
|
||||
|
||||
Reference in New Issue
Block a user