Commit b7246f34 authored by Romain Courteaud's avatar Romain Courteaud

slapos_accounting: test: templates were dropped

parent cb10f80f
......@@ -158,7 +158,9 @@ class TestSlapOSAccounting(SlapOSTestCaseMixin):
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(),
......@@ -166,22 +168,32 @@ class TestSlapOSAccounting(SlapOSTestCaseMixin):
)
sale_trade_condition.validate()
template = self.portal.restrictedTraverse(
self.portal.portal_preferences.getPreferredDefaultPrePaymentSubscriptionInvoiceTemplate())
current_invoice = template.Base_createCloneDocument(batch_mode=1)
current_invoice.edit(
specialise_value=sale_trade_condition,
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')
cell = current_invoice["1"]["movement_0"]
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)
......@@ -217,10 +229,29 @@ class TestSlapOSAccounting(SlapOSTestCaseMixin):
[current_invoice.getRelativeUrl()])
self.login()
payment_template = self.portal.restrictedTraverse(
self.portal.portal_preferences.getPreferredDefaultPrePaymentTemplate())
payment = payment_template.Base_createCloneDocument(batch_mode=1)
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)
......@@ -235,14 +266,11 @@ class TestSlapOSAccounting(SlapOSTestCaseMixin):
payment.stop()
self.tic()
is_lettered = False
letter = None
for line in current_invoice.contentValues():
if line.getSource() == "account_module/receivable":
is_lettered = True
letter = line.getGroupingReference()
self.assertTrue(is_lettered)
self.assertTrue(current_invoice.SaleInvoiceTransaction_isLettered())
# is it groupped?
is_lettered = False
......
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