Commit 50dc2fc4 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_accounting: Update Price assertion constraint

   We do expect that all trade conditions be attached to a business process, so for manual accounting
   the condition changed.

    Se would like to skip consistency check if the invoice isn't automated (ledger) and has no lines,
   otherwise this consistency check should still apply as usual.
parent 3e320b13
invoice = context
specialise = context.getSpecialiseValue(portal_type='Sale Trade Condition')
if specialise is None or specialise.getSpecialiseValue() is None:
if not len(invoice.objectValues(portal_type="Invoice Line")):
# The trade model don't applies if the Trade Condition isn't attached to
# A business process
if invoice.getLedger() != 'automated' and \
not len(invoice.objectValues(portal_type="Invoice Line")):
# Non automated invoices can be used w/o Invoice Lines for
# the most part.
return True
total_price = invoice.getTotalPrice()
if invoice.getTotalPrice() < 0:
# For a negative total is from the Reversal transactions
......
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