testTradeReports.py 45.9 KB
Newer Older
Romain Courteaud's avatar
Romain Courteaud committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
#############################################################################
#
# Copyright  2008 Nexedi SA Contributors. All Rights Reserved.
#              Romain Courteaud <romain@nexedi.com>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################

"""Tests Standards ERP5 Trade Reports
"""
import unittest
32
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5ReportTestCase
Romain Courteaud's avatar
Romain Courteaud committed
33 34 35 36
from Products.ERP5Type.tests.utils import reindex
from AccessControl.SecurityManagement import newSecurityManager
from DateTime import DateTime

37
class TestTradeReports(ERP5ReportTestCase):
Romain Courteaud's avatar
Romain Courteaud committed
38 39 40 41 42 43 44
  """Test Trade reports
  """
  def getTitle(self):
    return "Trade Reports"

  def getBusinessTemplateList(self):
    """Returns list of BT to be installed."""
45 46
    return ('erp5_core_proxy_field_legacy',
            'erp5_base', 'erp5_trade', 'erp5_pdm', )
Romain Courteaud's avatar
Romain Courteaud committed
47 48 49 50 51 52 53 54 55

  def login(self):
    """login with Manager roles."""
    uf = self.getPortal().acl_users
    uf._doAddUser('manager', 'manager', ['Manager', 'Assignee', 'Assignor',
                               'Associate', 'Auditor', 'Author'], [])
    user = uf.getUserById('manager').__of__(uf)
    newSecurityManager(None, user)

56 57 58 59 60 61 62
  def loginAsUser(self):
    """login as user, without Manager role"""
    uf = self.getPortal().acl_users
    uf._doAddUser('user', 'user', ['Assignee', 'Assignor',
                               'Associate', 'Auditor', 'Author'], [])
    user = uf.getUserById('manager').__of__(uf)
    newSecurityManager(None, user)
Aurel's avatar
Aurel committed
63 64

  def afterSetUp(self):
Romain Courteaud's avatar
Romain Courteaud committed
65 66 67 68 69
    """Setup the fixture.
    """
    self.portal = self.getPortal()
    self.organisation_module = self.portal.organisation_module
    self.inventory_module = self.portal.inventory_module
Aurel's avatar
Aurel committed
70
    self.sale_order_module = self.portal.sale_order_module
Romain Courteaud's avatar
Romain Courteaud committed
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
    self.product_module = self.portal.product_module
    self.portal_categories = self.portal.portal_categories
 
    # Create site category
    for site_id in ('demo_site_A', 'demo_site_B',):
      if not self.portal_categories['site'].has_key(site_id): 
        self.portal_categories.site.newContent(
                                  portal_type='Category',
                                  title=site_id,
                                  reference=site_id,
                                  id=site_id)
    # Colour categories
    for colour_id in ('colour1', 'colour2',):
      if not self.portal_categories['colour'].has_key(colour_id): 
        self.portal_categories.colour.newContent(
                                  portal_type='Category',
                                  title=colour_id,
                                  reference=colour_id,
                                  id=colour_id)

Aurel's avatar
Aurel committed
91
    # create group categories
92
    for group_id in ('g1', 'g2', 'g3'):
Aurel's avatar
Aurel committed
93 94 95 96 97 98
      if not self.portal_categories['group'].has_key(group_id):
        self.portal_categories.group.newContent(
                                  portal_type='Category',
                                  title=group_id,
                                  reference=group_id,
                                  id=group_id)
99
    # create organisations (with no organisation member of g3)
Romain Courteaud's avatar
Romain Courteaud committed
100 101 102 103 104 105
    if not self.organisation_module.has_key('Organisation_1'): 
      org = self.portal.organisation_module.newContent(
                              portal_type='Organisation',
                              reference='Organisation_1',
                              title='Organisation_1',
                              id='Organisation_1',
Aurel's avatar
Aurel committed
106
                              group='g1',
Romain Courteaud's avatar
Romain Courteaud committed
107 108 109 110 111 112 113
                              site='demo_site_A')
    if not self.organisation_module.has_key('Organisation_2'): 
      org = self.portal.organisation_module.newContent(
                              portal_type='Organisation',
                              reference='Organisation_2',
                              title='Organisation_2',
                              id='Organisation_2',
Aurel's avatar
Aurel committed
114
                              group='g2',
Romain Courteaud's avatar
Romain Courteaud committed
115
                              site='demo_site_B')
116 117 118 119 120 121 122
    # no group no site
    if not self.organisation_module.has_key('Organisation_3'):
      org = self.portal.organisation_module.newContent(
                              portal_type='Organisation',
                              reference='Organisation_3',
                              title='Organisation_3',
                              id='Organisation_3',)
123

Aurel's avatar
Aurel committed
124 125 126 127 128
    # create unit categories
    for unit_id in ('kg', 'g',):
      if not self.portal_categories['quantity_unit'].has_key(unit_id): 
        self.portal_categories.quantity_unit.newContent(
                                  portal_type='Category',
Aurel's avatar
Aurel committed
129
                                  title=unit_id.title(),
Aurel's avatar
Aurel committed
130 131 132
                                  reference=unit_id,
                                  id=unit_id)
      
133
    # Create resources
Romain Courteaud's avatar
Romain Courteaud committed
134 135 136 137 138 139 140
    module = self.portal.product_module
    if not module.has_key('product_B'): 
      product = module.newContent(
          portal_type='Product',
          id='product_B',
          title='product_B',
          reference='ref 1',
Aurel's avatar
Aurel committed
141
          quantity_unit='kg'
Romain Courteaud's avatar
Romain Courteaud committed
142 143 144 145 146 147 148
          )
    if not module.has_key('product_A'): 
      product = module.newContent(
          portal_type='Product',
          id='product_A',
          title='product_A',
          reference='ref 2',
Aurel's avatar
Aurel committed
149
          quantity_unit='g'
Romain Courteaud's avatar
Romain Courteaud committed
150 151 152 153 154 155 156 157 158 159
          )
    if not module.has_key('product_C'): 
      product = module.newContent(
          portal_type='Product',
          id='product_C',
          title='variated product',
          reference='ref 3',
          variation_base_category_list=['colour'],
          colour_list=['colour1', 'colour2'],
          )
160 161 162 163 164 165 166 167
    if not self.portal.service_module.has_key('service_a'):
      self.portal.service_module.newContent(
          portal_type='Service',
          id='service_a',
          title='Service A',
          reference='ref sA',
          )

Romain Courteaud's avatar
Romain Courteaud committed
168 169
    # and all this available to catalog
    self.tic()
170
    self.loginAsUser()
Romain Courteaud's avatar
Romain Courteaud committed
171

Aurel's avatar
Aurel committed
172
  def beforeTearDown(self):
Romain Courteaud's avatar
Romain Courteaud committed
173 174
    """Remove all documents.
    """
175
    self.abort()
Romain Courteaud's avatar
Romain Courteaud committed
176 177 178 179 180 181 182 183 184 185 186

    self.organisation_module.manage_delObjects(
                      list(self.organisation_module.objectIds()))
    self.product_module.manage_delObjects(
                      list(self.product_module.objectIds()))
    self.portal_categories.site.manage_delObjects(
        [x for x in self.portal_categories['site'].objectIds()])
    self.portal_categories.colour.manage_delObjects(
        [x for x in self.portal_categories['colour'].objectIds()])
    self.inventory_module.manage_delObjects(
                      list(self.inventory_module.objectIds()))
187 188
    self.sale_order_module.manage_delObjects(
                      list(self.sale_order_module.objectIds()))
Romain Courteaud's avatar
Romain Courteaud committed
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205
                      
    self.tic()

  @reindex  
  def _makeOneInventory(self, simulation_state='draft', 
                        resource=None, quantity=None, **kw):
    """Creates an inventory.
    """
    inventory = self.inventory_module.newContent(portal_type='Inventory', **kw)
    inventory_line = inventory.newContent(portal_type='Inventory Line',
                                          resource=resource,
                                          inventory=quantity)

    if simulation_state == 'delivered':
      inventory.deliver()
    
    # sanity check
206
    self.assertEqual(simulation_state, inventory.getSimulationState())
Romain Courteaud's avatar
Romain Courteaud committed
207 208
    return inventory

Aurel's avatar
Aurel committed
209 210 211 212 213 214 215 216 217 218 219 220
  @reindex
  def _makeOneSaleOrder(self, resource_dict={}, cancel=False, **kw):
    """
    Create a sale order
    """
    sale_order = self.sale_order_module.newContent(portal_type="Sale Order", **kw)
    for product, values in resource_dict.iteritems():
      sale_order_line = sale_order.newContent(portal_type="Sale Order Line",
                                              resource=product,
                                              quantity=values["quantity"],
                                              price=values["price"])
      
221
    self.assertEqual(sale_order.getSimulationState(), 'draft')
Aurel's avatar
Aurel committed
222 223
    if cancel:
      sale_order.cancel()
224
      self.assertEqual(sale_order.getSimulationState(), 'cancelled')
Aurel's avatar
Aurel committed
225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263
      
    return sale_order
      
  def testSaleOrderReport(self):
    """
    Sale order report.
    """
    # Create sales orders
    first = self._makeOneSaleOrder(
              title='SO 1',
              destination_value=self.organisation_module.Organisation_1,
              destination_section_value=self.organisation_module.Organisation_1,
              destination_decision_value=self.organisation_module.Organisation_1,
              source_value=self.organisation_module.Organisation_2,
              source_section_value=self.organisation_module.Organisation_2,
              source_decision_value=self.organisation_module.Organisation_2,
              start_date=DateTime(2006, 2, 2),
              resource_dict = {'product_module/product_A':{"quantity":11, "price":3},
                               'product_module/product_B':{"quantity":7, "price":6},}
              )
    second = self._makeOneSaleOrder(
              title='SO 2',
              destination_value=self.organisation_module.Organisation_1,
              destination_section_value=self.organisation_module.Organisation_1,
              destination_decision_value=self.organisation_module.Organisation_1,
              source_value=self.organisation_module.Organisation_2,
              source_section_value=self.organisation_module.Organisation_2,
              source_decision_value=self.organisation_module.Organisation_2,
              start_date=DateTime(2007, 2, 2),
              resource_dict = {'product_module/product_A':{"quantity":3, "price":3},}
              )
    third = self._makeOneSaleOrder(
              title='SO 3',
              destination_value=self.organisation_module.Organisation_2,
              destination_section_value=self.organisation_module.Organisation_2,
              destination_decision_value=self.organisation_module.Organisation_2,
              source_value=self.organisation_module.Organisation_1,
              source_section_value=self.organisation_module.Organisation_1,
              source_decision_value=self.organisation_module.Organisation_1,
264
              start_date=DateTime(2006, 2, 22),
Aurel's avatar
Aurel committed
265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295
              resource_dict = {'product_module/product_A':{"quantity":5, "price":3},
                               'product_module/product_B':{"quantity":1, "price":6},}
              )
    fourth = self._makeOneSaleOrder(
              title='SO 4',
              destination_value=self.organisation_module.Organisation_1,
              destination_section_value=self.organisation_module.Organisation_1,
              destination_decision_value=self.organisation_module.Organisation_1,
              source_value=self.organisation_module.Organisation_2,
              source_section_value=self.organisation_module.Organisation_2,
              source_decision_value=self.organisation_module.Organisation_2,
              start_date=DateTime(2007, 2, 2),
              resource_dict = {'product_module/product_A':{"quantity":17, "price":3},
                               'product_module/product_B':{"quantity":13, "price":6},},
              cancel=True
              )

    self.tic()


    request = self.portal.REQUEST
    #
    # Before 2006
    #
    request['from_date'] = DateTime(2004, 1, 1)
    request['at_date'] = DateTime(2005, 1, 1)
    request['aggregation_level'] = "year"
    request['group_by'] = "both"
    request['simulation_state'] = ['cancelled', 'draft']
    report_section_list = self.getReportSectionList(self.sale_order_module,
                                                    'OrderModule_viewOrderReport')
296
    self.assertEqual(1, len(report_section_list))
Aurel's avatar
Aurel committed
297 298 299

    line_list = self.getListBoxLineList(report_section_list[0])
    data_line_list = [l for l in line_list if l.isDataLine()]
300
    self.assertEqual(0, len(data_line_list))
Aurel's avatar
Aurel committed
301 302 303 304 305 306 307 308 309

    #
    # Year 2005 + 2006, all documents
    #
    request['from_date'] = DateTime(2005, 2, 2)
    request['at_date'] = DateTime("2006-12-31")

    report_section_list = self.getReportSectionList(self.sale_order_module,
                                                    'OrderModule_viewOrderReport')
310
    self.assertEqual(1, len(report_section_list))
Aurel's avatar
Aurel committed
311 312 313 314

    line_list = self.getListBoxLineList(report_section_list[0])
    data_line_list = [l for l in line_list if l.isDataLine()]
    stat_line_list = [l for l in line_list if l.isStatLine()]
315 316
    self.assertEqual(6, len(data_line_list))
    self.assertEqual(1, len(stat_line_list))
Aurel's avatar
Aurel committed
317 318 319

    # test columns values
    line = data_line_list[0]
320
    self.assertEqual(line.column_id_list, ['client',
Aurel's avatar
Aurel committed
321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349
                    'product',
                    'Amount 2005',
                    'Quantity 2005',
                    'Quantity Unit 2005',
                    'Amount 2006',
                    'Quantity 2006',
                    'Quantity Unit 2006',
                    'total amount',
                    'total quantity'])
    
    # First Organisation
    d =  {'Amount 2005': 0,
                 'Amount 2006': 75.0,
                 'Quantity 2005': None,
                 'Quantity 2006': None,
                 'Quantity Unit 2005': None,
                 'Quantity Unit 2006': None,
                 'client': 'Organisation_1',
                 'product': None,
                 'total amount': 75.0,
                 'total quantity': None}
    self.checkLineProperties(data_line_list[0],**d)

    # Product one for first organisation
    d={'Amount 2005': 0,
                 'Amount 2006': 33.0,
                 'Quantity 2005': 0,
                 'Quantity 2006': 11.0,
                 'Quantity Unit 2005': '',
Aurel's avatar
Aurel committed
350
                 'Quantity Unit 2006': 'G',
Aurel's avatar
Aurel committed
351 352 353 354 355 356 357 358 359 360 361 362
                 'client': None,
                 'product': 'product_A',
                 'total amount': 33.0,
                 'total quantity': 11.0}
    self.checkLineProperties(data_line_list[1],**d)
                             
    # Product two for first organisation
    d = {'Amount 2005': 0,
                 'Amount 2006': 42.0,
                 'Quantity 2005': 0,
                 'Quantity 2006': 7.0,
                 'Quantity Unit 2005': '',
Aurel's avatar
Aurel committed
363
                 'Quantity Unit 2006': 'Kg',
Aurel's avatar
Aurel committed
364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388
                 'client': None,
                 'product': 'product_B',
                 'total amount': 42.0,
                 'total quantity': 7.0}
    self.checkLineProperties(data_line_list[2],**d)
                             
    # Second organisation
    d = {'Amount 2005': 0,
                 'Amount 2006': 21.0,
                 'Quantity 2005': None,
                 'Quantity 2006': None,
                 'Quantity Unit 2005': None,
                 'Quantity Unit 2006': None,
                 'client': 'Organisation_2',
                 'product': None,
                 'total amount': 21.0,
                 'total quantity': None}
    self.checkLineProperties(data_line_list[3],**d)
                             
    # Product one for second organisation
    d = {'Amount 2005': 0,
                 'Amount 2006': 15.0,
                 'Quantity 2005': 0,
                 'Quantity 2006': 5.0,
                 'Quantity Unit 2005': '',
Aurel's avatar
Aurel committed
389
                 'Quantity Unit 2006': 'G',
Aurel's avatar
Aurel committed
390 391 392 393 394 395 396 397 398 399 400 401
                 'client': None,
                 'product': 'product_A',
                 'total amount': 15.0,
                 'total quantity': 5.0}
    self.checkLineProperties(data_line_list[4],**d)
                             
    # Product two for second organisation
    d = {'Amount 2005': 0,
                 'Amount 2006': 6.0,
                 'Quantity 2005': 0,
                 'Quantity 2006': 1.0,
                 'Quantity Unit 2005': '',
Aurel's avatar
Aurel committed
402
                 'Quantity Unit 2006': 'Kg',
Aurel's avatar
Aurel committed
403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428
                 'client': None,
                 'product': 'product_B',
                 'total amount': 6.0,
                 'total quantity': 1.0}
    self.checkLineProperties(data_line_list[5],**d)
                             
    # stat line
    d = {'Amount 2005': None,
                 'Amount 2006': 96.0,
                 'Quantity 2005': None,
                 'Quantity 2006': None,
                 'Quantity Unit 2005': None,
                 'Quantity Unit 2006': None,
                 'client': 'Total',
                 'product': None,
                 'total amount': 96.0,
                 'total quantity': None}
    self.checkLineProperties(stat_line_list[0],**d)
                             
    
    #
    # Year 2006 + 2007, only draft documents and one group
    #
    request['from_date'] = DateTime(2006, 2, 2)
    request['at_date'] = DateTime(2007, 12, 31)
    request['simulation_state'] = ['draft',]
429
    request['section_category'] = 'group/g2'
Aurel's avatar
Aurel committed
430 431
    report_section_list = self.getReportSectionList(self.sale_order_module,
                                                    'OrderModule_viewOrderReport')
432
    self.assertEqual(1, len(report_section_list))
Aurel's avatar
Aurel committed
433 434 435 436

    line_list = self.getListBoxLineList(report_section_list[0])
    data_line_list = [l for l in line_list if l.isDataLine()]
    stat_line_list = [l for l in line_list if l.isStatLine()]
437 438
    self.assertEqual(3, len(data_line_list))
    self.assertEqual(1, len(stat_line_list))
Aurel's avatar
Aurel committed
439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455
    # First organisation    
    d = {'Amount 2006': 75.0,
                 'Amount 2007': 9.0,
                 'Quantity 2006': None,
                 'Quantity 2007': None,
                 'Quantity Unit 2006': None,
                 'Quantity Unit 2007': None,
                 'client': 'Organisation_1',
                 'product': None,
                 'total amount': 84.0,
                 'total quantity': None}
    self.checkLineProperties(data_line_list[0],**d)
    # Product one for organisation
    d = {'Amount 2006': 33.0,
                 'Amount 2007': 9.0,
                 'Quantity 2006': 11.0,
                 'Quantity 2007': 3.0,
Aurel's avatar
Aurel committed
456 457
                 'Quantity Unit 2006': 'G',
                 'Quantity Unit 2007': 'G',
Aurel's avatar
Aurel committed
458 459 460 461 462 463 464 465 466 467
                 'client': None,
                 'product': 'product_A',
                 'total amount': 42.0,
                 'total quantity': 14.0}
    # Product two for organisation
    self.checkLineProperties(data_line_list[1],**d)
    d = {'Amount 2006': 42.0,
                 'Amount 2007': 0,
                 'Quantity 2006': 7.0,
                 'Quantity 2007': 0,
Aurel's avatar
Aurel committed
468
                 'Quantity Unit 2006': 'Kg',
Aurel's avatar
Aurel committed
469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486
                 'Quantity Unit 2007': '',
                 'client': None,
                 'product': 'product_B',
                 'total amount': 42.0,
                 'total quantity': 7.0}
    self.checkLineProperties(data_line_list[2],**d)
    # stat line
    d = {'Amount 2006': 75.0,
                 'Amount 2007': 9.0,
                 'Quantity 2006': None,
                 'Quantity 2007': None,
                 'Quantity Unit 2006': None,
                 'Quantity Unit 2007': None,
                 'client': 'Total',
                 'product': None,
                 'total amount': 84.0,
                 'total quantity': None}
    self.checkLineProperties(stat_line_list[0],**d)
487 488 489 490 491
  
    # weekly aggregation level
    request['from_date'] = DateTime(2006, 2, 1)
    request['at_date'] = DateTime(2006, 2, 28)
    request['aggregation_level'] = "week"
492
    request['section_category'] = None
493 494 495 496
    request['group_by'] = "client"
    request['simulation_state'] = ['cancelled', 'draft']
    report_section_list = self.getReportSectionList(self.sale_order_module,
                                                    'OrderModule_viewOrderReport')
497
    self.assertEqual(1, len(report_section_list))
498 499
    line_list = self.getListBoxLineList(report_section_list[0])
    data_line_list = [l for l in line_list if l.isDataLine()]
500
    self.assertEqual(2, len(data_line_list))
501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518

    self.checkLineProperties(data_line_list[0],
                   **{'Amount 2006-05': 11*3 + 7*6,
                      'Amount 2006-06': 0,
                      'Amount 2006-07': 0,
                      'Amount 2006-08': 0,
                      'Amount 2006-09': 0,
                      'client': 'Organisation_1',
                      'total amount': 3*11 + 7*6})
    self.checkLineProperties(data_line_list[1],
                   **{'Amount 2006-05': 0,
                      'Amount 2006-06': 0,
                      'Amount 2006-07': 0,
                      'Amount 2006-08': 5*3 + 6,
                      'Amount 2006-09': 0,
                      'client': 'Organisation_2',
                      'total amount': 5*3 + 6})

519
    self.assertTrue(line_list[-1].isStatLine())
520 521 522 523 524 525 526 527 528
    self.checkLineProperties(line_list[-1],
                   **{'Amount 2006-05': 11*3 + 7*6,
                      'Amount 2006-06': None,
                      'Amount 2006-07': None,
                      'Amount 2006-08': 5*3 + 6,
                      'Amount 2006-09': None,
                      'client': 'Total',
                      'total amount': 3*11 + 7*6 + 5*3 + 6})

Aurel's avatar
Aurel committed
529

530 531 532 533 534 535
    # dates not specified -> they should be guessed
    request['from_date'] = None
    request['at_date'] = None
    request['simulation_state'] = ['draft',]
    request['aggregation_level'] = "year"
    request['group_by'] = "both"
536
    request['section_category'] = 'group/g2'
537 538
    report_section_list = self.getReportSectionList(self.sale_order_module,
                                                    'OrderModule_viewOrderReport')
539
    self.assertEqual(1, len(report_section_list))
540 541 542 543

    line_list = self.getListBoxLineList(report_section_list[0])
    data_line_list = [l for l in line_list if l.isDataLine()]
    stat_line_list = [l for l in line_list if l.isStatLine()]
544 545
    self.assertEqual(3, len(data_line_list))
    self.assertEqual(1, len(stat_line_list))
546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594
    # First organisation    
    d = {'Amount 2006': 75.0,
                 'Amount 2007': 9.0,
                 'Quantity 2006': None,
                 'Quantity 2007': None,
                 'Quantity Unit 2006': None,
                 'Quantity Unit 2007': None,
                 'client': 'Organisation_1',
                 'product': None,
                 'total amount': 84.0,
                 'total quantity': None}
    self.checkLineProperties(data_line_list[0],**d)
    # Product one for organisation
    d = {'Amount 2006': 33.0,
                 'Amount 2007': 9.0,
                 'Quantity 2006': 11.0,
                 'Quantity 2007': 3.0,
                 'Quantity Unit 2006': 'G',
                 'Quantity Unit 2007': 'G',
                 'client': None,
                 'product': 'product_A',
                 'total amount': 42.0,
                 'total quantity': 14.0}
    # Product two for organisation
    self.checkLineProperties(data_line_list[1],**d)
    d = {'Amount 2006': 42.0,
                 'Amount 2007': 0,
                 'Quantity 2006': 7.0,
                 'Quantity 2007': 0,
                 'Quantity Unit 2006': 'Kg',
                 'Quantity Unit 2007': '',
                 'client': None,
                 'product': 'product_B',
                 'total amount': 42.0,
                 'total quantity': 7.0}
    self.checkLineProperties(data_line_list[2],**d)
    # stat line
    d = {'Amount 2006': 75.0,
                 'Amount 2007': 9.0,
                 'Quantity 2006': None,
                 'Quantity 2007': None,
                 'Quantity Unit 2006': None,
                 'Quantity Unit 2007': None,
                 'client': 'Total',
                 'product': None,
                 'total amount': 84.0,
                 'total quantity': None}
    self.checkLineProperties(stat_line_list[0],**d)
  
595
    # section category set, with no matching organisations
596 597 598
    request['simulation_state'] = ['draft',]
    request['aggregation_level'] = "year"
    request['group_by'] = "both"
599
    request['section_category'] = 'group/g3'
600 601
    report_section_list = self.getReportSectionList(self.sale_order_module,
                                                    'OrderModule_viewOrderReport')
602
    self.assertEqual(1, len(report_section_list))
603 604 605 606

    line_list = self.getListBoxLineList(report_section_list[0])
    data_line_list = [l for l in line_list if l.isDataLine()]
    stat_line_list = [l for l in line_list if l.isStatLine()]
607 608
    self.assertEqual(0, len(data_line_list))
    self.assertEqual(1, len(stat_line_list))
609 610 611 612 613 614 615 616 617 618 619 620 621
    # stat line
    d = {'Amount 2006': None,
                 'Amount 2007': None,
                 'Quantity 2006': None,
                 'Quantity 2007': None,
                 'Quantity Unit 2006': None,
                 'Quantity Unit 2007': None,
                 'client': 'Total',
                 'product': None,
                 'total amount': None,
                 'total quantity': None}
    self.checkLineProperties(stat_line_list[0],**d)
  
Romain Courteaud's avatar
Romain Courteaud committed
622 623 624 625 626 627 628 629 630
  def testStockReport(self):
    """
    Stock report.
    """
    # Create inventories
    first = self._makeOneInventory(
              title='Inventory 1',
              simulation_state='delivered',
              destination_value=self.organisation_module.Organisation_1,
631
              source_value=self.organisation_module.Organisation_3,
Romain Courteaud's avatar
Romain Courteaud committed
632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686
              start_date=DateTime(2006, 2, 2),
              resource='product_module/product_A',
              quantity=11,
              )

    second = self._makeOneInventory(
              title='Inventory 2',
              simulation_state='delivered',
              destination_value=self.organisation_module.Organisation_1,
              start_date=DateTime(2007, 2, 2),
              resource='product_module/product_A',
              quantity=22,
              )

    third = self._makeOneInventory(
              title='Inventory 3',
              simulation_state='delivered',
              destination_value=self.organisation_module.Organisation_1,
              start_date=DateTime(2007, 2, 2),
              resource='product_module/product_B',
              quantity=33,
              )

    fourth = self._makeOneInventory(
              title='Inventory 4',
              simulation_state='delivered',
              destination_value=self.organisation_module.Organisation_2,
              start_date=DateTime(2007, 2, 2),
              resource='product_module/product_B',
              quantity=44,
              )

    fifth = self._makeOneInventory(
              title='Inventory 5',
              destination_value=self.organisation_module.Organisation_1,
              start_date=DateTime(2007, 2, 2),
              resource='product_module/product_C',
              quantity=55,
              )
    fifth_line = fifth.contentValues(portal_type='Inventory Line')[0]
    fifth_line.edit(
        variation_category_list=['colour/colour1', 'colour/colour2'],
        )
    base_id = 'movement'
    cell_key_list = list(fifth_line.getCellKeyList(base_id=base_id))
    for cell_key in cell_key_list:
      cell = fifth_line.newCell(base_id=base_id,
                                portal_type='Inventory Cell', 
                                *cell_key)
      cell.edit(mapped_value_property_list=['inventory'],
                inventory=66,
                predicate_category_list=cell_key,
                variation_category_list=cell_key)
    fifth.deliver()

687 688 689 690 691 692 693 694 695 696
    # services are ignored
    self._makeOneInventory(
              title='Inventory 6',
              simulation_state='delivered',
              destination_value=self.organisation_module.Organisation_1,
              start_date=DateTime(2007, 2, 2),
              resource='service_module/service_a',
              quantity=11,
              )

Romain Courteaud's avatar
Romain Courteaud committed
697 698 699 700 701 702 703
    self.tic()

    request = self.portal.REQUEST
    ################################
    # Old date
    ################################
    request.form['at_date'] = DateTime(2005, 1, 1)
704
    request.form['node_category'] = 'site/demo_site_A'
Romain Courteaud's avatar
Romain Courteaud committed
705 706 707 708 709 710
    
    line_list = self.portal.inventory_module.Base_viewStockReportBySite.listbox.\
        get_value('default',
                  render_format='list', REQUEST=request)

    data_line_list = [l for l in line_list if l.isDataLine()]
711
    self.assertEqual(0, len(data_line_list))
Romain Courteaud's avatar
Romain Courteaud committed
712 713 714 715
    ################################
    # Middle date
    ################################
    request.form['at_date'] = DateTime(2006, 4, 4)
716
    request.form['node_category'] = 'site/demo_site_A'
Romain Courteaud's avatar
Romain Courteaud committed
717 718 719 720 721 722
    
    line_list = self.portal.inventory_module.Base_viewStockReportBySite.listbox.\
        get_value('default',
                  render_format='list', REQUEST=self.portal.REQUEST)

    data_line_list = [l for l in line_list if l.isDataLine()]
723
    self.assertEqual(1, len(data_line_list))
Romain Courteaud's avatar
Romain Courteaud committed
724 725 726
    
    # test columns values
    line = data_line_list[0]
Julien Muchembled's avatar
Julien Muchembled committed
727 728 729 730 731
    self.assertEqual(line.column_id_list, ['resource_title',
                                           'resource_reference',
                                           'variation_category_item_list',
                                           'inventory',
                                           'quantity_unit'])
Romain Courteaud's avatar
Romain Courteaud committed
732 733 734 735
    self.checkLineProperties(
                   data_line_list[0],
                   resource_title='product_A',
                   resource_reference='ref 2',
Julien Muchembled's avatar
Julien Muchembled committed
736
                   variation_category_item_list=[],
Romain Courteaud's avatar
Romain Courteaud committed
737
                   inventory=11,
Aurel's avatar
Aurel committed
738
                   quantity_unit='G')
Romain Courteaud's avatar
Romain Courteaud committed
739 740 741 742 743

    ################################
    # Futur date
    ################################
    request.form['at_date'] = DateTime(2008, 4, 4)
744
    request.form['node_category'] = 'site/demo_site_A'
Romain Courteaud's avatar
Romain Courteaud committed
745 746 747 748 749 750
    
    line_list = self.portal.inventory_module.Base_viewStockReportBySite.listbox.\
        get_value('default',
                  render_format='list', REQUEST=self.portal.REQUEST)

    data_line_list = [l for l in line_list if l.isDataLine()]
751
    self.assertEqual(4, len(data_line_list))
Romain Courteaud's avatar
Romain Courteaud committed
752 753 754 755 756
    
    self.checkLineProperties(
                   data_line_list[0],
                   resource_title='product_B',
                   resource_reference='ref 1',
Julien Muchembled's avatar
Julien Muchembled committed
757
                   variation_category_item_list=[],
Romain Courteaud's avatar
Romain Courteaud committed
758
                   inventory=33,
Aurel's avatar
Aurel committed
759
                   quantity_unit='Kg')
Romain Courteaud's avatar
Romain Courteaud committed
760 761 762 763
    self.checkLineProperties(
                   data_line_list[1],
                   resource_title='product_A',
                   resource_reference='ref 2',
Julien Muchembled's avatar
Julien Muchembled committed
764
                   variation_category_item_list=[],
Romain Courteaud's avatar
Romain Courteaud committed
765
                   inventory=22,
Aurel's avatar
Aurel committed
766
                   quantity_unit='G')
Romain Courteaud's avatar
Romain Courteaud committed
767 768 769 770
    self.checkLineProperties(
                   data_line_list[2],
                   resource_title='variated product',
                   resource_reference='ref 3',
Julien Muchembled's avatar
Julien Muchembled committed
771
                   variation_category_item_list=['colour1'],
Romain Courteaud's avatar
Romain Courteaud committed
772 773 774 775 776 777
                   inventory=66,
                   quantity_unit='')
    self.checkLineProperties(
                   data_line_list[3],
                   resource_title='variated product',
                   resource_reference='ref 3',
Julien Muchembled's avatar
Julien Muchembled committed
778
                   variation_category_item_list=['colour2'],
Romain Courteaud's avatar
Romain Courteaud committed
779 780
                   inventory=66,
                   quantity_unit='')
781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862
                    
  def testStockReportWithPositiveOrNegativeOrZeroStock(self):
    """
    Stock report.
    """
    # Create inventories
    first = self._makeOneInventory(
              title='Inventory 1',
              simulation_state='delivered',
              destination_value=self.organisation_module.Organisation_1,
              start_date=DateTime(2007, 2, 2),
              resource='product_module/product_A',
              quantity=22,
              )

    second = self._makeOneInventory(
              title='Inventory 2',
              simulation_state='delivered',
              destination_value=self.organisation_module.Organisation_1,
              start_date=DateTime(2007, 2, 2),
              resource='product_module/product_A',
              quantity=-22,
              )

    third = self._makeOneInventory(
              title='Inventory 3',
              simulation_state='delivered',
              destination_value=self.organisation_module.Organisation_1,
              start_date=DateTime(2007, 2, 2),
              resource='product_module/product_B',
              quantity=-33,
              )

    fourth = self._makeOneInventory(
              title='Inventory 4',
              simulation_state='delivered',
              destination_value=self.organisation_module.Organisation_2,
              start_date=DateTime(2007, 2, 2),
              resource='product_module/product_B',
              quantity=-44,
              )

    fifth = self._makeOneInventory(
              title='Inventory 5',
              destination_value=self.organisation_module.Organisation_1,
              start_date=DateTime(2007, 2, 2),
              resource='product_module/product_C',
              quantity=55,
              )
    fifth_line = fifth.contentValues(portal_type='Inventory Line')[0]
    fifth_line.edit(
        variation_category_list=['colour/colour1', 'colour/colour2'],
        )
    base_id = 'movement'
    cell_key_list = list(fifth_line.getCellKeyList(base_id=base_id))
    for cell_key in cell_key_list:
      cell = fifth_line.newCell(base_id=base_id,
                                portal_type='Inventory Cell', 
                                *cell_key)
      cell.edit(mapped_value_property_list=['inventory'],
                inventory=66,
                predicate_category_list=cell_key,
                variation_category_list=cell_key)
    fifth.deliver()

    # services are ignored
    self._makeOneInventory(
              title='Inventory 6',
              simulation_state='delivered',
              destination_value=self.organisation_module.Organisation_1,
              start_date=DateTime(2007, 2, 2),
              resource='service_module/service_a',
              quantity=11,
              )

    self.tic()

    request = self.portal.REQUEST
    ################################
    # Don't Display Positive Stock
    ################################
    request.form['at_date'] = DateTime(2008, 4, 4)
863
    request.form['node_category'] = 'site/demo_site_A'
864 865 866 867 868 869 870 871
    request.form['positive_stock'] = 1
    line_list = \
      self.portal.inventory_module.Base_viewStockReportBySite.listbox.\
        get_value('default',
                  render_format='list', REQUEST=self.portal.REQUEST)

    data_line_list = [l for l in line_list if l.isDataLine()]
  
872
    self.assertEqual(2, len(data_line_list))
873 874 875 876 877
    
    self.checkLineProperties(
                   data_line_list[0],
                   resource_title='product_B',
                   resource_reference='ref 1',
Julien Muchembled's avatar
Julien Muchembled committed
878
                   variation_category_item_list=[],
879 880 881 882 883 884
                   inventory=-33,
                   quantity_unit='Kg')
    self.checkLineProperties(
                   data_line_list[1],
                   resource_title='product_A',
                   resource_reference='ref 2',
Julien Muchembled's avatar
Julien Muchembled committed
885
                   variation_category_item_list=[],
886 887 888 889 890 891
                   inventory=0,
                   quantity_unit='G')
    ################################
    # Don't Display Negative Stock
    ################################
    request.form['at_date'] = DateTime(2008, 4, 4)
892
    request.form['node_category'] = 'site/demo_site_A'
893 894 895 896 897 898 899 900 901 902
    request.form['positive_stock'] = 0
    request.form['negative_stock'] = 1
    
    line_list = \
      self.portal.inventory_module.Base_viewStockReportBySite.listbox.\
        get_value('default',
                  render_format='list', REQUEST=self.portal.REQUEST)

    data_line_list = [l for l in line_list if l.isDataLine()]
  
903
    self.assertEqual(3, len(data_line_list))
904 905 906 907
    self.checkLineProperties(
                   data_line_list[0],
                   resource_title='product_A',
                   resource_reference='ref 2',
Julien Muchembled's avatar
Julien Muchembled committed
908
                   variation_category_item_list=[],
909 910 911 912 913 914
                   inventory=0,
                   quantity_unit='G')
    self.checkLineProperties(
                   data_line_list[1],
                   resource_title='variated product',
                   resource_reference='ref 3',
Julien Muchembled's avatar
Julien Muchembled committed
915
                   variation_category_item_list=['colour1'],
916 917 918 919 920 921
                   inventory=66,
                   quantity_unit='')
    self.checkLineProperties(
                   data_line_list[2],
                   resource_title='variated product',
                   resource_reference='ref 3',
Julien Muchembled's avatar
Julien Muchembled committed
922
                   variation_category_item_list=['colour2'],
923 924 925 926 927 928
                   inventory=66,
                   quantity_unit='')
    ################################
    # Don't Display Zero Stock
    ################################
    request.form['at_date'] = DateTime(2008, 4, 4)
929
    request.form['node_category'] = 'site/demo_site_A'
930 931 932 933 934 935 936 937 938 939
    request.form['positive_stock'] = 0
    request.form['negative_stock'] = 0
    request.form['zero_stock'] = 1
    line_list = \
      self.portal.inventory_module.Base_viewStockReportBySite.listbox.\
        get_value('default',
                  render_format='list', REQUEST=self.portal.REQUEST)

    data_line_list = [l for l in line_list if l.isDataLine()]
  
940
    self.assertEqual(3, len(data_line_list))
941 942 943 944
    self.checkLineProperties(
                   data_line_list[0],
                   resource_title='product_B',
                   resource_reference='ref 1',
Julien Muchembled's avatar
Julien Muchembled committed
945
                   variation_category_item_list=[],
946 947 948 949 950 951
                   inventory=-33,
                   quantity_unit='Kg')
    self.checkLineProperties(
                   data_line_list[1],
                   resource_title='variated product',
                   resource_reference='ref 3',
Julien Muchembled's avatar
Julien Muchembled committed
952
                   variation_category_item_list=['colour1'],
953 954 955 956 957 958
                   inventory=66,
                   quantity_unit='')
    self.checkLineProperties(
                   data_line_list[2],
                   resource_title='variated product',
                   resource_reference='ref 3',
Julien Muchembled's avatar
Julien Muchembled committed
959
                   variation_category_item_list=['colour2'],
960 961 962 963
                   inventory=66,
                   quantity_unit='')
    
                   
964 965 966 967 968
    ################################
    # Don't Display Positive Stock
    # And Negative Stock
    ################################
    request.form['at_date'] = DateTime(2008, 4, 4)
969
    request.form['node_category'] = 'site/demo_site_A'
970 971 972 973 974 975 976 977 978 979
    request.form['positive_stock'] = 1
    request.form['negative_stock'] = 1
    request.form['zero_stock'] = 0
    line_list = \
      self.portal.inventory_module.Base_viewStockReportBySite.listbox.\
        get_value('default',
                  render_format='list', REQUEST=self.portal.REQUEST)

    data_line_list = [l for l in line_list if l.isDataLine()]
  
980
    self.assertEqual(1, len(data_line_list))
981 982 983 984
    self.checkLineProperties(
                   data_line_list[0],
                   resource_title='product_A',
                   resource_reference='ref 2',
Julien Muchembled's avatar
Julien Muchembled committed
985
                   variation_category_item_list=[],
986 987 988 989 990 991
                   inventory=0,
                   quantity_unit='G')
    ########################################
    # Don't Display Positive And Zero Stock
    ########################################
    request.form['at_date'] = DateTime(2008, 4, 4)
992
    request.form['node_category'] = 'site/demo_site_A'
993 994 995 996 997 998 999 1000 1001 1002
    request.form['positive_stock'] = 1
    request.form['negative_stock'] = 0
    request.form['zero_stock'] = 1
    line_list = \
      self.portal.inventory_module.Base_viewStockReportBySite.listbox.\
        get_value('default',
                  render_format='list', REQUEST=self.portal.REQUEST)

    data_line_list = [l for l in line_list if l.isDataLine()]
  
1003
    self.assertEqual(1, len(data_line_list))
1004 1005 1006 1007
    self.checkLineProperties(
                   data_line_list[0],
                   resource_title='product_B',
                   resource_reference='ref 1',
Julien Muchembled's avatar
Julien Muchembled committed
1008
                   variation_category_item_list=[],
1009 1010 1011 1012 1013 1014
                   inventory=-33,
                   quantity_unit='Kg')
    ########################################
    # Don't Display Negative And Zero Stock
    ########################################
    request.form['at_date'] = DateTime(2008, 4, 4)
1015
    request.form['node_category'] = 'site/demo_site_A'
1016 1017 1018 1019 1020 1021 1022 1023 1024 1025
    request.form['positive_stock'] = 0
    request.form['negative_stock'] = 1
    request.form['zero_stock'] = 1
    line_list = \
      self.portal.inventory_module.Base_viewStockReportBySite.listbox.\
        get_value('default',
                  render_format='list', REQUEST=self.portal.REQUEST)

    data_line_list = [l for l in line_list if l.isDataLine()]
  
1026
    self.assertEqual(2, len(data_line_list))
1027 1028 1029 1030
    self.checkLineProperties(
                   data_line_list[0],
                   resource_title='variated product',
                   resource_reference='ref 3',
Julien Muchembled's avatar
Julien Muchembled committed
1031
                   variation_category_item_list=['colour1'],
1032 1033 1034 1035 1036 1037
                   inventory=66,
                   quantity_unit='')
    self.checkLineProperties(
                   data_line_list[1],
                   resource_title='variated product',
                   resource_reference='ref 3',
Julien Muchembled's avatar
Julien Muchembled committed
1038
                   variation_category_item_list=['colour2'],
1039 1040 1041 1042 1043 1044
                   inventory=66,
                   quantity_unit='')
    ################################################
    # Don't Display Positive,Negative And Zero Stock
    ################################################
    request.form['at_date'] = DateTime(2008, 4, 4)
1045
    request.form['node_category'] = 'site/demo_site_A'
1046 1047 1048 1049 1050 1051 1052
    request.form['positive_stock'] = 1
    request.form['negative_stock'] = 1
    request.form['zero_stock'] = 1
    line_list = \
      self.portal.inventory_module.Base_viewStockReportBySite.listbox.\
        get_value('default',
                  render_format='list', REQUEST=self.portal.REQUEST)
Romain Courteaud's avatar
Romain Courteaud committed
1053

1054 1055
    data_line_list = [l for l in line_list if l.isDataLine()]
  
1056
    self.assertEqual(0, len(data_line_list))
1057 1058

    
1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100
  def test_Folder_generateWorkflowReport(self):
    # Create sales orders
    first = self._makeOneSaleOrder(
              title='SO 1',
              destination_value=self.organisation_module.Organisation_1,
              destination_section_value=self.organisation_module.Organisation_1,
              destination_decision_value=self.organisation_module.Organisation_1,
              source_value=self.organisation_module.Organisation_2,
              source_section_value=self.organisation_module.Organisation_2,
              source_decision_value=self.organisation_module.Organisation_2,
              start_date=DateTime(2006, 2, 2),
              resource_dict = {'product_module/product_A':{"quantity":11, "price":3},
                               'product_module/product_B':{"quantity":7, "price":6},}
              )
    second = self._makeOneSaleOrder(
              title='SO 2',
              destination_value=self.organisation_module.Organisation_1,
              destination_section_value=self.organisation_module.Organisation_1,
              destination_decision_value=self.organisation_module.Organisation_1,
              source_value=self.organisation_module.Organisation_2,
              source_section_value=self.organisation_module.Organisation_2,
              source_decision_value=self.organisation_module.Organisation_2,
              start_date=DateTime(2007, 2, 2),
              resource_dict = {'product_module/product_A':{"quantity":3, "price":3},}
              )
    third = self._makeOneSaleOrder(
              title='SO 4',
              destination_value=self.organisation_module.Organisation_1,
              destination_section_value=self.organisation_module.Organisation_1,
              destination_decision_value=self.organisation_module.Organisation_1,
              source_value=self.organisation_module.Organisation_2,
              source_section_value=self.organisation_module.Organisation_2,
              source_decision_value=self.organisation_module.Organisation_2,
              start_date=DateTime(2007, 2, 2),
              resource_dict = {'product_module/product_A':{"quantity":17, "price":3},
                               'product_module/product_B':{"quantity":13, "price":6},},
              cancel=True
              )
    
    # call the report first, it will set selection
    report_html = \
        self.portal.sale_order_module.Folder_generateWorkflowReport()
1101
    self.assertFalse('Site Error' in report_html)
1102 1103 1104 1105 1106

    line_list = self.portal.sale_order_module.Folder_viewWorkflowReport.listbox.\
        get_value('default',
                  render_format='list', REQUEST=self.portal.REQUEST)
    data_line_list = [l for l in line_list if l.isDataLine()]
1107
    self.assertEqual(8, len(data_line_list))
1108 1109
    order_workflow_name = 'Sale Order - Order Workflow'
    causality_workflow_name = 'Sale Order - Causality Workflow'
1110
    self.checkLineProperties(data_line_list[0],
1111
                             translated_portal_type=order_workflow_name)
1112 1113 1114 1115 1116 1117 1118 1119 1120
    self.checkLineProperties(data_line_list[1],
                             translated_portal_type='',
                             state='Cancelled',
                             count=1)
    self.checkLineProperties(data_line_list[2],
                             translated_portal_type='',
                             state='Draft',
                             count=2)
    self.checkLineProperties(data_line_list[3],
1121
                             translated_portal_type=causality_workflow_name)
1122
    self.checkLineProperties(data_line_list[4],
1123 1124 1125 1126 1127 1128
                             translated_portal_type='',
                             state='Draft',
                             count=3)
    self.checkLineProperties(data_line_list[5],
                             translated_portal_type='All')
    self.checkLineProperties(data_line_list[6],
1129 1130 1131
                             translated_portal_type='',
                             state='Cancelled',
                             count=1)
1132
    self.checkLineProperties(data_line_list[7],
1133 1134
                             translated_portal_type='',
                             state='Draft',
1135
                             count=5)
1136 1137


Romain Courteaud's avatar
Romain Courteaud committed
1138 1139 1140 1141 1142
def test_suite():
  suite = unittest.TestSuite()
  suite.addTest(unittest.makeSuite(TestTradeReports))
  return suite