Commit ca5a11db authored by Jérome Perrin's avatar Jérome Perrin

payroll_l10n_fr: pylint

parent ec835d86
portal = context.getPortalObject()
portal_categories = context.portal_categories
rubric_value_dict = {} 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): def formatDate(datetime):
return "%02d%02d%04d" % (datetime.day(), datetime.month(), datetime.year()) return "%02d%02d%04d" % (datetime.day(), datetime.month(), datetime.year())
def formatFloat(number):
return "{:.2f}".format(float(number))
# Bloc Declaration # Bloc Declaration
if block_id == 'S20.G00.05': if block_id == 'S20.G00.05':
...@@ -44,7 +29,6 @@ if block_id == 'S21.G00.06': ...@@ -44,7 +29,6 @@ if block_id == 'S21.G00.06':
# Etablissement # Etablissement
elif block_id == 'S21.G00.11': 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.001'] = target.getCorporateRegistrationCode()[-5:]
rubric_value_dict['S21.G00.11.003'] = target.getDefaultAddressStreetAddress() rubric_value_dict['S21.G00.11.003'] = target.getDefaultAddressStreetAddress()
rubric_value_dict['S21.G00.11.004'] = target.getDefaultAddressZipCode() rubric_value_dict['S21.G00.11.004'] = target.getDefaultAddressZipCode()
......
portal = context.getPortalObject()
portal_categories = context.portal_categories
rubric_value_dict = {} 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): def formatDate(datetime):
return "%02d%02d%04d" % (datetime.day(), datetime.month(), datetime.year()) return "%02d%02d%04d" % (datetime.day(), datetime.month(), datetime.year())
def formatFloat(number):
return "{:.2f}".format(float(number))
# Bloc Declaration # Bloc Declaration
if block_id == 'S20.G00.05': if block_id == 'S20.G00.05':
...@@ -44,7 +29,6 @@ if block_id == 'S21.G00.06': ...@@ -44,7 +29,6 @@ if block_id == 'S21.G00.06':
# Etablissement # Etablissement
elif block_id == 'S21.G00.11': 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.001'] = target.getCorporateRegistrationCode()[-5:]
rubric_value_dict['S21.G00.11.003'] = target.getDefaultAddressStreetAddress() rubric_value_dict['S21.G00.11.003'] = target.getDefaultAddressStreetAddress()
rubric_value_dict['S21.G00.11.004'] = target.getDefaultAddressZipCode() rubric_value_dict['S21.G00.11.004'] = target.getDefaultAddressZipCode()
......
from erp5.component.module.DateUtils import addToDate
from Products.ERP5Type.Message import translateString from Products.ERP5Type.Message import translateString
if context.getSourceAdministration() is None \ if context.getSourceAdministration() is None \
......
portal = context.getPortalObject()
portal_categories = context.portal_categories
rubric_value_dict = {} 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): def formatDate(datetime):
return "%02d%02d%04d" % (datetime.day(), datetime.month(), datetime.year()) return "%02d%02d%04d" % (datetime.day(), datetime.month(), datetime.year())
def formatFloat(number):
return "{:.2f}".format(float(number))
# Declaration # Declaration
if block_id == 'S20.G00.05': if block_id == 'S20.G00.05':
......
portal = context.getPortalObject()
def formatDate(datetime): def formatDate(datetime):
return "%02d%02d%04d" % (datetime.day(), datetime.month(), datetime.year()) 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 # Get the DSN Header and make modifications
is_monthly_dsn = False is_monthly_dsn = False
header_bloc = [] # list of 2-item tuples header_bloc = [] # list of 2-item tuples
header_line_number = 0 header_line_number = 0
header_length = 0 header_length = 0
previous_date = None
previous_order = 0
data = context.getTextContent() data = context.getTextContent()
dsn_file_as_list = data.split('\n') dsn_file_as_list = data.split('\n')
...@@ -28,10 +22,8 @@ for line_number, line in enumerate(dsn_file_as_list): ...@@ -28,10 +22,8 @@ for line_number, line in enumerate(dsn_file_as_list):
if is_monthly_dsn and rubric == 'S20.G00.05.002': if is_monthly_dsn and rubric == 'S20.G00.05.002':
value = "03" value = "03"
elif is_monthly_dsn and rubric == 'S20.G00.05.004': elif is_monthly_dsn and rubric == 'S20.G00.05.004':
previous_order = value
value = "%d" % (int(value) + 1) value = "%d" % (int(value) + 1)
elif is_monthly_dsn and rubric == 'S20.G00.05.007': elif is_monthly_dsn and rubric == 'S20.G00.05.007':
previous_date = value
value = "%s" % formatDate(DateTime()) value = "%s" % formatDate(DateTime())
header_bloc.append((rubric, "'%s'" % value)) header_bloc.append((rubric, "'%s'" % value))
......
from erp5.component.module.DateUtils import addToDate, getIntervalBetweenDates, getNumberOfDayInMonth from erp5.component.module.DateUtils import getIntervalBetweenDates, getNumberOfDayInMonth
import six import six
portal = context.getPortalObject() portal = context.getPortalObject()
......
from erp5.component.module.DateUtils import getNumberOfDayInMonth
portal = context.getPortalObject() portal = context.getPortalObject()
paysheet = portal.accounting_module[paysheet_id] paysheet = portal.accounting_module[paysheet_id]
remuneration_bloc = {}
bonus_result = [] bonus_result = []
result = [] result = []
is_trainee = (True if enrollment_record.getContractType() == '29' else False) is_trainee = (True if enrollment_record.getContractType() == '29' else False)
......
...@@ -4,9 +4,7 @@ from Products.ZSQLCatalog.SQLCatalog import Query ...@@ -4,9 +4,7 @@ from Products.ZSQLCatalog.SQLCatalog import Query
portal = context.getPortalObject() portal = context.getPortalObject()
portal_categories = portal.portal_categories portal_categories = portal.portal_categories
now = DateTime()
effective_date = context.getEffectiveDate() effective_date = context.getEffectiveDate()
previous_pay_day = addToDate(effective_date, month=-1)
# Get period dates # Get period dates
result = portal.portal_catalog(portal_type="DSN Monthly Report", result = portal.portal_catalog(portal_type="DSN Monthly Report",
......
from erp5.component.module.DateUtils import addToDate
portal = context.getPortalObject() portal = context.getPortalObject()
# record base and rate for each ctp for an Establishment # record base and rate for each ctp for an Establishment
...@@ -17,8 +15,6 @@ fillon_relative_min_salary = {} ...@@ -17,8 +15,6 @@ fillon_relative_min_salary = {}
fillon_individual_reduction = {} fillon_individual_reduction = {}
# Social Entity corporate registration code # Social Entity corporate registration code
SOCIAL_ENTITY = '' 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 # 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, 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: ...@@ -139,32 +135,6 @@ for paysheet_id in paysheet_list:
done_ctp_set.update(current_ctp_set) 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): 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" Write a S21.G00.23 bloc for each ctp, helped by a record from the dict "fee_per_ctp_dict"
......
...@@ -244,8 +244,6 @@ for paysheet_id in paysheet_id_list: ...@@ -244,8 +244,6 @@ for paysheet_id in paysheet_id_list:
social_entity=transport_individual_fee[1], social_entity=transport_individual_fee[1],
insee_code=transport_individual_fee[3])) insee_code=transport_individual_fee[3]))
errors = []
# Add leave event DSN if needed # Add leave event DSN if needed
if len(leave_period_dict): if len(leave_period_dict):
for employee in leave_period_dict: for employee in leave_period_dict:
...@@ -268,11 +266,11 @@ if len(leave_period_dict): ...@@ -268,11 +266,11 @@ if len(leave_period_dict):
dsn_file.append(period) dsn_file.append(period)
# Print DSN Record # Print DSN Record
last_block = ''
rubric_counter = 0 rubric_counter = 0
# DEBUG MODE # DEBUG MODE
# # errors = []
# last_block = ''
# def checkformat(rubric, value): # def checkformat(rubric, value):
# rubric_desc = rubric_dict[rubric] # rubric_desc = rubric_dict[rubric]
# if len(str(value)) < rubric_desc.min_length: # if len(str(value)) < rubric_desc.min_length:
......
...@@ -95,9 +95,9 @@ employee_result_list = [ ...@@ -95,9 +95,9 @@ employee_result_list = [
] ]
if len(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: else:
employee_data_list, paysheet_data_list = [], [] _, paysheet_data_list = [], []
insurance_contract_id_list = set() insurance_contract_id_list = set()
for employee_data_dict, paysheet_data_dict in employee_result_list: for employee_data_dict, paysheet_data_dict in employee_result_list:
...@@ -408,11 +408,10 @@ if len(leave_period_dict): ...@@ -408,11 +408,10 @@ if len(leave_period_dict):
# Print DSN Record # Print DSN Record
last_block = ''
rubric_counter = 0 rubric_counter = 0
# DEBUG MODE # DEBUG MODE
# # last_block = ''
# for block in dsn_file: # for block in dsn_file:
# for rubric in sorted(block.keys()): # for rubric in sorted(block.keys()):
# if block[rubric]: # if block[rubric]:
......
portal = context.getPortalObject() portal = context.getPortalObject()
translateString = portal.Base_translateString translateString = portal.Base_translateString
request = context.REQUEST
quantity_renderer = portal.Base_viewFieldLibrary.my_view_mode_money_quantity.render_pdf quantity_renderer = portal.Base_viewFieldLibrary.my_view_mode_money_quantity.render_pdf
paysheet = context paysheet = context
def getFieldAsString(field):
return ', '.join(getFieldAsLineList(field))
def getFieldAsLineList(field): def getFieldAsLineList(field):
"""Returns the text as a list of lines.""" """Returns the text as a list of lines."""
field = field or '' field = field or ''
......
...@@ -31,11 +31,11 @@ for paysheet in paysheet_list: ...@@ -31,11 +31,11 @@ for paysheet in paysheet_list:
start_date=paysheet.getStartDate(), start_date=paysheet.getStartDate(),
stop_date=paysheet.getStopDate()) stop_date=paysheet.getStopDate())
if model is not None: if model is not None:
slice = model.getCell(slice_path) slice_cell = model.getCell(slice_path)
if slice is None: if slice_cell is None:
return 0.0 return 0.0
plafond_max = slice.getQuantityRangeMax() plafond_max = slice_cell.getQuantityRangeMax()
plafond_min = slice.getQuantityRangeMin() plafond_min = slice_cell.getQuantityRangeMin()
yearly_slice_amount += min(salary, plafond_max) - plafond_min yearly_slice_amount += min(salary, plafond_max) - plafond_min
return yearly_slice_amount return yearly_slice_amount
# pylint:disable=redefined-builtin
from Products.ERP5Type.Message import translateString from Products.ERP5Type.Message import translateString
if dialog_id is not None: if dialog_id is not None:
request = container.REQUEST request = container.REQUEST
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment