Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Xiaowu Zhang
erp5
Commits
ca5a11db
Commit
ca5a11db
authored
Feb 29, 2024
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
payroll_l10n_fr: pylint
parent
ec835d86
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
14 additions
and
111 deletions
+14
-111
bt5/erp5_payroll_l10n_fr/SkinTemplateItem/portal_skins/erp5_payroll_l10n_fr/DSNEarlyRecoveryReport_getDataDict.py
...rp5_payroll_l10n_fr/DSNEarlyRecoveryReport_getDataDict.py
+0
-16
bt5/erp5_payroll_l10n_fr/SkinTemplateItem/portal_skins/erp5_payroll_l10n_fr/DSNEarlyRecoveryReport_getDataDictPhaseTwo.py
...oll_l10n_fr/DSNEarlyRecoveryReport_getDataDictPhaseTwo.py
+0
-16
bt5/erp5_payroll_l10n_fr/SkinTemplateItem/portal_skins/erp5_payroll_l10n_fr/DSNEarlyRecoveryReport_makeDSNPhaseTwo.py
...payroll_l10n_fr/DSNEarlyRecoveryReport_makeDSNPhaseTwo.py
+0
-1
bt5/erp5_payroll_l10n_fr/SkinTemplateItem/portal_skins/erp5_payroll_l10n_fr/DSNEndOfContractReport_getDataDict.py
...rp5_payroll_l10n_fr/DSNEndOfContractReport_getDataDict.py
+0
-15
bt5/erp5_payroll_l10n_fr/SkinTemplateItem/portal_skins/erp5_payroll_l10n_fr/DSNMonthlyReport_createReplacement.py
...rp5_payroll_l10n_fr/DSNMonthlyReport_createReplacement.py
+0
-8
bt5/erp5_payroll_l10n_fr/SkinTemplateItem/portal_skins/erp5_payroll_l10n_fr/DSNMonthlyReport_getDataDict.py
...kins/erp5_payroll_l10n_fr/DSNMonthlyReport_getDataDict.py
+2
-2
bt5/erp5_payroll_l10n_fr/SkinTemplateItem/portal_skins/erp5_payroll_l10n_fr/DSNMonthlyReport_getDataDictPhaseTwo.py
...5_payroll_l10n_fr/DSNMonthlyReport_getDataDictPhaseTwo.py
+1
-1
bt5/erp5_payroll_l10n_fr/SkinTemplateItem/portal_skins/erp5_payroll_l10n_fr/DSNMonthlyReport_getEmployeeRemunerationList.py
...l_l10n_fr/DSNMonthlyReport_getEmployeeRemunerationList.py
+0
-3
bt5/erp5_payroll_l10n_fr/SkinTemplateItem/portal_skins/erp5_payroll_l10n_fr/DSNMonthlyReport_getLeavePeriodDict.py
...p5_payroll_l10n_fr/DSNMonthlyReport_getLeavePeriodDict.py
+0
-2
bt5/erp5_payroll_l10n_fr/SkinTemplateItem/portal_skins/erp5_payroll_l10n_fr/DSNMonthlyReport_getSocialContributionDict.py
...oll_l10n_fr/DSNMonthlyReport_getSocialContributionDict.py
+0
-30
bt5/erp5_payroll_l10n_fr/SkinTemplateItem/portal_skins/erp5_payroll_l10n_fr/DSNMonthlyReport_makeDSNPhaseTwo.py
.../erp5_payroll_l10n_fr/DSNMonthlyReport_makeDSNPhaseTwo.py
+2
-4
bt5/erp5_payroll_l10n_fr/SkinTemplateItem/portal_skins/erp5_payroll_l10n_fr/DSNMonthlyReport_makeReport.py
...skins/erp5_payroll_l10n_fr/DSNMonthlyReport_makeReport.py
+4
-5
bt5/erp5_payroll_l10n_fr/SkinTemplateItem/portal_skins/erp5_payroll_l10n_fr/PaySheetTransaction_getOtherInformationsDataDict.py
...0n_fr/PaySheetTransaction_getOtherInformationsDataDict.py
+0
-4
bt5/erp5_payroll_l10n_fr/SkinTemplateItem/portal_skins/erp5_payroll_l10n_fr/PaySheetTransaction_getYearToDateSlice.py
...payroll_l10n_fr/PaySheetTransaction_getYearToDateSlice.py
+4
-4
bt5/erp5_payroll_l10n_fr/SkinTemplateItem/portal_skins/erp5_payroll_l10n_fr/PaySheetTransaction_updatePayslipReportDialog.py
..._l10n_fr/PaySheetTransaction_updatePayslipReportDialog.py
+1
-0
No files found.
bt5/erp5_payroll_l10n_fr/SkinTemplateItem/portal_skins/erp5_payroll_l10n_fr/DSNEarlyRecoveryReport_getDataDict.py
View file @
ca5a11db
portal
=
context
.
getPortalObject
()
portal_categories
=
context
.
portal_categories
rubric_value_dict
=
{}
france_territory_code
=
(
'FR'
,
'GP'
,
'BL'
,
'MF'
,
'MQ'
,
'GF'
,
'RE'
,
'PM'
,
'YT'
,
'WF'
,
'PF'
,
'NC'
,
'MC'
)
def
getCountryCode
(
target
):
region
=
portal_categories
.
getCategoryValue
(
target
.
getDefaultAddressRegion
(),
base_category
=
"region"
)
if
region
is
None
:
raise
ValueError
(
"Country should be defined in address field of %s"
%
target
.
getRelativeUrl
())
codification
=
region
.
getCodification
()
if
codification
is
None
:
raise
ValueError
(
"Region %s doesn't have codification"
%
region
.
getRelativeUrl
())
return
codification
def
formatDate
(
datetime
):
return
"%02d%02d%04d"
%
(
datetime
.
day
(),
datetime
.
month
(),
datetime
.
year
())
def
formatFloat
(
number
):
return
"{:.2f}"
.
format
(
float
(
number
))
# Bloc Declaration
if
block_id
==
'S20.G00.05'
:
...
...
@@ -44,7 +29,6 @@ if block_id == 'S21.G00.06':
# Etablissement
elif
block_id
==
'S21.G00.11'
:
establishment_country_code
=
getCountryCode
(
target
)
rubric_value_dict
[
'S21.G00.11.001'
]
=
target
.
getCorporateRegistrationCode
()[
-
5
:]
rubric_value_dict
[
'S21.G00.11.003'
]
=
target
.
getDefaultAddressStreetAddress
()
rubric_value_dict
[
'S21.G00.11.004'
]
=
target
.
getDefaultAddressZipCode
()
...
...
bt5/erp5_payroll_l10n_fr/SkinTemplateItem/portal_skins/erp5_payroll_l10n_fr/DSNEarlyRecoveryReport_getDataDictPhaseTwo.py
View file @
ca5a11db
portal
=
context
.
getPortalObject
()
portal_categories
=
context
.
portal_categories
rubric_value_dict
=
{}
france_territory_code
=
(
'FR'
,
'GP'
,
'BL'
,
'MF'
,
'MQ'
,
'GF'
,
'RE'
,
'PM'
,
'YT'
,
'WF'
,
'PF'
,
'NC'
,
'MC'
)
def
getCountryCode
(
target
):
region
=
portal_categories
.
getCategoryValue
(
target
.
getDefaultAddressRegion
(),
base_category
=
"region"
)
if
region
is
None
:
raise
ValueError
(
"Country should be defined in address field of %s"
%
target
.
getRelativeUrl
())
codification
=
region
.
getCodification
()
if
codification
is
None
:
raise
ValueError
(
"Region %s doesn't have codification"
%
region
.
getRelativeUrl
())
return
codification
def
formatDate
(
datetime
):
return
"%02d%02d%04d"
%
(
datetime
.
day
(),
datetime
.
month
(),
datetime
.
year
())
def
formatFloat
(
number
):
return
"{:.2f}"
.
format
(
float
(
number
))
# Bloc Declaration
if
block_id
==
'S20.G00.05'
:
...
...
@@ -44,7 +29,6 @@ if block_id == 'S21.G00.06':
# Etablissement
elif
block_id
==
'S21.G00.11'
:
establishment_country_code
=
getCountryCode
(
target
)
rubric_value_dict
[
'S21.G00.11.001'
]
=
target
.
getCorporateRegistrationCode
()[
-
5
:]
rubric_value_dict
[
'S21.G00.11.003'
]
=
target
.
getDefaultAddressStreetAddress
()
rubric_value_dict
[
'S21.G00.11.004'
]
=
target
.
getDefaultAddressZipCode
()
...
...
bt5/erp5_payroll_l10n_fr/SkinTemplateItem/portal_skins/erp5_payroll_l10n_fr/DSNEarlyRecoveryReport_makeDSNPhaseTwo.py
View file @
ca5a11db
from
erp5.component.module.DateUtils
import
addToDate
from
Products.ERP5Type.Message
import
translateString
if
context
.
getSourceAdministration
()
is
None
\
...
...
bt5/erp5_payroll_l10n_fr/SkinTemplateItem/portal_skins/erp5_payroll_l10n_fr/DSNEndOfContractReport_getDataDict.py
View file @
ca5a11db
portal
=
context
.
getPortalObject
()
portal_categories
=
context
.
portal_categories
rubric_value_dict
=
{}
france_territory_code
=
(
'FR'
,
'GP'
,
'BL'
,
'MF'
,
'MQ'
,
'GF'
,
'RE'
,
'PM'
,
'YT'
,
'WF'
,
'PF'
,
'NC'
,
'MC'
)
def
getCountryCode
(
target
):
region
=
portal_categories
.
getCategoryValue
(
target
.
getDefaultAddressRegion
(),
base_category
=
"region"
)
if
region
is
None
:
raise
ValueError
(
"Country should be defined in address field of %s"
%
target
.
getRelativeUrl
())
codification
=
region
.
getCodification
()
if
codification
is
None
:
raise
ValueError
(
"Region %s doesn't have codification"
%
region
.
getRelativeUrl
())
return
codification
def
formatDate
(
datetime
):
return
"%02d%02d%04d"
%
(
datetime
.
day
(),
datetime
.
month
(),
datetime
.
year
())
def
formatFloat
(
number
):
return
"{:.2f}"
.
format
(
float
(
number
))
# Declaration
if
block_id
==
'S20.G00.05'
:
...
...
bt5/erp5_payroll_l10n_fr/SkinTemplateItem/portal_skins/erp5_payroll_l10n_fr/DSNMonthlyReport_createReplacement.py
View file @
ca5a11db
portal
=
context
.
getPortalObject
()
def
formatDate
(
datetime
):
return
"%02d%02d%04d"
%
(
datetime
.
day
(),
datetime
.
month
(),
datetime
.
year
())
def
formatFloat
(
number
):
return
"{:.02f}"
.
format
(
float
(
number
))
# Get the DSN Header and make modifications
is_monthly_dsn
=
False
header_bloc
=
[]
# list of 2-item tuples
header_line_number
=
0
header_length
=
0
previous_date
=
None
previous_order
=
0
data
=
context
.
getTextContent
()
dsn_file_as_list
=
data
.
split
(
'
\
n
'
)
...
...
@@ -28,10 +22,8 @@ for line_number, line in enumerate(dsn_file_as_list):
if
is_monthly_dsn
and
rubric
==
'S20.G00.05.002'
:
value
=
"03"
elif
is_monthly_dsn
and
rubric
==
'S20.G00.05.004'
:
previous_order
=
value
value
=
"%d"
%
(
int
(
value
)
+
1
)
elif
is_monthly_dsn
and
rubric
==
'S20.G00.05.007'
:
previous_date
=
value
value
=
"%s"
%
formatDate
(
DateTime
())
header_bloc
.
append
((
rubric
,
"'%s'"
%
value
))
...
...
bt5/erp5_payroll_l10n_fr/SkinTemplateItem/portal_skins/erp5_payroll_l10n_fr/DSNMonthlyReport_getDataDict.py
View file @
ca5a11db
from
erp5.component.module.DateUtils
import
addToDate
,
getIntervalBetweenDates
,
getNumberOfDayInMonth
from
erp5.component.module.DateUtils
import
getIntervalBetweenDates
,
getNumberOfDayInMonth
import
six
portal
=
context
.
getPortalObject
()
...
...
@@ -164,7 +164,7 @@ elif block_id == 'S21.G00.11':
if
block_id
==
'S21.G00.15'
:
# XXX: Hack as some organisations may have several contracts
return
[
return
[
{
'S21.G00.15.001'
:
'REF_CONTRACT1'
,
'S21.G00.15.002'
:
'ORGANISATION1'
,
...
...
bt5/erp5_payroll_l10n_fr/SkinTemplateItem/portal_skins/erp5_payroll_l10n_fr/DSNMonthlyReport_getDataDictPhaseTwo.py
View file @
ca5a11db
...
...
@@ -266,7 +266,7 @@ if block_id == 'S21.G00.70':
start_date
=
enrollment_record
.
getCareerStartDate
()
if
start_date
.
year
()
==
context
.
getEffectiveDate
().
year
()
\
and
start_date
.
month
()
==
context
.
getEffectiveDate
().
month
():
just_hired
=
True
just_hired
=
True
else
:
just_hired
=
False
rubric_value_dict
[
'S21.G00.70.001'
]
=
'ReferenceAdhesionPSC'
...
...
bt5/erp5_payroll_l10n_fr/SkinTemplateItem/portal_skins/erp5_payroll_l10n_fr/DSNMonthlyReport_getEmployeeRemunerationList.py
View file @
ca5a11db
from
erp5.component.module.DateUtils
import
getNumberOfDayInMonth
portal
=
context
.
getPortalObject
()
paysheet
=
portal
.
accounting_module
[
paysheet_id
]
remuneration_bloc
=
{}
bonus_result
=
[]
result
=
[]
is_trainee
=
(
True
if
enrollment_record
.
getContractType
()
==
'29'
else
False
)
...
...
bt5/erp5_payroll_l10n_fr/SkinTemplateItem/portal_skins/erp5_payroll_l10n_fr/DSNMonthlyReport_getLeavePeriodDict.py
View file @
ca5a11db
...
...
@@ -4,9 +4,7 @@ from Products.ZSQLCatalog.SQLCatalog import Query
portal
=
context
.
getPortalObject
()
portal_categories
=
portal
.
portal_categories
now
=
DateTime
()
effective_date
=
context
.
getEffectiveDate
()
previous_pay_day
=
addToDate
(
effective_date
,
month
=-
1
)
# Get period dates
result
=
portal
.
portal_catalog
(
portal_type
=
"DSN Monthly Report"
,
...
...
bt5/erp5_payroll_l10n_fr/SkinTemplateItem/portal_skins/erp5_payroll_l10n_fr/DSNMonthlyReport_getSocialContributionDict.py
View file @
ca5a11db
from
erp5.component.module.DateUtils
import
addToDate
portal
=
context
.
getPortalObject
()
# record base and rate for each ctp for an Establishment
...
...
@@ -17,8 +15,6 @@ fillon_relative_min_salary = {}
fillon_individual_reduction
=
{}
# Social Entity corporate registration code
SOCIAL_ENTITY
=
''
# establishment paysheets belong to
current_establishement_code
=
portal
.
accounting_module
[
paysheet_list
[
0
]].
getDestinationSectionValue
().
getCorporateRegistrationCode
()[
-
5
:]
# Rate to apply to bases to calculate the final amount of fees
standard_rate_mapping
=
{
'012D'
:
0.28
,
'027D'
:
0.00016
,
'100D'
:
0.1954
,
'100P'
:
0.1545
,
...
...
@@ -139,32 +135,6 @@ for paysheet_id in paysheet_list:
done_ctp_set
.
update
(
current_ctp_set
)
def
getFeeFromDate
(
ctp_code
,
date
):
'''
Return a list of the previous contributions for
a specific CTP code in the older DSN
'''
amount_list
=
[]
aggregated_fee_list
=
context
.
DSNReport_getGroupedOlderValues
(
searched_bloc
=
'S21.G00.23'
,
grouping_rubric
=
'S21.G00.11.001'
,
from_date
=
date
)
for
dsn_record
in
aggregated_fee_list
:
for
establishment
in
aggregated_fee_list
[
dsn_record
].
keys
():
if
establishment
!=
current_establishement_code
:
continue
for
bloc
in
aggregated_fee_list
[
dsn_record
][
establishment
]:
bloc_found
=
0
for
rubric
,
value
in
bloc
:
value
=
value
.
strip
(
'
\
'
'
)
if
rubric
==
'S21.G00.23.001'
and
value
==
ctp_code
:
bloc_found
=
1
if
rubric
==
'S21.G00.23.001'
and
value
!=
ctp_code
:
bloc_found
=
0
if
bloc_found
and
rubric
==
'S21.G00.23.004'
:
amount_list
.
append
(
float
(
value
))
return
(
amount_list
if
len
(
amount_list
)
>
0
else
[
0
])
def
getFeeBlocAsDict
(
ctp
,
ctp_dict
):
""""
Write a S21.G00.23 bloc for each ctp, helped by a record from the dict "fee_per_ctp_dict"
...
...
bt5/erp5_payroll_l10n_fr/SkinTemplateItem/portal_skins/erp5_payroll_l10n_fr/DSNMonthlyReport_makeDSNPhaseTwo.py
View file @
ca5a11db
...
...
@@ -244,8 +244,6 @@ for paysheet_id in paysheet_id_list:
social_entity
=
transport_individual_fee
[
1
],
insee_code
=
transport_individual_fee
[
3
]))
errors
=
[]
# Add leave event DSN if needed
if
len
(
leave_period_dict
):
for
employee
in
leave_period_dict
:
...
...
@@ -268,11 +266,11 @@ if len(leave_period_dict):
dsn_file
.
append
(
period
)
# Print DSN Record
last_block
=
''
rubric_counter
=
0
# DEBUG MODE
#
# errors = []
# last_block = ''
# def checkformat(rubric, value):
# rubric_desc = rubric_dict[rubric]
# if len(str(value)) < rubric_desc.min_length:
...
...
bt5/erp5_payroll_l10n_fr/SkinTemplateItem/portal_skins/erp5_payroll_l10n_fr/DSNMonthlyReport_makeReport.py
View file @
ca5a11db
...
...
@@ -95,9 +95,9 @@ employee_result_list = [
]
if
len
(
employee_result_list
):
employee_data_list
,
paysheet_data_list
=
zip
(
*
employee_result_list
)
_
,
paysheet_data_list
=
zip
(
*
employee_result_list
)
else
:
employee_data_list
,
paysheet_data_list
=
[],
[]
_
,
paysheet_data_list
=
[],
[]
insurance_contract_id_list
=
set
()
for
employee_data_dict
,
paysheet_data_dict
in
employee_result_list
:
...
...
@@ -408,11 +408,10 @@ if len(leave_period_dict):
# Print DSN Record
last_block
=
''
rubric_counter
=
0
# DEBUG MODE
#
#
last_block = ''
# for block in dsn_file:
# for rubric in sorted(block.keys()):
# if block[rubric]:
...
...
@@ -446,4 +445,4 @@ if batch_mode:
return
context
.
Base_redirect
(
form_id
,
keep_items
=
{
'portal_status_message'
:
translateString
(
"Monthly DSN Record Created."
),
'portal_status_level'
:
'success'
,
})
\ No newline at end of file
})
bt5/erp5_payroll_l10n_fr/SkinTemplateItem/portal_skins/erp5_payroll_l10n_fr/PaySheetTransaction_getOtherInformationsDataDict.py
View file @
ca5a11db
portal
=
context
.
getPortalObject
()
translateString
=
portal
.
Base_translateString
request
=
context
.
REQUEST
quantity_renderer
=
portal
.
Base_viewFieldLibrary
.
my_view_mode_money_quantity
.
render_pdf
paysheet
=
context
def
getFieldAsString
(
field
):
return
', '
.
join
(
getFieldAsLineList
(
field
))
def
getFieldAsLineList
(
field
):
"""Returns the text as a list of lines."""
field
=
field
or
''
...
...
bt5/erp5_payroll_l10n_fr/SkinTemplateItem/portal_skins/erp5_payroll_l10n_fr/PaySheetTransaction_getYearToDateSlice.py
View file @
ca5a11db
...
...
@@ -31,11 +31,11 @@ for paysheet in paysheet_list:
start_date
=
paysheet
.
getStartDate
(),
stop_date
=
paysheet
.
getStopDate
())
if
model
is
not
None
:
slice
=
model
.
getCell
(
slice_path
)
if
slice
is
None
:
slice
_cell
=
model
.
getCell
(
slice_path
)
if
slice
_cell
is
None
:
return
0.0
plafond_max
=
slice
.
getQuantityRangeMax
()
plafond_min
=
slice
.
getQuantityRangeMin
()
plafond_max
=
slice
_cell
.
getQuantityRangeMax
()
plafond_min
=
slice
_cell
.
getQuantityRangeMin
()
yearly_slice_amount
+=
min
(
salary
,
plafond_max
)
-
plafond_min
return
yearly_slice_amount
bt5/erp5_payroll_l10n_fr/SkinTemplateItem/portal_skins/erp5_payroll_l10n_fr/PaySheetTransaction_updatePayslipReportDialog.py
View file @
ca5a11db
# pylint:disable=redefined-builtin
from
Products.ERP5Type.Message
import
translateString
if
dialog_id
is
not
None
:
request
=
container
.
REQUEST
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment