Commit 007371d2 authored by Rafael Monnerat's avatar Rafael Monnerat

[slapos_accounting] Don't compare Price if Causality is a Contract

If Sale Invoice Transaction is created for account validation (Causality == Cloud Contract), skip this Consistency Script to check prices against Sale Packing List
parent 4248227e
......@@ -50,11 +50,18 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>invoice = context\n
<value> <string encoding="cdata"><![CDATA[
invoice = context\n
specialise = context.getPortalObject().portal_preferences.getPreferredAggregatedSaleTradeCondition()\n
if invoice.getSpecialise() != specialise:\n
raise TypeError(\'Only invoice specialised by %s shall be checked\' % specialise)\n
\n
if len(invoice.getCausalityRelatedList(portal_type=\'Cloud Contract\')) > 0:\n
# Nothing to compare\n
return True\n
\n
\n
delivery_list = invoice.getCausalityValueList(portal_type=\'Sale Packing List\')\n
amount = len(delivery_list)\n
if amount != 1:\n
......@@ -62,7 +69,9 @@ if amount != 1:\n
delivery = delivery_list[0]\n
\n
return delivery.getTotalPrice(use=\'use/trade/sale\') == context.getTotalPrice(use=\'use/trade/sale\')\n
</string> </value>
]]></string> </value>
</item>
<item>
<key> <string>_params</string> </key>
......
262
\ No newline at end of file
263
\ 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