Commit 97e4e866 authored by Romain Courteaud's avatar Romain Courteaud

slapos_accounting:

* use the discount_service on the discount service
  No idea if it is a good idea or not for now
* generate accounting movement for discount service
* also compare invoice price with discount sale packing list
parent 6246a4e9
......@@ -61,9 +61,11 @@
<value>
<object>
<klass>
<global id="1.1" name="DateTime" module="DateTime.DateTime"/>
<global id="1.1" name="_reconstructor" module="copy_reg"/>
</klass>
<tuple>
<global id="1.2" name="DateTime" module="DateTime.DateTime"/>
<global id="1.3" name="object" module="__builtin__"/>
<none/>
</tuple>
<state>
......@@ -84,6 +86,16 @@
<value> <string>This business path is just a template thus disabled by using \'python:False\' in Predicate.\n
For real use, it is required to set an appropriate source (= account) category in Profile.</string> </value>
</item>
<item>
<key> <string>destination_method_id</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>destination_method_replace_category</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>efficiency</string> </key>
<value> <float>1.0</float> </value>
......@@ -115,6 +127,7 @@ For real use, it is required to set an appropriate source (= account) category i
<value>
<tuple>
<string>resource_use/use/trade/sale</string>
<string>resource_use/use/trade/discount_service</string>
</tuple>
</value>
</item>
......@@ -124,6 +137,8 @@ For real use, it is required to set an appropriate source (= account) category i
<object>
<klass> <reference id="1.1"/> </klass>
<tuple>
<reference id="1.2"/>
<reference id="1.3"/>
<none/>
</tuple>
<state>
......@@ -149,6 +164,10 @@ For real use, it is required to set an appropriate source (= account) category i
<key> <string>portal_type</string> </key>
<value> <string>Trade Model Path</string> </value>
</item>
<item>
<key> <string>source_method_replace_category</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>string_index</string> </key>
<value>
......@@ -169,7 +188,7 @@ For real use, it is required to set an appropriate source (= account) category i
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Accounting Credit</string> </value>
<value> <string>Accounting Sale Credit</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -129,6 +129,7 @@ For real use, it is required to set an appropriate source (= account) category i
<string>resource_use/use/trade/sale</string>
<string>resource_use/use/trade/tax</string>
<string>resource_use/use/trade/deposit</string>
<string>resource_use/use/trade/discount_service</string>
</tuple>
</value>
</item>
......
......@@ -56,9 +56,9 @@
<key> <string>categories</string> </key>
<value>
<tuple>
<string>use/trade/discount</string>
<string>quantity_unit/unit/piece</string>
<string>base_contribution/base_amount/invoicing/taxable</string>
<string>use/trade/discount_service</string>
</tuple>
</value>
</item>
......@@ -278,6 +278,53 @@
</value>
</item>
</dictionary>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>edit</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>1007.12867.59577.21009</string> </value>
</item>
<item>
<key> <string>state</string> </key>
<value> <string>current</string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass> <reference id="3.1"/> </klass>
<tuple>
<reference id="3.2"/>
<reference id="3.3"/>
<none/>
</tuple>
<state>
<tuple>
<float>1686649912.97</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</value>
</item>
......
......@@ -2,15 +2,12 @@ invoice = context
if invoice.getLedger() != 'automated':
return False
if len(invoice.getCausalityRelatedList(portal_type=['Cloud Contract', 'Subscription Request'])) > 0:
# Nothing to compare
return True
delivery_list = invoice.getCausalityValueList(portal_type='Sale Packing List')
amount = len(delivery_list)
if amount < 1:
return False
amount = sum([delivery.getTotalPrice(use='use/trade/sale') for delivery in delivery_list])
use_list = ['use/trade/sale', 'use/trade/discount_service']
amount = sum([delivery.getTotalPrice(use=use_list) for delivery in delivery_list])
return amount == context.getTotalPrice(use='use/trade/sale')
return amount == context.getTotalPrice(use=use_list)
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