Commit 3dda255e authored by Łukasz Nowak's avatar Łukasz Nowak

Fetch directly monthly invoice.

parent 84e61d95
...@@ -15,6 +15,25 @@ class TestVifibDefaultUseCase(TestVifibSlapWebServiceMixin): ...@@ -15,6 +15,25 @@ class TestVifibDefaultUseCase(TestVifibSlapWebServiceMixin):
return transaction_list[0].getObject().getParentValue() return transaction_list[0].getObject().getParentValue()
def _getMonthlyInvoice(self, person):
line_list = self.portal.portal_catalog(
resource_relative_url=[
self.portal.portal_preferences.getPreferredInstanceSetupResource(),
self.portal.portal_preferences.getPreferredInstanceHostingResource(),
self.portal.portal_preferences.getPreferredInstanceCleanupResource(),
self.portal.portal_preferences.getPreferredInstanceUpdateResource(),
self.portal.portal_preferences.getPreferredInstanceSubscriptionResource(),
],
portal_type="Invoice Line",
**{'movement.destination_uid': person.getUid()}
)
transaction_list = [line.getParentValue() for line in line_list]
transaction_list = list(set(transaction_list))
self.assertEquals(1, len(transaction_list))
return transaction_list[0].getObject().getParentValue()
def stepCheckRegistrationAccounting(self, sequence, **kw): def stepCheckRegistrationAccounting(self, sequence, **kw):
""" """
""" """
...@@ -601,15 +620,7 @@ class TestVifibDefaultUseCase(TestVifibSlapWebServiceMixin): ...@@ -601,15 +620,7 @@ class TestVifibDefaultUseCase(TestVifibSlapWebServiceMixin):
person = self.portal.ERP5Site_getAuthenticatedMemberPersonValue(sequence[ person = self.portal.ERP5Site_getAuthenticatedMemberPersonValue(sequence[
'web_user']) 'web_user'])
# Check that 2 sale invoice has been generated for the user sale_invoice = self._getMonthlyInvoice(person)
transaction_list = self.portal.portal_catalog(
portal_type="Sale Invoice Transaction",
destination_section_relative_url=person.getRelativeUrl(),
sort_on=(('creation_date', 'DESC'),),
)
self.assertEquals(2, len(transaction_list))
sale_invoice = transaction_list[0].getObject()
# Check invoice creation # Check invoice creation
self.assertEquals( self.assertEquals(
...@@ -779,15 +790,7 @@ class TestVifibDefaultUseCase(TestVifibSlapWebServiceMixin): ...@@ -779,15 +790,7 @@ class TestVifibDefaultUseCase(TestVifibSlapWebServiceMixin):
person = self.portal.ERP5Site_getAuthenticatedMemberPersonValue(sequence[ person = self.portal.ERP5Site_getAuthenticatedMemberPersonValue(sequence[
'web_user']) 'web_user'])
# Check that 2 sale invoice has been generated for the user sale_invoice = self._getMonthlyInvoice(person)
transaction_list = self.portal.portal_catalog(
portal_type="Sale Invoice Transaction",
destination_section_relative_url=person.getRelativeUrl(),
sort_on=(('creation_date', 'DESC'),),
)
self.assertEquals(2, len(transaction_list))
sale_invoice = transaction_list[0].getObject()
# Check invoice creation # Check invoice creation
self.assertEquals( self.assertEquals(
...@@ -1094,15 +1097,7 @@ class TestVifibDefaultUseCase(TestVifibSlapWebServiceMixin): ...@@ -1094,15 +1097,7 @@ class TestVifibDefaultUseCase(TestVifibSlapWebServiceMixin):
person = self.portal.ERP5Site_getAuthenticatedMemberPersonValue(sequence[ person = self.portal.ERP5Site_getAuthenticatedMemberPersonValue(sequence[
'web_user']) 'web_user'])
# Check that 2 sale invoice has been generated for the user sale_invoice = self._getMonthlyInvoice(person)
transaction_list = self.portal.portal_catalog(
portal_type="Sale Invoice Transaction",
destination_section_relative_url=person.getRelativeUrl(),
sort_on=(('creation_date', 'DESC'),),
)
self.assertEquals(2, len(transaction_list))
sale_invoice = transaction_list[0].getObject()
# Check invoice creation # Check invoice creation
self.assertEquals( self.assertEquals(
......
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