Commit 55a49c0f authored by Romain Courteaud's avatar Romain Courteaud 🐸

slapos_accounting: testSlapOSEntityCreatePayment: stop using invoice template

parent feba0be3
...@@ -20,20 +20,54 @@ ...@@ -20,20 +20,54 @@
############################################################################## ##############################################################################
from erp5.component.test.SlapOSTestCaseMixin import SlapOSTestCaseMixin from erp5.component.test.SlapOSTestCaseMixin import SlapOSTestCaseMixin
from DateTime import DateTime
class TestSlapOSEntityCreatePaymentMixin(SlapOSTestCaseMixin): class TestSlapOSEntityCreatePaymentMixin(SlapOSTestCaseMixin):
def makeSaleInvoiceTransaction(self, person=None): def makeSaleInvoiceTransaction(self, person=None):
project = self.addProject() project = self.addProject()
organisation = self.portal.organisation_module.newContent(
portal_type="Organisation"
)
currency = self.portal.currency_module.newContent(
portal_type="Currency"
)
if person is None: if person is None:
person = self.portal.person_module.template_member\ person = self.portal.person_module.template_member\
.Base_createCloneDocument(batch_mode=1) .Base_createCloneDocument(batch_mode=1)
invoice = self.portal.accounting_module.template_sale_invoice_transaction\
.Base_createCloneDocument(batch_mode=1) invoice = self.createSaleInvoiceTransaction(
invoice.edit(destination_section_value=person, source_value=organisation,
source_section_value=organisation,
destination_section_value=person,
destination_project_value=project, destination_project_value=project,
resource_value=currency,
price_currency_value=currency,
ledger='automated', ledger='automated',
payment_mode=self.payment_mode) payment_mode=self.payment_mode,
start_date=DateTime('2012/01/01'),
stop_date=DateTime('2012/01/15'),
created_by_builder=1 # to prevent init script to create lines
)
for line_kw in [{
'destination': 'account_module/payable',
'source': 'account_module/receivable',
'quantity': -1.0
}, {
'destination': 'account_module/purchase',
'source': 'account_module/sales',
'quantity': 0.84
}, {
'destination': 'account_module/refundable_vat',
'source': 'account_module/coll_vat',
'quantity': 0.16
}]:
invoice.newContent(
portal_type="Sale Invoice Transaction Line",
resource_value=currency,
price=1.0,
**line_kw
)
return person, invoice return person, invoice
def sumReceivable(self, payment_transaction): def sumReceivable(self, payment_transaction):
...@@ -60,7 +94,7 @@ class TestSlapOSEntityCreatePaymentMixin(SlapOSTestCaseMixin): ...@@ -60,7 +94,7 @@ class TestSlapOSEntityCreatePaymentMixin(SlapOSTestCaseMixin):
'destination_project/%s' % invoice.getDestinationProject(), 'destination_project/%s' % invoice.getDestinationProject(),
'price_currency/%s' % invoice.getPriceCurrency(), 'price_currency/%s' % invoice.getPriceCurrency(),
'resource/%s' % invoice.getResource(), 'resource/%s' % invoice.getResource(),
'source_payment/organisation_module/slapos/bank_account', 'source_payment/%s/bank_account' % invoice.getSourceSection(),
'payment_mode/%s' % self.payment_mode, 'payment_mode/%s' % self.payment_mode,
'source_section/%s' % invoice.getSourceSection(), 'source_section/%s' % invoice.getSourceSection(),
#'source_project/%s' % invoice.getSourceProject(), #'source_project/%s' % invoice.getSourceProject(),
......
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