odoo-addon-account-move-payroll-import 16.0.1.0.2__py2.py3-none-any.whl → 16.0.1.0.3__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.
- odoo/addons/account_move_payroll_import/__manifest__.py +1 -1
- odoo/addons/account_move_payroll_import/models/payroll_import_setup.py +39 -4
- odoo/addons/account_move_payroll_import/utils/parse_utils.py +17 -5
- {odoo_addon_account_move_payroll_import-16.0.1.0.2.dist-info → odoo_addon_account_move_payroll_import-16.0.1.0.3.dist-info}/METADATA +1 -1
- {odoo_addon_account_move_payroll_import-16.0.1.0.2.dist-info → odoo_addon_account_move_payroll_import-16.0.1.0.3.dist-info}/RECORD +7 -7
- {odoo_addon_account_move_payroll_import-16.0.1.0.2.dist-info → odoo_addon_account_move_payroll_import-16.0.1.0.3.dist-info}/WHEEL +0 -0
- {odoo_addon_account_move_payroll_import-16.0.1.0.2.dist-info → odoo_addon_account_move_payroll_import-16.0.1.0.3.dist-info}/top_level.txt +0 -0
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
|
4
4
|
{
|
|
5
5
|
"name": "SomItCoop ODOO accounting spanish payroll import",
|
|
6
|
-
"version": "16.0.1.0.
|
|
6
|
+
"version": "16.0.1.0.3",
|
|
7
7
|
"depends": ["account", "hr", "web", "l10n_es"],
|
|
8
8
|
"author": """
|
|
9
9
|
Som It Cooperatiu SCCL,
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
from odoo import models, fields, api, _, Command
|
|
4
4
|
from odoo.exceptions import UserError
|
|
5
5
|
|
|
6
|
-
from ..utils.parse_utils import abs_float
|
|
6
|
+
from ..utils.parse_utils import abs_float, parse_float
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
# This are the only allowed mappings for the moment
|
|
@@ -18,6 +18,8 @@ ALLOWED_MAPPINGS = [
|
|
|
18
18
|
"payroll_import_mapping_ss_bonus",
|
|
19
19
|
]
|
|
20
20
|
|
|
21
|
+
VALUE_ERROR_MSG = "Invalid value '%s' in column %s."
|
|
22
|
+
|
|
21
23
|
|
|
22
24
|
class PayrollImportSetup(models.Model):
|
|
23
25
|
_name = "payroll.import.setup"
|
|
@@ -394,16 +396,37 @@ class PayrollImportSetup(models.Model):
|
|
|
394
396
|
row[self.column_total_tc1rlc - 1],
|
|
395
397
|
self.thousands_delimiter,
|
|
396
398
|
self.decimal_delimiter,
|
|
399
|
+
context={
|
|
400
|
+
"raise_exception": True,
|
|
401
|
+
"exception_msg": VALUE_ERROR_MSG % (
|
|
402
|
+
row[self.column_total_tc1rlc - 1],
|
|
403
|
+
self.column_total_tc1rlc
|
|
404
|
+
)
|
|
405
|
+
}
|
|
397
406
|
)
|
|
398
407
|
- abs_float(
|
|
399
408
|
row[self.column_ss_employee - 1],
|
|
400
409
|
self.thousands_delimiter,
|
|
401
410
|
self.decimal_delimiter,
|
|
411
|
+
context={
|
|
412
|
+
"raise_exception": True,
|
|
413
|
+
"exception_msg": VALUE_ERROR_MSG % (
|
|
414
|
+
row[self.column_ss_employee - 1],
|
|
415
|
+
self.column_ss_employee
|
|
416
|
+
)
|
|
417
|
+
}
|
|
402
418
|
)
|
|
403
419
|
- abs_float(
|
|
404
420
|
row[self.column_ss_company - 1],
|
|
405
421
|
self.thousands_delimiter,
|
|
406
422
|
self.decimal_delimiter,
|
|
423
|
+
context={
|
|
424
|
+
"raise_exception": True,
|
|
425
|
+
"exception_msg": VALUE_ERROR_MSG % (
|
|
426
|
+
row[self.column_ss_company - 1],
|
|
427
|
+
self.column_ss_company
|
|
428
|
+
)
|
|
429
|
+
}
|
|
407
430
|
)
|
|
408
431
|
)
|
|
409
432
|
return cumulative
|
|
@@ -436,8 +459,10 @@ class PayrollImportSetup(models.Model):
|
|
|
436
459
|
return {}
|
|
437
460
|
|
|
438
461
|
column = getattr(self, line_mapping.column_field, False)
|
|
439
|
-
|
|
440
|
-
|
|
462
|
+
exception_msg = VALUE_ERROR_MSG % (row[column - 1], column)
|
|
463
|
+
value = parse_float(
|
|
464
|
+
row[column - 1], self.thousands_delimiter, self.decimal_delimiter,
|
|
465
|
+
context={"raise_exception": True, "exception_msg": exception_msg}
|
|
441
466
|
)
|
|
442
467
|
|
|
443
468
|
if not value:
|
|
@@ -489,8 +514,10 @@ class PayrollImportSetup(models.Model):
|
|
|
489
514
|
cc_vals_list = []
|
|
490
515
|
for custom_concept in self.custom_concepts_ids:
|
|
491
516
|
column = custom_concept.col_index
|
|
517
|
+
exception_msg = VALUE_ERROR_MSG % (row[column - 1], column)
|
|
492
518
|
value = abs_float(
|
|
493
|
-
row[column - 1], self.thousands_delimiter, self.decimal_delimiter
|
|
519
|
+
row[column - 1], self.thousands_delimiter, self.decimal_delimiter,
|
|
520
|
+
context={"raise_exception": True, "exception_msg": exception_msg}
|
|
494
521
|
)
|
|
495
522
|
|
|
496
523
|
if not value:
|
|
@@ -511,6 +538,14 @@ class PayrollImportSetup(models.Model):
|
|
|
511
538
|
"""
|
|
512
539
|
Create the payroll account move.
|
|
513
540
|
"""
|
|
541
|
+
for vals in lines_vals:
|
|
542
|
+
# credits might be negative in the file
|
|
543
|
+
vals["credit"] = abs(vals.get("credit", 0.0))
|
|
544
|
+
|
|
545
|
+
# debits must be positive so: switch debit/credit if debit is negative
|
|
546
|
+
if vals.get("debit", 0.0) < 0.0:
|
|
547
|
+
vals["credit"] = abs(vals.pop("debit"))
|
|
548
|
+
|
|
514
549
|
move = self.env["account.move"].with_context(
|
|
515
550
|
is_payroll_import=True
|
|
516
551
|
).create(
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
|
+
from odoo.exceptions import UserError
|
|
2
3
|
|
|
3
4
|
|
|
4
|
-
def parse_float(value, thousands_sep=",", decimal_sep="."):
|
|
5
|
+
def parse_float(value, thousands_sep=",", decimal_sep=".", context={}):
|
|
5
6
|
"""
|
|
6
7
|
Parse a float value.
|
|
7
8
|
:param thousands_sep: the thousands separator.
|
|
8
9
|
:param decimal_sep: the decimal separator.
|
|
9
10
|
:param value: the value to parse.
|
|
11
|
+
:param context: the context.
|
|
10
12
|
:return: the parsed float value.
|
|
11
13
|
"""
|
|
12
14
|
if type(value) in (int, float, bool):
|
|
@@ -16,19 +18,29 @@ def parse_float(value, thousands_sep=",", decimal_sep="."):
|
|
|
16
18
|
if not value:
|
|
17
19
|
return 0.0
|
|
18
20
|
|
|
19
|
-
value = value.replace(thousands_sep, "").replace(decimal_sep, ".")
|
|
20
|
-
|
|
21
|
+
value = value.replace(thousands_sep, "", 1).replace(decimal_sep, ".", 1)
|
|
22
|
+
try:
|
|
23
|
+
return float(value)
|
|
24
|
+
except ValueError:
|
|
25
|
+
if context.get("raise_exception", True):
|
|
26
|
+
msg = context.get("exception_msg", "Invalid float value: %s" % value)
|
|
27
|
+
raise UserError(msg)
|
|
28
|
+
return 0.0
|
|
21
29
|
|
|
22
30
|
|
|
23
|
-
def abs_float(value, thousands_sep=",", decimal_sep="."):
|
|
31
|
+
def abs_float(value, thousands_sep=",", decimal_sep=".", context={}):
|
|
24
32
|
"""
|
|
25
33
|
Parse a float value and return its absolute value.
|
|
26
34
|
:param thousands_sep: the thousands separator.
|
|
27
35
|
:param decimal_sep: the decimal separator.
|
|
28
36
|
:param value: the value to parse.
|
|
37
|
+
:param context: the context.
|
|
29
38
|
:return: the absolute value of the parsed float value.
|
|
30
39
|
"""
|
|
31
40
|
try:
|
|
32
41
|
return abs(parse_float(value, thousands_sep, decimal_sep))
|
|
33
42
|
except ValueError:
|
|
34
|
-
|
|
43
|
+
if context.get("raise_exception", True):
|
|
44
|
+
msg = context.get("exception_msg", "Invalid float value: %s" % value)
|
|
45
|
+
raise UserError(msg)
|
|
46
|
+
return 0.0
|
|
@@ -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.
|
|
3
|
+
Version: 16.0.1.0.3
|
|
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,7 +1,7 @@
|
|
|
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=
|
|
4
|
+
odoo/addons/account_move_payroll_import/__manifest__.py,sha256=ZNwrFnlEv-s7-KXZpw3ysYRKTmi3YP1KczQDz5xknWg,1379
|
|
5
5
|
odoo/addons/account_move_payroll_import/data/payroll_import_defaults.xml,sha256=8fnC8Z2ov3ulvcwcaazG5i3DGBzaK5Q0JFhF4dRzn9s,4570
|
|
6
6
|
odoo/addons/account_move_payroll_import/i18n/ca_ES.po,sha256=shnWYO_4x0t4HRM7ajXBT06tIOuEmFch6zXc7wfKybQ,41693
|
|
7
7
|
odoo/addons/account_move_payroll_import/i18n/es.po,sha256=MJslDNYJsRPQRk11u3SB-uH6diHLHQoqa-rqTEqt-cw,41915
|
|
@@ -9,20 +9,20 @@ odoo/addons/account_move_payroll_import/models/__init__.py,sha256=MvOdNmgSVk-29b
|
|
|
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=
|
|
12
|
+
odoo/addons/account_move_payroll_import/models/payroll_import_setup.py,sha256=9LJnoFphJD7-YWUQ9ZiVvS7uZWlNRiIjOk-WRmBKNv0,20488
|
|
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
18
|
odoo/addons/account_move_payroll_import/utils/file_utils.py,sha256=kgf_NfE-HwJlIv6M8aVJFWl7ZHMRGJuCg6cqITXQvOg,615
|
|
19
|
-
odoo/addons/account_move_payroll_import/utils/parse_utils.py,sha256=
|
|
19
|
+
odoo/addons/account_move_payroll_import/utils/parse_utils.py,sha256=z0C9Q14W24tBRfb-j28w1kVnVc7WPXVGHZ8b58g4ziA,1496
|
|
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
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.
|
|
26
|
-
odoo_addon_account_move_payroll_import-16.0.1.0.
|
|
27
|
-
odoo_addon_account_move_payroll_import-16.0.1.0.
|
|
28
|
-
odoo_addon_account_move_payroll_import-16.0.1.0.
|
|
25
|
+
odoo_addon_account_move_payroll_import-16.0.1.0.3.dist-info/METADATA,sha256=Kh-cYP-FgxqMszhcSUW9Fme8LfBBvivoSGMDicE05fQ,3905
|
|
26
|
+
odoo_addon_account_move_payroll_import-16.0.1.0.3.dist-info/WHEEL,sha256=QyeGbh-t8WT0nt0_LNSP02jN-g4ymd1egk1U3osCGMU,110
|
|
27
|
+
odoo_addon_account_move_payroll_import-16.0.1.0.3.dist-info/top_level.txt,sha256=qBj40grFkGOfDZ2WDSw3y1RnDlgG0u8rP8pvGNdbz4w,5
|
|
28
|
+
odoo_addon_account_move_payroll_import-16.0.1.0.3.dist-info/RECORD,,
|
|
File without changes
|