Commit Graph
109488 Commits
Author SHA1 Message Date
Aaron Bohy c7fc74fb79 [FIX] web: BasicModel: fetch added x2many records
Suppose that there is a many2many (list) field in a form view,
and there is a many2many (e.g. many2many_tags) field inside the
list.

In edit mode, if the user adds a record in the relation, this
record and its relational data should be fetched.

Before this rev., the relational data wasn't fetched, so the
many2many_tags couldn't be displayed correctly.
2017-05-03 20:48:25 +02:00
Lucas Perais (lpe) d56baebc8e [IMP] l10n_fr: make french localization usable out of the box.
* added some accounts, cash based taxes, DOM-TOM country group...
* improved sale/purchase journal creation for french companies by making sure they have a dedicated sequence for refunds
2017-05-03 16:59:01 +02:00
qdp-odoo 77157c6ddd [IMP] l10n_fr: set one tag per grid in vat report. 2017-05-03 16:59:01 +02:00
qdp-odoo 3bb774d6de [IMP] account: add a default 'cash basis tax journal' upon chart template installation.
This is probably needed by all countries that use caseh basis taxes, and will save them the journal creation + save of the settings.
2017-05-03 16:59:01 +02:00
Raphael Collet 59ee813a82 [IMP] fields: clean up comparisons to False 2017-05-03 15:54:36 +02:00
Raphael Collet 8706a8503b [REF] base: convert python constraint to SQL constraint
The constraint is `UNIQUE(model, name)` on `ir.model.fields`.
2017-05-03 15:52:58 +02:00
Raphael Collet b59318ec12 [REF] registry: always perform registry/cache signaling at the end of request
Problem: the update of custom models/fields is not fully transactional, and may
potentially lead to an inconsistent database.  An other problem is creating two
custom fields by writing on a model: if the second one fails, the first one has
been committed without notice.  Retrying the request will give an unexpected
error (duplicate field name).

Solution: never commit in the middle of a request.  If the changes have an
impact on the registry, then mark it as invalid (with a new flag), and signal
registry invalidation after everything has been committed.  If the request
fails, reset the registry.  Both registry and cache invalidation are handled
the same way.
2017-05-03 15:41:05 +02:00
Raphael Collet 1458f1b313 [REF] registry: delegate addition of custom models/fields
Delegate to models `ir.model` and `ir.model.fields`, so that this functionality
can be extended easily.
2017-05-03 15:41:05 +02:00
Raphael Collet f3f41ec551 [REF] registry: replace partial by attribute registry.loaded 2017-05-03 15:41:05 +02:00
Raphael Collet 5d3474254d [REF] registry: remove deprecated RegistryManager 2017-05-03 15:41:05 +02:00
Géry Debongnie b38137d498 [FIX] web: prevent loss of edits in list view
Before this commit, it was possible to edit something in an editable
list view, then press the DOWN key, then enter some other values.  With
the DOWN key, the focus is supposed to move to the line below, so we
save the current line, in the current state.  This means that the edit
coming after are simply lost (well, just not saved nor displayed).

What this commit does is simply disable all control elements in that
situation.  This prevents uncomfortable situations from occurring.
2017-05-03 15:20:16 +02:00
Christophe Simonis c8dfc701bc [FIX] delivery: force non-inheritance of views 2017-05-03 13:56:44 +02:00
fwi-odoo 1af7864fdf [FIX] web: correct column title when kanban grouped
Before this commit, when a kanban view was grouped by a selection field, the
column were named with the raw value of the selection instead of the display
string.

Furthermore, fix the fact that when the column title was 0 or False,
'undefined' was displayed instead.
2017-05-03 13:41:13 +02:00
fwi-odoo a53335fdb2 [FIX] web, document: adapt toolbar to the new views
- Fix the toolbar behaviour since there is no more dataset in the widget.
- Improve the communication beetwen the controller and the toolbar.
- Move the code linked to the document upload in the right file.
- Adapt the tests to mock the search_read done by ´document´ addon
- Adapt the mock server to be able to give a custom toolbar action
2017-05-03 13:41:07 +02:00
Jérome Maes 30384249e1 [ADD] project_timesheet_holidays: generate timesheet when on leaves
This commit proposes to allow to automatically generate timesheet lines
when an employee is on leaves. Project and task used for timesheeting
is globally configured on the company. Holidays type choose whether to
generate timesheets or not and take the company default configuration.

When an HR officer validates a leave request, analytic lines will be
generated for each day off. The unit amount will be based on the working
calendar of the employee taking the leave. Generated timesheet lines are
attached to the project and task configured on the holidays type.

Configuring timesheet lines generation at holiday type level allows to
tune the use of leave requests. You may have for example "home working"
holiday type that should not generate timesheets while "legal leaves"
should.
2017-05-03 10:15:27 +02:00
Thibault Delavallée 69631078ba [IMP] resource: add iterator on work hours count between two datetimes 2017-05-03 10:13:24 +02:00
Christophe Simonis bf7de4d32f [MERGE] forward port branch saas-15 up to 3f6bb0f544 2017-05-02 18:53:44 +02:00
Christophe Simonis 3f6bb0f544 [MERGE] forward port branch saas-14 up to 6441ea28b3 2017-05-02 18:25:31 +02:00
Fabien Pinckaers a97cb66961 [IMP] mail: less visible when no activity scheduled 2017-05-02 09:12:32 -07:00
Christophe Simonis 6441ea28b3 [MERGE] forward port branch 10.0 up to cc7ae17bd5 2017-05-02 18:12:09 +02:00
Fabien Pinckaers a5cf0cc8b4 [IMP] mail: spacing around the next activity icon 2017-05-02 09:05:56 -07:00
Fabien Pinckaers f72d87ab1a [IMP] hr_recruitment: improved kanban view of applicants
[IMP] hr_org_chart: help sentence
[IMP] sale: search on customer in main search
2017-05-02 09:01:39 -07:00
qsm-odoo 2c59d81d44 [FIX] web: edit correct list line on click after line deletion
Before this commit, if the user created a line (thanks to the create
button) then deleted it, the rows were in a broken state which made the
list edit the wrong line on line click (it opened the next one). This
was due to row indexes which are kept as data on rows: they were not
updated on row deletion. This commit simplifies the code by getting rid
of this indexes data and instead compute those when necessary.
2017-05-02 17:47:18 +02:00
Christophe Simonis cc7ae17bd5 [MERGE] forward port branch saas-11 up to 73527d0fc6 2017-05-02 17:05:42 +02:00
Nicolas Martinelli 279b3a8ac1 [FIX] account_tax_cash_basis: raise if no account
Since the account is a mandatory field, we raise an clear error is no
account is defined.

This is necessary when running an automatic reconciliation on the POS.
The POS uses a try/except to avoid any error, but in the case of an SQL
error, the cursor is invalidated, so the transaction fails.

opw-741677
2017-05-02 16:20:50 +02:00
Christophe Simonis 73527d0fc6 [MERGE] forward port branch 9.0 up to c66e454f06 2017-05-02 16:17:35 +02:00
Nicolas Martinelli be1ca7b100 [FIX] web: min/max integer
In PostgreSQL, a field of type `integer` must be in the range
-2147483648 to +2147483647. If the user enters a lower or a larger
value, a traceback is thrown.

opw-740286
2017-05-02 16:11:01 +02:00
Aaron Bohy c891463e50 [FIX] web: BasicModel: apply onchange after x2m edition
When a record is added in an x2many field with an onchange, the
onchange is only triggered once the new record is valid (i.e. when
all its required fields have a correct value).

However, there was an issue in the code checking the validity of
a record, as it iterated on all known fields of the model (instead
of those in the view), so if there were required fields that
weren't, the record was always invalid (as those fields obviously
never had a value), and thus the onchange was never done.

This wasn't a problem with embedded views as in this case, the
known fields are those in the view. But when the view isn't
embedded, all fields of the related model are known, even if only
some of them are in the view.

This was the case for example in the stock.picking form view, when
adding a line in the stock.move o2m: the onchange wasn't done and
thus, the schedule date wasn't correctly set.
2017-05-02 15:34:43 +02:00
Aaron Bohy e9dce2c7b6 [FIX] web: don't fetch invisible relational fields
Relational fields with attribute 'invisible' set to true are in
views because they are used in domains or contexts. In this case
their relational data is useless, only their ids matter. Before
this rev., their relational data was fetched anyway. More
precisely, it was the case for many2ones after a default_get, and
for x2manys with inline views, or without view (e.g. with widget
'many2many_tags').
2017-05-02 15:34:43 +02:00
David Monjoie d99ae3fd87 [FIX] web: keep positional args for search_read
The previous code used to create its own args array
for the search_read method, replacing the one that
was originally given to it.

This lead to silent errors since positional arguments
to this function were completely ignored in the case
of search_read.

I took this commit as an opportunity to improve a
bit on the current state of these rpc helpers.
Namely, the basic args/kwargs priority is the following (top-to-bottom):
- kwargs defined in the rpc call
- kwargs defined in the kwargs key of the params kwarg of the rpc call
- positional arguments are passed as is

For read_group and search_read methods, the priority is the following:
- kwargs defined in the rpc call
- kwargs defined in the params kwarg to the rpc call
- kwargs defined in the kwargs key of the params kwarg of the rpc call
- positional arguments are passed as is

For the /web/dataset/search_read controller, only the params kwarg is
supported, resulting in the following priority:
- kwargs defined in the rpc call
- kwargs defined in the params kwarg to the rpc call
- positional arguments are passed as is

If both a kwargs and a positional arg is given for the same parameter,
it will be sent as is to the server which will crash with a typical
"got multiple values for keyword argument" TypeError. However, in the
MockServer however, we give priority to kwargs over args in this case.

Please note that I also chose to remove unnecessary default values so
that the ones actually used are the ones from the server, not the ones
that were duplicating those in the rpc js file.
2017-05-02 15:24:56 +02:00
David Monjoie 642fe9b9c1 [FIX] web: support anchor tags with action type in views 2017-05-02 15:24:55 +02:00
David Monjoie e02cee4ea6 [FIX] web: fix missing idForLabel on some widgets
Widgets which manipulates their dom in _renderEdit were left out
from the previous implementation since this processing was done
only once when the widget is rendered the first time. If the
widget regenerates a new input upon reset for example, then it
would lack the idForLabel.
2017-05-02 15:24:54 +02:00
David Monjoie 4e4c89969c [FIX] web: fix FieldStatus tests on extra small screens
When enterprise is installed, the rendering of these widgets on
extra small screens is different, thus breaking these tests. We
need to force the test to run on normal screens.
2017-05-02 15:24:54 +02:00
Goffin Simon e645d38ce1 [FIX] sale: Wrong access_name button in Sales Order - Send by Email
When the online SO was already confirmed and paid, the button "Accept and pay"
was displayed instead of "View".

opw:728306
2017-05-02 15:04:19 +02:00
Martin Trigaux ceeee8e6e2 [FIX] sale: avoid updating layout sequence at creation
When a invoice line is create a default layout_category_sequence was created
with a value of 0, updating the value of layout_category_id.sequence instead
of fetching it.

This operation was very slow on the invoice creation wizard

opw-741517
2017-05-02 14:25:29 +02:00
Christophe Simonis c66e454f06 [MERGE] forward port branch saas-6 up to 671864e72b 2017-05-02 12:07:05 +02:00
Christophe Simonis 671864e72b [MERGE] forward port branch 8.0 up to 0b4d01f1d3 2017-05-02 11:40:48 +02:00
qdp-odoo 4e0430d06d [IMP] account: make currency_exchange_journal_id field visible in settings 2017-05-02 11:36:47 +02:00
qdp-odoo a78389546b [FIX] account: fix consistency for fiscal positions and reconcile model with their respective templates.
- Some fields were simply missing on templates, making impossible to give them a value on chart template installation.
- Added a real link between account.reconcile.model.template and its chart template instead of using account_id.chart_template_id
- Added tests for checking the consistency of those objects in the future.
2017-05-02 10:12:04 +02:00
Géry Debongnie 6f0be0dfca [FIX] web: prevent crash in some cases in list editable
Before this commit, when we moved from one line to the next, we did not
wait for the unselectRow to end.  This means that if the read (from the
unselect row) completes after the default_get, the list renderer was not
in a coherent state (currentRow was set to null), which could (and did)
cause a crash.

This was found by pressing the TAB key a few times, and editing some
values.

Also, we slightly improved the logging in the mock server.  Before this,
the responses from the mock server did not show from which route it came
from.  But in this test, we specifically make sure that the rpcs
complete in a different order, so it was not really optimal.
2017-05-02 09:12:41 +02:00
Odoo Translation Bot 0b4d01f1d3 [I18N] Update translation terms from Transifex 2017-05-01 02:40:51 +02:00
Jeremy Kersten 76d0444fde [FIX] website_hr: fix access right to allow portal user to read employee website_published
opw-741077
This commit closes #16616
2017-04-30 11:57:46 +02:00
Odoo Translation Bot eb19319585 [I18N] Update translation terms from Transifex 2017-04-30 07:12:44 +02:00
Odoo Translation Bot e0ff2840a5 [I18N] Update translation terms from Transifex 2017-04-30 04:31:05 +02:00
Odoo Translation Bot 32ea5ad690 [I18N] Update translation terms from Transifex 2017-04-30 00:29:03 +02:00
Dainius Kaniava 4f9ac6c093 [FIX] web: properly transfer javascript options
Fix options not being passed from view declaration to JS
frontend function. If passing option 'no_create': True,
"Create" button was still visible.
2017-04-28 21:13:28 +02:00
Dainius Kaniava 43cdec0517 [CLA] boolit.md
Signed corporate contributor license.
2017-04-28 21:13:09 +02:00
Christophe Simonis 9a769a8b47 [FIX] tools.sql: correct queries used to rename field 2017-04-28 18:59:14 +02:00
Géry Debongnie 5a58cb2817 [FIX] web: better navigation in editable list
When the user press the TAB key on the last cell of an editable list, it
is supposed to create a new line.
2017-04-28 17:23:16 +02:00
qsm-odoo 03c4c855b9 [REF] web: restore editable list views behaviors
Since the new views, the editable list view lost some behaviors. These
behaviors were indeed implemented in the form controller/renderer but
as the new editable list view does not use an inline form view, these
behaviors had to be implemented in the basic controller/renderer.
For this to work, the list editable renderer had to be changed as it
was doing work that should be done by the controller.

The problem is even more complex because the x2m fields are using a
list renderer but not a list controller. So moving code from the
renderer to the controller obviously broke the x2m fields. Right now,
the problem is solved by catching renderer events and forwarding new
ones to the form controller (which handles the x2m specifically).

The initial goal of this commit was to share the validation of records
on save. Indeed, the fields were marked as invalid in the form view but
not in the list view. Also, before the new views, the editable list
view had different behaviors if they were used for a x2m field or not.
As these behaviors are making sense, this commit tries to restore them.

Basically, what we want is:
- When a record is saved (form view save or list view line leaving),
the invalid fields are marked (in red), the names of the related fields
are notified to the user and the record is not left.
- When a record is discarded (form view discard or list view discard),
the user is asked to confirm if the record is dirty before making the
record readonly.
- When a record is discarded, if the record is a new one, then the
record should be abandoned (removed as if never existed). In the form
view this induces to go back in the history and in the list view, to
remove a row.
- For x2m fields, the notification of invalid fields is not triggered
but the user is instead asked if he wants to discard the changes made
to the row (indeed, this replaces the list "Discard" button, as non
existent for x2m lists).
- ...

Saving, discarding, marking the fields as invalid and other behaviors
are thus now shared behavior of basic views.

The management of the dirty flag has also been moved to the model
as it was handle by the controller for the form view but by the
renderer for the list view. Now this flag is directly managed in the
basic model (the model can have changes thanks to the `_changes`
property but not be dirty (this is the case for creations)).
This change however created a problem. The view manager is currently
keeping asking if there are changes to discard at each action which
might lead to leave a dirty record (appswitcher / url change / ...).
It however did not discard anything as leaving if the user is ok with
it will lead to an implicit discard. However, as the view manager might
ask for this discard multiple times by second, the controller was
marking the record as not dirty the first time but without discarding
the changes. This is more complex to do now, as the dirty state is
part of the model and that the renderer should match the model data.
To solve this problem, the view manager now actually discard changes
explicitely when asked to. Even though this had been optimized to not
cause any rerender in some cases where it is not needed, this could
cause some performance decreasing. However, this makes some cases more
logical (opening the app switcher on a dirty form view then going back
to the form view by hitting the "go back" button left the form view
untouched although the user asked to discard it). This solution will
be improved with the view manager refactoring.

This commit is also making use of the `commitChanges` system which had
been implemented for HTML fields. Indeed, these fields cannot know
about all of their changes, so when hitting the save button, we asked
those fields to commit their value. Using this system is a great way
to make the `isValid` method of x2m fields synchronous. Indeed, before
this commit, the method was sometimes asking the user if he wants to
discard an invalid line before save. That case can be handled by the
x2m `commitChanges` method: we consider that saving the lines of x2m is
an operation that has to be done before considering the save, so we ask
all the x2m fields to do so at that time. Also, the system was broken
since a recent commit: we indeed protected the changes - save order
with a mutex but unfortunately, the `commitChanges` method was part of
the save and the changes it triggered were not able to be considered
because of this mutex. This had not been detected by tests as there is
not current way to test html fields.
2017-04-28 16:53:43 +02:00