mirror of
https://github.com/OCA/bank-statement-import.git
synced 2025-01-20 12:37:43 +02:00
[IMP] account_bank_statement_import_online: use pre-computed sanitized bank account number
[UPD] Update account_bank_statement_import_online.pot account_bank_statement_import_online 12.0.1.2.0
This commit is contained in:
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
{
|
{
|
||||||
'name': 'Online Bank Statements',
|
'name': 'Online Bank Statements',
|
||||||
'version': '12.0.1.1.0',
|
'version': '12.0.1.2.0',
|
||||||
'author':
|
'author':
|
||||||
'Brainbean Apps, '
|
'Brainbean Apps, '
|
||||||
'Dataplug, '
|
'Dataplug, '
|
||||||
|
|||||||
@@ -19,11 +19,6 @@ msgstr ""
|
|||||||
msgid "%(number)s %(type)s"
|
msgid "%(number)s %(type)s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#. module: account_bank_statement_import_online
|
|
||||||
#: model:ir.model.fields,field_description:account_bank_statement_import_online.field_online_bank_statement_provider__account_number
|
|
||||||
msgid "Account Number"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#. module: account_bank_statement_import_online
|
#. module: account_bank_statement_import_online
|
||||||
#: model:ir.model.fields,field_description:account_bank_statement_import_online.field_online_bank_statement_provider__message_needaction
|
#: model:ir.model.fields,field_description:account_bank_statement_import_online.field_online_bank_statement_provider__message_needaction
|
||||||
msgid "Action Needed"
|
msgid "Action Needed"
|
||||||
@@ -372,6 +367,11 @@ msgstr ""
|
|||||||
msgid "Pull Online Bank Statements"
|
msgid "Pull Online Bank Statements"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: account_bank_statement_import_online
|
||||||
|
#: model:ir.model.fields,field_description:account_bank_statement_import_online.field_online_bank_statement_provider__account_number
|
||||||
|
msgid "Sanitized Account Number"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#. module: account_bank_statement_import_online
|
#. module: account_bank_statement_import_online
|
||||||
#: model_terms:ir.ui.view,arch_db:account_bank_statement_import_online.online_bank_statement_provider_form
|
#: model_terms:ir.ui.view,arch_db:account_bank_statement_import_online.online_bank_statement_provider_form
|
||||||
msgid "Scheduled Pull"
|
msgid "Scheduled Pull"
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ class OnlineBankStatementProvider(models.Model):
|
|||||||
related='journal_id.currency_id',
|
related='journal_id.currency_id',
|
||||||
)
|
)
|
||||||
account_number = fields.Char(
|
account_number = fields.Char(
|
||||||
related='journal_id.bank_account_id.acc_number'
|
related='journal_id.bank_account_id.sanitized_acc_number'
|
||||||
)
|
)
|
||||||
service = fields.Selection(
|
service = fields.Selection(
|
||||||
selection=lambda self: self._selection_service(),
|
selection=lambda self: self._selection_service(),
|
||||||
@@ -258,6 +258,15 @@ class OnlineBankStatementProvider(models.Model):
|
|||||||
[('unique_import_id', '=', unique_import_id)],
|
[('unique_import_id', '=', unique_import_id)],
|
||||||
limit=1):
|
limit=1):
|
||||||
continue
|
continue
|
||||||
|
bank_account_number = line_values.get('account_number')
|
||||||
|
if bank_account_number:
|
||||||
|
line_values.update({
|
||||||
|
'account_number': (
|
||||||
|
self._sanitize_bank_account_number(
|
||||||
|
bank_account_number
|
||||||
|
)
|
||||||
|
),
|
||||||
|
})
|
||||||
filtered_lines.append(line_values)
|
filtered_lines.append(line_values)
|
||||||
statement_values.update({
|
statement_values.update({
|
||||||
'line_ids': [[0, False, line] for line in filtered_lines],
|
'line_ids': [[0, False, line] for line in filtered_lines],
|
||||||
@@ -340,11 +349,16 @@ class OnlineBankStatementProvider(models.Model):
|
|||||||
@api.multi
|
@api.multi
|
||||||
def _generate_unique_import_id(self, unique_import_id):
|
def _generate_unique_import_id(self, unique_import_id):
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
sanitized_account_number = sanitize_account_number(self.account_number)
|
|
||||||
return (
|
return (
|
||||||
sanitized_account_number and sanitized_account_number + '-' or ''
|
self.account_number and self.account_number + '-' or ''
|
||||||
) + str(self.journal_id.id) + '-' + unique_import_id
|
) + str(self.journal_id.id) + '-' + unique_import_id
|
||||||
|
|
||||||
|
@api.multi
|
||||||
|
def _sanitize_bank_account_number(self, bank_account_number):
|
||||||
|
"""Hook for extension"""
|
||||||
|
self.ensure_one()
|
||||||
|
return sanitize_account_number(bank_account_number)
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def _get_next_run_period(self):
|
def _get_next_run_period(self):
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
|
|||||||
@@ -49,6 +49,8 @@ class OnlineBankStatementProviderDummy(models.Model):
|
|||||||
'unique_import_id': str(int(
|
'unique_import_id': str(int(
|
||||||
(date - datetime(1970, 1, 1)) / timedelta(seconds=1)
|
(date - datetime(1970, 1, 1)) / timedelta(seconds=1)
|
||||||
)),
|
)),
|
||||||
|
'partner_name': 'John Doe',
|
||||||
|
'account_number': 'XX00 0000 0000 0000',
|
||||||
})
|
})
|
||||||
balance += amount
|
balance += amount
|
||||||
date += line_step
|
date += line_step
|
||||||
|
|||||||
Reference in New Issue
Block a user