Commit 1a091fa6 authored by Romain Courteaud's avatar Romain Courteaud

Do not create custome trade condition.

For now, it allows to aggregate all invoice lines.
Those custom trade condition will be reintegrated when more complex pricing model will be activated.
parent 17b331a5
......@@ -55,39 +55,41 @@ order = state_change[\'object\']\n
portal = order.getPortalObject()\n
\n
vifib_trade_condition = \'sale_trade_condition_module/vifib_trade_condition\'\n
### STEP 1: does this order have a client-specific Trade Condition\n
trade_condition = order.getSpecialiseValue(portal_type="Sale Trade Condition")\n
custom_trade_condition = None\n
if trade_condition is not None:\n
if trade_condition.getDestinationSection() == order.getDestinationSection():\n
# The client in this trade condition is the client of the order\n
custom_trade_condition = trade_condition\n
order.edit(specialise=vifib_trade_condition)\n
\n
if custom_trade_condition is None:\n
# If no trade condition or generic trade condition\n
# try to find existing trade condition\n
trade_condition_list = portal.portal_catalog(\n
destination_section_relative_url=order.getDestinationSection(),\n
validation_state="validated",\n
specialise_relative_url=vifib_trade_condition,\n
portal_type=\'Sale Trade Condition\')\n
if len(trade_condition_list):\n
custom_trade_condition = trade_condition_list[0].getObject()\n
\n
if custom_trade_condition is None:\n
# nothing found then create a new custom trade condition\n
custom_trade_condition = portal.sale_trade_condition_module.newContent(specialise=vifib_trade_condition,\n
destination_section=order.getDestinationSection(),\n
title="ViFiB Custom Conditions",\n
portal_type=\'Sale Trade Condition\')\n
\n
if custom_trade_condition is None:\n
raise ValueError(\'It was impossible to generate custom trade condition.\')\n
if order.getSpecialise(portal_type="Sale Trade Condition") != custom_trade_condition.getRelativeUrl():\n
order.setSpecialiseValue(custom_trade_condition)\n
\n
if portal.portal_workflow.isTransitionPossible(custom_trade_condition, \'validate\'):\n
custom_trade_condition.validate()\n
# ### STEP 1: does this order have a client-specific Trade Condition\n
# trade_condition = order.getSpecialiseValue(portal_type="Sale Trade Condition")\n
# custom_trade_condition = None\n
# if trade_condition is not None:\n
# if trade_condition.getDestinationSection() == order.getDestinationSection():\n
# # The client in this trade condition is the client of the order\n
# custom_trade_condition = trade_condition\n
# \n
# if custom_trade_condition is None:\n
# # If no trade condition or generic trade condition\n
# # try to find existing trade condition\n
# trade_condition_list = portal.portal_catalog(\n
# destination_section_relative_url=order.getDestinationSection(),\n
# validation_state="validated",\n
# specialise_relative_url=vifib_trade_condition,\n
# portal_type=\'Sale Trade Condition\')\n
# if len(trade_condition_list):\n
# custom_trade_condition = trade_condition_list[0].getObject()\n
# \n
# if custom_trade_condition is None:\n
# # nothing found then create a new custom trade condition\n
# custom_trade_condition = portal.sale_trade_condition_module.newContent(specialise=vifib_trade_condition,\n
# destination_section=order.getDestinationSection(),\n
# title="ViFiB Custom Conditions",\n
# portal_type=\'Sale Trade Condition\')\n
# \n
# if custom_trade_condition is None:\n
# raise ValueError(\'It was impossible to generate custom trade condition.\')\n
# if order.getSpecialise(portal_type="Sale Trade Condition") != custom_trade_condition.getRelativeUrl():\n
# order.setSpecialiseValue(custom_trade_condition)\n
# \n
# if portal.portal_workflow.isTransitionPossible(custom_trade_condition, \'validate\'):\n
# custom_trade_condition.validate()\n
</string> </value>
</item>
<item>
......
158
\ No newline at end of file
159
\ 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