Commit 28cb4d8d authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_jio: Allow set destination_section (or destination) on the Internal Packing Lists

This is used to setup security on ComputerNetwork, Computer and/or Hosting Subscription
parent 14376b51
...@@ -18,21 +18,25 @@ resource_value = context.Item_getResourceValue() ...@@ -18,21 +18,25 @@ resource_value = context.Item_getResourceValue()
if destination_project is None and source_project is not None: if destination_project is None and source_project is not None:
destination_project = source_project.getRelativeUrl() destination_project = source_project.getRelativeUrl()
destination_section = context.getSourceAdministration() if destination_section is None:
destination_section = source_section.getRelativeUrl()
if source_section is None: if source_section is None:
source_section = context.getSourceAdministration() source_section = context.getSourceAdministration()
source = context.getSourceAdministration()
destination = context.getSourceAdministration()
resource_value = context.product_module.computer resource_value = context.product_module.computer
module = context.getDefaultModule(portal_type=portal_type) module = context.getDefaultModule(portal_type=portal_type)
line_portal_type = '%s Line' % portal_type line_portal_type = '%s Line' % portal_type
delivery = module.newContent(title="Transfer %s to %s" % (context.getTitle(), destination_project), delivery = module.newContent(title="Transfer %s to %s" % (context.getTitle(), destination_project),
source_value=source_section, source=source,
source_section_value=source_section, source_section_value=source_section,
source_project_value=source_project, source_project_value=source_project,
destination=destination_section, destination=destination,
destination_section=destination_section, destination_section=destination_section,
source_decision=destination_section, source_decision=destination_section,
destination_decision=destination_section, destination_decision=destination_section,
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>destination_project=None</string> </value> <value> <string>destination_project=None, destination_section=None</string> </value>
</item> </item>
<item> <item>
<key> <string>_proxy_roles</string> </key> <key> <string>_proxy_roles</string> </key>
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
Create an internal Packing List and attach the computer Create an internal Packing List and attach the computer
""" """
from DateTime import DateTime from DateTime import DateTime
from Products.ERP5Type.Message import translateString
from zExceptions import Unauthorized from zExceptions import Unauthorized
user = context.getPortalObject().portal_membership.getAuthenticatedMember().getUserValue() user = context.getPortalObject().portal_membership.getAuthenticatedMember().getUserValue()
...@@ -20,7 +19,8 @@ resource_value = context.Item_getResourceValue() ...@@ -20,7 +19,8 @@ resource_value = context.Item_getResourceValue()
if destination_project is None and source_project is not None: if destination_project is None and source_project is not None:
destination_project = source_project.getRelativeUrl() destination_project = source_project.getRelativeUrl()
destination_section = context.getSourceAdministration() if destination_section is None:
destination_section = context.getSourceAdministration()
if destination is None and source is not None: if destination is None and source is not None:
# We do not change location of the machine # We do not change location of the machine
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>destination=None, destination_project=None</string> </value> <value> <string>destination=None, destination_project=None, destination_section=None</string> </value>
</item> </item>
<item> <item>
<key> <string>_proxy_roles</string> </key> <key> <string>_proxy_roles</string> </key>
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
Create an internal Packing List and attach the computer Create an internal Packing List and attach the computer
""" """
from DateTime import DateTime from DateTime import DateTime
from Products.ERP5Type.Message import translateString
from zExceptions import Unauthorized from zExceptions import Unauthorized
user = context.getPortalObject().portal_membership.getAuthenticatedMember().getUserValue() user = context.getPortalObject().portal_membership.getAuthenticatedMember().getUserValue()
...@@ -12,6 +11,7 @@ if user.getRelativeUrl() != context.getDestinationSection(): ...@@ -12,6 +11,7 @@ if user.getRelativeUrl() != context.getDestinationSection():
portal_type = "Internal Packing List" portal_type = "Internal Packing List"
source = context.Item_getCurrentSiteValue()
source_project = context.Item_getCurrentProjectValue() source_project = context.Item_getCurrentProjectValue()
source_section = context.Item_getCurrentOwnerValue() source_section = context.Item_getCurrentOwnerValue()
resource_value = context.Item_getResourceValue() resource_value = context.Item_getResourceValue()
...@@ -24,16 +24,19 @@ destination_section = context.getDestinationSection() ...@@ -24,16 +24,19 @@ destination_section = context.getDestinationSection()
if source_section is None: if source_section is None:
source_section = context.getDestinationSectionValue() source_section = context.getDestinationSectionValue()
if destination is None and source is not None:
destination = source.getRelativeUrl()
resource_value = context.product_module.computer resource_value = context.product_module.computer
module = context.getDefaultModule(portal_type=portal_type) module = context.getDefaultModule(portal_type=portal_type)
line_portal_type = '%s Line' % portal_type line_portal_type = '%s Line' % portal_type
delivery = module.newContent(title="Transfer %s to %s" % (context.getTitle(), destination_project), delivery = module.newContent(title="Transfer %s to %s" % (context.getTitle(), destination_project),
source_value=source_section, source_value=source,
source_section_value=source_section, source_section_value=source_section,
source_project_value=source_project, source_project_value=source_project,
destination=destination_section, destination=destination,
destination_section=destination_section, destination_section=destination_section,
source_decision=destination_section, source_decision=destination_section,
destination_decision=destination_section, destination_decision=destination_section,
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>destination_project=None</string> </value> <value> <string>destination_project=None, destination=None</string> </value>
</item> </item>
<item> <item>
<key> <string>_proxy_roles</string> </key> <key> <string>_proxy_roles</string> </key>
......
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