1. 06 Mar, 2024 35 commits
  2. 05 Mar, 2024 5 commits
    • Jérome Perrin's avatar
      *: refactor edit_order of Base._edit · 6c2bffed
      Jérome Perrin authored
      Instead of overriding the method and adjusting edit order in some class,
      define "_default_edit_order" as a class value and use it in Base._edit
      as default value when caller do not explicitly pass edit_order.
      
      This was made to keep the default edit order consistent with the order
      of edits on python2 for properties where the edit order matters.
      
      This affects mostly scripts, when for example in a script we do:
      
        delivery.edit(start_date=d, stop_date=d)
      
      on python2 without PYTHONHASHSEED, stop_date is also set, so we keep
      this behavior (that is assumed by some tests).
      
      We also change the order of edit for other properties not constraint
      by edit_order to edit them in alphabetic order, to have a constant
      deterministic behavior.
      Co-authored-by: Kazuhiko Shiozaki's avatarKazuhiko SHIOZAKI <kazuhiko@nexedi.com>
      6c2bffed
    • Jérome Perrin's avatar
      accessor_holder: respect the order of property_sheets when building class · 37049166
      Jérome Perrin authored
      Because this was using a set, the order in which property sheets were
      used when generating classes was not deterministic.
      This can make a different if two property sheets define the same
      property. This was the case for short_title property, which was defined
      with different default values in DublinCore and SimpleItem property
      sheets. With this change the behavior is always same when hash
      randomization is enabled.
      
      Property sheets can be defined in classes or on the portal type. The
      test only covers the case that a property defined on the portal type
      must override the same property defined on a class, but the expected
      behavior is also that property sheets defined on a class override
      property sheets from parent class.
      37049166
    • Jérome Perrin's avatar
      ERP5Type/Base: execute workflow interactions in alphabetic order · bfc4f46e
      Jérome Perrin authored
      With a perfect configuration, this should probably does not matter,
      because the order of interactions should not be important (if there
      are dependencies they should be handled more explicitly), but this
      makes the behavior deterministic.
      Co-authored-by: Kazuhiko Shiozaki's avatarKazuhiko SHIOZAKI <kazuhiko@nexedi.com>
      bfc4f46e
    • Jérome Perrin's avatar
      base: fix movement_resource_interaction_workflow · 5a5320fe
      Jérome Perrin authored
      movement.hasCategory('quantity_unit') was always false, it was a
      misunderstanding of hasCategory API. This was working anyway because
      of the order of edit (which depends on iteration order of **kw arguments
      passed to edit), this was only working when quantity unit was set before
      resource.
      
      ( this was revealed by test_01_quantity_unit_copied from testInvoice
      running on python2 with PYTHONHASHSEED=164 )
      5a5320fe
    • Jérome Perrin's avatar
      property_sheets: set default value on SimpleItem.short_title · 3ccfa0f1
      Jérome Perrin authored
      We have DublinCore.short_title and SimpleItem.short_title, make the two
      use the same default value for consistency.
      3ccfa0f1