Commit Graph
108963 Commits
Author SHA1 Message Date
qdp-odoo 3eb252ab0e [IMP] account, payment form view: add a button to open payment matching
button will only be visible if the move_line are not reconciled yet
This button will allow user to register a payment and then reconcile it with multiple invoices in the payment matching view.

Was PR #15157
2017-04-12 16:22:40 +02:00
Josse Colpaert d5908083b4 [IMP] point_of_sale: indicate on pos picking type the use of lots
By unticking the "Use Existing Lots" checkbox on the pos picking type,
you can choose not to enter any lots/serial numbers in the pos.  This
way, the picking will not specify the lots either and the system will
take the quants and lots according to the removal strategy.
2017-04-12 15:40:40 +02:00
Josse Colpaert 283f8df95b [FIX] point_of_sale: don't generate move lines with a qty of 0 2017-04-12 15:40:40 +02:00
Josse Colpaert 99deebe015 [FIX] point_of_sale: validate picking when all lots are correct
Before, when the POS order created the picking, it would not be set to
done when one of the lines contained a product that required lots.

This was to avoid the case where the lot given in text in the POS
order would not correspond with a real lot in the database.

So, in order to not annoy the user when he gives correct lots, we
validate the picking when we can find back the given lots in the
system.

opw-698060
2017-04-12 15:40:40 +02:00
Joren Van Onder 025d9432a1 [IMP] point_of_sale: handle products tracked as lots
The POS support for tracked products implemented at
8f39c652c6 was mainly meant for products
tracked with serial numbers. In theory it would also work for lots as
long as the lots were only sold in integer quantities. One could specify
the same lot multiple times.

For products tracked in non-integer quantities this wouldn't work
however. This commit makes the POS handle lots more like the stock
module. When a product tracked in lots is bought in the POS you can only
specify one lot number. If a product is sold from multiple lots then
multiple order lines have to be specified.

Fixes #15325
2017-04-12 15:40:40 +02:00
Xavier Morel 76852a2fad [#8530] fix uses of `reduce` builtin
Demoted to library in Python 3, see if uses can be replaced by more
specific construct, just import functools.reduce otherwise.

Futurize fixers:
* lib2to3.fixes.fix_reduce
2017-04-12 13:48:42 +02:00
Martin Geubelle 15e17e7b48 [FIX] web: switch in edit mode when creating a record
When creating a new record (form view without `currentId`), the form
view should be rendered in edit mode and not readonly.
2017-04-12 12:25:03 +02:00
Martin Geubelle 16dc001e42 [FIX] web: Form: only render button StatButton
One could want to render something else than a `button` in the
buttonbox (even if the name seems to imply that it will contain
buttons).

In this case, we render the method corresponding to the tag instead
of a button.
2017-04-12 12:23:31 +02:00
Aaron Bohy 3638cade09 [MERGE] web,*: redesign all JS views
This branch introduces a full redesign of all JS views.  We started
basically from scratch.  The goal was to unify all the various views
under a common framework, to make them testable, to make then usable
in different conditions (in studio, or in the frontend), and to make
our lives easier.

Some important points are:
- we have a brand new testing framework (still QUnit based)
- kanban view (formerly in web_kanban) moved to the web addon
- calendar view (formerly in web_calendar) moved to web as well
- tree view was removed
- each view is now separated into 3 parts: the renderer, the model,
  the controller (so, actually a kind of MVC)
- we introduced new coding guidelines (camelCase, 80 chars width, ...)
- all new code should be documented

We hope that this code is the start of a new era for the Odoo web
client, we want to have a high quality codebase, well documented, well
tested, well designed.

Work done by the framework team: mostly aab, ged, chm, dmo, qsm, mge,
fwi, adr
2017-04-12 10:44:06 +02:00
Aaron Bohy e2e0353ce5 [FIX] web: AceEditor Field should be debounced
Debounced fields do not notify their environment each time their
value changes, but rather wait for a given delay after the last
change. Input fields allowing the user to type text should be
debounced. The AceEditor is one of them.

Note: this should be tested, but i can't find a way to simulate
text entries in the ace editor.
2017-04-11 19:44:38 +02:00
Aaron Bohy 942d5fc4a3 [REF] web: Fields: DEBOUNCE is a DebouncedField attribute 2017-04-11 19:44:38 +02:00
Adrien Dieudonne 64e0fe80a3 [FIX] web: Calendar: enter key not working in quick create
Before this commit, it was not possible to add a new event
with the "quick create" if you pressed enter key instead of
using confirm button.
2017-04-11 19:44:38 +02:00
Adrien Dieudonne f624e8a575 [FIX] *: unsupported type for graph views
In the new implementation, the type is checked to prevent loading
a view type that does not exist.

In the old implementation, the type was ignored resulting in a graph view.

So, before this commit, some views were no longer loaded.

The 'pivot' type should not be used since there is a dedicated pivot
view.
2017-04-11 19:44:38 +02:00
Géry Debongnie 875ea7964c [REF] account, web, web_diagram: rename static test folder
For consistency, every static test folder should be named 'tests', with
a s.
2017-04-11 19:44:38 +02:00
Géry Debongnie f0ee1e2be5 [FIX] web: add session user_context in the evalcontext
When evaluating a domain, we need to add the user context, so domains
can use a key such as uid.
2017-04-11 19:44:38 +02:00
Martin Geubelle 0cb5005946 [FIX] web, *: basic model: makeRecord with X2manys
`makeRecord` is now asynchronous as it will load data
for relational fields (X2manys and many2ones if `display_name`
is not fetched).

This change has implied a refactoring in all `makeRecord`
occurences to adapt with the returned deferred.
2017-04-11 19:44:38 +02:00
Aaron Bohy b6ce7b136f [IMP] web: protect _rpc calls on destroyed widgets
It might happen that some code in a widget (callbacks given to
other function calls) is executed after the widget's destruction.
For example, trigger an event up with a callback in option, the
event is handled by a parent that performs an rpc, meanwhile, the
child widget is destroyed, then, the rpc returns and the parent
executes the callback.

This shouldn't happen, because it means that the callback is
executed for nothing. Worst, it crashes if the function _rpc is
called inside the callback, because the widget being destroyed,
there is no parent to handle the request, and _rpc thus returns
undefined.

This rev. protects the code from crashing by making _rpc return
a pending deferred instead of undefined.
2017-04-11 19:44:38 +02:00
Aaron Bohy ec9001eb9d [FIX] hr_timesheet_sheet: disable widget
It will be removed soon, and thus hasn't been adapted to the new
views. We disable it to prevent it from crashing.
2017-04-11 19:44:38 +02:00
Géry Debongnie d1d80a494b [FIX] web: make sure buttons are called with proper res_id
Before this commit, clicking on buttons did not reload the current
record, which is good.  However, it kept the reference to the record
after saving, even if that record could have been changed, which is
definitely the case when starting from a new record and saving it (it
will have the correct res_id, which is really important).
2017-04-11 19:44:38 +02:00
Géry Debongnie 64a9398fb3 [FIX] web: fix corrupt datapoint in basic model
When saving a new record, with the option reload=false, a datapoint in the
basic model could be left in a wrong state: the x2many fields were
deleted, with all the changes, but the values in the data key were still
null, which means that the x2many field has no valid corresponding
datapoint, as far as the basicmodel can see.

So, with this commit, we make sure to push the changes into the data, so
the datapoint is in a proper clean state.
2017-04-11 19:44:38 +02:00
Géry Debongnie 2bf2976c20 [FIX] web: don't reload form view before opening action
When we click on a button in a form view, we don't need to reload the
data for the form view.
2017-04-11 19:44:38 +02:00
fwi-odoo 85790a2980 [FIX] web: don't try to create datapoint for relational field not in view
In some case ´default_get´ returns values for relational fields that are not
in the view so we cannot create a datapoint for these field. Furthermore, we
cannot discard these fields in order to save their values correctly in the newly
created record.
2017-04-11 19:44:38 +02:00
fwi-odoo 60ae646c66 [FIX] web: properly initialize non empty x2many in default_get
When the ´default_get´ returns default values for a x2many field, it needs
to be set as changed fields in this x2many field. Previously, it was wrongly
assumed that these changes were non existant.
2017-04-11 19:44:38 +02:00
fwi-odoo 36aed81d90 [FIX] website: update to new views
The methods overriden were not the correct one anymore.
2017-04-11 19:44:38 +02:00
fwi-odoo e3d1abc75f [FIX] hr_org_chart: update to new views and guidelines 2017-04-11 19:44:38 +02:00
Adrien Dieudonne ef6b330d8f [FIX] web: Form: avoid to change mode on button click
When clicking on a button in a form view, the current data should be
saved but the form view shouldn't be re-rendered in readonly.
Before this commit, the view was re-rendered, causing a weird glitch
in dialogs as buttons that were supposed to be moved to the dialog's
footer appeared inside the view when the button was clicked.

Also forces the default mode in form view to readonly, so that it is
correctly redrawn in readonly when coming back using the breadcrumbs.
2017-04-11 19:44:38 +02:00
Aaron Bohy b0fd99f261 [FIX] test_new_api: apply commit odoo/odoo@a24793962
Commit odoo/odoo@a24793962 adds some steps to the x2many tour.
This part of the commit had been deliberately moved aside for a
while in the new views branch, as what was tested didn't work yet
back then. It does now, so we re-enable those steps.
2017-04-11 19:44:38 +02:00
Aaron Bohy 318ff5f00d [FIX] web: pass context of changed field to onchange RPC
When a field with an onchange is changed, if there is a context
defined on the field in the arch, this context must be added to
the context sent with the onchange RPC.
2017-04-11 19:44:38 +02:00
Christophe Matthieu 3dfa2caa3d [FIX] web: various bugs in calendar and move _rpc call into model 2017-04-11 19:44:38 +02:00
Géry Debongnie e7dfa4af77 [FIX] web: add support for editable=top/bottom in o2m
Before this commit, we lost the functionality of editing records top or
bottom.  However, it as almost ready, but we needed to change the way
commands are generated, to respect the actual order in the UI.

Also, the mock server needed to be updated, to make sure he also save
the new ids in the correct order.
2017-04-11 19:44:38 +02:00
Aaron Bohy 39ab5712ed [FIX] test_new_api: enable deactivated steps of x2many tour
Those steps had been deactivated because the onchanges didn't
work well back then. Now, everything that is tested by the tour
works fine, so we can re-enable it entirely.
2017-04-11 19:44:38 +02:00
Aaron Bohy 7e14e81903 [FIX] web: one2many onchanges
When there is an onchange on fields of a one2many, the data given
to the onchange RPC should contain an additional key for the
corresponding many2one, mapping to the current data of the parent
(main) record.

This wasn't working before this rev. for new o2m records created
when the one2many wasn't editable inline (with a list view
editable), because in that particular case, the reference to the
parent record wasn't specified correctly.
2017-04-11 19:44:38 +02:00
Christophe Matthieu e8b9515980 [IMP] account: add write-off alert message in reconciliation 2017-04-11 19:44:38 +02:00
Christophe Matthieu 792ba42751 [IMP] account: in reconciliation, don't open partner on click 2017-04-11 19:44:38 +02:00
Christophe Matthieu f62597ae1f [FIX] web: radio button display the checked input 2017-04-11 19:44:38 +02:00
Aaron Bohy d0f321d6cc [FIX] web: Form: don't discard onchange when editing a o2m
Assume that there is an onchange on a form view that upates the
records of a one2many field. Before this rev., if the user edited
one of those one2many records (in a dialog) after the onchange,
the onchange values were lost.
2017-04-11 19:44:38 +02:00
Aaron Bohy bc89bb79d2 [FIX] web: BasicModel: ignore unknown fields after onchange
It may happen that an onchange returns values for unknown fields in
the view. In that case, the corresponding values need to be ignored
as the postprocessing base on the field type can't be done, which
may lead to errors later on (e.g. when saving).

For example: one2many list in a form view which doesn't display
a many2one field that exists on the related model. If an onchange
on the main form view updates the value of the many2one inside the
one2many, it will crash later on when the user will try to save
(because the value [id, display_name] will be sent to the server).
2017-04-11 19:44:38 +02:00
fwi-odoo ab44cabc78 [FIX] web: render the statinfo buttons that are not in a buttonbox
Without this commit, the statinfo field in a button but
not in a buttonbox are not rendered.
With this commit, when the button is rendered, the children are
processed and then the statinfo field is rendered (e.g. bank account(s) statinfo
in the Sales & Purchases tab in the res.partner form view).
2017-04-11 19:44:38 +02:00
Géry Debongnie 4872c8da31 [FIX] web: don't save readonly fields
Readonly fields can be modified with onchanges, but they should
not be saved.
2017-04-11 19:44:38 +02:00
Christophe Matthieu 97c6dc7792 [FIX] account: fix various bugs in reconciliation
* partial reconcile, display, compute, process_reconciliations
* more information in tooltip
* add domain to filter partner
2017-04-11 19:44:38 +02:00
Géry Debongnie 2a40c78a8b [FIX] web: fix rendering issue with fieldselection on m2o
Before this commit, the FieldSelection did not work properly in edit
mode with a many2one.  This was because it did not take the correct
value into account, and the test did not notice it, so both had to be
fixed.
2017-04-11 19:44:38 +02:00
Christophe Matthieu 920df597d3 [REF] barcode, *: update code to new JS framework
With the new views, the barcode mechanisms were completely broken,
because the view and widget JS code was totally changed.

This commit update and refactor all that code to make it work with the
new design philosophy.  Also, it update the coding style.
2017-04-11 19:44:38 +02:00
Aaron Bohy c5cf445462 [FIX] web: Form: protect against widget destruction
When a button is clicked in a form view, the event 'execute_action'
is triggered up and catched by the view_manager, which can do
various async stuff. Meanwhile, the form view might be destroyed,
and in this case, the handlers shouldn't be executed when the
async stuff is done.
2017-04-11 19:44:38 +02:00
Géry Debongnie 3ff7ff3e94 [FIX] web: properly evaluate unset numeric values in domain
Before this commit, when a numeric value was not set (for example, a new
record with no default_get value), then it was not properly evaluated as
0 in a domain.

We also slightly refactored the code so we always use the same method to
compute the evaluation context.
2017-04-11 19:44:38 +02:00
Géry Debongnie a529a928b4 [REF] web: prevent useless rerender in some cases
When clicking on a form button, the saveRecord method is called, which
will then call the toReadonlymode method, which will rerender the form
view, even if it was already in readonly mode.
2017-04-11 19:44:38 +02:00
Aaron Bohy 2bca653584 [FIX] web: BasicModel: correctly generate x2many commands
This commit fixes two problems. First, the commands weren't
correctly generated for relational fields inside relational fields.
For example, if a form view contained a one2many containing itself
a many2many, the commands weren't generated for the many2many
inside the one2many. Thus, it's value couldn't be saved.

Second, when doing an onchange RPC, all record data should be sent
to the server, not only what have changed. Before this rev., for
x2many fields, commands were sent only if the field had changed.
2017-04-11 19:44:38 +02:00
Aaron Bohy 2932aa64bc [IMP] web: relational_fields: re-enable assert in a test
This didn't work when the test has been written, but it does now.
2017-04-11 19:44:38 +02:00
qsm-odoo a3271fa663 [FIX] web: formview button context should be given to actions
When clicking on a stat button in a form view, an action is executed.
The button might also be given a context which have to be used when
running the action. This context was ignored since the context
refactoring made with commit 26a7fe7de1b6258989bc63335321f8f8e83435af.
2017-04-11 19:44:38 +02:00
Géry Debongnie 8ad523a865 [FIX] web: fix focus issue in fields x2many
Before this fix, when the user dared press 'TAB', the move_next event
was propagated from the sub one2many to the outer form renderer, and
caused the form view to try to focus another totally unrelated field.
Also, the event was sent twice, because we are in a case where a field
widget is contained in another field widget.
2017-04-11 19:44:38 +02:00
fwi-odoo c7cd6fdd41 [FIX] web: wrong reference to this 2017-04-11 19:44:38 +02:00