Commit 9e5fe11d authored by Romain Courteaud's avatar Romain Courteaud

slapos_accounting: drop unused AccountingTransactionModule_getUnpaidInvoiceList

parent ef0af36d
portal = context.getPortalObject()
portal_membership=portal.portal_membership
user = portal_membership.getAuthenticatedMember().getUserValue()
def wrapWithShadow(user):
return user.Entity_getOutstandingAmountList()
return user.Person_restrictMethodAsShadowUser(
shadow_document=user,
callable_object=wrapWithShadow,
argument_list=[user])
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="_reconstructor" module="copy_reg"/>
</klass>
<tuple>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
<global name="object" module="__builtin__"/>
<none/>
</tuple>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>**kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>AccountingTransactionModule_getUnpaidInvoiceList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -152,141 +152,6 @@ class TestSlapOSAccounting(SlapOSTestCaseMixin): ...@@ -152,141 +152,6 @@ class TestSlapOSAccounting(SlapOSTestCaseMixin):
sale_invoice_transaction.SaleInvoiceTransaction_resetPaymentMode, sale_invoice_transaction.SaleInvoiceTransaction_resetPaymentMode,
REQUEST={}) REQUEST={})
#################################################################
# AccountingTransactionModule_getUnpaidInvoiceList
#################################################################
def test_AccountingTransactionModule_getUnpaidInvoiceList(self):
project = self.addProject()
person = self.makePerson(project, user=1)
organisation = self.portal.organisation_module.newContent(
portal_type="Organisation"
)
sale_trade_condition = self.portal.sale_trade_condition_module.newContent(
portal_type="Sale Trade Condition",
reference=self.generateNewId(),
specialise="business_process_module/slapos_ultimate_business_process"
)
sale_trade_condition.validate()
current_invoice = self.portal.accounting_module.newContent(
portal_type="Sale Invoice Transaction",
created_by_builder=1,# to prevent init script to create lines
specialise_value=sale_trade_condition,
source_section_value=organisation,
destination_value=person,
destination_section_value=person,
destination_decision_value=person,
start_date=DateTime('2019/10/20'),
stop_date=DateTime('2019/10/20'),
title='Fake Invoice for Demo User Functional',
price_currency="currency_module/EUR",
reference='1',
ledger='automated'
)
cell = current_invoice.newContent(
portal_type="Invoice Line",
resource="service_module/slapos_reservation_fee_2",
use="trade/sale",
quantity_unit="unit/piece",
base_contribution_list=[
"base_amount/invoicing/discounted",
"base_amount/invoicing/taxable"
]
)
cell.edit(quantity=1)
cell.setPrice(1)
current_invoice.plan()
current_invoice.confirm()
current_invoice.startBuilding()
current_invoice.reindexObject()
current_invoice.stop()
self.tic()
applied_rule = current_invoice.getCausalityRelated(portal_type="Applied Rule")
for sm in self.portal.portal_catalog(portal_type='Simulation Movement',
simulation_state=['draft', 'planned', None],
left_join_list=['delivery_uid'],
delivery_uid=None,
path="%%%s%%" % applied_rule):
if sm.getDelivery() is not None:
continue
root_applied_rule = sm.getRootAppliedRule()
root_applied_rule_path = root_applied_rule.getPath()
sm.getCausalityValue(portal_type='Business Link').build(
path='%s/%%' % root_applied_rule_path)
self.tic()
self.login(person.getUserId())
unpaid_invoice_list = self.portal.accounting_module.AccountingTransactionModule_getUnpaidInvoiceList()
self.assertEqual(
[i.getRelativeUrl() for i in unpaid_invoice_list],
[current_invoice.getRelativeUrl()])
self.login()
payment = self.portal.accounting_module.newContent(
portal_type="Payment Transaction",
created_by_builder=1,# to prevent init script to create lines
source_section_value=organisation,
destination_value=person,
start_date=DateTime('2019/10/20'),
stop_date=DateTime('2019/10/20'),
title='Fake Payment for Demo User Functional',
ressource="currency_module/EUR",
price_currency="currency_module/EUR",
ledger='automated'
)
payment.newContent(
portal_type="Accounting Transaction Line",
destination="account_module/payable",
source="account_module/receivable"
)
payment.newContent(
portal_type="Accounting Transaction Line",
destination="account_module/payment_to_encash",
source="account_module/payment_to_encash"
)
for line in payment.contentValues():
if line.getSource() == "account_module/payment_to_encash":
line.setQuantity(-1)
elif line.getSource() == "account_module/receivable":
line.setQuantity(1)
payment.confirm()
payment.start()
payment.setCausalityValue(current_invoice)
payment.setDestinationSectionValue(person)
payment.stop()
self.tic()
letter = None
for line in current_invoice.contentValues():
if line.getSource() == "account_module/receivable":
letter = line.getGroupingReference()
self.assertTrue(current_invoice.SaleInvoiceTransaction_isLettered())
# is it groupped?
is_lettered = False
for line in payment.contentValues():
if line.getSource() == "account_module/receivable":
is_lettered = True
self.assertEqual(letter, line.getGroupingReference())
self.assertTrue(is_lettered)
self.login(person.getUserId())
unpaid_invoice_list = self.portal.accounting_module.AccountingTransactionModule_getUnpaidInvoiceList()
self.assertEqual(
[i.getRelativeUrl() for i in unpaid_invoice_list],
[])
################################################################# #################################################################
# SaleInvoiceTransaction_createReversalSaleInvoiceTransaction # SaleInvoiceTransaction_createReversalSaleInvoiceTransaction
################################################################# #################################################################
......
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