Commit 10152fe2 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_crm: Use a script to define who is Service Provider instead

parent a7d9cd78
...@@ -60,17 +60,11 @@ computer_reference = computer.getReference()\n ...@@ -60,17 +60,11 @@ computer_reference = computer.getReference()\n
if allocation_scope not in [\'open/public\', \'open/friend\']:\n if allocation_scope not in [\'open/public\', \'open/friend\']:\n
return\n return\n
\n \n
is_service_provider = False\n
person = computer.getSourceAdministrationValue(portal_type="Person")\n person = computer.getSourceAdministrationValue(portal_type="Person")\n
if not person:\n if not person:\n
return\n return\n
\n \n
for assignment in person.contentValues(portal_type="Assignment"):\n if not person.Person_isServiceProvider():\n
if assignment.getRole() == \'service_provider\':\n
is_service_provider = True\n
break\n
\n
if not is_service_provider:\n
#Turn this computer allocation scope to \'open/personal\'\n #Turn this computer allocation scope to \'open/personal\'\n
edit_kw = {\n edit_kw = {\n
\'allocation_scope\': \'open/personal\',\n \'allocation_scope\': \'open/personal\',\n
......
<?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>_body</string> </key>
<value> <string>if \'service_provider\' in context.getRoleList():\n
return True\n
\n
for assignment in context.contentValues(portal_type="Assignment"):\n
if assignment.getRole() == \'service_provider\':\n
return True\n
\n
return False\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Person_isServiceProvider</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -76,7 +76,7 @@ class TestSlapOSPerson_checkToCreateRegularisationRequest(testSlapOSMixin): ...@@ -76,7 +76,7 @@ class TestSlapOSPerson_checkToCreateRegularisationRequest(testSlapOSMixin):
ticket.getSource()) ticket.getSource())
expected_text_content = """Dear user, expected_text_content = """Dear user,
A new invoice has been generated. A new invoice has been generated.
You can access it in your invoice section at http://foobar.org/. You can access it in your invoice section at http://foobar.org/.
Do not hesitate to visit the web forum (http://community.slapos.org/forum) in case of question. Do not hesitate to visit the web forum (http://community.slapos.org/forum) in case of question.
......
46 47
\ No newline at end of file \ No newline at end of file
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