1. 16 May, 2017 18 commits
  2. 15 May, 2017 2 commits
  3. 12 May, 2017 1 commit
  4. 11 May, 2017 3 commits
    • Xiaowu Zhang's avatar
    • Arnaud Fontaine's avatar
      Prevent 'draft' Solver Process from being created when there is already a 'solving' one (#KH-1107). · 2e2f59f7
      Arnaud Fontaine authored
        1. 'Solve Divergences' action:
           => Display Delivery_viewSolveDivergenceDialog.listbox:
              -> Delivery_getSolverDecisionList
                 -> Delivery_getSolverProcess => create Solver Process in 'draft' state and build Solver Decisions.
        2. Clicking 'Update' button updates Solver Decisions.
        3. Click 'Solve Divergences' button after either 'Adopt Prevision' or 'Accept Decision'.
           => SolverProcess.solve():
              Solver Process transit to 'solving' state and 'solve' Activity is created.
      
      Before this Activity is executed, user can still select 'Solve Divergences'
      action and this will create another 'Solver Process' as the current one is not
      in 'draft' state anymore. Moreover, another user can still 'Adopt Prevision'
      (while the first user selected 'Accept Decision') and this will be actually be
      applied despite the first user choice.
      
      Instead, create Solver Process when transiting to 'diverged' state and do not
      display 'Solve Divergences' button nor allow access to 'Solve Divergences
      Dialog' (Delivery_viewSolveDivergenceDialog) if there is a Solver Process in
      'solving' state.
      2e2f59f7
    • Arnaud Fontaine's avatar
      erp5_simulation: Display Divergence dialog even if there is nothing to solve... · 66cc5bfa
      Arnaud Fontaine authored
      erp5_simulation: Display Divergence dialog even if there is nothing to solve (same as legacy Simulation Dialog).
      
      This fixes the following Site Error when there is no Divergence to solve:
        AttributeError: 'NoneType' object has no attribute 'SolverProcess_getSolverDecisionList'
      
      This may happen if user selects 'Solve Divergence' Action and solve
      Divergences, then immediately goes back and selects again this action
      whereas there is actually no Divergence to solve.
      66cc5bfa
  5. 08 May, 2017 1 commit
  6. 05 May, 2017 1 commit
  7. 04 May, 2017 7 commits
  8. 02 May, 2017 6 commits
  9. 01 May, 2017 1 commit
    • Jérome Perrin's avatar
      upgrader: upgrade catalog schema right after installing BTs · ba541ad4
      Jérome Perrin authored
      93e30e5e introduce a  new `user` table that is listed as a *search table*, so until this table is created all catalog queries are failing, and alarm tool, which relies on catalog fail with such a traceback:
      
      ```
      ERROR TimerService Process timer error
      Traceback (most recent call last):
        File "parts/erp5/product/TimerService/TimerService.py", line 102, in process_timer
          DateTime(prev_tick), DateTime(next_tick))
        File "parts/erp5/product/ERP5/Tool/AlarmTool.py", line 175, in process_timer
          self.tic()
        File "parts/erp5/product/ERP5/Tool/AlarmTool.py", line 135, in tic
          for alarm in self.getAlarmList(to_active=1):
        File "parts/erp5/product/ERP5/Tool/AlarmTool.py", line 111, in getAlarmList
          alarm_date={'query':now,'range':'ngt'}
        File "parts/erp5/product/ERP5Catalog/CatalogTool.py", line 702, in unrestrictedSearchResults
          return ZCatalog.searchResults(self, **kw)
        File "parts/erp5/product/ZSQLCatalog/ZSQLCatalog.py", line 1091, in searchResults
          return catalog.searchResults(REQUEST, **kw)
        File "parts/erp5/product/ZSQLCatalog/SQLCatalog.py", line 2585, in searchResults
          **kw
        File "parts/erp5/product/ZSQLCatalog/SQLCatalog.py", line 2554, in queryResults
          **kw
        File "parts/erp5/product/ZSQLCatalog/SQLCatalog.py", line 2418, in buildSQLQuery
          ignore_unknown_columns=ignore_unknown_columns,
        File "parts/erp5/product/ZSQLCatalog/SQLCatalog.py", line 2394, in buildEntireQuery
          query=self.buildQuery(kw, ignore_empty_string=ignore_empty_string, ignore_unknown_columns=ignore_unknown_columns),
        File "parts/erp5/product/ZSQLCatalog/SQLCatalog.py", line 2295, in buildQuery
          result = self.buildSingleQuery(key, value)
        File "parts/erp5/product/ZSQLCatalog/SQLCatalog.py", line 2087, in buildSingleQuery
          search_key, related_key_definition = self.getColumnSearchKey(key, search_key_name)
        File "parts/erp5/product/ZSQLCatalog/SQLCatalog.py", line 2049, in getColumnSearchKey
          related_key_definition = self.getRelatedKeyDefinition(key)
        File "parts/erp5/product/ZSQLCatalog/SQLCatalog.py", line 1999, in getRelatedKeyDefinition
          for entire_definition in self.getSQLCatalogRelatedKeyList([key]):
        File "parts/erp5/product/ZSQLCatalog/SQLCatalog.py", line 1935, in getSQLCatalogRelatedKeyList
          column_map = self._getSQLCatalogRelatedKeySet()
        File "parts/erp5/product/ZSQLCatalog/SQLCatalog.py", line 130, in wrapper
          result = transactional_cache[cache_id] = method(wrapped_self)
        File "parts/erp5/product/ZSQLCatalog/SQLCatalog.py", line 1908, in _getSQLCatalogRelatedKeySet
          column_map = self.getColumnMap()
        File "parts/erp5/product/ZSQLCatalog/SQLCatalog.py", line 130, in wrapper
          result = transactional_cache[cache_id] = method(wrapped_self)
        File "parts/erp5/product/ZSQLCatalog/SQLCatalog.py", line 1146, in getColumnMap
          for field in table_dict[table]:
      KeyError: 'user'
      ```
      
      This means that even if upgrader's post upgrade constraint are supposed to fix this by calling `portal_catalog.upgradeSchema`, because this constraint rely on alarm tool, it's already too late.
      
      The suggested way to fix this is to also call [`portal_catalog.upgradeSchema`](https://lab.nexedi.com/nexedi/erp5/blob/c99fb9163503c5afdef59ecb124b3060b05330a4/bt5/erp5_upgrader/SkinTemplateItem/portal_skins/erp5_upgrader/TemplateTool_checkTableConsistency.py#L7) in the same transaction that the transaction upgrading business templates.
      
      I have not completely removed `TemplateToolTableConsistencyConstraint`, because maybe there will be cases where just call post upgrade alarm to execute data migration steps after installing a business template manually. But you guys think it's better to completely merge `TemplateToolTableConsistencyConstraint` with `TemplateToolBusinessTemplateInstallationConstraint` I would be OK with that too.
      
      Of course, we cannot just make
      `TemplateToolTableConsistencyConstraint` an `upgrade` constraint, because there would be no guarantee that it's called after `TemplateToolBusinessTemplateInstallationConstraint`.
      
      Also, I have not considered making [`getColumnMap` and friends](https://lab.nexedi.com/nexedi/erp5/blob/master/product/ZSQLCatalog/SQLCatalog.py#L1142) resilient to the case where a table listed in search tables does not exist, because it's would just have been failing later anyway and it's better to fail early in such case.
      
      cc: @vpelletier @jm @seb @tiwariayush @gabriel
      
      /reviewed-on !247
      ba541ad4