Commit 417caf72 authored by Romain Courteaud's avatar Romain Courteaud

slapos_accounting: also compare invoice price with discount sale packing list

parent c9b464b3
......@@ -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