Skip to content
Snippets Groups Projects
  1. Jul 03, 2017
  2. Jul 02, 2017
    • Géry Debongnie's avatar
      [FIX] web: protect logged object in mockserver · 690446b5
      Géry Debongnie authored
      Before this commit, when whe loglevel was set to 2 in the mock server,
      we simply logged the parameters in the console, then give the same
      object to the _performRpc route.  Most of the time, it is not an issue,
      but nothing prevents the _performRpc route to modify the args object.
      
      And this happens with the /create route, which is very confusing: when
      we have a breakpoint/debugger in the mock rpc function in a test, we see
      the correct arguments passed to the function.  However, if we look at
      the arguments in the console, after the end of the test, we see other
      values (for all fields) in the args.args[0] object.
      
      The solution is to simply deep copying everything, so any modification
      in the mockserver will not affect the logged object.
      690446b5
  3. Jun 29, 2017
    • Cédric Snauwaert's avatar
      [ADD] web: add parse monetary method · 07fdcad3
      Cédric Snauwaert authored
      In field_utils, the parse monetary method was remapped to parsefloat. In this commit, we add a specific parseMonetary method to handle currency specific formatting.
      07fdcad3
    • Aaron Bohy's avatar
      [FIX] web: handle 'domain' key returned by onchanges · 8473bde8
      Aaron Bohy authored
      Onchange RPCs return an object that may contain a 'domain' key.
      When it does, its value is an object whose keys are field names and
      values are the new domain for the corresponding field.
      
      Before this rev., the 'domain' key was totally ignored by the
      BasicModel. This feature is used for example in the account.payment
      form view (go to an open invoice, click on 'Register payment'): the
      domain of field payment_method_id is updated by the onchanges (e.g.
      when changing the journal_id). As the domain was ignored, it always
      displayed all possible payment methods.
      8473bde8
    • Aaron Bohy's avatar
      [FIX] web: BasicModel: send correct context · b954cd64
      Aaron Bohy authored
      ... when reading and writing on a record (especially inside lists).
      
      Before this rev., the context sent when reading a record, and when
      writing records inside lists (editable list views) wasn't correct.
      This caused an issue in Sales > Products (variant activated) >
      open a product with variants > click on variant prices > edit the
      prices of a variant: the value wasn't saved correctly (because the
      inverse function requires 'active_id' to be in the context and it
      wasn't the case).
      b954cd64
    • Aaron Bohy's avatar
      [FIX] web: mockServer and mockEnvironment · 2846887e
      Aaron Bohy authored
      Fixes two issues in the test environment:
      
      - for unset fields, the mockRead is supposed to return 0 (numerical
        fields), empty array (x2many fields) or false (otherwise). Except
        for the first case, it was returning undefined, and this might
        cause crashes when evaluating contexts or domains.
      - the mock environment allows overriding some global properties
        like the session, for the test case only. Once the widget is
        destroyed, those global properties are reset to their original
        value. This wasn't working for models tests, because the destroy
        function of the parent widget was never called. This could make
        tests fail as they could have been impacted by other tests.
      2846887e
    • Géry Debongnie's avatar
      [FIX] web: prevent dirty state after test · 514c8e5c
      Géry Debongnie authored
      The test changed in this commit had a big issue: it did not properly
      destroy the second form view that it created.  Because of that, it was
      still alive and could interact with other tests, such as the barcode
      tests.
      
      This is what happened:
      1. var form was assigned to a form view
      2. form was destroyed
      3. in a try catch, form was reassigned to the result of createView, but
      the evaluation of createView crashed (after creating a form view), so the
      assignation was not done, and the var form was still pointing to the first
      form view
      4. form.destroy is called, which did nothing for the second form view.
      
      There is no easy way to get the reference to the form view created by
      createView without changing some other code, so we simply remove the
      second part of the test, which was not particularly important.
      514c8e5c
  4. Jun 28, 2017
    • Martin Geubelle's avatar
      [FIX] web: deal with reference fields · ec3bc2ee
      Martin Geubelle authored
      The reference fields haven't been correctly implemented with the new views.
      This commit restores their behaviour.
      
      Note that an small improvement has been introduced in this commit.
      Before saas-16, a `name_get` was done for each record (so 80 if the field
      was displayed in a full list view), which is not optimal. The calls are now
      batched by model (so one `name_get` by model appearing in the field values).
      ec3bc2ee
    • Martin Geubelle's avatar
      [FIX] web: FieldText: keep editing the textarea after enter · 157732cf
      Martin Geubelle authored
      In the editable list, when pressing enter, the cursor goes to the next line and
      the current row is saved.
      
      This should not be the case for a textarea (i.e. in the FieldText widget). In
      this particular case, we just want to continue editing the textarea.
      157732cf
    • xmo-odoo's avatar
      [FIX] PO translations export · 98602e93
      xmo-odoo authored
      Within the scope of P3 compatibility, a StringIO was replaced by
      BytesIO in b4429c2a, however I missed
      that BytesIO is much stricter about types than StringIO *even in
      Python 2*. Some bits of text would sneak up in PoFile.write or
      PoFile.write_info and blow up the export.
      
      The BytesIO makes sense for output (tgz is definitely not a text
      format and base64 is a bytes -> bytes encoding), but ensuring the
      entirety of PoFile worked on bytes seemed distasteful (and lots of
      changes), it seemed more sensible at all levels that PoFile would make
      sure to properly work on *text*, and to add a text adapter wrapper
      around the BytesIO buffer.
      
      io.TextIOWrapper was almost perfect (it closes the underlying stream
      on close but that can be worked around) *however* it turns out
      TextIOWrapper does not work on Python 2's `file` objects... so use the
      older codecs.StreamReaderWriter which should be able to do the job
      properly.
      
      fixes #17834
      98602e93
    • Martin Trigaux's avatar
      [I18N] export base source terms · 81ff060f
      Martin Trigaux authored
      81ff060f
    • Darshan Kalola's avatar
      [FIX] web_editor: make html widget translatable · 7ada921e
      Darshan Kalola authored
      The translate feature of widgets html and html_frame had been
      broken by the new views refactoring. This commit restores it for
      the html widget, and removes it completely for html_frame as it
      wasn't working correctly before the new views anyway (moreover,
      it had already been disabled for mass_mailing: de403dc1).
      
      This commit also ensures that the changes are correctly saved for
      the html_frame widget. Note that this widget still needs to be
      converted to our new coding guidelines.
      7ada921e
    • Adrien Dieudonne's avatar
      [FIX] web: test wrongly adapted in ceff4d46 · 9f4922a8
      Adrien Dieudonne authored
      A test has been adapted in ceff4d46 whereas it shoudn't.
      Indeed this commit doesn't change anything in the case of 'Discard'
      button clicked.
      9f4922a8
    • Adrien Dieudonne's avatar
      [FIX] web: basic_controller: wait for the mutex before discard changes · ceff4d46
      Adrien Dieudonne authored
      Before this commit, the discard confirm dialog was directly shown
      without waiting for the write RPC. For instance, it the user clicked on 'Save'
      after editing a record, and then directly clicked on another menu or on the
      breadcrumb before the write RPC returned, the record was still considered
      as dirty and thus the confirm dialog was displayed. We now wait for the RPC
      to return before checking if the record is dirty, so that the confirm dialog
      is only displayed when the record is actually dirty.
      ceff4d46
  5. Jun 27, 2017
    • Aaron Bohy's avatar
      [FIX] mail: discuss: correctly bind handler · df45cf65
      Aaron Bohy authored
      df45cf65
    • Aaron Bohy's avatar
      [FIX] web: apps: correctly use this._rpc · 964b7c37
      Aaron Bohy authored
      session.rpc should not be used anymore. The function '_rpc'
      available on widgets should be used instead (with the correct
      params).
      
      Also, 'session' is no longer a widget attribute.
      964b7c37
    • Aaron Bohy's avatar
      [FIX] web: FieldSelection on m2o: unset value · 9fbed634
      Aaron Bohy authored
      When the value of a many2one field with widget selection was unset,
      it's value wasn't actually set to false in the BasicModel. It was
      set to a virtual id like 'virtual_294' instead. This caused a
      traceback when this value was sent to the server, obviously.
      
      This was for example the case of the Register Payment form view
      (accessible from a customer invoice), when the user selected a
      payment journal, and then unselected it (the virtual id was then
      sent to the onchange RPC).
      9fbed634
    • Aaron Bohy's avatar
      [FIX] web: MonetaryField: rerender with currency · 7ea6f653
      Aaron Bohy authored
      The MonetaryField can be rendered with or without a currency. The
      currency can change during the lifecyle of the widget (e.g.
      currency field in the view, whose value is set by an onchange).
      More precisely, the widget can be instantiated without currency,
      then a change on another field can trigger an onchange which sets
      the currency, and our monetary widget is re-rendered with a
      currency.
      
      Before this rev., this wasn't supported in edit mode because the
      $el's root node was different if there were a currency or not
      (it was an input if there were no currency, and a div containing
      an input and a span otherwise). This root node being rendered only
      once (at the creation of the widget), the widget wasn't re-rendered
      correctly if the currency was suddenly set or unset.
      
      This fix makes the widget behave uniformly whether or not there is
      a currency, so now it is always a div containing an input (and
      optionally a span if there is a currency).
      7ea6f653
    • Aaron Bohy's avatar
      [FIX] web: ViewManager: filter out some keys from context · 816a3cd2
      Aaron Bohy authored
      A traceback occured when trying to create a BOM by going to
      Inventory > Master Data > Products, on a product form view clicking
      on the BOM stat button, and then on 'Create'.
      
      This was a context problem: the context of the 'Products' action
      was passed to the 'BOM' action without removing action specific
      keys like 'default_*' or 'search_default_*'. For instance, it
      contained a 'default_type' key, and as type is also a field of the
      mrp.bom model, the python tried to interpret it, except that the
      given value wasn't a correct value for mrp.bom.
      
      When a button is clicked, we mix contexts coming from different
      places to execute the new action. For some of them, we already
      filtered out those action specific keys. This fix is simply to
      make the piece of context adding the problematic keys pass though
      the filter as well.
      816a3cd2
    • Aaron Bohy's avatar
      [FIX] web: BasicModel: correctly eval x2manys in domains · 4881f942
      Aaron Bohy authored
      When x2many fields have to be evaluated in domains (e.g. ['id',
      'in', some_x2many_field]), they must be evaluated as the list of
      ids in the relation (whereas in contexts, they are evaluated as a
      list of commands). Before this rev., they were always evaluated as
      a list of commands.
      
      Note that this didn't work neither before the new views.
      4881f942
    • Aaron Bohy's avatar
      [FIX] web: BasicModel: store changes in x2many as operations · 17e19815
      Aaron Bohy authored
      Datapoints of the BasicModel store the data fetched from the
      server and changes done (not saved yet) by the user. For x2many
      fields, datapoints are of type 'list' and have a 'res_ids' key
      containing the ids of all records in the relation. They also have a
      'data' key containing datapoints of type 'record', representing the
      records in the relation that have been fetched (with a limit set to
      40 or 80 depending on the subview used). So basically, the length
      of res_ids may be different than the length of data.
      
      Before this rev., the changes in x2manys were saved under the key
      '_changes' as a duplication of the content of 'data', i.e. same
      list of datapoints of type 'record', modulo the changes done (it
      contained the new records added and didn't contained the removed
      records, whereas the 'data' remained unchanged). This didn't worked
      at all when there were more records than the limit in the relation.
      Indeed, when this happened, the commands to send to the server
      couldn't be generated correctly.
      
      This rev. modifies the way changes are stored in those datapoints.
      Now, each change is stored as an operation. An operation could be
      of type 'ADD', 'REMOVE', 'REMOVE_ALL' or 'UPDATE'. As before,
      'data' remains unchanged and always keeps the datapoints of records
      that have been fetched (the ones that are currently displayed in
      the list or kanban subview). This way, commands can now be properly
      computed.
      
      This had a nice side-effect of fixing two other bugs linked to
      x2manys.
      First, when used in a context (e.g. {some_key: some_x2many_field}),
      the value of some_x2many_field (i.e. a list of commands) was always
      [] if the field was invisible="1" in the view, because it's
      subrecords weren't fetched, and the generated commands were based
      on them. Now, they are generated from the list of res_ids in the
      relation, so it works fine.
      Second, the x2many records are supposed to be sorted client-side,
      after being read, and after each edition. This was working in the
      first case, but not in the second. Now it's working even after
      a record edition.
      
      This rev. also correctly sets the 'parentID' and 'static' keys in
      datapoints.
      
      Finally, we also fixed the pager in x2manys as it was badly
      displayed (small less tweaks).
      17e19815
    • Christophe Simonis's avatar
    • Christophe Simonis's avatar
    • Quentin De Paoli's avatar
      [FIX] account: max_date field of partial reconciliation is a date, not a datetime. · d3ff2665
      Quentin De Paoli authored
      This field it is computing the max of 2 date fields, so it has to be a date too. This was messing in the aged receivable/payable reports.
      d3ff2665
    • Christophe Simonis's avatar
      b1f738d1
    • Adrien Dieudonne's avatar
      [FIX] *: reports: check required values for 'render_html' · 1e4f4299
      Adrien Dieudonne authored
      Some reports require additional information to render. When
      accessed in Odoo, the user has to fill a wizard to provide those
      information. However, when these reports were opened in Studio,
      it crashed as those information were missing (we don't pass
      through the configuration wizard in this case).
      
      This fix checks if all the required information are given before
      trying to render those reports, and it displays a warning in
      the logs in they are missing, which is better than a traceback.
      1e4f4299
    • Xavier Morel's avatar
      89a99407
    • Aaron Bohy's avatar
      [FIX] web: pyeval_tests: typo · 05282fd4
      Aaron Bohy authored
      Introduced by forwardport 34b432d5
      05282fd4
  6. Jun 26, 2017
    • Christophe Simonis's avatar
    • Christophe Simonis's avatar
      80775a73
    • Martin Trigaux's avatar
      [FIX] website_sale,website_crm: untranslated term · 4c66eae3
      Martin Trigaux authored
      opw-748880
      4c66eae3
    • Martin Trigaux's avatar
      [IMP] doc: warn gantt view is not available in community version · b1a3bb7d
      Martin Trigaux authored
      May be confusing for new users
      
      Closes #17817
      b1a3bb7d
    • Goffin Simon's avatar
      [FIX] mrp: Post inventory button without finished product" · d37ef94c
      Goffin Simon authored
      This fix 2e18070a66595a72a9a626a196c97a689832f667  has been done in stable and some customers
      wants to keep the button "Post Inventory" available all the time.
      Now the button is just visible in developper mode.
      
      opw:748347
      d37ef94c
    • Nicolas Martinelli's avatar
      [FIX] stock: incorrect ordered quantity · d6909f42
      Nicolas Martinelli authored
      - Create a stockable product, get 61 units in stock
      - Create a SO of 75 units, validate
      - In the picking, transfer only 50 units, validate and create a
        backorder
      - Print the Delivery Slip of the picking: it shows 61 units ordered
      - Print the Delivery Slip of the backorder: it shows 61 units ordered
      - Receive the 14 missing units, recheck availability on the backorder:
        it shows 25 units ordered
      
      The quantity ordered should be recomputed from the stock moves when a
      partial transfer is done.
      
      opw-747983
      d6909f42
    • Christophe Matthieu's avatar
      [FIX] payment: prevent access error for manual payments · 4d79a1ff
      Christophe Matthieu authored
      Rev. cf1df16a introduced new callback
      fields with restricted access. The lazy hash generation in create() was
      however causing access errors for manual transactions created by users
      who are not administrators (e.g. Accountants).
      
      Those manual transactions do not typically need a callback, but checking
      the presence of the callback requires a limited sudo() context.
      
      Similarly, the execute_callback() method may be called for a manual,
      non-admin transaction, and should not do anything if there is no
      callback, instead of crashing with an AccessError.
      
      The generation of the hash and execution of the callback should be done
      with a normal environment, though, as these must only be used for
      transactions run by the system.
      
      opw-747536
      4d79a1ff
    • Nicolas Martinelli's avatar
      [FIX] stock: empty state · 83174468
      Nicolas Martinelli authored
      - Update view with external_id=stock.view_move_picking_tree and remove
        editable attribute on the tree view.
      - Create a new picking
      - Add a line (form view will open) and click on "Save and close"
      
      => A traceback show up since 'scrapped' was not in the form view.
      
      - The picking location fields become readonly, and the status bar
        disappears
      - Save the picking
      
      => Error: "creation/update: a mandatory field is not correctly set :
         [object with reference: location_id - location.id]"
      
      Courtesy of @benwillig
      
      Closes #17738
      opw-748353
      83174468
    • Christophe Simonis's avatar
    • Pieczynski Marcin's avatar
      [CLA] signature for piemar1 · d86f134a
      Pieczynski Marcin authored
      Done at #17817
      d86f134a
    • Goffin Simon's avatar
      [FIX] stock_account: Invalid product price history breaks stock valuation · 51d072db
      Goffin Simon authored
      Steps to reproduce:
      
      1. Create a new Stockable Product
      2. Set cost price to 2.00
      3. Adjust stock to 10 pcs
      4. Enable developer mode
      5. Go to Inventory > Reports > Inventory at Date
      6. Select current time and retrieve the inventory value
      
      Bug:
      
      The stock valuation for the product was 0.0.
      
      Reason:
      
      When creating a stockable product, Odoo creates
      two price history entries with the same datetime
      but different cost. The stock valuation report only
      takes one of them into account.
      
      Fixes #14889
      
      opw:747857
      51d072db
Loading