Commit 9fce83e0 authored by Xiaowu Zhang's avatar Xiaowu Zhang

erp5_payroll_l10n_fr: get correct address accroding to date

parent 0378c29a
<tal:block tal:define="data_dict here/PaySheetTransaction_getODTDataDict;
other_data_dict here/PaySheetTransaction_getOtherInformationsDataDict;
address here/PaySheetTransaction_getAddressAccordingToDate;
language python: options.get('language');
date_renderer nocall:here/Base_viewFieldLibrary/my_date_time_field/render_pdf;
">
......@@ -20,8 +21,8 @@
</div>
<div class="payslip-header-employee">
<span class='payslip-report-emphasis' tal:content='python:data_dict["source_section_title"].upper()'>source_section</span>
<tal:block tal:condition="data_dict/source_section_address"
tal:define="address_list python: data_dict['source_section_address'].split('\n');">
<tal:block tal:condition="python: address"
tal:define="address_list python: address.split('\n');">
<tal:block tal:repeat="line address_list">
<span tal:content='line'></span>
</tal:block>
......
address_dict = {
'street_address':'',
'zip_code':'',
'city':''
}
stop_date = context.getStopDate()
person = context.getSourceSectionValue()
if person:
if stop_date.isCurrentMonth():
return person.getDefaultAddressText()
default_address = person.getDefaultAddress()
if default_address:
for dict_ in default_address.Base_getZODBChangeHistoryList(default_address, size=100):
if stop_date > dict_['datetime']:
for key in address_dict:
if key in dict_['changes']:
address_dict[key]=dict_['changes'][key]
zip_code_city = []
if address_dict['zip_code']:
zip_code_city.append(address_dict['zip_code'])
if address_dict['city']:
zip_code_city.append(address_dict['city'])
return '\n'.join([address_dict['street_address'] or '', ' '.join(zip_code_city)])
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>PaySheetTransaction_getAddressAccordingToDate</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
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