Commit cff9daa3 authored by Rafael Monnerat's avatar Rafael Monnerat

erp5_maileva_connector: Use script to not hardcore dependence

   Otherwise, erp5_payroll_l10n_fr would be a direct dependent of this service, which is not what we want.

   It also allows implement other kind of document sending w/o hardcode the core or overwriting too much.
parent 17a05db9
...@@ -6,12 +6,33 @@ ...@@ -6,12 +6,33 @@
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item>
<key> <string>_local_properties</string> </key>
<value>
<tuple>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>business_template_skin_layer_priority</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>string</string> </value>
</item>
</dictionary>
</tuple>
</value>
</item>
<item> <item>
<key> <string>_objects</string> </key> <key> <string>_objects</string> </key>
<value> <value>
<tuple/> <tuple/>
</value> </value>
</item> </item>
<item>
<key> <string>business_template_skin_layer_priority</string> </key>
<value> <string>50.5</string> </value>
</item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>erp5_maileva_connector</string> </value> <value> <string>erp5_maileva_connector</string> </value>
......
"""
Consider always enabled, and let the projects define the logic
to enable/disable this feature by overwriting this script.
"""
return True
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="_reconstructor" module="copy_reg"/>
</klass>
<tuple>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
<global name="object" module="__builtin__"/>
<none/>
</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>id</string> </key>
<value> <string>Base_isMailevaEnabled</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
erp5_maileva_connector | 50.5
\ No newline at end of file
""" This script should be overwrited by erp5_maileva_connector
business template.
"""
return False
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="_reconstructor" module="copy_reg"/>
</klass>
<tuple>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
<global name="object" module="__builtin__"/>
<none/>
</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>id</string> </key>
<value> <string>Base_isMailevaEnabled</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -12,7 +12,7 @@ Wire PaySheetTransaction through to erp5_corporate_identity Report ...@@ -12,7 +12,7 @@ Wire PaySheetTransaction through to erp5_corporate_identity Report
# international_form translate terms # international_form translate terms
# language target_language # language target_language
kw['format'] =format kw['format'] = format
kw['report_header'] = "PaySheetTransaction_generatePayslipReportHeader" kw['report_header'] = "PaySheetTransaction_generatePayslipReportHeader"
kw['report_name'] = "PaySheetTransaction_generatePayslipReport" kw['report_name'] = "PaySheetTransaction_generatePayslipReport"
kw['report_footer'] = "PaySheetTransaction_generatePayslipReportFooter" kw['report_footer'] = "PaySheetTransaction_generatePayslipReportFooter"
...@@ -20,19 +20,26 @@ kw['conversion_dict'] = dict( ...@@ -20,19 +20,26 @@ kw['conversion_dict'] = dict(
margin_top=60, margin_top=60,
header_spacing=5 header_spacing=5
) )
kw['css_path']="payslip_css/payslip" kw['css_path'] = "payslip_css/payslip"
kw['document_language']=target_language or 'fr' kw['document_language'] = target_language or 'fr'
kw['start_date']=context.getStartDate() or None kw['start_date'] = context.getStartDate() or None
kw['stop_date']=context.getStopDate() or None kw['stop_date'] = context.getStopDate() or None
kw['get_doc_after_save'] = send_to_maileva kw['get_doc_after_save'] = send_to_maileva
if not send_to_maileva: if not send_to_maileva:
return context.Base_printAsReport(**kw) return context.Base_printAsReport(**kw)
if not context.Base_isMailevaEnabled():
return context.Base_redirect('view',
keep_items={'portal_status_message': 'Maileva is not configured.'})
document = context.Base_printAsReport(**kw) document = context.Base_printAsReport(**kw)
document.edit(title='BULLETIN DE PAIE: %s' % document.getTitle()) document.edit(title='BULLETIN DE PAIE: %s' % document.getTitle())
document.PDF_sendToMaileva(recipient=context.getSourceSectionValue(), sender=context.getDestinationTradeValue()) document.PDF_sendToMaileva(recipient=context.getSourceSectionValue(),
sender=context.getDestinationTradeValue())
document.setFollowUpValue(context) document.setFollowUpValue(context)
document.PDF_setAccountingSecurity() document.PDF_setAccountingSecurity()
return document.Base_redirect('PDF_viewPDFJSPreview', keep_items={'portal_status_message': 'This document is sending to maileva'}) return document.Base_redirect('PDF_viewPDFJSPreview',
keep_items={'portal_status_message': 'This document is sending to maileva'})
...@@ -102,7 +102,9 @@ ...@@ -102,7 +102,9 @@
</item> </item>
<item> <item>
<key> <string>enabled</string> </key> <key> <string>enabled</string> </key>
<value> <string></string> </value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item> </item>
<item> <item>
<key> <string>external_validator</string> </key> <key> <string>external_validator</string> </key>
...@@ -153,7 +155,7 @@ ...@@ -153,7 +155,7 @@
</item> </item>
<item> <item>
<key> <string>enabled</string> </key> <key> <string>enabled</string> </key>
<value> <int>1</int> </value> <value> <int>0</int> </value>
</item> </item>
<item> <item>
<key> <string>external_validator</string> </key> <key> <string>external_validator</string> </key>
...@@ -181,4 +183,17 @@ ...@@ -181,4 +183,17 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>here/Base_isMailevaEnabled</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData> </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