Commit 0bea8d32 authored by Romain Courteaud's avatar Romain Courteaud

slapos_panel: update add Sale SUpply action

parent 5dddea56
......@@ -92,7 +92,7 @@
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>python: (context.Project_getAccountingCurrency() is not None) and context.Base_hasSlapOSProjectUserGroup(manager=True, agent=True)</string> </value>
<value> <string>python: portal.Base_checkPermission(\'sale_supply_module\', \'Add portal content\')</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -92,7 +92,7 @@
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>python: (context.getValidationState() == \'validated\') and (context.Base_hasSlapOSProjectUserGroup(manager=True, agent=True, project_relation=\'destination_project\'))</string> </value>
<value> <string>python: (context.getValidationState() == \'validated\') and ((context.Base_hasSlapOSProjectUserGroup(manager=True, agent=True, project_relation=\'destination_project\')) or (context.Base_hasSlapOSProjectUserGroup(manager=True, agent=True, project_relation=\'source_project\')))</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -92,7 +92,7 @@
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>python: (context.getValidationState() in (\'draft\', \'invalidated\')) and (context.Base_hasSlapOSProjectUserGroup(manager=True, agent=True, project_relation=\'destination_project\'))</string> </value>
<value> <string>python: (context.getValidationState() in (\'draft\', \'invalidated\')) and ((context.Base_hasSlapOSProjectUserGroup(manager=True, agent=True, project_relation=\'destination_project\')) or (context.Base_hasSlapOSProjectUserGroup(manager=True, agent=True, project_relation=\'source_project\')))</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -6,6 +6,8 @@ elif project_relation == 'follow_up':
project = context.getFollowUpValue()
elif project_relation == 'destination_project':
project = context.getDestinationProjectValue()
elif project_relation == 'source_project':
project = context.getSourceProjectValue()
else:
raise ValueError('Unexpected project relation: %s' % project_relation)
......
......@@ -6,18 +6,18 @@
</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"/>
<global name="_reconstructor" module="copy_reg"/>
</klass>
<tuple/>
<tuple>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
<global name="object" module="__builtin__"/>
<none/>
</tuple>
<state>
<dictionary>
<item>
......
......@@ -3,22 +3,11 @@ from Products.ERP5Type.Message import translateString
portal = context.getPortalObject()
project = context
currency = project.Project_getAccountingCurrency()
if currency is None:
return context.Base_redirect(
keep_items={
'portal_status_message': translateString('Can not find project currency'),
'portal_status_level': "error",
}
)
sale_supply = portal.sale_supply_module.newContent(
title="All %s" % DateTime(),
portal_type="Sale Supply",
destination_project_value=project,
start_date_range_min=DateTime(),
price_currency=currency
source_project_value=project,
start_date_range_min=DateTime()
)
software_product_list = portal.portal_catalog(
......@@ -32,7 +21,14 @@ for sql_software_product in software_product_list:
title=sql_software_product.getTitle(),
resource_value=sql_software_product.getObject()
)
"""
compute_node_service = portal.restrictedTraverse('service_module/slapos_compute_node_subscription')
sale_supply.newContent(
portal_type="Sale Supply Line",
title=compute_node_service.getTitle(),
resource_value=compute_node_service
)
"""
return sale_supply.Base_redirect(
keep_items={'portal_status_message': translateString('New Sale Supply created.')}
)
......@@ -6,18 +6,18 @@
</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"/>
<global name="_reconstructor" module="copy_reg"/>
</klass>
<tuple/>
<tuple>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
<global name="object" module="__builtin__"/>
<none/>
</tuple>
<state>
<dictionary>
<item>
......
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