odoo-addon-account-move-payroll-import 16.0.1.0.1__py2.py3-none-any.whl → 16.0.1.0.2__py2.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.
@@ -338,9 +338,51 @@ class PayrollImportSetup(models.Model):
338
338
  }
339
339
 
340
340
  def validate_column_numbers(self, data_length):
341
+ def validate_indexes(names):
342
+ repeated_indexes = [
343
+ k for k, v in names.items() if list(names.values()).count(v) > 1
344
+ ]
345
+ if repeated_indexes:
346
+ raise UserError(
347
+ _(
348
+ "%s indexes are repeated. Please review your setup."
349
+ % (", ".join(repeated_indexes))
350
+ )
351
+ )
352
+
353
+ for name, idx in names.items():
354
+ if idx < 1:
355
+ raise UserError(
356
+ _(
357
+ "Column index for %s must be greater than or equal to 1."
358
+ % name
359
+ )
360
+ )
361
+ if idx > data_length:
362
+ raise UserError(
363
+ _(
364
+ "Column index for %s must be less or equal than %s."
365
+ % (name, data_length)
366
+ )
367
+ )
368
+
369
+ names = {}
341
370
  for field in [k for k in self._fields.keys() if k.startswith("column_")]:
342
- if getattr(self, field) > data_length:
343
- raise UserError(_("Column %s is out of range." % field))
371
+ index = getattr(self, field)
372
+ name = self.env["ir.model.fields"].search(
373
+ [("model", "=", self._name), ("name", "=", field)],
374
+ limit=1,
375
+ ).field_description
376
+ names[name] = index
377
+
378
+ for custom_concept in self.custom_concepts_ids:
379
+ index = custom_concept.col_index
380
+ name = custom_concept.name
381
+ names[name] = index
382
+
383
+ validate_indexes(names)
384
+
385
+ return True
344
386
 
345
387
  def compute_tc1rlc_ss_cumulative(self, row, cumulative):
346
388
  """
@@ -10,7 +10,8 @@ def get_file_extension(file_name):
10
10
  Get the file extension from the file name.
11
11
  """
12
12
  if file_name:
13
- return os.path.splitext(file_name)[-1]
13
+ ext = os.path.splitext(file_name)[-1]
14
+ return str(ext).lower() if ext else False
14
15
  return False
15
16
 
16
17
 
@@ -290,6 +290,8 @@ class AccountPayrollImportWizard(models.TransientModel):
290
290
  rows, cumulative_tc1rlc_ss = [], 0.0
291
291
  skip_lines = options.get("header_lines", 1) - 1
292
292
  for idx, row in enumerate(getattr(self, f"_read_{extension}")(options)):
293
+ if idx == 0:
294
+ import_setup.validate_column_numbers(len(row))
293
295
  if idx == import_setup.header_ref_line - 1:
294
296
  self.account_move_ref = row[0].strip() or import_setup.name
295
297
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: odoo-addon-account-move-payroll-import
3
- Version: 16.0.1.0.1
3
+ Version: 16.0.1.0.2
4
4
  Summary: ODOO account move spanish payroll data import for social cooperatives.
5
5
  Home-page: https://gitlab.com/somitcoop/erp-research/odoo-accounting
6
6
  Author: Som It Cooperatiu SCCL, Som Connexió SCCL
@@ -1,28 +1,28 @@
1
1
  odoo/addons/account_move_payroll_import/CHANGELOG.md,sha256=COE0An9jnvIrV7eWgGSa6XzTGN8tACjr_LkFmjRbqos,608
2
2
  odoo/addons/account_move_payroll_import/README.rst,sha256=fnLmb6E5pLv2d-kzAVwIs2O1QKyApMwCobkT9nUgXbo,3354
3
3
  odoo/addons/account_move_payroll_import/__init__.py,sha256=xdfbExIUANT_2sXVtonxwfOse1Cqvz2AVNntyx_lINE,68
4
- odoo/addons/account_move_payroll_import/__manifest__.py,sha256=8Tl6Ba4ENLvLvnqQc0Z4p4xZm0LvxYVjBFPG6dWfRUc,1379
4
+ odoo/addons/account_move_payroll_import/__manifest__.py,sha256=kX0bjjK13GFQaPtzrlk9ibJSc5gzHuOIX8F9Lps5cP4,1379
5
5
  odoo/addons/account_move_payroll_import/data/payroll_import_defaults.xml,sha256=8fnC8Z2ov3ulvcwcaazG5i3DGBzaK5Q0JFhF4dRzn9s,4570
6
- odoo/addons/account_move_payroll_import/i18n/ca_ES.po,sha256=8ucDStleOanDEsdBK1IFKGsbwWjrQ6_-YUCICN3TGaI,38186
7
- odoo/addons/account_move_payroll_import/i18n/es.po,sha256=grQjubV3lz29tHlLtRyUjSF6NrmHyDRRUGo1V7poTpw,38369
6
+ odoo/addons/account_move_payroll_import/i18n/ca_ES.po,sha256=shnWYO_4x0t4HRM7ajXBT06tIOuEmFch6zXc7wfKybQ,41693
7
+ odoo/addons/account_move_payroll_import/i18n/es.po,sha256=MJslDNYJsRPQRk11u3SB-uH6diHLHQoqa-rqTEqt-cw,41915
8
8
  odoo/addons/account_move_payroll_import/models/__init__.py,sha256=MvOdNmgSVk-29bpZZRt415YrRUGryuSE7gpIzoRqw5c,161
9
9
  odoo/addons/account_move_payroll_import/models/account_move.py,sha256=8T-DNpKHc_e4r18NSx8Bh2xFQB4DlLI69ImxmghXJU8,6031
10
10
  odoo/addons/account_move_payroll_import/models/payroll_custom_concept.py,sha256=m8Wl_xFsWCwOqLJWwBFTmtA669rqIg0mIvGNqDtBnfw,2003
11
11
  odoo/addons/account_move_payroll_import/models/payroll_import_mapping.py,sha256=ARiif1H0CMs17n-0SW563Jv9jA1ta3nhCtq9l4vVbHA,943
12
- odoo/addons/account_move_payroll_import/models/payroll_import_setup.py,sha256=WHT3A4jy6Ba-8i_A6Voddpxa8Dk4BXJJdaYJpBZFDAI,17577
12
+ odoo/addons/account_move_payroll_import/models/payroll_import_setup.py,sha256=_kSbc1HtLHE03-tNZpoSyKJTLYankJcO-DLAh36bYQM,18967
13
13
  odoo/addons/account_move_payroll_import/security/ir.model.access.csv,sha256=YI4EAYd35NkiQvd1URS3Ex_zV3GVuI1-T-thl9mlCrU,536
14
14
  odoo/addons/account_move_payroll_import/static/src/css/styles.css,sha256=JK4NBJ_TIy-sWYIGa5nRlZh-KH1OKr1eBzCYx7pJjyI,522
15
15
  odoo/addons/account_move_payroll_import/static/src/js/payroll_import_button.js,sha256=cK9eHxA9jCSGr0HuZFV5Gvy8WWXe8iwNSDV4bYpJEFc,844
16
16
  odoo/addons/account_move_payroll_import/static/src/xml/payroll_import_templates.xml,sha256=HKgIpLA1aN9JruR-W3yKb5MEFezCGurxJAG1sOhDlQ0,731
17
17
  odoo/addons/account_move_payroll_import/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
- odoo/addons/account_move_payroll_import/utils/file_utils.py,sha256=ngbyD5Z9kdJ4nSiuI2jxuuTUTuy9ZrLrXEVjrXVyJpI,566
18
+ odoo/addons/account_move_payroll_import/utils/file_utils.py,sha256=kgf_NfE-HwJlIv6M8aVJFWl7ZHMRGJuCg6cqITXQvOg,615
19
19
  odoo/addons/account_move_payroll_import/utils/parse_utils.py,sha256=G5Crc1A0NzMtD6zSZOl2PVrgMMOfTOZNR2y0Mh9u3FM,1020
20
20
  odoo/addons/account_move_payroll_import/views/assets_template.xml,sha256=SMV2_61cbZG_IjIlsBEiYVLVAb4VmoBRYSsiljou1jU,544
21
21
  odoo/addons/account_move_payroll_import/views/payroll_import_views.xml,sha256=r4PrdTU7MY_KZMJFIcOgms9IaCPv2sirJagnlVWUotI,10386
22
22
  odoo/addons/account_move_payroll_import/wizards/__init__.py,sha256=ZJP90LnlsKPOz5hOqllzpC8O0__7WcIiH6FauPHav_w,60
23
- odoo/addons/account_move_payroll_import/wizards/payroll_import_wizard.py,sha256=gdOBxLPhEmZ2GnUi2rTz5JBfCWk1gy53cFM3Mx8kGCg,12340
23
+ odoo/addons/account_move_payroll_import/wizards/payroll_import_wizard.py,sha256=bJjuYMjc_kSspxWld8xw6nMvE-JgwDRurYBjEzZ9zoE,12428
24
24
  odoo/addons/account_move_payroll_import/wizards/payroll_import_wizard.xml,sha256=p7ewpc4WKDMdJ3a5DGYLtyX8bYDZWHqUrZ42XKzW868,1926
25
- odoo_addon_account_move_payroll_import-16.0.1.0.1.dist-info/METADATA,sha256=uqfPwlUPPXRpa289NBaW--5RmVg0MdDZ9DlPwY9Wqss,3905
26
- odoo_addon_account_move_payroll_import-16.0.1.0.1.dist-info/WHEEL,sha256=QyeGbh-t8WT0nt0_LNSP02jN-g4ymd1egk1U3osCGMU,110
27
- odoo_addon_account_move_payroll_import-16.0.1.0.1.dist-info/top_level.txt,sha256=qBj40grFkGOfDZ2WDSw3y1RnDlgG0u8rP8pvGNdbz4w,5
28
- odoo_addon_account_move_payroll_import-16.0.1.0.1.dist-info/RECORD,,
25
+ odoo_addon_account_move_payroll_import-16.0.1.0.2.dist-info/METADATA,sha256=_psgw__Go9wG65j8ogrE-EjGE5yY552mcmdL39K5Kjs,3905
26
+ odoo_addon_account_move_payroll_import-16.0.1.0.2.dist-info/WHEEL,sha256=QyeGbh-t8WT0nt0_LNSP02jN-g4ymd1egk1U3osCGMU,110
27
+ odoo_addon_account_move_payroll_import-16.0.1.0.2.dist-info/top_level.txt,sha256=qBj40grFkGOfDZ2WDSw3y1RnDlgG0u8rP8pvGNdbz4w,5
28
+ odoo_addon_account_move_payroll_import-16.0.1.0.2.dist-info/RECORD,,