odoo-addon-account-statement-import-sheet-file 17.0.1.1.2__py3-none-any.whl → 18.0.1.0.0.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,7 +11,7 @@ Bank Statement TXT/CSV/XLSX Import
11
11
  !! This file is generated by oca-gen-addon-readme !!
12
12
  !! changes will be overwritten. !!
13
13
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
14
- !! source digest: sha256:e91b66bd2dd7b69e871f22ebaea435ecc394e62eddbff8c196ccfb3f58c63d9a
14
+ !! source digest: sha256:7f262d73d39b721a7fe36fc8279b95fed86757391be9ea917e3f13ee9f4cd83f
15
15
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
16
16
 
17
17
  .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
@@ -21,13 +21,13 @@ Bank Statement TXT/CSV/XLSX Import
21
21
  :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
22
22
  :alt: License: AGPL-3
23
23
  .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fbank--statement--import-lightgray.png?logo=github
24
- :target: https://github.com/OCA/bank-statement-import/tree/17.0/account_statement_import_sheet_file
24
+ :target: https://github.com/OCA/bank-statement-import/tree/18.0/account_statement_import_sheet_file
25
25
  :alt: OCA/bank-statement-import
26
26
  .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
27
- :target: https://translation.odoo-community.org/projects/bank-statement-import-17-0/bank-statement-import-17-0-account_statement_import_sheet_file
27
+ :target: https://translation.odoo-community.org/projects/bank-statement-import-18-0/bank-statement-import-18-0-account_statement_import_sheet_file
28
28
  :alt: Translate me on Weblate
29
29
  .. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
30
- :target: https://runboat.odoo-community.org/builds?repo=OCA/bank-statement-import&target_branch=17.0
30
+ :target: https://runboat.odoo-community.org/builds?repo=OCA/bank-statement-import&target_branch=18.0
31
31
  :alt: Try me on Runboat
32
32
 
33
33
  |badge1| |badge2| |badge3| |badge4| |badge5|
@@ -76,7 +76,7 @@ Bug Tracker
76
76
  Bugs are tracked on `GitHub Issues <https://github.com/OCA/bank-statement-import/issues>`_.
77
77
  In case of trouble, please check there if your issue has already been reported.
78
78
  If you spotted it first, help us to smash it by providing a detailed and welcomed
79
- `feedback <https://github.com/OCA/bank-statement-import/issues/new?body=module:%20account_statement_import_sheet_file%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
79
+ `feedback <https://github.com/OCA/bank-statement-import/issues/new?body=module:%20account_statement_import_sheet_file%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
80
80
 
81
81
  Do not contact contributors directly about support or help with technical issues.
82
82
 
@@ -133,6 +133,6 @@ Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
133
133
 
134
134
  |maintainer-alexey-pelykh|
135
135
 
136
- This module is part of the `OCA/bank-statement-import <https://github.com/OCA/bank-statement-import/tree/17.0/account_statement_import_sheet_file>`_ project on GitHub.
136
+ This module is part of the `OCA/bank-statement-import <https://github.com/OCA/bank-statement-import/tree/18.0/account_statement_import_sheet_file>`_ project on GitHub.
137
137
 
138
138
  You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
@@ -1,11 +1,12 @@
1
1
  # Copyright 2019 ForgeFlow, S.L.
2
2
  # Copyright 2020 CorporateHub (https://corporatehub.eu)
3
+ # Copyright 2025 Tecnativa - Pedro M. Baeza
3
4
  # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
4
5
 
5
6
  {
6
7
  "name": "Bank Statement TXT/CSV/XLSX Import",
7
8
  "summary": "Import TXT/CSV or XLSX files as Bank Statements in Odoo",
8
- "version": "17.0.1.1.2",
9
+ "version": "18.0.1.0.0",
9
10
  "category": "Accounting",
10
11
  "website": "https://github.com/OCA/bank-statement-import",
11
12
  "author": "ForgeFlow, CorporateHub, Odoo Community Association (OCA)",
@@ -15,7 +16,6 @@
15
16
  "depends": [
16
17
  "account_statement_import_file",
17
18
  ],
18
- "external_dependencies": {"python": ["xlrd", "chardet"]},
19
19
  "data": [
20
20
  "security/ir.model.access.csv",
21
21
  "data/map_data.xml",
@@ -4,7 +4,7 @@
4
4
  #
5
5
  msgid ""
6
6
  msgstr ""
7
- "Project-Id-Version: Odoo Server 17.0\n"
7
+ "Project-Id-Version: Odoo Server 18.0\n"
8
8
  "Report-Msgid-Bugs-To: \n"
9
9
  "Last-Translator: \n"
10
10
  "Language-Team: \n"
@@ -16,23 +16,23 @@ msgstr ""
16
16
  #. module: account_statement_import_sheet_file
17
17
  #. odoo-python
18
18
  #: code:addons/account_statement_import_sheet_file/models/account_statement_import_sheet_parser.py:0
19
- #, python-format
20
19
  msgid "%(code)s: %(filename)s"
21
20
  msgstr ""
22
21
 
23
22
  #. module: account_statement_import_sheet_file
24
23
  #: model_terms:ir.ui.view,arch_db:account_statement_import_sheet_file.account_statement_import_sheet_mapping_tree
25
24
  msgid ""
26
- "<span class=\"fa fa-info-circle\"/> Add the column names or column number (when the file has no header).\n"
27
- " You can concatenate multiple columns in the file into the same field, indicating the\n"
28
- " column names or numbers separated by comma."
25
+ "<span class=\"fa fa-info-circle\">\n"
26
+ " Add the column names or column number (when the file has no header). You can concatenate multiple columns in the file into the same field, indicating the column names or numbers separated by comma.\n"
27
+ " </span>"
29
28
  msgstr ""
30
29
 
31
30
  #. module: account_statement_import_sheet_file
32
31
  #: model_terms:ir.ui.view,arch_db:account_statement_import_sheet_file.account_statement_import_sheet_mapping_tree
33
32
  msgid ""
34
- "<span class=\"fa fa-info-circle\"/> indicate the column number in the "
35
- "Columns section. The first column is 0."
33
+ "<span class=\"fa fa-info-circle\">\n"
34
+ " indicate the column number in the Columns section. The first column is 0.\n"
35
+ " </span>"
36
36
  msgstr ""
37
37
 
38
38
  #. module: account_statement_import_sheet_file
@@ -43,7 +43,6 @@ msgstr ""
43
43
  #. module: account_statement_import_sheet_file
44
44
  #. odoo-python
45
45
  #: code:addons/account_statement_import_sheet_file/models/account_statement_import_sheet_parser.py:0
46
- #, python-format
47
46
  msgid "Account: %s; "
48
47
  msgstr ""
49
48
 
@@ -65,7 +64,6 @@ msgstr ""
65
64
  #. module: account_statement_import_sheet_file
66
65
  #. odoo-python
67
66
  #: code:addons/account_statement_import_sheet_file/models/account_statement_import.py:0
68
- #, python-format
69
67
  msgid "Bad file/mapping: "
70
68
  msgstr ""
71
69
 
@@ -107,7 +105,6 @@ msgstr ""
107
105
  #. module: account_statement_import_sheet_file
108
106
  #. odoo-python
109
107
  #: code:addons/account_statement_import_sheet_file/models/account_statement_import_sheet_parser.py:0
110
- #, python-format
111
108
  msgid "Bank: %s; "
112
109
  msgstr ""
113
110
 
@@ -316,7 +313,6 @@ msgstr ""
316
313
  #. odoo-python
317
314
  #: code:addons/account_statement_import_sheet_file/models/account_statement_import_sheet_parser.py:0
318
315
  #: model:ir.model.fields.selection,name:account_statement_import_sheet_file.selection__account_statement_import_sheet_mapping__delimiter__n/a
319
- #, python-format
320
316
  msgid "N/A"
321
317
  msgstr ""
322
318
 
@@ -328,7 +324,6 @@ msgstr ""
328
324
  #. module: account_statement_import_sheet_file
329
325
  #. odoo-python
330
326
  #: code:addons/account_statement_import_sheet_file/models/account_statement_import_sheet_parser.py:0
331
- #, python-format
332
327
  msgid "No valid encoding was found for the attached file"
333
328
  msgstr ""
334
329
 
@@ -345,7 +340,6 @@ msgstr ""
345
340
  #. module: account_statement_import_sheet_file
346
341
  #. odoo-python
347
342
  #: code:addons/account_statement_import_sheet_file/models/account_statement_import_sheet_mapping.py:0
348
- #, python-format
349
343
  msgid "Offsets cannot be negative"
350
344
  msgstr ""
351
345
 
@@ -459,7 +453,6 @@ msgstr ""
459
453
  #. module: account_statement_import_sheet_file
460
454
  #. odoo-python
461
455
  #: code:addons/account_statement_import_sheet_file/models/account_statement_import_sheet_parser.py:0
462
- #, python-format
463
456
  msgid "Transaction ID: %s; "
464
457
  msgstr ""
465
458
 
@@ -496,14 +489,12 @@ msgstr ""
496
489
  #. module: account_statement_import_sheet_file
497
490
  #. odoo-python
498
491
  #: code:addons/account_statement_import_sheet_file/models/account_statement_import_sheet_mapping.py:0
499
- #, python-format
500
492
  msgid "Use amount_column if you have set Amount type = 'Single value'"
501
493
  msgstr ""
502
494
 
503
495
  #. module: account_statement_import_sheet_file
504
496
  #. odoo-python
505
497
  #: code:addons/account_statement_import_sheet_file/models/account_statement_import_sheet_mapping.py:0
506
- #, python-format
507
498
  msgid ""
508
499
  "Use amount_debit_column and amount_credit_column if you have set Amount type"
509
500
  " = 'Distinct Credit/debit Column'"
@@ -512,7 +503,6 @@ msgstr ""
512
503
  #. module: account_statement_import_sheet_file
513
504
  #. odoo-python
514
505
  #: code:addons/account_statement_import_sheet_file/models/account_statement_import_sheet_mapping.py:0
515
- #, python-format
516
506
  msgid "Use debit_credit_column if you have set Amount type = 'Absolute value'"
517
507
  msgstr ""
518
508
 
@@ -3,7 +3,7 @@
3
3
 
4
4
  import logging
5
5
 
6
- from odoo import _, fields, models
6
+ from odoo import fields, models
7
7
  from odoo.exceptions import UserError
8
8
 
9
9
  _logger = logging.getLogger(__name__)
@@ -37,7 +37,7 @@ class AccountStatementImport(models.TransientModel):
37
37
  if self.env.context.get("account_statement_import_sheet_file_test"):
38
38
  raise
39
39
  _logger.warning("Sheet parser error", exc_info=True)
40
- raise UserError(_("Bad file/mapping: ") + str(exc)) from exc
40
+ raise UserError(self.env._("Bad file/mapping: ") + str(exc)) from exc
41
41
  return super()._parse_file(data_file)
42
42
 
43
43
  def _create_bank_statements(self, stmts_vals, result):
@@ -2,7 +2,7 @@
2
2
  # Copyright 2020 CorporateHub (https://corporatehub.eu)
3
3
  # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
4
4
 
5
- from odoo import _, api, fields, models
5
+ from odoo import api, fields, models
6
6
  from odoo.exceptions import ValidationError
7
7
 
8
8
 
@@ -194,11 +194,13 @@ class AccountStatementImportSheetMapping(models.Model):
194
194
  for item in self:
195
195
  if item.amount_type == "simple_value" and not item.amount_column:
196
196
  raise ValidationError(
197
- _("Use amount_column if you have set Amount type = 'Single value'")
197
+ self.env._(
198
+ "Use amount_column if you have set Amount type = 'Single value'"
199
+ )
198
200
  )
199
201
  elif item.amount_type == "absolute_value" and not item.debit_credit_column:
200
202
  raise ValidationError(
201
- _(
203
+ self.env._(
202
204
  "Use debit_credit_column if you have set "
203
205
  "Amount type = 'Absolute value'"
204
206
  )
@@ -207,7 +209,7 @@ class AccountStatementImportSheetMapping(models.Model):
207
209
  not item.amount_debit_column or not item.amount_credit_column
208
210
  ):
209
211
  raise ValidationError(
210
- _(
212
+ self.env._(
211
213
  "Use amount_debit_column and amount_credit_column if you "
212
214
  "have set Amount type = 'Distinct Credit/debit Column'"
213
215
  )
@@ -231,7 +233,7 @@ class AccountStatementImportSheetMapping(models.Model):
231
233
  def _check_columns(self):
232
234
  for mapping in self:
233
235
  if mapping.offset_column < 0:
234
- raise ValidationError(_("Offsets cannot be negative"))
236
+ raise ValidationError(self.env._("Offsets cannot be negative"))
235
237
 
236
238
  def _get_float_separators(self):
237
239
  self.ensure_one()
@@ -12,7 +12,7 @@ from decimal import Decimal
12
12
  from io import StringIO
13
13
  from os import path
14
14
 
15
- from odoo import _, api, models
15
+ from odoo import api, models
16
16
  from odoo.exceptions import UserError
17
17
 
18
18
  _logger = logging.getLogger(__name__)
@@ -72,11 +72,11 @@ class AccountStatementImportSheetParser(models.TransientModel):
72
72
  last_line = lines[-1]
73
73
  data = {
74
74
  "date": first_line["timestamp"].date(),
75
- "name": _("%(code)s: %(filename)s")
76
- % {
77
- "code": journal.code,
78
- "filename": path.basename(filename),
79
- },
75
+ "name": self.env._(
76
+ "%(code)s: %(filename)s",
77
+ code=journal.code,
78
+ filename=path.basename(filename),
79
+ ),
80
80
  }
81
81
 
82
82
  if mapping.balance_column:
@@ -173,7 +173,7 @@ class AccountStatementImportSheetParser(models.TransientModel):
173
173
  detected_encoding = chardet.detect(data_file).get("encoding", False)
174
174
  if not detected_encoding:
175
175
  raise UserError(
176
- _("No valid encoding was found for the attached file")
176
+ self.env._("No valid encoding was found for the attached file")
177
177
  ) from None
178
178
  decoded_file = data_file.decode(detected_encoding)
179
179
  csv_or_xlsx = reader(StringIO(decoded_file), **csv_options)
@@ -446,22 +446,21 @@ class AccountStatementImportSheetParser(models.TransientModel):
446
446
  transaction["currency_id"] = currency.id
447
447
 
448
448
  if transaction_id:
449
- transaction["unique_import_id"] = "{}-{}".format(
450
- transaction_id,
451
- int(timestamp.timestamp()),
449
+ transaction["unique_import_id"] = (
450
+ f"{transaction_id}-{int(timestamp.timestamp())}"
452
451
  )
453
452
 
454
- transaction["payment_ref"] = description or _("N/A")
453
+ transaction["payment_ref"] = description or self.env._("N/A")
455
454
  if reference:
456
455
  transaction["ref"] = reference
457
456
 
458
457
  note = ""
459
458
  if bank_name:
460
- note += _("Bank: %s; ") % (bank_name,)
459
+ note += self.env._("Bank: %s; ") % (bank_name,)
461
460
  if bank_account:
462
- note += _("Account: %s; ") % (bank_account,)
461
+ note += self.env._("Account: %s; ") % (bank_account,)
463
462
  if transaction_id:
464
- note += _("Transaction ID: %s; ") % (transaction_id,)
463
+ note += self.env._("Transaction ID: %s; ") % (transaction_id,)
465
464
  if note and notes:
466
465
  note = f"{notes}\n{note.strip()}"
467
466
  elif note:
@@ -372,9 +372,9 @@ ul.auto-toc {
372
372
  !! This file is generated by oca-gen-addon-readme !!
373
373
  !! changes will be overwritten. !!
374
374
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
375
- !! source digest: sha256:e91b66bd2dd7b69e871f22ebaea435ecc394e62eddbff8c196ccfb3f58c63d9a
375
+ !! source digest: sha256:7f262d73d39b721a7fe36fc8279b95fed86757391be9ea917e3f13ee9f4cd83f
376
376
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
377
- <p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/license-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/bank-statement-import/tree/17.0/account_statement_import_sheet_file"><img alt="OCA/bank-statement-import" src="https://img.shields.io/badge/github-OCA%2Fbank--statement--import-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/bank-statement-import-17-0/bank-statement-import-17-0-account_statement_import_sheet_file"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/bank-statement-import&amp;target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
377
+ <p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/license-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/bank-statement-import/tree/18.0/account_statement_import_sheet_file"><img alt="OCA/bank-statement-import" src="https://img.shields.io/badge/github-OCA%2Fbank--statement--import-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/bank-statement-import-18-0/bank-statement-import-18-0-account_statement_import_sheet_file"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/bank-statement-import&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
378
378
  <p>This module allows you to import any TXT/CSV or XLSX file in Odoo as
379
379
  bank statements.</p>
380
380
  <p><strong>Table of contents</strong></p>
@@ -431,7 +431,7 @@ format</li>
431
431
  <p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/bank-statement-import/issues">GitHub Issues</a>.
432
432
  In case of trouble, please check there if your issue has already been reported.
433
433
  If you spotted it first, help us to smash it by providing a detailed and welcomed
434
- <a class="reference external" href="https://github.com/OCA/bank-statement-import/issues/new?body=module:%20account_statement_import_sheet_file%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
434
+ <a class="reference external" href="https://github.com/OCA/bank-statement-import/issues/new?body=module:%20account_statement_import_sheet_file%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
435
435
  <p>Do not contact contributors directly about support or help with technical issues.</p>
436
436
  </div>
437
437
  <div class="section" id="credits">
@@ -478,7 +478,7 @@ mission is to support the collaborative development of Odoo features and
478
478
  promote its widespread use.</p>
479
479
  <p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
480
480
  <p><a class="reference external image-reference" href="https://github.com/alexey-pelykh"><img alt="alexey-pelykh" src="https://github.com/alexey-pelykh.png?size=40px" /></a></p>
481
- <p>This module is part of the <a class="reference external" href="https://github.com/OCA/bank-statement-import/tree/17.0/account_statement_import_sheet_file">OCA/bank-statement-import</a> project on GitHub.</p>
481
+ <p>This module is part of the <a class="reference external" href="https://github.com/OCA/bank-statement-import/tree/18.0/account_statement_import_sheet_file">OCA/bank-statement-import</a> project on GitHub.</p>
482
482
  <p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
483
483
  </div>
484
484
  </div>
@@ -1,5 +1,6 @@
1
1
  # Copyright 2019 ForgeFlow, S.L.
2
2
  # Copyright 2020 CorporateHub (https://corporatehub.eu)
3
+ # Copyright 2025 Tecnativa - Pedro M. Baeza
3
4
  # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
4
5
 
5
6
  from base64 import b64encode
@@ -10,183 +11,106 @@ from unittest.mock import Mock
10
11
  from odoo import fields
11
12
  from odoo.exceptions import UserError
12
13
  from odoo.tests import common
13
- from odoo.tools import float_round
14
+ from odoo.tools import float_round, mute_logger
14
15
 
15
16
 
16
17
  class TestAccountStatementImportSheetFile(common.TransactionCase):
17
- def setUp(self):
18
- super().setUp()
19
-
20
- self.now = fields.Datetime.now()
21
- self.currency_eur = self.env.ref("base.EUR")
22
- self.currency_usd = self.env.ref("base.USD")
23
- self.currency_usd.active = True
24
- # Make sure the currency of the company is USD, as this not always happens
25
- # To be removed in V17: https://github.com/odoo/odoo/pull/107113
26
- self.company = self.env.company
27
- self.env.cr.execute(
28
- "UPDATE res_company SET currency_id = %s WHERE id = %s",
29
- (self.env.ref("base.USD").id, self.company.id),
30
- )
18
+ @classmethod
19
+ def setUpClass(cls):
20
+ super().setUpClass()
21
+ cls.now = fields.Datetime.now()
22
+ cls.currency_eur = cls.env.ref("base.EUR")
23
+ cls.currency_usd = cls.env.ref("base.USD")
24
+ cls.currency_usd.active = True
31
25
  # Activate EUR for unit test, by default is not active
32
- self.currency_eur.active = True
33
- self.sample_statement_map = self.env.ref(
26
+ cls.currency_eur.active = True
27
+ cls.sample_statement_map = cls.env.ref(
34
28
  "account_statement_import_sheet_file.sample_statement_map"
35
29
  )
36
- self.AccountJournal = self.env["account.journal"]
37
- self.AccountBankStatement = self.env["account.bank.statement"]
38
- self.AccountStatementImport = self.env["account.statement.import"]
39
- self.AccountStatementImportSheetMapping = self.env[
30
+ cls.AccountJournal = cls.env["account.journal"]
31
+ cls.AccountBankStatement = cls.env["account.bank.statement"]
32
+ cls.AccountStatementImport = cls.env["account.statement.import"]
33
+ cls.AccountStatementImportSheetMapping = cls.env[
40
34
  "account.statement.import.sheet.mapping"
41
35
  ]
42
- self.AccountStatementImportWizard = self.env["account.statement.import"]
43
- self.suspense_account = self.env["account.account"].create(
36
+ cls.AccountStatementImportWizard = cls.env["account.statement.import"]
37
+ cls.suspense_account = cls.env["account.account"].create(
44
38
  {
45
39
  "code": "987654",
46
40
  "name": "Suspense Account",
47
41
  "account_type": "asset_current",
48
42
  }
49
43
  )
50
- self.parser = self.env["account.statement.import.sheet.parser"]
44
+ cls.parser = cls.env["account.statement.import.sheet.parser"]
51
45
  # Mock the mapping object to return predefined separators
52
- self.mock_mapping_comma_dot = Mock()
53
- self.mock_mapping_comma_dot._get_float_separators.return_value = (",", ".")
54
- self.mock_mapping_dot_comma = Mock()
55
- self.mock_mapping_dot_comma._get_float_separators.return_value = (".", ",")
56
-
57
- def _data_file(self, filename, encoding=None):
58
- mode = "rt" if encoding else "rb"
59
- with open(path.join(path.dirname(__file__), filename), mode) as file:
60
- data = file.read()
61
- if encoding:
62
- data = data.encode(encoding)
63
- return b64encode(data)
64
-
65
- def test_import_csv_file(self):
66
- journal = self.AccountJournal.create(
46
+ cls.mock_mapping_comma_dot = Mock()
47
+ cls.mock_mapping_comma_dot._get_float_separators.return_value = (",", ".")
48
+ cls.mock_mapping_dot_comma = Mock()
49
+ cls.mock_mapping_dot_comma._get_float_separators.return_value = (".", ",")
50
+ cls.journal = cls.AccountJournal.create(
67
51
  {
68
52
  "name": "Bank",
69
53
  "type": "bank",
70
54
  "code": "BANK",
71
- "currency_id": self.currency_usd.id,
72
- "suspense_account_id": self.suspense_account.id,
55
+ "currency_id": cls.currency_usd.id,
56
+ "suspense_account_id": cls.suspense_account.id,
73
57
  }
74
58
  )
75
- data = self._data_file("fixtures/sample_statement_en.csv", "utf-8")
76
- wizard = self.AccountStatementImport.with_context(journal_id=journal.id).create(
59
+ cls.statement_domain = [("journal_id", "=", cls.journal.id)]
60
+
61
+ def _get_import_wizard(self, path):
62
+ return self.AccountStatementImport.with_context(
63
+ journal_id=self.journal.id, account_statement_import_sheet_file_test=True
64
+ ).create(
77
65
  {
78
- "statement_filename": "fixtures/sample_statement_en.csv",
79
- "statement_file": data,
66
+ "statement_filename": path,
67
+ "statement_file": self._data_file(path),
80
68
  "sheet_mapping_id": self.sample_statement_map.id,
81
69
  }
82
70
  )
83
- wizard.with_context(
84
- account_statement_import_sheet_file_test=True
85
- ).import_file_button()
86
- statement = self.AccountBankStatement.search([("journal_id", "=", journal.id)])
71
+
72
+ def _data_file(self, filename, encoding=None):
73
+ mode = "rt" if encoding else "rb"
74
+ with open(path.join(path.dirname(__file__), filename), mode) as file:
75
+ data = file.read()
76
+ if encoding:
77
+ data = data.encode(encoding)
78
+ return b64encode(data)
79
+
80
+ def test_import_csv_file(self):
81
+ wizard = self._get_import_wizard("fixtures/sample_statement_en.csv")
82
+ wizard.import_file_button()
83
+ statement = self.AccountBankStatement.search(self.statement_domain)
87
84
  self.assertEqual(len(statement), 1)
88
85
  self.assertEqual(len(statement.line_ids), 2)
89
86
 
90
87
  def test_import_empty_csv_file(self):
91
- journal = self.AccountJournal.create(
92
- {
93
- "name": "Bank",
94
- "type": "bank",
95
- "code": "BANK",
96
- "currency_id": self.currency_usd.id,
97
- "suspense_account_id": self.suspense_account.id,
98
- }
99
- )
100
- data = self._data_file("fixtures/empty_statement_en.csv", "utf-8")
101
- wizard = self.AccountStatementImport.with_context(journal_id=journal.id).create(
102
- {
103
- "statement_filename": "fixtures/empty_statement_en.csv",
104
- "statement_file": data,
105
- "sheet_mapping_id": self.sample_statement_map.id,
106
- }
107
- )
88
+ wizard = self._get_import_wizard("fixtures/empty_statement_en.csv")
108
89
  with self.assertRaises(UserError):
109
- wizard.with_context(
110
- account_statement_import_sheet_file_test=True
111
- ).import_file_button()
112
- statement = self.AccountBankStatement.search([("journal_id", "=", journal.id)])
90
+ wizard.import_file_button()
91
+ statement = self.AccountBankStatement.search(self.statement_domain)
113
92
  self.assertEqual(len(statement), 0)
114
93
 
115
94
  def test_import_xlsx_file(self):
116
- journal = self.AccountJournal.create(
117
- {
118
- "name": "Bank",
119
- "type": "bank",
120
- "code": "BANK",
121
- "currency_id": self.currency_usd.id,
122
- "suspense_account_id": self.suspense_account.id,
123
- }
124
- )
125
- data = self._data_file("fixtures/sample_statement_en.xlsx")
126
- wizard = self.AccountStatementImport.with_context(journal_id=journal.id).create(
127
- {
128
- "statement_filename": "fixtures/sample_statement_en.xlsx",
129
- "statement_file": data,
130
- "sheet_mapping_id": self.sample_statement_map.id,
131
- }
132
- )
133
- wizard.with_context(
134
- account_statement_import_sheet_file_test=True
135
- ).import_file_button()
136
- statement = self.AccountBankStatement.search([("journal_id", "=", journal.id)])
95
+ wizard = self._get_import_wizard("fixtures/sample_statement_en.xlsx")
96
+ wizard.import_file_button()
97
+ statement = self.AccountBankStatement.search(self.statement_domain)
137
98
  self.assertEqual(len(statement), 1)
138
99
  self.assertEqual(len(statement.line_ids), 2)
139
100
 
140
101
  def test_import_empty_xlsx_file(self):
141
- journal = self.AccountJournal.create(
142
- {
143
- "name": "Bank",
144
- "type": "bank",
145
- "code": "BANK",
146
- "currency_id": self.currency_usd.id,
147
- "suspense_account_id": self.suspense_account.id,
148
- }
149
- )
150
- data = self._data_file("fixtures/empty_statement_en.xlsx")
151
- wizard = self.AccountStatementImport.with_context(journal_id=journal.id).create(
152
- {
153
- "statement_filename": "fixtures/empty_statement_en.xlsx",
154
- "statement_file": data,
155
- "sheet_mapping_id": self.sample_statement_map.id,
156
- }
157
- )
102
+ wizard = self._get_import_wizard("fixtures/empty_statement_en.xlsx")
158
103
  with self.assertRaises(UserError):
159
- wizard.with_context(
160
- account_statement_import_sheet_file_test=True
161
- ).import_file_button()
162
- statement = self.AccountBankStatement.search([("journal_id", "=", journal.id)])
104
+ wizard.import_file_button()
105
+ statement = self.AccountBankStatement.search(self.statement_domain)
163
106
  self.assertEqual(len(statement), 0)
164
107
 
165
108
  def test_original_currency(self):
166
- journal = self.AccountJournal.create(
167
- {
168
- "name": "Bank",
169
- "type": "bank",
170
- "code": "BANK",
171
- "currency_id": self.currency_usd.id,
172
- "suspense_account_id": self.suspense_account.id,
173
- }
174
- )
175
- data = self._data_file("fixtures/original_currency.csv", "utf-8")
176
- wizard = self.AccountStatementImport.with_context(journal_id=journal.id).create(
177
- {
178
- "statement_filename": "fixtures/original_currency.csv",
179
- "statement_file": data,
180
- "sheet_mapping_id": self.sample_statement_map.id,
181
- }
182
- )
183
- wizard.with_context(
184
- account_statement_import_sheet_file_test=True
185
- ).import_file_button()
186
- statement = self.AccountBankStatement.search([("journal_id", "=", journal.id)])
109
+ wizard = self._get_import_wizard("fixtures/original_currency.csv")
110
+ wizard.import_file_button()
111
+ statement = self.AccountBankStatement.search(self.statement_domain)
187
112
  self.assertEqual(len(statement), 1)
188
113
  self.assertEqual(len(statement.line_ids), 1)
189
-
190
114
  line = statement.line_ids
191
115
  self.assertEqual(line.currency_id, self.currency_usd)
192
116
  self.assertEqual(line.amount, 1525.0)
@@ -214,30 +138,12 @@ class TestAccountStatementImportSheetFile(common.TransactionCase):
214
138
  "bank_account_column": "6",
215
139
  }
216
140
  )
217
- journal = self.AccountJournal.create(
218
- {
219
- "name": "Bank",
220
- "type": "bank",
221
- "code": "BANK",
222
- "currency_id": self.currency_usd.id,
223
- "suspense_account_id": self.suspense_account.id,
224
- }
225
- )
226
- data = self._data_file("fixtures/original_currency_no_header.csv", "utf-8")
227
- wizard = self.AccountStatementImport.with_context(journal_id=journal.id).create(
228
- {
229
- "statement_filename": "fixtures/original_currency.csv",
230
- "statement_file": data,
231
- "sheet_mapping_id": no_header_statement_map.id,
232
- }
233
- )
234
- wizard.with_context(
235
- account_statement_import_sheet_file_test=True
236
- ).import_file_button()
237
- statement = self.AccountBankStatement.search([("journal_id", "=", journal.id)])
141
+ wizard = self._get_import_wizard("fixtures/original_currency_no_header.csv")
142
+ wizard.sheet_mapping_id = no_header_statement_map.id
143
+ wizard.import_file_button()
144
+ statement = self.AccountBankStatement.search(self.statement_domain)
238
145
  self.assertEqual(len(statement), 1)
239
146
  self.assertEqual(len(statement.line_ids), 1)
240
-
241
147
  line = statement.line_ids
242
148
  self.assertEqual(line.currency_id, self.currency_usd)
243
149
  self.assertEqual(line.foreign_currency_id, self.currency_eur)
@@ -245,99 +151,43 @@ class TestAccountStatementImportSheetFile(common.TransactionCase):
245
151
  self.assertEqual(line.payment_ref, "Your payment INV0001")
246
152
 
247
153
  def test_original_currency_empty(self):
248
- journal = self.AccountJournal.create(
249
- {
250
- "name": "Bank",
251
- "type": "bank",
252
- "code": "BANK",
253
- "currency_id": self.currency_usd.id,
254
- "suspense_account_id": self.suspense_account.id,
255
- }
256
- )
257
- data = self._data_file("fixtures/original_currency_empty.csv", "utf-8")
258
- wizard = self.AccountStatementImport.with_context(journal_id=journal.id).create(
259
- {
260
- "statement_filename": "fixtures/original_currency_empty.csv",
261
- "statement_file": data,
262
- "sheet_mapping_id": self.sample_statement_map.id,
263
- }
264
- )
265
- wizard.with_context(
266
- account_statement_import_sheet_file_test=True
267
- ).import_file_button()
268
- statement = self.AccountBankStatement.search([("journal_id", "=", journal.id)])
154
+ wizard = self._get_import_wizard("fixtures/original_currency_empty.csv")
155
+ wizard.import_file_button()
156
+ statement = self.AccountBankStatement.search(self.statement_domain)
269
157
  self.assertEqual(len(statement), 1)
270
158
  self.assertEqual(len(statement.line_ids), 1)
271
-
272
159
  line = statement.line_ids
273
160
  self.assertFalse(line.foreign_currency_id)
274
161
  self.assertEqual(line.amount_currency, 0.0)
275
162
 
276
163
  def test_multi_currency(self):
277
- journal = self.AccountJournal.create(
278
- {
279
- "name": "Bank",
280
- "type": "bank",
281
- "code": "BANK",
282
- "currency_id": self.currency_usd.id,
283
- "suspense_account_id": self.suspense_account.id,
284
- }
285
- )
286
- statement_map = self.sample_statement_map.copy(
164
+ self.sample_statement_map.write(
287
165
  {
288
166
  "currency_column": "Currency",
289
167
  "original_currency_column": None,
290
168
  "original_amount_column": None,
291
169
  }
292
170
  )
293
- data = self._data_file("fixtures/multi_currency.csv", "utf-8")
294
- wizard = self.AccountStatementImport.with_context(journal_id=journal.id).create(
295
- {
296
- "statement_filename": "fixtures/multi_currency.csv",
297
- "statement_file": data,
298
- "sheet_mapping_id": statement_map.id,
299
- }
300
- )
301
- wizard.with_context(
302
- account_statement_import_sheet_file_test=True
303
- ).import_file_button()
304
- statement = self.AccountBankStatement.search([("journal_id", "=", journal.id)])
171
+ wizard = self._get_import_wizard("fixtures/multi_currency.csv")
172
+ wizard.import_file_button()
173
+ statement = self.AccountBankStatement.search(self.statement_domain)
305
174
  self.assertEqual(len(statement), 1)
306
175
  self.assertEqual(len(statement.line_ids), 1)
307
-
308
176
  line = statement.line_ids
309
177
  self.assertFalse(line.foreign_currency_id)
310
178
  self.assertEqual(line.amount, -33.5)
311
179
 
312
180
  def test_balance(self):
313
- journal = self.AccountJournal.create(
314
- {
315
- "name": "Bank",
316
- "type": "bank",
317
- "code": "BANK",
318
- "currency_id": self.currency_usd.id,
319
- "suspense_account_id": self.suspense_account.id,
320
- }
321
- )
322
- statement_map = self.sample_statement_map.copy(
181
+ self.sample_statement_map.write(
323
182
  {
324
183
  "balance_column": "Balance",
325
184
  "original_currency_column": None,
326
185
  "original_amount_column": None,
327
186
  }
328
187
  )
329
- data = self._data_file("fixtures/balance.csv", "utf-8")
330
- wizard = self.AccountStatementImport.with_context(journal_id=journal.id).create(
331
- {
332
- "statement_filename": "fixtures/balance.csv",
333
- "statement_file": data,
334
- "sheet_mapping_id": statement_map.id,
335
- }
336
- )
337
- wizard.with_context(
338
- account_statement_import_sheet_file_test=True
339
- ).import_file_button()
340
- statement = self.AccountBankStatement.search([("journal_id", "=", journal.id)])
188
+ wizard = self._get_import_wizard("fixtures/balance.csv")
189
+ wizard.import_file_button()
190
+ statement = self.AccountBankStatement.search(self.statement_domain)
341
191
  self.assertEqual(len(statement), 1)
342
192
  self.assertEqual(len(statement.line_ids), 2)
343
193
  self.assertEqual(statement.balance_start, 10.0)
@@ -345,16 +195,7 @@ class TestAccountStatementImportSheetFile(common.TransactionCase):
345
195
  self.assertEqual(statement.balance_end, 1510.0)
346
196
 
347
197
  def test_debit_credit(self):
348
- journal = self.AccountJournal.create(
349
- {
350
- "name": "Bank",
351
- "type": "bank",
352
- "code": "BANK",
353
- "currency_id": self.currency_usd.id,
354
- "suspense_account_id": self.suspense_account.id,
355
- }
356
- )
357
- statement_map = self.sample_statement_map.copy(
198
+ self.sample_statement_map.write(
358
199
  {
359
200
  "balance_column": "Balance",
360
201
  "original_currency_column": None,
@@ -364,18 +205,9 @@ class TestAccountStatementImportSheetFile(common.TransactionCase):
364
205
  "credit_value": "C",
365
206
  }
366
207
  )
367
- data = self._data_file("fixtures/debit_credit.csv", "utf-8")
368
- wizard = self.AccountStatementImport.with_context(journal_id=journal.id).create(
369
- {
370
- "statement_filename": "fixtures/debit_credit.csv",
371
- "statement_file": data,
372
- "sheet_mapping_id": statement_map.id,
373
- }
374
- )
375
- wizard.with_context(
376
- account_statement_import_sheet_file_test=True
377
- ).import_file_button()
378
- statement = self.AccountBankStatement.search([("journal_id", "=", journal.id)])
208
+ wizard = self._get_import_wizard("fixtures/debit_credit.csv")
209
+ wizard.import_file_button()
210
+ statement = self.AccountBankStatement.search(self.statement_domain)
379
211
  self.assertEqual(len(statement), 1)
380
212
  self.assertEqual(len(statement.line_ids), 2)
381
213
  self.assertEqual(statement.balance_start, 10.0)
@@ -383,16 +215,7 @@ class TestAccountStatementImportSheetFile(common.TransactionCase):
383
215
  self.assertEqual(statement.balance_end, 1510.0)
384
216
 
385
217
  def test_debit_credit_amount(self):
386
- journal = self.AccountJournal.create(
387
- {
388
- "name": "Bank",
389
- "type": "bank",
390
- "code": "BANK",
391
- "currency_id": self.currency_usd.id,
392
- "suspense_account_id": self.suspense_account.id,
393
- }
394
- )
395
- statement_map = self.sample_statement_map.copy(
218
+ self.sample_statement_map.write(
396
219
  {
397
220
  "amount_type": "distinct_credit_debit",
398
221
  "amount_debit_column": "Debit",
@@ -403,18 +226,9 @@ class TestAccountStatementImportSheetFile(common.TransactionCase):
403
226
  "original_amount_column": None,
404
227
  }
405
228
  )
406
- data = self._data_file("fixtures/debit_credit_amount.csv", "utf-8")
407
- wizard = self.AccountStatementImport.with_context(journal_id=journal.id).create(
408
- {
409
- "statement_filename": "fixtures/debit_credit_amount.csv",
410
- "statement_file": data,
411
- "sheet_mapping_id": statement_map.id,
412
- }
413
- )
414
- wizard.with_context(
415
- account_statement_import_sheet_file_test=True
416
- ).import_file_button()
417
- statement = self.AccountBankStatement.search([("journal_id", "=", journal.id)])
229
+ wizard = self._get_import_wizard("fixtures/debit_credit_amount.csv")
230
+ wizard.import_file_button()
231
+ statement = self.AccountBankStatement.search(self.statement_domain)
418
232
  self.assertEqual(len(statement), 1)
419
233
  self.assertEqual(len(statement.line_ids), 4)
420
234
  self.assertEqual(statement.balance_start, 10.0)
@@ -422,16 +236,7 @@ class TestAccountStatementImportSheetFile(common.TransactionCase):
422
236
  self.assertEqual(statement.balance_end, 1510.0)
423
237
 
424
238
  def test_metadata_separated_debit_credit_csv(self):
425
- journal = self.AccountJournal.create(
426
- {
427
- "name": "Bank",
428
- "type": "bank",
429
- "code": "BANK",
430
- "currency_id": self.currency_usd.id,
431
- "suspense_account_id": self.suspense_account.id,
432
- }
433
- )
434
- statement_map = self.sample_statement_map.copy(
239
+ self.sample_statement_map.write(
435
240
  {
436
241
  "footer_lines_skip_count": 1,
437
242
  "header_lines_skip_count": 5,
@@ -448,19 +253,11 @@ class TestAccountStatementImportSheetFile(common.TransactionCase):
448
253
  "amount_credit_column": "Credit",
449
254
  }
450
255
  )
451
- data = self._data_file("fixtures/meta_data_separated_credit_debit.csv", "utf-8")
452
- wizard = self.AccountStatementImport.with_context(journal_id=journal.id).create(
453
- {
454
- "statement_filename": "fixtures/meta_data_separated_credit_debit.csv",
455
- "statement_file": data,
456
- "sheet_mapping_id": statement_map.id,
457
- }
256
+ wizard = self._get_import_wizard(
257
+ "fixtures/meta_data_separated_credit_debit.csv"
458
258
  )
459
- wizard.with_context(
460
- journal_id=journal.id,
461
- account_bank_statement_import_txt_xlsx_test=True,
462
- ).import_file_button()
463
- statement = self.AccountBankStatement.search([("journal_id", "=", journal.id)])
259
+ wizard.import_file_button()
260
+ statement = self.AccountBankStatement.search(self.statement_domain)
464
261
  self.assertEqual(len(statement), 1)
465
262
  self.assertEqual(len(statement.line_ids), 4)
466
263
  line1 = statement.line_ids.filtered(lambda x: x.payment_ref == "LABEL 1")
@@ -469,16 +266,7 @@ class TestAccountStatementImportSheetFile(common.TransactionCase):
469
266
  self.assertEqual(line4.amount, -1300)
470
267
 
471
268
  def test_metadata_separated_debit_credit_xlsx(self):
472
- journal = self.AccountJournal.create(
473
- {
474
- "name": "Bank",
475
- "type": "bank",
476
- "code": "BANK",
477
- "currency_id": self.currency_usd.id,
478
- "suspense_account_id": self.suspense_account.id,
479
- }
480
- )
481
- statement_map = self.sample_statement_map.copy(
269
+ self.sample_statement_map.write(
482
270
  {
483
271
  "footer_lines_skip_count": 1,
484
272
  "header_lines_skip_count": 5,
@@ -495,19 +283,11 @@ class TestAccountStatementImportSheetFile(common.TransactionCase):
495
283
  "amount_credit_column": "Credit",
496
284
  }
497
285
  )
498
- data = self._data_file("fixtures/meta_data_separated_credit_debit.xlsx")
499
- wizard = self.AccountStatementImport.with_context(journal_id=journal.id).create(
500
- {
501
- "statement_filename": "fixtures/meta_data_separated_credit_debit.xlsx",
502
- "statement_file": data,
503
- "sheet_mapping_id": statement_map.id,
504
- }
286
+ wizard = self._get_import_wizard(
287
+ "fixtures/meta_data_separated_credit_debit.xlsx"
505
288
  )
506
- wizard.with_context(
507
- journal_id=journal.id,
508
- account_bank_statement_import_txt_xlsx_test=True,
509
- ).import_file_button()
510
- statement = self.AccountBankStatement.search([("journal_id", "=", journal.id)])
289
+ wizard.import_file_button()
290
+ statement = self.AccountBankStatement.search(self.statement_domain)
511
291
  self.assertEqual(len(statement), 1)
512
292
  self.assertEqual(len(statement.line_ids), 4)
513
293
  line1 = statement.line_ids.filtered(lambda x: x.payment_ref == "LABEL 1")
@@ -517,28 +297,11 @@ class TestAccountStatementImportSheetFile(common.TransactionCase):
517
297
 
518
298
  def test_amount_inverse_sign(self):
519
299
  self.sample_statement_map.amount_inverse_sign = True
520
- journal = self.AccountJournal.create(
521
- {
522
- "name": "Bank",
523
- "type": "bank",
524
- "code": "BANK",
525
- "currency_id": self.currency_usd.id,
526
- "suspense_account_id": self.suspense_account.id,
527
- }
300
+ wizard = self._get_import_wizard(
301
+ "fixtures/sample_statement_credit_card_inverse_sign_en.csv"
528
302
  )
529
- filename = "fixtures/sample_statement_credit_card_inverse_sign_en.csv"
530
- data = self._data_file(filename, "utf-8")
531
- wizard = self.AccountStatementImport.with_context(journal_id=journal.id).create(
532
- {
533
- "statement_filename": filename,
534
- "statement_file": data,
535
- "sheet_mapping_id": self.sample_statement_map.id,
536
- }
537
- )
538
- wizard.with_context(
539
- account_statement_import_sheet_file_test=True
540
- ).import_file_button()
541
- statement = self.AccountBankStatement.search([("journal_id", "=", journal.id)])
303
+ wizard.import_file_button()
304
+ statement = self.AccountBankStatement.search(self.statement_domain)
542
305
  self.assertEqual(len(statement), 1)
543
306
  self.assertEqual(len(statement.line_ids), 2)
544
307
  line1 = statement.line_ids.filtered(lambda x: x.payment_ref == "LABEL 1")
@@ -571,27 +334,12 @@ class TestAccountStatementImportSheetFile(common.TransactionCase):
571
334
  }
572
335
  )
573
336
  )
574
- journal = self.AccountJournal.create(
575
- {
576
- "name": "Bank 2",
577
- "type": "bank",
578
- "code": "BAN2",
579
- "currency_id": self.currency_usd.id,
580
- "suspense_account_id": self.suspense_account.id,
581
- }
337
+ wizard = self._get_import_wizard(
338
+ "fixtures/sample_statement_en_empty_values.xlsx"
582
339
  )
583
- data = self._data_file("fixtures/sample_statement_en_empty_values.xlsx")
584
- wizard = self.AccountStatementImport.with_context(journal_id=journal.id).create(
585
- {
586
- "statement_filename": "fixtures/sample_statement_en_empty_values.xlsx",
587
- "statement_file": data,
588
- "sheet_mapping_id": sample_statement_map_empty_values.id,
589
- }
590
- )
591
- wizard.with_context(
592
- account_statement_import_sheet_file_test=True
593
- ).import_file_button()
594
- statement = self.AccountBankStatement.search([("journal_id", "=", journal.id)])
340
+ wizard.sheet_mapping_id = sample_statement_map_empty_values.id
341
+ wizard.import_file_button()
342
+ statement = self.AccountBankStatement.search(self.statement_domain)
595
343
  self.assertEqual(len(statement), 1)
596
344
  self.assertEqual(len(statement.line_ids), 3)
597
345
 
@@ -679,16 +427,12 @@ class TestAccountStatementImportSheetFile(common.TransactionCase):
679
427
  1234.56,
680
428
  )
681
429
 
430
+ @mute_logger(
431
+ "odoo.addons.account_statement_import_sheet_file.models."
432
+ "account_statement_import"
433
+ )
682
434
  def test_offsets(self):
683
- journal = self.AccountJournal.create(
684
- {
685
- "name": "Bank",
686
- "type": "bank",
687
- "code": "BANK",
688
- "currency_id": self.currency_usd.id,
689
- "suspense_account_id": self.suspense_account.id,
690
- }
691
- )
435
+ journal = self.journal
692
436
  file_name = "fixtures/sample_statement_offsets.xlsx"
693
437
  data = self._data_file(file_name)
694
438
  wizard = self.AccountStatementImport.with_context(journal_id=journal.id).create(
@@ -698,72 +442,49 @@ class TestAccountStatementImportSheetFile(common.TransactionCase):
698
442
  "sheet_mapping_id": self.sample_statement_map.id,
699
443
  }
700
444
  )
445
+ # First try with incorrect values
701
446
  with self.assertRaises(UserError):
702
447
  wizard.with_context(
703
448
  account_statement_import_txt_xlsx_test=True
704
449
  ).import_file_button()
705
- statement_map_offsets = self.sample_statement_map.copy(
706
- {
707
- "offset_column": 1,
708
- "header_lines_skip_count": 3,
709
- }
710
- )
711
- wizard = self.AccountStatementImport.with_context(journal_id=journal.id).create(
712
- {
713
- "statement_filename": file_name,
714
- "statement_file": data,
715
- "sheet_mapping_id": statement_map_offsets.id,
716
- }
450
+ self.sample_statement_map.write(
451
+ {"offset_column": 1, "header_lines_skip_count": 3}
717
452
  )
718
453
  wizard.with_context(
719
454
  account_statement_import_txt_xlsx_test=True
720
455
  ).import_file_button()
721
- statement = self.AccountBankStatement.search([("journal_id", "=", journal.id)])
456
+ statement = self.AccountBankStatement.search(self.statement_domain)
722
457
  self.assertEqual(len(statement), 1)
723
458
  self.assertEqual(len(statement.line_ids), 2)
724
459
  self.assertEqual(statement.balance_start, 0.0)
725
460
  self.assertEqual(statement.balance_end_real, 1491.5)
726
461
  self.assertEqual(statement.balance_end, 1491.5)
727
462
 
463
+ @mute_logger(
464
+ "odoo.addons.account_statement_import_sheet_file.models."
465
+ "account_statement_import"
466
+ )
728
467
  def test_skip_empty_lines(self):
729
- journal = self.AccountJournal.create(
730
- {
731
- "name": "Bank",
732
- "type": "bank",
733
- "code": "BANK",
734
- "currency_id": self.currency_usd.id,
735
- "suspense_account_id": self.suspense_account.id,
736
- }
737
- )
468
+ journal = self.journal
738
469
  file_name = "fixtures/empty_lines_statement.csv"
739
470
  data = self._data_file(file_name, "utf-8")
740
- statement_map_empty_line = self.sample_statement_map.copy(
741
- {
742
- "skip_empty_lines": False,
743
- }
744
- )
471
+ self.sample_statement_map.skip_empty_lines = False
745
472
  wizard = self.AccountStatementImport.with_context(journal_id=journal.id).create(
746
473
  {
747
474
  "statement_filename": file_name,
748
475
  "statement_file": data,
749
- "sheet_mapping_id": statement_map_empty_line.id,
476
+ "sheet_mapping_id": self.sample_statement_map.id,
750
477
  }
751
478
  )
752
479
  with self.assertRaises(UserError):
753
480
  wizard.with_context(
754
481
  account_statement_import_txt_xlsx_test=True
755
482
  ).import_file_button()
756
- wizard = self.AccountStatementImport.with_context(journal_id=journal.id).create(
757
- {
758
- "statement_filename": file_name,
759
- "statement_file": data,
760
- "sheet_mapping_id": self.sample_statement_map.id,
761
- }
762
- )
483
+ self.sample_statement_map.skip_empty_lines = True
763
484
  wizard.with_context(
764
485
  account_statement_import_txt_xlsx_test=True
765
486
  ).import_file_button()
766
- statement = self.AccountBankStatement.search([("journal_id", "=", journal.id)])
487
+ statement = self.AccountBankStatement.search(self.statement_domain)
767
488
  self.assertEqual(len(statement), 1)
768
489
  self.assertEqual(len(statement.line_ids), 3)
769
490
  self.assertEqual(statement.balance_start, 0.0)
@@ -9,9 +9,9 @@
9
9
  <field name="name">account.statement.import.sheet.mapping.form</field>
10
10
  <field name="model">account.statement.import.sheet.mapping</field>
11
11
  <field name="arch" type="xml">
12
- <tree>
12
+ <list>
13
13
  <field name="name" />
14
- </tree>
14
+ </list>
15
15
  </field>
16
16
  </record>
17
17
  <record id="account_statement_import_sheet_mapping_tree" model="ir.ui.view">
@@ -47,9 +47,9 @@
47
47
  invisible="not no_header"
48
48
  colspan="2"
49
49
  >
50
- <span
51
- class="fa fa-info-circle"
52
- /> indicate the column number in the Columns section. The first column is 0.
50
+ <span class="fa fa-info-circle">
51
+ indicate the column number in the Columns section. The first column is 0.
52
+ </span>
53
53
  </div>
54
54
  </group>
55
55
  <group invisible="not debit_credit_column">
@@ -66,11 +66,9 @@
66
66
  <group string="Columns">
67
67
  <group colspan="2" col="2">
68
68
  <div class="alert alert-info" role="alert" colspan="2">
69
- <span
70
- class="fa fa-info-circle"
71
- /> Add the column names or column number (when the file has no header).
72
- You can concatenate multiple columns in the file into the same field, indicating the
73
- column names or numbers separated by comma.
69
+ <span class="fa fa-info-circle">
70
+ Add the column names or column number (when the file has no header). You can concatenate multiple columns in the file into the same field, indicating the column names or numbers separated by comma.
71
+ </span>
74
72
  </div>
75
73
  </group>
76
74
  <group>
@@ -121,7 +119,7 @@
121
119
  >
122
120
  <field name="name">Statement Sheet Mappings</field>
123
121
  <field name="res_model">account.statement.import.sheet.mapping</field>
124
- <field name="view_mode">tree,form</field>
122
+ <field name="view_mode">list,form</field>
125
123
  </record>
126
124
  <menuitem
127
125
  id="menu_statement_import_sheet_mapping"
@@ -1,11 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: odoo-addon-account_statement_import_sheet_file
3
- Version: 17.0.1.1.2
3
+ Version: 18.0.1.0.0.3
4
4
  Requires-Python: >=3.10
5
- Requires-Dist: chardet
6
- Requires-Dist: odoo-addon-account_statement_import_file>=17.0dev,<17.1dev
7
- Requires-Dist: odoo>=17.0a,<17.1dev
8
- Requires-Dist: xlrd
5
+ Requires-Dist: odoo-addon-account_statement_import_file==18.0.*
6
+ Requires-Dist: odoo==18.0.*
9
7
  Summary: Import TXT/CSV or XLSX files as Bank Statements in Odoo
10
8
  Home-page: https://github.com/OCA/bank-statement-import
11
9
  License: AGPL-3
@@ -13,7 +11,7 @@ Author: ForgeFlow, CorporateHub, Odoo Community Association (OCA)
13
11
  Author-email: support@odoo-community.org
14
12
  Classifier: Programming Language :: Python
15
13
  Classifier: Framework :: Odoo
16
- Classifier: Framework :: Odoo :: 17.0
14
+ Classifier: Framework :: Odoo :: 18.0
17
15
  Classifier: License :: OSI Approved :: GNU Affero General Public License v3
18
16
  Description-Content-Type: text/x-rst
19
17
 
@@ -30,7 +28,7 @@ Bank Statement TXT/CSV/XLSX Import
30
28
  !! This file is generated by oca-gen-addon-readme !!
31
29
  !! changes will be overwritten. !!
32
30
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
33
- !! source digest: sha256:e91b66bd2dd7b69e871f22ebaea435ecc394e62eddbff8c196ccfb3f58c63d9a
31
+ !! source digest: sha256:7f262d73d39b721a7fe36fc8279b95fed86757391be9ea917e3f13ee9f4cd83f
34
32
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
35
33
 
36
34
  .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
@@ -40,13 +38,13 @@ Bank Statement TXT/CSV/XLSX Import
40
38
  :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
41
39
  :alt: License: AGPL-3
42
40
  .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fbank--statement--import-lightgray.png?logo=github
43
- :target: https://github.com/OCA/bank-statement-import/tree/17.0/account_statement_import_sheet_file
41
+ :target: https://github.com/OCA/bank-statement-import/tree/18.0/account_statement_import_sheet_file
44
42
  :alt: OCA/bank-statement-import
45
43
  .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
46
- :target: https://translation.odoo-community.org/projects/bank-statement-import-17-0/bank-statement-import-17-0-account_statement_import_sheet_file
44
+ :target: https://translation.odoo-community.org/projects/bank-statement-import-18-0/bank-statement-import-18-0-account_statement_import_sheet_file
47
45
  :alt: Translate me on Weblate
48
46
  .. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
49
- :target: https://runboat.odoo-community.org/builds?repo=OCA/bank-statement-import&target_branch=17.0
47
+ :target: https://runboat.odoo-community.org/builds?repo=OCA/bank-statement-import&target_branch=18.0
50
48
  :alt: Try me on Runboat
51
49
 
52
50
  |badge1| |badge2| |badge3| |badge4| |badge5|
@@ -95,7 +93,7 @@ Bug Tracker
95
93
  Bugs are tracked on `GitHub Issues <https://github.com/OCA/bank-statement-import/issues>`_.
96
94
  In case of trouble, please check there if your issue has already been reported.
97
95
  If you spotted it first, help us to smash it by providing a detailed and welcomed
98
- `feedback <https://github.com/OCA/bank-statement-import/issues/new?body=module:%20account_statement_import_sheet_file%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
96
+ `feedback <https://github.com/OCA/bank-statement-import/issues/new?body=module:%20account_statement_import_sheet_file%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
99
97
 
100
98
  Do not contact contributors directly about support or help with technical issues.
101
99
 
@@ -152,6 +150,6 @@ Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
152
150
 
153
151
  |maintainer-alexey-pelykh|
154
152
 
155
- This module is part of the `OCA/bank-statement-import <https://github.com/OCA/bank-statement-import/tree/17.0/account_statement_import_sheet_file>`_ project on GitHub.
153
+ This module is part of the `OCA/bank-statement-import <https://github.com/OCA/bank-statement-import/tree/18.0/account_statement_import_sheet_file>`_ project on GitHub.
156
154
 
157
155
  You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
@@ -1,8 +1,8 @@
1
- odoo/addons/account_statement_import_sheet_file/README.rst,sha256=5R4SgfFkgNehK3473mFo5gZmh6vWpTxdhgNdLC9JZ54,4724
1
+ odoo/addons/account_statement_import_sheet_file/README.rst,sha256=NLjf-miy43diFV2hojRbkYSQWievJicb-tUDrC66DAg,4724
2
2
  odoo/addons/account_statement_import_sheet_file/__init__.py,sha256=X9EJGOE2GtZbS0G82PtSXmWSZ_R8jEM0rlJTDliQjp4,21
3
- odoo/addons/account_statement_import_sheet_file/__manifest__.py,sha256=2EVavi_PYUEbhKyrPGkFqEsveMCVxpU9Pt-BsTvbE5M,934
3
+ odoo/addons/account_statement_import_sheet_file/__manifest__.py,sha256=xe37vMJSf3o6LAz0Ef8kx-4l87kJKhTNQPz1JIxeDEk,916
4
4
  odoo/addons/account_statement_import_sheet_file/data/map_data.xml,sha256=nz_4CchVMF9pb_SI4I6UZAt2IBPxWapX37lU6J6sTJ0,1225
5
- odoo/addons/account_statement_import_sheet_file/i18n/account_statement_import_sheet_file.pot,sha256=0bOWoJHO8rwi8ouPB7ui-M2O7Ht80-pXCZkJTq3k2Tg,27191
5
+ odoo/addons/account_statement_import_sheet_file/i18n/account_statement_import_sheet_file.pot,sha256=AG8U1aMzt3a_sNYVvXW1WkVZzOvffjBh-hS3zLi_ddI,27095
6
6
  odoo/addons/account_statement_import_sheet_file/i18n/es.po,sha256=AZXEocNT6Gp7W8ZpanJ0MENVamkH-nXANZtiu7Y_fB4,32246
7
7
  odoo/addons/account_statement_import_sheet_file/i18n/es_AR.po,sha256=HWVBRxFW7P1g2XunUS8wCyYW9mg0opw-IB8VvTK_mqY,30982
8
8
  odoo/addons/account_statement_import_sheet_file/i18n/it.po,sha256=B0Ig2xRyLqgGOMvgpI-bYRbjC78PMLs0c3OfSgM4ec8,32323
@@ -12,9 +12,9 @@ odoo/addons/account_statement_import_sheet_file/i18n/tr.po,sha256=ywXWa4dSz1J2IZ
12
12
  odoo/addons/account_statement_import_sheet_file/i18n/zh_CN.po,sha256=AdXlAUPY3-6Gv6TNrB-xrX6if5c2Os8XQWBFb677FBA,30449
13
13
  odoo/addons/account_statement_import_sheet_file/models/__init__.py,sha256=RsEvd89lQS7V0Mlk6D6FAWyOMDRd8YD0d9i4Xc-XcDo,240
14
14
  odoo/addons/account_statement_import_sheet_file/models/account_journal.py,sha256=F4_deAvNErZ6o1gkw9uhDrEnHyWXUKNvk09mzCVzTIw,562
15
- odoo/addons/account_statement_import_sheet_file/models/account_statement_import.py,sha256=KWDYgO9-C1ZAF7JO9Qlq2ghROcJIwKhGp1CueTnA368,1932
16
- odoo/addons/account_statement_import_sheet_file/models/account_statement_import_sheet_mapping.py,sha256=HDR7tcbzw-I6h_hKRNpCFTDiHvOtfgHeAgoFV-Fg_yY,9308
17
- odoo/addons/account_statement_import_sheet_file/models/account_statement_import_sheet_parser.py,sha256=Oe89O5vlG4otLPKpWbVeO2bArqI0AruQ3VG7RzARnGM,18150
15
+ odoo/addons/account_statement_import_sheet_file/models/account_statement_import.py,sha256=_RibEjJfF5XAOJf_4MdXPI39txZTZquMbzHpIwN3gTU,1938
16
+ odoo/addons/account_statement_import_sheet_file/models/account_statement_import_sheet_mapping.py,sha256=PUyVDYKQ5SrdkJvwSSA1ojGuJ_CIRYRSWx5Yl-fi7j0,9387
17
+ odoo/addons/account_statement_import_sheet_file/models/account_statement_import_sheet_parser.py,sha256=ltRx35KSi4AYdJzJnax64pYTdhWVBY9msad0hIgws10,18171
18
18
  odoo/addons/account_statement_import_sheet_file/readme/CONFIGURE.md,sha256=1Z-fR-OJrU8oshmBIcFA3yBd4evqZSgfqezqPRs8RpY,226
19
19
  odoo/addons/account_statement_import_sheet_file/readme/CONTRIBUTORS.md,sha256=Xuy8w1BQ1Nh6eVxGLjqVWXlzIMK7EAGf3whVsycey_Q,535
20
20
  odoo/addons/account_statement_import_sheet_file/readme/DESCRIPTION.md,sha256=VFlOJ-nljwNW6S9uaZVNb_x6Gw1P0FLr6gHcV2-dHk4,86
@@ -22,9 +22,9 @@ odoo/addons/account_statement_import_sheet_file/readme/HISTORY.md,sha256=7y-Qd00
22
22
  odoo/addons/account_statement_import_sheet_file/readme/USAGE.md,sha256=KcCNrSS7xVkRrpqfoZoL6VVkysu1dpOgRRNTfn2QH0c,190
23
23
  odoo/addons/account_statement_import_sheet_file/security/ir.model.access.csv,sha256=ofB5jVirJJ3FQ-uWfKFD-DIg8Lh9bYLaUDQWnb9MkgM,685
24
24
  odoo/addons/account_statement_import_sheet_file/static/description/icon.png,sha256=6xBPJauaFOF0KDHfHgQopSc28kKvxMaeoQFQWZtfZDo,9455
25
- odoo/addons/account_statement_import_sheet_file/static/description/index.html,sha256=myWqrK7VSDhGAGNfETV4aPcHRq_RQI0H_BMrt4ZWLgc,15710
25
+ odoo/addons/account_statement_import_sheet_file/static/description/index.html,sha256=3M0Pout0EW82MDmzaiAJ7u8uTHrfK0f0OmSTZJrYHE4,15710
26
26
  odoo/addons/account_statement_import_sheet_file/tests/__init__.py,sha256=f7vTpmONnfbbcMp5wZ1p7muSkyLC2vcDONaw2VGyiBw,121
27
- odoo/addons/account_statement_import_sheet_file/tests/test_account_statement_import_sheet_file.py,sha256=qLDrS6cmMQZnh1yKkuhToFD1vKXr19s33Rb-TDKPRUY,31320
27
+ odoo/addons/account_statement_import_sheet_file/tests/test_account_statement_import_sheet_file.py,sha256=OyuPUp97y4CvDrhj14rQYij90kNB-hIBmgoQibsDzqA,20503
28
28
  odoo/addons/account_statement_import_sheet_file/tests/fixtures/balance.csv,sha256=-7VrGM_IbKhOJzbX-bUMIsnd99uDIBkalTytlj2jVtk,209
29
29
  odoo/addons/account_statement_import_sheet_file/tests/fixtures/debit_credit.csv,sha256=AaVQ9G5gqsLhxtAsYXCmFCTxpBPonKA1uxy7ue5gYYE,223
30
30
  odoo/addons/account_statement_import_sheet_file/tests/fixtures/debit_credit_amount.csv,sha256=y-VoBcF_7WaUZhnmOqSuCv7ElCKSHRbsqKWpCH49Ams,369
@@ -44,8 +44,8 @@ odoo/addons/account_statement_import_sheet_file/tests/fixtures/sample_statement_
44
44
  odoo/addons/account_statement_import_sheet_file/tests/fixtures/sample_statement_offsets.xlsx,sha256=zfuCnPrKeXQmZ3VV3FgdMY59ZDt7WOQx5PYNchNbUp0,5993
45
45
  odoo/addons/account_statement_import_sheet_file/views/account_journal_views.xml,sha256=h3A5JmNGunmCybjD_Gx_v6PghhHy0TOqos3Bu5PHhTk,594
46
46
  odoo/addons/account_statement_import_sheet_file/views/account_statement_import.xml,sha256=KhgiMxHjI5tq1RlkmDYOhejqrxN4mXLc5nT9EM9gQ5s,842
47
- odoo/addons/account_statement_import_sheet_file/views/account_statement_import_sheet_mapping.xml,sha256=QiL4psn7CLxbbNE01mpkDDghoKs6AsSVx3pFSuA8Klk,6418
48
- odoo_addon_account_statement_import_sheet_file-17.0.1.1.2.dist-info/METADATA,sha256=Wz6MY4gBW3Yf_dRLo8v9O62rT_mZpMww5RhVtilskXs,5465
49
- odoo_addon_account_statement_import_sheet_file-17.0.1.1.2.dist-info/WHEEL,sha256=ZhOvUsYhy81Dx67gN3TV0RchQWBIIzutDZaJODDg2Vo,81
50
- odoo_addon_account_statement_import_sheet_file-17.0.1.1.2.dist-info/top_level.txt,sha256=QE6RBQ0QX5f4eFuUcGgU5Kbq1A_qJcDs-e_vpr6pmfU,4
51
- odoo_addon_account_statement_import_sheet_file-17.0.1.1.2.dist-info/RECORD,,
47
+ odoo/addons/account_statement_import_sheet_file/views/account_statement_import_sheet_mapping.xml,sha256=6tJov8VP3muFCbYv-qnZYNaRKgXntJlmdgPHCe9cSbI,6366
48
+ odoo_addon_account_statement_import_sheet_file-18.0.1.0.0.3.dist-info/METADATA,sha256=wgXC10iSv-KkYePQnvAmbWKN242J_U2YuC2wL4u22Z8,5406
49
+ odoo_addon_account_statement_import_sheet_file-18.0.1.0.0.3.dist-info/WHEEL,sha256=ZhOvUsYhy81Dx67gN3TV0RchQWBIIzutDZaJODDg2Vo,81
50
+ odoo_addon_account_statement_import_sheet_file-18.0.1.0.0.3.dist-info/top_level.txt,sha256=QE6RBQ0QX5f4eFuUcGgU5Kbq1A_qJcDs-e_vpr6pmfU,4
51
+ odoo_addon_account_statement_import_sheet_file-18.0.1.0.0.3.dist-info/RECORD,,