1. 24 Feb, 2022 9 commits
    • Jérome Perrin's avatar
      configurator: create account matching constraint · f14403d5
      Jérome Perrin authored
      Because we want to check consistency on all documents created by
      configurator, we also need documents created during the test to be
      consistent (or deleted)
      f14403d5
    • Jérome Perrin's avatar
      *: fix trade phase duplication in erp5_simulation_test and erp5_configurator_standard_categories · 416c6212
      Jérome Perrin authored
      We had trade phase duplication:
       - `trade_phase/default/*` were provided by erp5_simulation_test
       - `trade_phase/trade/*` are provided by erp5_configurator_standard_categories
      
      so the former was only for testing and the later were actually used in
      instance configured by configurator.
      
      But in some paths from configurator_standard_*template, which are also
      used on configurated instances, were using trade_phase/default (the one
      from test). Some rules were referencing these categories, but apparenlty
      not using them.
      
      To fix this confusion, use trade_phase/trade/* everywhere, and install
      erp5_configurator_standard_categories where needed in tests.
      416c6212
    • Jérome Perrin's avatar
      configurator: fix some BusinessConfiguration methods · d4a9d1c3
      Jérome Perrin authored
      BusinessConfiguration have a resource category, but it's the workflow,
      it's not really a resource, so some APIs from the base Amount class are
      not available. Because they have no meaning on BusinessConfiguration
      anyway, define the broken APIs to return nothing.
      
      This fixes errors trying to use check_consistency alarm on Business
      Configurations.
      d4a9d1c3
    • Jérome Perrin's avatar
    • Jérome Perrin's avatar
      administration: Extend check_consistency alarm to check tools as well as modules · 2bc5d232
      Jérome Perrin authored
      Tools also contain documents, so it makes sense to check them as well
      2bc5d232
    • Jérome Perrin's avatar
      *knowledge_pad: fix some gadget instances properties types · 2e00d49f
      Jérome Perrin authored
      These documents were probably edited before they had correct property
      sheets, because they had local properties as incorrect type, as reported
      by PropertyTypeValidity:
      
          <ERP5Type.ConsistencyMessage for PropertyTypeValidity type_check on portal_gadgets/erp5_persons (message: Attribute gadget_type should be of type lines but is of type <type 'str'>)>
          <ERP5Type.ConsistencyMessage for PropertyTypeValidity type_check on portal_gadgets/erp5_gadget_new_sale_opportunity (message: Attribute gadget_type should be of type lines but is of type <type 'str'>)>
          <ERP5Type.ConsistencyMessage for PropertyTypeValidity type_check on portal_gadgets/erp5_gadget_contact_person (message: Attribute gadget_type should be of type lines but is of type <type 'str'>)>
      2e00d49f
    • Jérome Perrin's avatar
      core: define Domain_getPriceCalculationOperandDict · 1295ecb0
      Jérome Perrin authored
      This disable price lookup on domains, because it errors and because the
      meaning is not clear.
      
      It errors because Domains are MetaResources, so they are subclass of
      Resource and they inherit the price lookup mechanism, which does not
      work on domains because of their different `getRelativeUrl` implementation.
      1295ecb0
    • Jérome Perrin's avatar
      configurator_standard: sense check consistency alarm after configurator · 2a54b345
      Jérome Perrin authored
      check_consistency alarm checks that every document created satisfy
      contraints. This is done in order to verify that configurator it self
      create consistent documents and also that all default documents from a
      realistic configuration are consistent.
      2a54b345
    • Jérome Perrin's avatar
      configurator: use _createConstraintMessage for all configurator item · 6d4cf452
      Jérome Perrin authored
      the API is not to return a list of strings, but a list of ConsistencyMessage
      6d4cf452
  2. 23 Feb, 2022 2 commits
    • Vincent Pelletier's avatar
      ERP5{,Type.Core}.InteractionWorkflow: Deprecate activeScript. · a4ffa1a7
      Vincent Pelletier authored
      Replace it with a method on ERP5Type.Base so these activities get found
      by CopySupport.unindexObject and flushed, rather than remaining on the
      interaction workflow's context and failing when run.
      It seems a lot more likely for a document to be deleted while interactions
      are being spawned than an interaction workflow itself. So this should be
      a net benefit in activity stability.
      a4ffa1a7
    • Vincent Pelletier's avatar
      ERP5TypeFunctionalTestCase: Improve initial login realism. · 95db27a8
      Vincent Pelletier authored
      This currently only works because CookieCrumbler reacts on *all* urls which
      contain the magic login & password fields. But the POST request body lacks
      any value from submit fields, which bypasses the "logged-in" scripts, which
      is harmless with current code but lack realism.
      95db27a8
  3. 22 Feb, 2022 1 commit
  4. 21 Feb, 2022 13 commits
    • Gabriel Monnerat's avatar
      erp5_ingestion: Use script and type based method to add or not published state · 661a3bfe
      Gabriel Monnerat authored
      The initial idea was that publishing documents is something really exceptional, the "attach document" normal use case is typically use cases like attaching a PDF invoice to an invoice document in accounting, ie. most of the time it's with sensitive information that we don't want users to be mistakenly publish on the internet just because they selected a wrong value in the field.
      
      Now we have a project with use cases where the attached documents needs to be published, we did not change our mind that publishing an attached document is an exceptional case, but we want to make it possible to configure so that in certain contexts, publishing documents is possible.
      
      So we reuse the existing configuration by type based method idea and when the getPreferredAttachedDocumentPublicationState returns "published" we make it possible to publish by default.
      661a3bfe
    • Jérome Perrin's avatar
      SecurityTestCase: fix username / user_id confusion · 9371393b
      Jérome Perrin authored
      Theses methods have always been using user_id, but where written at
      a time where there was not such disctinction
      9371393b
    • Jérome Perrin's avatar
      SecurityTestCase: minor simplifications · 913e0ba7
      Jérome Perrin authored
      913e0ba7
    • Jérome Perrin's avatar
      SecurityTestCase: update assertion failure message for new workflow API · 08f88c59
      Jérome Perrin authored
      This test case tries to provide message helpful for debugging in case
      of assertion failure for assertUserCanPassWorkflowTransition, but
      this was not correctly using new workflow API and in case of failure
      there was an error like this:
      
        File ".../custom/test.py"
          self.assertUserCanPassWorkflowTransition(user, 'stop_action', packing_list)
        File "product/ERP5Type/tests/SecurityTestCase.py", line 237, in failUnlessUserCanPassWorkflowTransition
          if wf_transition.trigger_type == TRIGGER_USER_ACTION:
      AttributeError: 'NoneType' object has no attribute 'trigger_type'
      
      The previous implementation was using getGuardSummary, which no
      longer exist in new workflow, so we implement similar logic here.
      
      The new message changes a bit, it now look like this:
      
          AssertionError: User X can NOT pass stop_action transition on Internal Packing List at /erp5/internal_packing_list_module/20220218-22A38 (draft on delivery_causality_workflow, draft on internal_packing_list_notification_workflow, started on packing_list_workflow).
           Roles: [Owner, Member, Authenticated, Associate]
           Available transitions:
                    deliver_action[packing_list_workflow]
                          Expression:
                          Permissions:
                          Groups:
                  * stop_action[packing_list_workflow]
                          Expression: python: not(state_change['object'].getPortalType() == "Sale Packing List" and state_change['object'].getSimulationState() == "confirmed")
                          Permissions:
                          Groups:
      08f88c59
    • Jérome Perrin's avatar
      SecurityTestCase: type annotations · eacea55f
      Jérome Perrin authored
      eacea55f
    • Jérome Perrin's avatar
      tests: fix counting selenium failures · 20408c24
      Jérome Perrin authored
      1b1dbf60 (tests: also consider python unittest failures in
      functional tests, 2021-06-16) was not counting properly the cases
      where we have selenium failures. In that case we only want to count
      selenium failures, if we add with the python failures from
      status_dict, we report one extra failures.
      
      The correct approach is to count selenium failures if any and otherwise
      count python failures
      Co-authored-by: Vincent Pelletier's avatarVincent Pelletier <vincent@nexedi.com>
      20408c24
    • Vincent Pelletier's avatar
    • Vincent Pelletier's avatar
    • Vincent Pelletier's avatar
      testOfficeJSSDKConfigurator: Get core business template list from portal. · c87a57b1
      Vincent Pelletier authored
      Avoids duplicating items from that list.
      c87a57b1
    • Vincent Pelletier's avatar
      Base_getUpgradeBusinessTemplateList: Include core business templates. · 92684364
      Vincent Pelletier authored
      Both so that changes to the list of core business templates are applied on
      upgrade, and to avoid uninstalling core business templates, if no other
      maintained-up-to-date business templates depend on them.
      Also, improve the documentation of the erp5_upgrader version of this
      script.
      92684364
    • Vincent Pelletier's avatar
      Products.ERP5.ERP5Site: Declare getCoreBusinessTemplateList public. · abb6a210
      Vincent Pelletier authored
      But make it non-publishable.
      abb6a210
    • Vincent Pelletier's avatar
      erp5_configurator: Refactor PortalTypeConfiguratorItem. · 63b1b1ac
      Vincent Pelletier authored
      The main reason is to use portal type setters, and not set the properties
      directly: setting the properties directly bypasses interactions which
      trigger type refresh, which hence prevents such changes from being applied
      to the types until something else would cause a reload.
      While at it:
      - modify the property sheet list once only instead of once per added
        property sheet
      - only modify the property sheet list when fixit is true
      - improve constraint message to actually tell what is being detected
      - do not report a constraint error when no change is necessary
      - follow naming conventions: avoid abbreviations, variables holding
        documents must end in "_value"
      - avoid single-use local variables
      63b1b1ac
    • Vincent Pelletier's avatar
      Revert "Products.CMFActivity.ActivityTool: Remove dependency on portal_catalog owner." · d2821caa
      Vincent Pelletier authored
      This reverts commit 77b3f202.
      For some obscure reason, this affects unit tests related to inventory
      unit conversion. There seems to be too much code to cleanup to keep this
      patch for now, so drop it.
      d2821caa
  5. 18 Feb, 2022 2 commits
  6. 17 Feb, 2022 7 commits
  7. 16 Feb, 2022 6 commits