Commit Graph
89 Commits
Author SHA1 Message Date
Xavier Morel fe8204a48d [FIX] web: overspecified test
Testing what's literally just a native feature seems odd, but in this
case it's also way over-specified: Firefox's error message for the
conversion of a symbol to a number is

    can't convert symbol to number
2021-04-20 14:10:31 +00:00
Aaron Bohy 98ede6e553 [IMP] web: patch/unpatch: better error handling
Before this commit, calling unpatch on an object that hasn't been
patched before crashed (before reaching the code that handles the
case by throwing an Error). This scenario is now properly handled.

This commit also defines specific Error classes for the patch and
unpatch faulty cases, so that they can be elegantly catched (in
tests for example).

closes odoo/odoo#68057

Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2021-03-18 10:25:31 +00:00
Aaron Bohy 6418a55fe4 [IMP] web: patch/unpatch: allow to re-apply a patch
In tests, we might want to disable a specific patch for a specific
test (e.g. to remove a monkey patch done when another addon is
installed, to test the behavior of the current addon).

Before this commit, it was possible to unpatch at the beginning of
the test, but we couldn't re-patch when the test was over.

Feature required by task~2392303
2021-03-18 09:59:53 +00:00
Michael Mattiello (mcm)andged-odoo 7086488064 [REF] web, *: remove patchMixin + imp utils.patch
* hr, hr_holidays, im_livechat, mail, snailmail, website,
  website_livechat

This commit removes `patchMixin` and improve `utils.patch`.
`utils.patch` now supports native classes and has a new parameter
used to patch class members.

`utils.patch` is now used everywhere `patchMixin` was and it must
be used to patch classes.

closes odoo/odoo#65967

Related: odoo/enterprise#16278
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
Co-authored-by: ged-odoo <ged@odoo.com>
2021-02-26 10:39:21 +00:00
Aaron Bohy a890b0bf03 [FIX] web: keep null/false/true strings in domains
Before this commit, occurences of 'null', 'true' and 'false'
strings as autocomplete values in the search view were replaced
respectively by None, True and False.

Fixes #65743

closes odoo/odoo#65958

X-original-commit: 885932ae8e31905e08b79141a445933b6afc9f15
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-02-11 12:18:25 +00:00
Aaron Bohy d9880122db [FIX] web: call do_hide/do_show on a destroyed widget
Before this commit, calling do_hide/do_show/do_toggle on a
widget that had been destroyed before being rendered crashed
(because this.$el was undefined).

Obviously, calling those methods in this situation is useless, but
with asynchronous code, it might happen that you call them in an
handler, and they have been destroyed meanwhile.

This commit checks if this.$el is set before accessing it to avoid
the crash.

closes odoo/odoo#65897

X-original-commit: 320c29f5b37d4f02b4d5f7b1b6ff64462b000c92
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2021-02-10 15:42:33 +00:00
wan db532b0804 [FIX] account: missing renaming type -> move_type
Following https://github.com/odoo/odoo/commit/d675dbaa4c7174591e0e7c1a3caf3e76877312ce

Also updated tests to be more consistant.

Regex used to find problematic lines:
`\btype\b.*\b(out|in)_(invoice|refund)\b`

closes odoo/odoo#64951

X-original-commit: 523cfc447bada2617d0e2cce61806aa188bc59b8
Related: odoo/enterprise#15917
Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
Signed-off-by: William André (wan) <wan@odoo.com>
2021-01-22 15:24:22 +00:00
Pierre Paridans 1eb474243b [FIX] web: Dialog widget should always call on_{attach|detach}_callback
Before this commit, the `on_attach_callback` and `on_detach_callback`
callbacks are not called all the time on the `Dialog` widget when it's
attached/detached to the DOM. Relying on those callbacks could result in
unpredictable behaviours.

To be more precise, the `on_attach_callback` isn't executed on a regular
Dialog#open() call. But Dialog spawned by the ActionManager will execute
it.

This difference prevents from properly binding those callbacks later on
through an extend or include of the Dialog widget as we have no way to
know if they have already been called or not (e.g. which can result in
calling them twice).

This commit normalize this situation by ensuring that the
`on_attach_callback` and `on_detach_callback` callbacks are properly
called by the Dialog widget and allows any extension of this widget to
rely on them. Therefore the ActionManager is adapted accordingly.

opw-2438534

closes odoo/odoo#64794

X-original-commit: 036fc78103e3d8875a5a54c797e1ba0670d02272
Related: odoo/enterprise#15856
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
Signed-off-by: Pierre Paridans <pparidans@users.noreply.github.com>
2021-01-20 12:40:04 +00:00
Julien Mougenot 3041d81135 [IMP] web: Allow asc/desc order in utils.sortBy
A string parameter 'order' has been added to the "sortBy" function of
the utils module to decide in which order the array should be sorted.
The default is 'asc'.
2020-10-12 07:43:43 +00:00
Sébastien Theys b519205ca0 [FIX] web: properly compute popover position
- avoid updating default position list in place
- ensure computed position takes into account enough margin with border
- fallback to requested position instead of bottom

Part of task-2270731

closes odoo/odoo#58370

X-original-commit: 3fad17421518732db2085c3eec596600cfe34f03
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2020-09-23 17:32:35 +00:00
Julien Mougenot 5698d1fab9 [IMP] web: add Registry predicate
Before this commit, any value could be added to registries and the class
needed to be overridden to assert that added values would answer to a
certain predicate.

Now, the registry can be instantiated with a given predicate function
that all added value must pass to be registered (default: all values
are accepted).

Existing implentations have been adapted:
- FieldRegistry
- FieldRegistryOwl.
2020-07-23 08:21:09 +00:00
Julien Mougenot ea1741bc74 [REF] web: Registry goes ESNext
Converted the Registry class to an ES6 class with the new framework
standards.
2020-07-23 08:21:09 +00:00
Benjamin Vrayandqsm-odoo 58179cebf1 [IMP] web, *: replace the bootstrap backdrop element with a bg on modals
*: web_editor

Do not display the backdrop element added by bootstrap in the body and
add a background on the modal to keep the same effect. The bootstrap
backdrop was probably useful for compatibility with <IE9 but is no
longer needed. This also avoids z-index issues because modals could be
opened in an element (e.g. the website #wrapwrap) whose stacking context
is different of the body one (where the backdrop is opened). This would
make the backdrop appears on top of the modal.

Part of https://github.com/odoo/odoo/pull/49142
Related to task-2229551

Co-authored-by: qsm-odoo <qsm@odoo.com>
2020-06-30 14:19:17 +00:00
qsm-odoo 4341a4d795 [IMP] web: better test modal backdrop behaviors
Part of https://github.com/odoo/odoo/pull/49142
task-2229551
2020-06-30 14:19:17 +00:00
Julien Mougenot a6cd6d5a89 [IMP] web: utils: add groupBy function
This commit introduces a new utility function: 'groupBy'. It is
similar in API and result as the underscore method of the same
name.

X-original-commit: 834a1967161dc537cb2d5543314a062dbac08f9c
2020-06-22 13:04:00 +00:00
Aaron Bohy b4ba0fc340 [FIX] *: adapt tests to env rework
This commit adapts tests following recent changes on the helpers.
The main change is that addMockEnvironment (and all functions using
it) are now async, as they need to wait for services to be started.
2020-06-12 09:47:48 +00:00
Mathieu Duckerts-Antoine a758f8f307 [FIX] web: don't forget initial registry entries
The entries comming from the optional parameter 'mapping' passed at the
instantiation of a registry were never considered when returning the
registry keys or entries. This is no longer the case.

closes odoo/odoo#52768

X-original-commit: e094ddd0ffaf3357e64ca5941ffc2e0454c24ab7
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2020-06-10 11:57:54 +00:00
Sébastien Theys 499bbfd5c3 [IMP] web: various Popover improvements
Close can now be requested by children (slot content) with the event
`o-popover-close`. This feature is necessary if we want a "close" button inside
the popover itself, which is the case for mail.activity "Mark Done".

Clicking on the popover target now acts as a toggle, which is also a feature
that was expected from the previous popover implementation.

Add a specific class (`o_is_open`) when the popover is displayed to be able to
style its target depending on whether it is displayed or not.

Ensure computed position is whole number of pixels to prevent flicker issue on
Firefox.

Remove forced width to let the component grow with its content.

Add appropriate z-index to prevent overlap issue with the rest of our interface.

closes odoo/odoo#50850

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-05-15 14:05:55 +00:00
Julien Mougenot d21c412985 [IMP] web: Standardize FALSE and TRUE leaves/domains
Add four static properties on the Domain.js class: (TRUE|FALSE)_(LEAF|DOMAIN).
This increases consistency for domains using these concepts.
2020-05-05 19:23:20 +00:00
Julien Mougenot 26491fcb4c [IMP] web: add sortBy to core.utils
Add a "sortBy" helper to core utils. This function takes an array and
an optional criterion as arguments and returns a new array sorted
according to the given criterion.
2020-05-05 19:23:20 +00:00
Xavier Morel f08b5d22a4 [IMP] web: handling of escaping in literals
Handling of escapes (`\`) was performed during evaluation rather than
parsing, so strings in the AST stored the escaped form (rather than
the proper one), and _formatAST had to mess around in order to try and
get it back into a semblance of relevance (especially as the AST would
store the escaped string without delimiters).

Fix: perform the escapes handling (aka normalisation) during
tokenization where it belongs. This means the AST formatter can now
just JSON.stringify the data. Until and unless we decide to produce a
cpython-compliant
repr (https://github.com/python/cpython/blob/0169d3003be3d072751dd14a5c84748ab63a249f/Objects/unicodeobject.c#L12902-L13006)
which is unlikely.

closes odoo/odoo#50236

Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2020-04-27 13:59:49 +00:00
Michael Mattiello (mcm) dcf9a4c38d [IMP] web: add es6 class patcher
This commit implements a new way to monkey-patch ES6
classes (for instance, Owl Components).

Usage
-----

odoo.module('module.BaseClass', function (require) {
    const patchMixin = require('web.patchMixin');

    // Define your class as usual
    class BaseClass {
        constructor() {
            this.foo = 'foo';
        }
        bar() {
            console.log(this.foo);
        }
    }

    // but export it like this to have a "patchable" version
    return patchMixin(BaseClass);
});

odoo.module('module.Patch', function (require) {
    // imports the "patchable" version
    const BaseClass = require('module.BaseClass');

    BaseClass.patch('key', T =>
        class extends T {
            constructor() {
                super();
                this.foo = 'patched foo';
            }
            bar() {
                super.bar();
                console.log('patched bar()');
            }
        }
    );
});

odoo.module('module.instance', function (require) {
    // imports the "patchable" version
    const BaseClass = require('module.BaseClass');

    const obj = new BaseClass();
    obj.bar();
    // if module.patch is loaded before this module the patch
    // will be apply and calling obj.bar() will log:
    // patched foo
    // patched bar()

    // You can unpatch a patchable class
    BaseClass.unpatch('key');
});
2020-04-16 07:19:25 +00:00
Damien Bouvy 256c75baf7 [IMP] web: add a <Popover> component
Using bootstrap popover with owl is possible, but with a lot of
friction.

This commit adds a Popover element to ease developments that require
a popover. This component takes 2 props:
  - position='bottom' (optional): 'top', 'bottom', 'left', 'right'
  - title (optional)

Its usage requires setting an `opened` slot for the content of the
popover, whilst the 'trigger' of the popover uses the default slot.

E.g.
```xml
<Parent>
 <Popover>
  <t t-set="opened">
   <p>You have opened the popover, congratulations!</p>
   <button t-on-click='_handlerOnParent'>Dispatch cake</button>
  </t>
  <button class="btn btn-primary">Click me!</button>
 </Popover>
</Parent>
```

Note that:
- only one popover can be opened at a time (opening a popover will
close any previously opened popover)
- `Popover` uses `Portal` under the hood, so events are propagated
correctly even though the popover is teleported elsewhere in the dom
(see example in this commit message with `_handlerOnParent`)
- `<Popover>` is registed as a global component in QWeb and does not
need to be added to a Component's subcomponents list

closes odoo/odoo#47710

Signed-off-by: Damien Bouvy (dbo) <dbo@odoo.com>
2020-04-14 11:59:04 +00:00
Nicolas Martinelli a12479aaa8 [FIX] web: rounding error
In JavaScript, the following computation introduces numerical errors:
```
Math.pow(10, -4) = 0.00009999999999999999
Math.pow(10, -5) = 0.000009999999999999999
```

In the context of `round_decimals`, such errors propagate to
`round_precision`, ultimately leading to inconsistencies between Python
and JS (see #47300 for detailed use case).

Instead of computing `Math.pow(10, decimals)`, we parse the scientific
notation to prevent such inaccuracies.

We also introduce tests in line with the Python tests.

opw-2205092

closes odoo/odoo#47694

X-original-commit: cb471897bfa08d1fee6a9f49e90d9c120e1733fc
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-03-16 12:01:57 +00:00
Joseph Caburnay 78beadb748 [REV] web: allow patching getters
This reverts commit d6b854306c.

The reverted commit introduced issues in patching class methods.
Introducing getters in the patch function is not actually compatible
with the original method patching.

Test for patch method is also introduced to guard patch from future
invalid modification that happened.

A more robust  way of patching classes is now being developed.

closes odoo/odoo#47557

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-03-13 08:41:15 +00:00
Joseph Caburnay d6b854306c [IMP] web: allow patching getters
Previous implementation of patch (web.utils) only allows patching
methods. This commit allows patching getters as well.

closes odoo/odoo#47047

Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2020-03-06 09:04:20 +00:00
Ankita Raval d675dbaa4c [IMP] account,* : Change type field to move_type in account.move
task-id: 2028z813
2020-02-19 09:09:20 +00:00
Xavier Morel e95ccf0908 [FIX] *: domains should not have as many binary operator as there are terms
* modify client-side domain normalisation to error if the domain is
  invalid (not enough terms / segments for the number of operators)
* add better error reporting to attrs / modifiers parsing
* add a few layered error augmentation to provide clearer context
  e.g. "error: invalid domain <thing>" is helpful but "error while
  parsing modifiers for field foo: modifier invisible: invalid domain
  <thing>" is much more helpful
* rework _evalModifiers to deduplicate it in order to more easily
  implement this contextual augmentation
* test that improper domains are properly found improper
* fix a bunch of incorrect attrs domains
* also removed an apparently undefined (& unused) "options" argument
  to a _applyModifiers call

closes odoo/odoo#44642

Related: odoo/enterprise#8175
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2020-02-12 09:32:17 +00:00
Julien Mougenot 5f6571a6fe [FIX] web,mail: only apply modal activity for Dialog modals
Before this commit, the CSS rule handling the "activity" of the modals
(their z-index compared to the one of their backdrop) was global and would
interfere with front-end or custom modals which do not use the static Dialog
methods giving them the "active" class.

Now, the rule has been inverted: the z-index of a modal is only changed when
it is given an "inactive" class, thus only impacting the modals instantiated
via Dialog or Owl Dialog classes.

closes odoo/odoo#44067

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-01-28 11:35:14 +00:00
Julien Mougenot c146af8a6d [REF] web: home menu template event names to kebab
Changed the event names to comply to Owl standards.
2020-01-15 11:31:17 +00:00
Julien Mougenot 1d58b76032 [FIX] web: correctly handle display/hide of dialogs
Before this commit: all dialogs would go through the static method (OwlDialog.hide)
when destroyed, regardless of wether they had been opened or not.

Now, only dialogs having an 'el' property set (= having been opened) will use
the 'hide' method.

Task 2170705

closes odoo/odoo#43124

Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2020-01-10 12:48:41 +00:00
Julien Mougenot 34bbdd88c0 [ADD] web: Owl Dialog
New Owl component: Dialog. It does not rely on Bootstrap but behaves the same
and does not conflict with legacy dialogs.
To call this component, you need to define it in the XML parent template instead
of calling it in the JS file, and put a flag in the parent state to toggle the dialog.
Old dialog file has also been slightly updated to ensure compatibility between both
versions.

This commit also updates a list view test which did not wait for click events to
properly trigger and would cause the new dialog system to crash.
2020-01-06 14:37:16 +00:00
Arnaud Joset c411bdfe4d [FIX] web: human readability of negative numbers.
Before this commit, negative numbers are never rendered as human readable (e.g. 34000 -> 34k).

closes odoo/odoo#42789

Taskid: 2160790
X-original-commit: b51877c4c4c9d8cd873dd0205954fd807d62ee01
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-01-06 15:46:28 +00:00
Vincent Schippefilt 4bcad6d546 [FIX] web: fix incorrect test of py utils
Before this fix, a QUnit test was wrong (didn't parse)
After this fix, the test actually works and tests something.

closes odoo/odoo#41257

X-original-commit: 3818a7f0df754717a7379dc8341729b508a166be
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2019-12-03 09:38:16 +00:00
Xavier Morel 9546a37599 [ADD] pyjs: support for conditional expressions
Conditional expressions were already parsed, but there was no support
for executing them (or stringifying them back though I'm not sure when
that's used).

closes odoo/odoo#40502

Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2019-11-19 13:16:04 +00:00
qsm-odoo 60d1e26f9a [FIX] web: prevent destroyed widget from calling start (2)
This completes a commit that was made for the version saas-11.3 (12.0):
https://github.com/odoo/odoo/commit/1440c8be0337c89e3d67d6d93e614c269c8689f1

Indeed, the logic was implemented for the appendTo, prependTo, etc
methods but not for the attachTo...
This could solve unknown problems in stable versions as well but was
judged too risky to merge there. Indeed, if a real problem occurs in a
stable version because of this, the condition can be added to the
related widget individually.

The problem was found in master: during website edition, the public
widgets can be restarted if an element is edited... but sometimes the
public widgets may be restarted in the same JS stack execution. The
willStart method being async, the destroy method was called before
the start method. This does not lead not any known problem with our
current widgets but will create one for a new snippet being implemented.

closes odoo/odoo#39949

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2019-11-07 12:10:59 +00:00
Julien Mougenot b416c15a77 [IMP] web: dialog triggers custom callback on close
Added an option in the Dialog class to give it a function to run
when it's closed by other ways than by its buttons.
Its default value is the "cancel" callback if given, or none.

Before this commit, there was no way to add any callback to run
when the modal wasn't closed by a button.

Now, when exiting the modal by other means (e.g.: "Escape" key),
it will run a given callback.
2019-08-16 09:03:49 +00:00
Mathieu Duckerts-AntoineandAaron Bohy 49a97305b1 [REF] *: pivot view refactoring
The main aim of the present refactoring is twofold:

- simplify the code that was largely complexified at the time of the
introduction of comparisons in the pivot view (Time Ranges menu),

- factorize the method expandHeader and _loadData that were too much complex.

Along the way, the pivot model structure has been simplified
and many tests have been added.
Performances in mobile mode have been improved by avoiding
unecessary operations due to useless column groupbys in that
mode.
It should now be easier to understand and modify the pivot view in future.

Co-Authored-By: Aaron Bohy <aab@odoo.com>

closes odoo/odoo#33615

Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2019-08-02 18:34:18 +00:00
Mathieu Duckerts-Antoine 5894df57d3 [IMP] web: add math_utils to core
math_utils is a small library that exports two
functions:

    - cartesian: allows to compute the cartesian
                products of any numbers of arrays
                while preserving the internal
                structures of their elements.
    - sections: returns an array with all
                the initial sections of the
                array passed as parameter.
2019-08-02 18:34:18 +00:00
qsm-odoo afb3c28fcc [FIX] web: restore modal backdrops click behavior
Since https://github.com/odoo/odoo/commit/2ad49ec93e39ae5d59ccc17884408870e1c86c5e,
all dialogs were able to be closed by clicking on the backdrop which was
not a desired behavior.

Indeed, the 'backdrop' option of the BS component was misused.

closes odoo/odoo#35300

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2019-07-30 13:42:09 +00:00
Cedric Snauwaert 9cab694bf5 [IMP] web: add simple calculator on numeric fields
Add a new behavior to numeric fields, possibility to enter value manually or to use a simple arithmetic expression that will be evaluated.
Example: =20+3*2
In order for the computation of the arithmetic expression to be done, the value needs to starts with = and then an expression can be entered. We only support the basics mathematical operations + - * / ( ) ^
User locale and digits separator are taken into account. If the value entered can't be evaluated to a numeric, the field will be displayed in error.

closes odoo/odoo#34538

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2019-07-09 07:45:42 +00:00
Laurent Smet bc131c0cfb [MERGE] manual forward port of accounting-pocalypse (beaa30a3d1)
This commit merges the following models
 * account.invoice and account.move
 * account.invoice.line and account.move.line
 * account.voucher and account.move
 * account.voucher.line and account.move.line

It was the opportunity for a big cleanup of the code, so it also restructures the whole account module, its different models/fields, the tests etc. for a better world and a better code readability.

==== Rationale ====
The rationale of this huge change is that we want journal entries / invoices to be easily edited, and changes reflected in the other model. It's a HUGE feature and very strategic for the fiduciary companies. For example, changing the account of a journal entry needs to be automatically reflected on the related invoice.

The same reasoning applies to sale/purchase vouchers.

==== Changes made in features =====
When creating an invoice, you are now creating a journal entry directly.
--> The object account.invoice no longer exists.
In the same fashion when creating an invoice line, you're now adding journal items directly in the journal entry representing the invoice. If this invoice line has some tax, it may create additional journal items as well.
--> The models account.invoice.line & account.invoice.tax no longer exist

Identically, when creating a sale/purchase receipt with its lines, you are now creating a journal entry directly and there's no more usability difference between encoding a receipt or an invoice.
--> The object account.voucher no longer exists.
--> The object account.voucher.line no longer exists.
--> The whole account_voucher module no longer exists.

Positive side-effects coming from these changes are
* draft invoices/bills/sale or purchase receipts now create a draft accounting entry. Validate these objects now simply post its journal entry. That means that draft invoices/bills/sale or purchase receipt can straightforwardly be included in reporting or budgets.
* opening a journal entry in form view will now always open the correct view: if it's a sale/purchase journal entry we will have a customer invoice/vendor bill view or a sale/purchase receipt view, whatever the menu we're coming from.
* code & business logic simplification. It is also condensed in a single place instead of being partially duplicated on invoices, vouchers and journal entries.

There should be no feature loss, except the one allowing to group multiple journal items together based on the same product during the invoice validation.

==== Changes made in models =====
* account.invoice: model removed. Instead, now use account.move with following mapping

field (account.invoice) 		field (account.move)
-----------------------			--------------------
name 					invoice_payment_ref
number 					name
reference 				ref
comment 				narration
user_id 				invoice_user_id
amount_					total_company_signed amount_total_signed
residual 				amount_residual
state 					state + invoice_payment_state 		/!\ selection changed
date_invoice 				invoice_date
date_due 				invoice_date_due
sent 					invoice_sent
origin 					invoice_origin
payment_term_id 			invoice_payment_term_id
partner_bank_id 			invoice_partner_bank_id
incoterm_id 				invoice_incoterm_id
vendor_bill_id 				invoice_vendor_bill_id
source_email 				invoice_source_email
vendor_display_name 			invoice_vendor_display_name
invoice_icon 				invoice_vendor_icon
cash_rounding_id 			invoice_cash_rounding_id
sequence_number_next 			invoice_sequence_number_next
sequence_number_next_prefix 		invoice_sequence_number_next_prefix

'invoices' subset of account.move can be accessed by using the selection field 'type' or one of the many helpers like is_invoice()

* account.move: now has a valid state 'cancel' that has to be excluded from all business logic
* account.move: field 'amount' renamed into 'amount_total'
* account.move: field 'reverse_entry_id' renamed into 'reversed_entry_id'
* account.move.line: now has a field 'display_type' that has to be excluded from all business logic, in order to support invoice layouting
* account.invoice.line: model removed. Instead, now use account.move.line with following mapping

field (account.invoice.line) 		field (account.move.line)
----------------------------		-------------------------
invoice_id 				move_id
uom_id 					product_uom_id
invoice_line_tax_ids 			tax_ids
account_analytic_id 			analytic_account_id

'invoice lines' subset of all account.move.line from a journal entry can be accessed by using the boolean field 'exclude_from_invoice_tab'

* account.invoice.tax: model removed. Instead, now use account.move.line with following mapping

field (account.invoice.tax) 		field (account.move.line)
---------------------------		-------------------------
invoice_id 				move_id
account_analytic_id 			analytic_account_id
amount 					price_unit
base 					tax_base_amount

'tax lines' subset of all account.move.line from a journal entry can be accessed by using the relational field 'tax_line_id'

* account.invoice.confirm: model removed. Instead, now use the 'post()' function of account.move
* account.invoice.refund: model removed. Instead, now use account.move.reversal to reverse the entries with the same options as we had for invoices
* account.voucher: model removed. Instead, now use account.move of type in ['out_receipt', 'in_receipt]
* account.voucher.line: model removed. Instead, now use account.move.line

==== Changes made in functions ====
* on account.move, method _run_post_draft_to_post() renamed into _autopost_draft_entries()
* on account.move, method action_account_invoice_payment() renamed into action_invoice_register_payment()
* on account.move, method action_invoice_reconcile_to_check() renamed into action_open_matching_suspense_moves()
* on account.move, method _get_domain_edition_mode_available() renamed into _get_domain_matching_supsense_moves()
* on account.move, method _get_intrastat_country_id() renamed into _get_invoice_intrastat_country_id()
* on account.move.line, method _get_domain_for_edition_mode() renamed into _get_suspense_moves_domain()
* in account.bank.statement, contextual key 'edition_mode' renamed into 'suspense_moves_mode'

Was task 1917430
2019-07-01 13:45:57 +02:00
Pierre Paridans 71a2d7c06a [REF] web: don't destroy twice a widget's children
Widget class indirectly inherits from ParentedMixin (through
PropertiesMixin).

The Widget's children are destroyed in both the ParentedMixin and the
Widget's own destroy() method.

This commit prevents from trying to destroy already destroyed children
and specifically from looping again on those children (resulting into a
minor performance improvement).

closes odoo/odoo#32174

Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
2019-05-23 15:41:30 +00:00
Mathieu Duckerts-Antoine 604c43640a [IMP] web: use Chart.js in graph view
It has been decided to use Chart.js instead of nvd3 to render charts.
In this commit the graph view has been largely rewritten to benefit
from the options offered by Chart.js.

Task ID: 1946138
2019-04-01 14:40:51 +00:00
ab56e637b7 [REF] web: adapt code after jQuery update
Part of task 1896658

Co-authored-by: Aaron Bohy <aab@odoo.com>
Co-authored-by: Christophe Matthieu <chm@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: David Monjoie <dmo@odoo.com>
Co-authored-by: Martin Geubelle <mge@odoo.com>
Co-authored-by: svs-odoo <svs@odoo.com>
Co-authored-by: Vincent Schippefilt <vsc@odoo.com>
2019-03-06 20:07:17 +01:00
Christophe Simonis 0e7675847f [MERGE] forward port branch saas-12.1 up to 0f4abc5c22 2019-02-22 16:25:02 +01:00
Christophe Simonis 1d2b6f1bef [MERGE] forward port branch 12.0 up to 84143a34b3 2019-02-21 15:37:19 +01:00
Mathieu Duckerts-Antoine 01c159fd9f [FIX] web: quotes and backslashes in search view
The commit 6d3ada178f
aimed to solve problems occuring whith (single or
double) quotes when creating new custom filters.
Unfortunately, the point was missed and bugs were
still present. The present commit solves the
orginial problem satisfactorily.
There was also a problem in the management of
backslashes. Type '\\' in the search bar would
lead to a domain like
[('...', 'ilike', '\\\\\\\\\\\\\\\\')].
This has also been fixed. Note that it is
necessary to input "\\" if one is looking for a
backslash in db (as before).

A remark on the _formatAST function (py_utils.js):

We deescape only the chars `'`, `"`, and `\`
because it does not seem possible to produce a
string in the search view that would intend a
search for a line return or a tab for example.

A general remark:

Domains should always be in normalized form.
In that way they could be manipulated and combined
together without a tokenization/parsing!

closes odoo/odoo#29756
2019-02-12 12:45:51 +00:00
Xavier Morel 78a1ba3449 [FIX] web: undestroyed widgets in tests
closes odoo/odoo#30794
2019-02-04 09:25:46 +00:00
Mathieu Duckerts-Antoine 24b0f092b4 [FIX] web: remove human_number limitations
The formatting of very big numbers (like
1.0045e+22) was not handled adequately by
the function 'human_number' in web.utils.
For those numbers, it seems more appropriate
to use the scientific format. The only
difference introduced here is the following.
Beyond a magnitude of e+21, we represent the
numbers by themselves but we keep the
number of decimals provided as parameter
(or zero by default) and we remove useless
zero decimals like in the other cases.
For instance, 1.0045e+22 is replaced by 1e+22
instead of 1.00e+22 if ask 2 decimals of
precision (and by 1.005e+22 for 3 decimals).

We have also fixed a small bug occuring in the
previous version of the function: the symbol
'E' was never used. So by the past the above
number would have be represented as
10045000P and, even worse, 1.01e+45 by
1.012e+28P.

closes odoo/odoo#31140
2019-02-15 10:51:01 +00:00