Commit 32be19f7 authored by Łukasz Nowak's avatar Łukasz Nowak

Use Inventory API to find old ongoing payments.

The sections are not definitive on Payment Transaction, so inventory API will
allow to easily find the payments, by checking balance with given states.
parent 45020470
...@@ -67,13 +67,14 @@ if maximum_balance > balance:\n ...@@ -67,13 +67,14 @@ if maximum_balance > balance:\n
return\n return\n
\n \n
# check ongoing payments and check that date if is acceptable, if not lock\n # check ongoing payments and check that date if is acceptable, if not lock\n
if context.portal_catalog.countResults(\n if context.portal_simulation.getInventoryAssetPrice(\n
portal_type=\'Payment Transaction\',\n parent_portal_type=\'Payment Transaction\',\n
node_category=\'account_type/asset/receivable\',\n
simulation_state=ongoing_simulation_state,\n simulation_state=ongoing_simulation_state,\n
**{\n section_uid=section_uid,\n
\'delivery.destination_section_uid\': customer_uid,\n mirror_section_uid=customer_uid,\n
\'delivery.start_date\': \'<= %s\' % maximum_due_date\n at_date=maximum_due_date,\n
})[0][0] > 0:\n ) > 0:\n
# there are ongoing old payments, shall be locked\n # there are ongoing old payments, shall be locked\n
if not locked and operation == \'lock\':\n if not locked and operation == \'lock\':\n
context.lock(comment="Payment transaction not paid for more than %s days" % maximum_due_date)\n context.lock(comment="Payment transaction not paid for more than %s days" % maximum_due_date)\n
......
534 535
\ No newline at end of file \ 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