Commit Graph
108676 Commits
Author SHA1 Message Date
Géry Debongnie da4e653695 [FIX] web: various fixes for date and datetime in client
The field_utils date method have been modified recently, and the idea
behind those changes is that the BasicModel keeps at all time a moment
instance as its internal representation of a date or datetime.

But the parse and format methods did not properly support unset dates,
so we have to slighlty change them to support the case where their values is
not set.
2017-04-11 19:44:38 +02:00
Géry Debongnie 4a612171b3 [FIX] web: basic model now parse dates on lists
Before this commit, the BasicModel didn't parse the dates when loading
data for a list.  But the rest of the web client assumes that data is
properly parsed into their correct types, so a moment instance for date
and datetime.

Also, uppercase field_utils and properly reorder imports
2017-04-11 19:44:38 +02:00
Géry Debongnie 064d7f4621 [FIX] web: make focus tests works if window has not the focus
Until now, those tests failed if the window did not have the focus. We
solve the issue with 2 different fixes:
* instead of checking that the focus property is set, we can check the
activeElement instead, it seems to work.
* instead of calling the focus method, in some tests, we can trigger a
* 'focusin' event.  I don't know why this works, but it does.

Note that this might make the tests work in phantomjs
2017-04-11 19:44:38 +02:00
Géry Debongnie 7c41254d8f [REF] web: small linting pass, add some comments, update style 2017-04-11 19:44:38 +02:00
Géry Debongnie 0c1d9204c3 [REF] web: small refactor + add code in basic model 2017-04-11 19:44:38 +02:00
Géry Debongnie ce4bf0378b [REF] web: update list renderer (new JS guidelines) 2017-04-11 19:44:38 +02:00
qsm-odoo 2db5ee0f7b [IMP] web: some more linting to follow guidelines 2017-04-11 19:44:38 +02:00
Christophe Matthieu 3c0190d0a6 [IMP] web: use moment object instead of string for date
Before this commit, the odoo web client used strings to represent dates.

Now, the date is parsed into a moment object when the value is read from the
server side. The widget formats the object to display the value. When the
widget value changes, the value is parsed to a moment object. The value is
automatically formatted to server value in ajax calls (toJSON method).
2017-04-11 19:44:38 +02:00
qsm-odoo cce579434b [FIX] web: destroy internal m2o on m2m tag field re-render 2017-04-11 19:44:38 +02:00
qsm-odoo 92f24f2cfe [IMP] web: adapt field domain to new API
Add the implementation of the "FieldDomain" (widget='domain') in
basic fields file.
2017-04-11 19:44:38 +02:00
qsm-odoo 274a0aadc6 [ADD] web: add domain and field selectors tests
Create a new folder "widgets" in the "test" folder and add basic tests
for the domain and field selector widgets.
2017-04-11 19:44:38 +02:00
Géry Debongnie 136292f689 [REF] web, *: move CompoundContext out of data.js
We want to remove data.js, but we still need the CompoundContext class,
so we take it out, and rename it 'Context'
2017-04-11 19:44:38 +02:00
Christophe Matthieu 173896b62d [REF] web: remove format.js
use 'web.field_utils' instead of 'web.formats'
2017-04-11 19:44:38 +02:00
Géry Debongnie c9f747dad6 [FIX] web: prevent web client from starting in tests
In test mode, we don't want the web client to start.
2017-04-11 19:44:38 +02:00
Géry Debongnie 044e7bb599 [FIX] web: display error dialog when onchanges fails
When the onchange returns a dictionary with a 'warning' key, it is
supposed to fail and display a dialog with the content of the warning.
2017-04-11 19:44:38 +02:00
Géry Debongnie 05ec284e9c [FIX] web: properly compute field values for onchanges 2017-04-11 19:44:38 +02:00
Aaron Bohy 8a9ba04420 [FIX] web: boot_tests: there should be no more missing modules 2017-04-11 19:44:38 +02:00
Aaron Bohy 79fe0622f7 [FIX] web: define 'web.web_client' module in qunit_suite template
To allow modules that require it to be loaded.
2017-04-11 19:44:38 +02:00
Géry Debongnie 4e4b3c7b59 [FIX] web: properly transfer context to onchange rpcs 2017-04-11 19:44:38 +02:00
Géry Debongnie 450e2f4d48 [FIX] web: basicmodel can evaluate context for new records 2017-04-11 19:44:38 +02:00
Aaron Bohy f3a811b2b2 [FIX] web_settings_dashboard: remove useless imports
It also allows this module to be loaded in the test environment,
where the module 'web.web_client' is missing.

Also fixes some linting warnings.
2017-04-11 19:44:38 +02:00
qsm-odoo fba8d0e5cd [FIX] web, barcodes: attrs processing in kanban
Commit cef659783514f8935cc46a496f71063d022e8dac changed the way domains
are computed but forgot to change the values representation used by the
Kanban view. This commit fixes that and adds tests to make sure it does
not happen again.
2017-04-11 19:44:38 +02:00
qsm-odoo e3546bb1b8 [IMP] web: better process modifiers in mock server
Before this commit, modifiers were partially processed by the mock
server. Now, it should be a better approximation of what the server
does:
- Take the invisible/readonly/required from "attrs"
- Merge invisible with the "states" ([["state", "not in", states]])
- Override if invisible/readonly/required attribute is present

+ Adapt some tests
2017-04-11 19:44:38 +02:00
Christophe Matthieu 654f932b3c [FIX] account: rewrite of the reconciliation feature
With our new views, we broke almost all JS code, including the
reconciliation widget, which was (and still is) dependant on the field
widget.  With this commit, we rewrite and simplify the reconciliation
code.  We also add some tests, to help with the maintenance.

Work done by CHM
2017-04-11 19:44:38 +02:00
Géry Debongnie 905e01921f [REF] web, *: redesign all JS views
This commit introduce 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 introduced new coding guidelines (camelCase, 80 chars width, ...)
- we have a brand new testing framework (still QUnit based)
- kanban view moved to the web addon
- calendar view (formerly web_calender) moved to web as well
- the tree view was removed
- 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
2017-04-11 19:44:38 +02:00
Géry Debongnie 54d4c73af4 [FIX] web: update view manager to delay call to render_buttons in form view 2017-04-11 19:44:38 +02:00
Aaron Bohy c5e00dc802 [REF] mail: remove useless emojis list on node in arch 2017-04-11 19:44:38 +02:00
Xavier Morel f1168d06c0 [#8530] fix octal literals (and remove unwittingly octals)
For readability and coherence, in Python 3 the prefix for octal
literal becomes ``0o`` (rather than just ``0``). This new version was
also added to Python 2 as of 2.6.

Convert all octal literals in file-manipulation code (POSIX ACL), and
fix a few integers which were unwittingly octal.

(lib2to3.fixes.fix_numliterals)
2017-04-11 17:29:18 +02:00
Xavier Morel 0b3ea57e61 [#8530] remove uses of tuple parameter unpacking
While sometimes convenient, the ability to unpack tuple parameters (to
lambdas and functions) was removed from Python 3. Either use the tuple
directly or unpack it in the function body.

(lib2to3.fixes.fix_tuple_params)
2017-04-11 17:15:01 +02:00
Xavier Morel 578b0ef2fd [#8530] convert dict.has_key
Redundant with `in` and removed from Python 3.

Removed odd, old and long-unused UpdatableDict (which defines and uses
has_key) and UpdatableStr (which was nearby and caught in the blast),
validated with al.

(lib2to3.fixes.fix_has_key)
2017-04-11 17:04:45 +02:00
Xavier Morel 3f20662b3e [#8530] convert deprecated operators
* `<>` was removed and should be replaced by
  `!=` (lib2to3.fixes.fix_ne)
* `\`` was removed and should be replaced by either `repr()` or the
  `%r` format string modifier (lib2to3.fixes.fix_repr followed by
  hand-rolled edition to replace concatenation)
2017-04-11 16:29:51 +02:00
qdp-odoo 515ac8e2ae [ADD] account: add test to check objects consistency when created from templates
For example, we had in the past fields added on account.account but not on account.account.template. The purpose of the new test is to detect such oversight (force developpers to explicitly name exceptions in the test).

Was PR #16012
task ID: 31488
2017-04-11 16:14:23 +02:00
Xavier Morel 3979f6802e [#8530] convert exception handlers to except..as syntax
Futurize fixers:
* lib2to3.fixes.fix_except
2017-04-11 14:53:29 +02:00
xmo-odoo ca74b5e1c8 [IMP] convert PG errors through pg93 diag info
Previously availability of meta-information (failing constraint,
impacted table and column, …) in pg errors (e.g. constraint check
failure) was limited and only available through formatted error
messages, which could be localised (by PG itself) so not did getting
that information require string extraction it was brittle in the face of
localised instances.

Postgres 9.3 adds this meta-information to error diagnostic data
(`PQresultErrorField`), allowing easy programmatic access to it.
Psycopg2 [added a Diagnostic
object](http://initd.org/psycopg/docs/extensions.html#psycopg2.extensions.Diagnostics)
around the time pg9.3 was itself released.

Assuming Odoo now requires pg >= 9.3 we can remove the old string
munging extraction for diagnostic.

* funny story, the handling of 23505 didn't actually work because
  "duplicate key value violates unique constraint" is a literal part
  of the error message, I'd misunderstood "value" as a field name
  because my test model's field was called "value". Makes sense too
  since you can set UNIQUE constraints on multiple fields (and UNIQUE
  indices on expressions)
* for both errors, it should be possible to use the table_name or
  constraint metadata to provide messages about sub-model issues (a
  constraint on an m2o), but that's not currently handled

Fixes #15323
2017-04-11 14:51:53 +02:00
Laurent Smet a8994b4075 [IMP] account: use max_date instead of create_date for aged reports
Aged receivable/payable was using create_date of account_partial_reconcile to decide if a partner needs to be shown at a given date or not.
While it was not wrong, our decision to use the create_date was based on the fact that we wanted to be able to render the exact same report we had at a past date, so a the date of the reconciliation would be important... but since the unreconciliation was not forbidden it wasn't really the case.
Moreover, in some case where reconciliation is not at the same time the payment is recorded, this choice
 - was confusing people about results given by the aged receivable/payable report.
 - was confusing people about the 'Paid on...' line in the payment widget on the invoice, as they would see there a date unused by the system (although they would have liked too)

This was discussed in opw 31844. Was PR #16016
2017-04-11 11:09:01 +02:00
qdp-odoo 84e4f6b08c [FIX] base: fixing test_new_api after previous commit.
New test introduced at https://github.com/odoo/odoo/commit/3214ca98206e5f99e2ab1d471ce1ef543057c9f6 tested the type of a column we changed from datetime to date in https://github.com/odoo/odoo/commit/01142701cc566b3084326af9649fd85db02b4220. Picked another datetime field to do the test
2017-04-11 08:39:34 +02:00
qdp-odoo f019479350 [FIX] account: suppress warning when account currency = company currency 2017-04-10 17:36:54 +02:00
qdp-odoo 01142701cc [REF] res_currency: res.currency.rate name is now a date instead of a datetime
Since we only uses date fields in accounting, it does not have any sense to have a datetime for currency rate:
 - it is error prone for the users as the timezone they're in will affect the rate (and possibly take yesterday's rate).
 - it involved the possibility to create several rates per day, which was not fully supported and might give undeterministic results (so we also add a constraint in order to only have one rate per day)
2017-04-10 16:08:07 +02:00
Fabien Meghazi aafa2f12c4 [IMP] web: improve qweb concatenation error logging 2017-04-10 16:01:30 +02:00
Fabien Pinckaers 4585b14cd1 [MERGE] account: menus for credit note + avoid negative invoices 2017-04-08 19:06:21 +02:00
Fabien Pinckaers 55ea4b16f0 [IMP] account: better CSS/XML for settings 2017-04-08 17:57:14 +02:00
Fabien Pinckaers 525d094ef6 [IMP] account: misc UX improvements
Allow to configure the bank statement import mode from kanban
    When doing a manual journal entry, don't show the maturity date
    Removing Issued total, using credit instead (less code, more
    useful to have due amounts, instead of overdue)
    Creating a bank, set a name 'BofA Current' and an
    account number (that way, the account.account is based
    on name)
    Settings Wizard & menus: better sentences
    Statement CSV Import: installed by default (it
    does not add any menu)
    remove use_in_payment: complex field, only
    used for a default value
    Small code cleanup
[IMP] sale: moving order date to secondary tab (strange on a quotation)
2017-04-08 16:52:05 +02:00
Fabrice Henrion a76ed8f2f3 [IMP] marketing_campaign: better icon
Keyboard is not a clear icon.
Calculator is better for statistics.

Closes #16095
2017-04-07 15:48:59 +02:00
Fabrice Henrion 5420c92b89 [IMP] mail: better notification icon
This icon allows to control what types of notifications you want to receive.
That an icon typically used for "notifications" is better than an icon
typically used for "reminders" and "alarms". There is the risk of a wrong
expectation because reminders and alarms have a notion of time associated to
them: reminders in the future or alarms in the future at a given time. In the
case of a follow, there is no "future time" concept, whereas there is a
notification concept. It makes even more sense when we look at the placement of
this icon on the right side of the label "Following".

Closes #16170
2017-04-07 15:40:55 +02:00
Levent Karakaş 7e8d37462b [ADD[ base: address format for Turkey
Closes #16304
2017-04-07 14:13:37 +02:00
Martin Trigaux 58918fb826 [FIX] account: bad forward port
Field remaining from 9.0 when cherry picking #16236 to #16282
2017-04-06 15:57:03 +02:00
Thomas Binsfeld f79e2fd318 [IMP] account: add prepare methods for exchange diff move lines
Such prepare methods are useful in situations where we want to propagate some
analytic dimension to exchange difference move.

Closes #16282
2017-04-06 15:17:17 +02:00
lap-odoo ba1bf379f4 [IMP] l10n_ar: update taxes descriptions
Replace taxes descriptions code into a clear tax description for l10n_ar. Was PR #16201
2017-04-06 15:08:33 +02:00
lap-odoo 70d351ebb2 [IMP] l10n_ca: update taxes description
Replace taxes descriptions codes by clear tax description for l10n_ca. Was PR #16202
2017-04-06 15:06:48 +02:00
lap-odoo 8d3556859d [IMP] l10n_ec: update account_tax description
Was PR #16203
2017-04-06 15:02:02 +02:00