Commit Graph
109629 Commits
Author SHA1 Message Date
Christophe Matthieu ef35702cbc [FIX] web: remove some memory leak 2017-05-15 13:16:02 +02:00
Christophe Matthieu 1c5ea99b7b [FIX] web: display a translation alert when saving the form view
In the form view, when the user saves a record (with a multilang instance),
an alert is displayed to display all modified translatable fields.
2017-05-15 10:06:58 +02:00
David Monjoie b57283619c [FIX] web: display field node string in form dialog title
Previously, the string attribute of the field node was ignored
in the title of the form dialog and it always displayed the
string value of the python field definition instead, which is
a default value instead.

Additionally, I took this opportunity to add tests for other
similar dialog titles which actually worked already with the
string attribute of the field node but were not tested yet.
2017-05-12 14:53:48 +02:00
David Monjoie 42d95cbfc3 [FIX] web: keep focus on checkboxes after rerendering
Previously, when a checkbox was re-rendered, it was losing focus
since it was removed and re-created. Now, if the checkbox itself
is the origin point of the re-rendering, we give the focus to the
newly re-rendered checkbox, resulting in a seamless experience
just as if the checkbox was never removed and re-rendered.
2017-05-12 14:53:48 +02:00
Géry Debongnie 310588b813 [FIX] web: prevent duplicated footers in dialogs
In some cases, we had duplicated footers in form view dialogs.  It
actually happened when the view was reloaded, which is not particularly
frequent, but happens most of the time the user clicks on an action
button, which does not close the window.

To reproduce the issue, you can open the lunch module, click on the
'Feeling Lucky' button.  It will open a form view with a special button
in the footer: 'I'm feeling lucky'.  Clicking on that button will return
an error (no order matches the criterion), and will trigger a form
reload.  Then, you will see two footers: one in the modal footer, the
other one in the form renderer.

The solution to this issue is to make sure, when we update the view and
a footer tag is found in the form renderer, to replace the current
footer buttons by these new buttons.
2017-05-12 14:05:17 +02:00
Jérome Maes e7e8ecc77b [FIX] project_timesheet_holidays: fix tests
Handling datetime is not a good idea, mostly
when computing different in terms of days.
Forcing the hour (time) will set the tests correctly
regarding the working hours, and the datetime
difference, independently of the execution time
of the test.
2017-05-11 18:27:33 +02:00
Thibault Delavallée 0d4ed7abf5 [FIX] hr_timesheet: compute default employee at create instead of having a default value
This way existing analytic lines won't have to set the current user
as employee when installing hr_timesheet module.
2017-05-11 17:25:41 +02:00
Jérome Maes 0c9c530233 [IMP] sale_timesheet: add test for revenue computation 2017-05-11 16:58:58 +02:00
Jérome Maes dcd7b0f5c3 [FIX] sale_timesheet: correctly handle multi currency and rounding 2017-05-11 16:58:45 +02:00
Jérome Maes fa0769c41c [IMP] project_timesheet_holidays: add tests
Tests to check the timesheet generation
when validating leaves.
2017-05-11 16:58:37 +02:00
Jérome Maes 486fe737b6 [IMP] hr_timesheet: add test cases
Add some tests case  about logging timesheet
2017-05-11 16:58:30 +02:00
Jérome Maes 6820863c59 [FIX] project_timesheet_holidays: correctly set the employee for generated timesheet 2017-05-11 16:58:23 +02:00
qsm-odoo 40a026d5b2 [FIX] web: implement <newline/> form tag behavior
Before this commit, the new form view implementation was rendering
<newline/> tags as real <newline/> DOM element. The wanted behavior
is now restored:
- As outer group direct child, produce a <br/> tag, forcing the next
  group children to be on a new line
- As inner group direct child, produce nothing but forces the creation
  of a new <tr/> (for the next group children)
2017-05-11 15:09:25 +02:00
qsm-odoo 97517a1cc2 [REF] web: label creation on form view rendering
The original goal of the commit was to implement a missing behavior
for label tags in form view. This finally need some deeper refactoring
for it to work so this commit does not introduce any change in behavior,
only comments explaining the problem.
2017-05-11 15:09:25 +02:00
qsm-odoo 23beee818a [FIX] web: do not lose field/label pair on field rerendering
When a field widget switches between readonly and editable states, it is
fully rerendered. Labels have sometimes to get a specific class when
their associated field is (become) readonly and without any value. This
condition was evaluated on the initial widget and not on rerendered
ones.

Note that this commit only restores an already implemented behavior
broken by https://github.com/odoo-dev/odoo/commit/8f9362809e91ff7c2876ab464017abb13a4e0974
... but this time a test will prevent a new breaking
2017-05-11 15:09:25 +02:00
Martin Geubelle ef643783a5 [FIX] web: deal with malformed default_order
Even if the `default_order` attribute should be like 'name,id desc,coucou'
we want to support the syntax 'name, id desc, coucou' (i.e. with spaces after
the comma).

The commit also patches the mock server.
2017-05-11 14:48:35 +02:00
Christophe Matthieu 2e69c189b1 [IMP] web: calendar test: Error message when the screen is too small 2017-05-11 12:57:59 +02:00
Christophe Matthieu cc141dcce1 [FIX] barcode: Avoid making requests to onchange method on each scan
Usecase: A person scans various products in a warehouse or the network is slow.
Only one request per product must be made, the rest is changing the number locally
and all performed scans (products or actions) must not be lost.
The mutex ensures that the scan is performed in the correct order.
2017-05-11 12:57:44 +02:00
Christophe Matthieu eae62af904 [FIX] account: remove automatic reconciliation button for manual reconciliation
Functionality deprecated since v9
Add also some small rendering fixes for manual reconciliation:
* display congrats only once
* display journal_id as required
* use isValid to create a new proposition line
* Can erase all proposition lines in manual reconciliation
2017-05-11 12:57:32 +02:00
Martin Geubelle c8d063d357 [FIX] web: use o_tag_color outside of badges
Since rev https://github.com/odoo/odoo/commit/250e716c3a12e88acb4a199b427dc47d4ec55d5d
the colors have been mistakenly moved in a too restrictive rule and could only be
used in a badge.
2017-05-11 11:21:00 +02:00
Martin Geubelle 268397e880 [IMP] web: TestUtils: allow to smoothly intercept an event
A parameter has been added in the `intercept` function if one wants to
intercept an event without stopping its propagation.
2017-05-11 11:20:59 +02:00
qsm-odoo 69d572a015 [FIX] web: restore col(span) feature for form groups
Current new implementation of the form view ignored several properties
linked to <group/> elements:

- groups' col attributes were considered to always be 2
- groups' children colspan attributes were considered to always be 1
- elements different than <field/> and <label/> in groups were forced
  to their own row
- it was not possible to have a group hierarchy deeper than 2
- <td/> elements widths were not properly set
- ...
2017-05-11 10:39:06 +02:00
qsm-odoo c44578ee1a [IMP] web: improve qunit logging and config
When a qunit test fails, the log only contains the assertion message.
This is in fact useful to have the "actual" and "expected" values to
understand the bug.

Also, we recently updated the configuration so that the "hide passed
tests" option is enabled by default. This is in fact useful to have
it disabled if the user wants to run only one test (debugging).
2017-05-11 10:39:06 +02:00
qsm-odoo ac7da497a2 [REF] web: form_tests.js was wrongly indented 2017-05-11 10:39:06 +02:00
Géry Debongnie c31bf95e4e [FIX] pad: make it work with the new views
The pad widget was partially updated to the new views, but was no longer
working.  In this commit, we rewrite the widget to make it work.

Note that we did some functional changes:
- we do only one rpc to check if the server is configured. the result is
  stored on the prototype, so we do not need to do it again
- we do some rpcs with shadow: true, so we will not stop the rest of the
  ui if the server is slow to respond
- we display a loading message in readonly, when the content is not
  loaded yet.
2017-05-11 09:53:10 +02:00
Géry Debongnie 33710d540c [FIX] web: small fixes in test framework
We fix in this commit three small issues in the test framework.

1. throw an explicit error when we try to do a fieldviewget in the mock
server with a model that does not exist.  This will make it easier to
figure out what went wrong when copy pasting a test from one file into
another, and forgetting to change the model in the createView parameters

2. wrap the result of special methods in the mock server in a deferred,
so we can simply return a value when using that functionality.  Also, it
is more consistent with the rest of the mock server

3. for iframes, we no longer change the src attribute to #test:url.
This had the problem of actually loading the page.  Instead, we change
it into about:blank and we copy the old url into the data-src attribute for
reference.
2017-05-11 09:53:08 +02:00
David Monjoie e1edd62320 [FIX] web: toggle checkboxes when clicked in editable list view
Previously, the checkbox was not checked when it was clicked in
editable list view, it only opened the row but did not check the
checkbox.
2017-05-10 15:20:03 +02:00
Lucas Perais (lpe) ec3baa6027 [FIX] l10n_fr: fix description of taxes 2017-05-10 10:54:26 +02:00
Lucas Perais (lpe) 189b2b5ce2 [FIX] l10n_fr: remove exclusion of account_cancel
l10n_fr is compatible per se with account_cancel, although cancelling account moves is not the right or best practice in accounting anyway.
2017-05-10 10:45:26 +02:00
Géry Debongnie 84187f972a [FIX] web: prevent view_dialogs from changing env
With this commit, we prevent view dialogs from changing the 'global'
environment in the view manager.  Here is how it could cause a problem:

* open a form view for a bill of material
* click on one of the component, it will open a form view in a dialog
  (and will change the environment with a wrong res_id)
* click on the many2one product -> it will open a new action in the
  background, and change the environment again
* click on the breadcrumb to come back to the bill of material: the view
  manager will try to restore the correct res_id (which is the wrong id
  from the component form view), the form view will do a read (when
  reloading the data), will get an empty result, will update its
  information with no data, then will be in a wrong state which means
  that the basicmodel will fetch a x2many with a wrong res_ids list
* boom
2017-05-09 17:03:30 +02:00
Martin Geubelle 136a119311 [FIX] web_editor: use new rpc system
Directly use `ajax.jsonRPC` makes it untestable as the RPCs can't
be mocked.
2017-05-09 15:19:00 +02:00
Martin Geubelle 0ac2d8f015 [FIX] web: add o_input class on m2o dialog input
Since the rev https://github.com/odoo/odoo/commit/250e716c3a12e88acb4a199b427dc47d4ec55d5d
the class `o_input` needs to be set on an input to correctly style it.
2017-05-09 15:19:00 +02:00
Yannick Tivisse 4f0544ad7c [FIX] hr_contract: Show kanban by default from contract stat button on employee form 2017-05-09 12:11:43 +02:00
qsm-odoo 111465c318 [FIX] web: numbers in list views should be right-aligned
Before this commit, numbers in list views were right-aligned
depending on the widget they were using (float/monetary). Now, the
input text alignment is inherited from the parent which should
solve the problem.
2017-05-08 17:12:11 +02:00
Martin Trigaux 7afe6d28b6 [FIX] account: do not display unused field
The field move_line_ids was present in the view and used only for display
purposes. However modifying another field triggering an onchange (e.g. a payment
line) was recreating the move lines.
Recreating the accounting entries may trigger an error if the entries are
already posted.

The entries are recreated because:
1. the move_line_ids is loaded with the default tree & form view for
   account.move.line records, displaying several fields
2. some of the fields (e.g. reconciled) are computed
3. the initial onchange recomputes all the computed field, including the one
   on the one2many (e.g. recomputing move_line_ids.reconciled)
4. the field being dirty, the onchange returns the value of move_line_ids with
   [(5,),(1,id,{...}),...]
5. trying to save the modified lines may fail

Replace the field by a simple readonly integer field.

opw-741205
2017-05-08 16:56:36 +02:00
Yannick Tivisse 47dab7d3b4 [FIX] hr_payroll: Allow a HR user to create a contract if not a payroll user 2017-05-08 16:55:51 +02:00
Yannick Tivisse 12dd3f3e99 [FIX] l10n_be_hr_payroll: Clean new_car display to avoid confusion between existing and new cars 2017-05-08 16:55:51 +02:00
Yannick Tivisse 3a2e4c1d7d [FIX] hr_contract,hr_payroll,...: Update tooltips on contract and job fields 2017-05-08 16:55:51 +02:00
Yannick Tivisse 62c2d0c3aa [FIX] hr,hr_recruitment: Display information correctly on job form 2017-05-08 16:55:51 +02:00
Yannick Tivisse dbeff8cce1 [FIX] hr, hr_contract: Rename 'Job Title' into 'Job Position' 2017-05-08 16:55:51 +02:00
Yannick Tivisse 967f92a539 [FIX] l10n_be_hr_payroll_fleet,fleet: Correct total costs computation on model + layout improvement 2017-05-08 16:55:51 +02:00
Jérome Maes a4b136377a FIX im_livechat bundle due to new views yeay 2017-05-08 15:57:18 +02:00
qsm-odoo 0764bc41aa [FIX] web: list rendering was not properly updated after discard
Before this commit, when hitting the "Discard" button in an editable
list view, the line switched to readonly mode but with the undiscarded
data (even though the data was properly discarded and not saved).

Fortunately, the fix is in fact making the save/discard/update system
more consistent. Here are some reasons why:
- the `_confirmSave` method is now used after a save or a discard
    (while it was before only called on readonly views where a change
    was made by a special field widget).
- Abandonning a record (discarding a new unsaved one), is now the
    responsability of `discardChanges` (and not `_setMode`).
- The renderer `updateState` method is used when its state is updated.
- ...

Note that setting the renderer mode is now taking care of deferreds
properly (the widgets deferred are now considered when switching
a row to readonly/edit mode).
2017-05-08 14:02:40 +02:00
Géry Debongnie c8d77f93e5 [FIX] web: display empty input fields properly
Before this commit, it was not possible to see the difference between an
unset float field (with a 'false' value) and a set field (for ex, with
value 0)

This was due to the fact that the formatFloat/formatMonetary functions
format false values as the number 0, unlike many other formatting
functions.
2017-05-08 13:56:18 +02:00
Yannick Tivisse aeae2fb64f [FIX] l10n_be_hr_payroll: Prevent 'Child Allowance' to exceed 'Withholding Taxes'
Note: Small fix, long diff. Read the specifcation section to understand why.

PURPOSE
=======

The child allowance is an amount to decrease the withholding taxes due to family charges.

SPECIFICATION
=============

Instead of having a salary rule with a fixed amount for the child allowance, we should have a salary rule on which the amount is computed with a python code, that take the minimum between the original fixed amount and the remaining withholding taxes to pay.

As the field 'amount_python_compute' isn't in the field declaration on the csv file, we have to add it and modify all the lines. The result is a quite long diff for a small fix.
2017-05-08 12:45:14 +02:00
Yannick Tivisse ac8800f0e0 [FIX] hr_contract,hr_payroll: Forms, menuitems and layout reorganization
New view for contract templates with a dedicated menuitem and less displayed information
2017-05-08 11:25:11 +02:00
qsm-odoo c1377f5972 [FIX] web: properly handle field navigation for all fields
Before this commit, only fields which were specializations of the
`InputField` were handling up/right/down/left navigation in editable
list view. As m2o field is not an `InputField` (yet?), it was not
possible to navigate from one of those for example.

Now, navigation events are handled by the `AbstractField` class. If a
given field has to handle navigation a different way, it is its
responsability to stop the associated navigation event. For example,
`InputField` instances are stopping the left/right event if the cursor
is not at the start/end of the <input/> element.

Also, before this commit, there were many events ("move_down",
"move_left", "move_next", ...). Now there is only one event for
navigation: "navigation_move". This event is given a "direction" data
("left", "next", ...). It also comes with a "target" data which is a
reference to the last `AbstractField` instance the navigation event
has crossed.
2017-05-08 10:38:05 +02:00
Aaron Bohy c04b840a45 [FIX] web: FieldMonetary: don't loose focus after edition
... in x2many editable list views.

Field widgets can detect that they are at the origin of a
field_changed event, so that they don't re-render themselves when
they are being edited.

This didn't work for fields inside x2many list views. This wasn't
a big problem for most of the fields, because the cursor position
was automatically reset after a re-rendering, but it wasn't
working for monetary fields that empty their $el before each
re-rendering.

This rev. fixes the issue by making the field widgets inside
x2many list able to detect that they are the origin of a change,
and thus removes the now useless code that restore the cursor
position.
2017-05-08 08:10:00 +02:00
Géry Debongnie c75680c527 [REF] web: optimize basic model (improve perfs for most views)
The 'get' method in the basic model is called very often (too often, but
that is another issue).  For a large list with many columns, it can be
quickly be called more than 10k times.

In that function, we had to protect our integrity by performing a deep
clone with $.extend, so noone else can be allowed to change something in
our internal structure.  This is good in theory, but not so good in
practice, as $.extend is a really expensive operation.

Also, we try to have the smallest external API by deleting useless keys.
But instead of keeping a blacklist of private keys, it is simpler to
have a whitelist of public keys.

So, what we do is to explicitely construct the object returned by key,
since we know the types of every values involved.  This is more
explicit, and at the same time, much faster.

Also, we propagate the options for elements of type list.  This is why I
had to change the isFieldSet method.

In a benchmark I just ran, loading and rendering a large list (200 rows,
7 columns) went from about 2.7s to 0.7s.

We still do way too much work, but at least it is much faster...
2017-05-07 22:38:27 +02:00
Simon Lejeune 9d7b421b8c [REL] 10.saas~16 2017-05-05 18:08:51 +02:00