Commit Graph
116583 Commits
Author SHA1 Message Date
Mathieu Duckerts-Antoine 166319fa4a [IMP] web: GraphView: remove hack to render in DOM
The graph view uses the nv(d3) lib to render the graph. This lib
requires that the rendering is done directly into the DOM (so that
it can correctly compute positions). However, the views are always
rendered in fragments, and appended to the DOM once ready (to
prevent them from flickering).

Before this rev., the graph view circumvented this by performing
the rendering in a setTimeout(0), letting the framework append the
widget to the DOM first.

This rev. removes this hack and uses the on_attach_callback hook
instead, which is called when the widget is attached to the DOM.
This ensures that the rendering is always done in the DOM, and we
keep the rendering part synchronous.
2018-04-03 15:19:42 +02:00
Mathieu Duckerts-Antoine 8e017ee296 [IMP] web: add a percentage formatter
This rev. adds a new formatter for numerical values to fieldsUtils.
2018-04-03 15:19:42 +02:00
Nicolas Martinelli dcca2e8b9d [FIX] account: fix test
Complement of 802339c12d
2018-04-03 14:10:09 +02:00
Nicolas Martinelli 802339c12d [FIX] analytic, hr_timesheet: recompute order
When creating a timesheet, several fields need to be recomputed:
- `currency_id`
- `group_id`
- `department_id`
- `is_timesheet`
- `validated`

When `validated` is computed before the other fields, the recomputation
will lead to an `AccessError` because of the rule
`hr_timesheet.timesheet_line_rule_user`.

Since the test `test_timesheet_validation_user` expects an
`AccessError`, the test succeeds. However, from time to time,
`validated` is computed last => the `AccessError` is not raised.

Actually, a `ValidationError` should be raised in this case (from the
`create` override in `timesheet_grid`).
2018-04-03 08:30:30 +02:00
Dipalee Bhalodia 1fa8f67926 [FIX] mail: click on unstar all button should reset the starredcounter
Before this commit:
Clicking on 'unstar all' button removes all messages from starred channel
but it only decreases the counter as many as there are displayed messages
on screen.

For example, if there are 40 messages starred, only 30 messages
are on screen (default limit) but unstar all will decrease counter
only for those messages instead of 40.

After this commit:
clicking on 'unstar all' button will correctly take in account all
fetched messages and not only displayed messages.
So now, after clicking on 'unstar all' button will update the starred
counter to 0.

task-ID: 33958
2018-03-30 16:42:59 +02:00
Olivier Colson 548e0ba239 [IMP] l10n_ch: allow manual value for postal bank accounts
Previously, the ISR reference was computed from the iban number but it seems some banks (for example UBS) use arbitrary ISR references that needs to be manually set.

Was task: 40975
Was PR #22931
2018-03-30 15:46:45 +02:00
dbhandAaron Bohy ea97fa3ac6 [IMP] mail: Discuss: load older messages automatically
After this rev., in Discuss, messages are automatically loaded when
the user scrolls to the top of the channel.

Task 33958

Co-authored-by: Aaron Bohy <aab@odoo.com>
2018-03-30 15:30:37 +02:00
Géry Debongnie c5c2b4855b [REF] web: put willStart method before start (AbstractField) 2018-03-30 11:26:32 +02:00
Raphael Collet 31025540c4 [IMP] models: user-specified field aggregator in read_group
The caller of `read_group` can now provide the aggregating function to use for
a given field:

    # set aggregating operator for fields 'foo' and 'bar'
    model.read_group(domain, ['foo:sum', 'bar:avg'], ...)

One can also aggregate the same field several times, by giving a specific
output name for each:

    # aggregate 'foo' with both 'min' and 'max'
    model.read_group(domain, ['foomin:min(foo)', 'foomax:max(foo)'], ...)
2018-03-30 11:01:08 +02:00
Aaron Bohy fce1a799fc [FIX] web: ActionManager: call 'on_attach_callback'
for actions in target='new'. Before this rev., it was only called
on the dialog, but not on the controller rendered inside it.
2018-03-30 07:49:19 +02:00
qdp-odoo 0afab2853b [FIX] account: fix previous commit
Field enaming introduced at https://github.com/odoo/odoo/commit/bfe362c87a2c058c9257166dca096d80c79d3dc3 left some references to old field name. #oops #cestpasmoicestlui
2018-03-29 21:54:13 +02:00
Laurent Smet bfe362c87a [IMP] account: allow choosing a cash basis taxes account for base amount
When using cash basis taxes, the user has now the possibility to select a cash basis account containing the base amount during the generation of accounting entries.
This commit has been backported in v9 (in form of a module) in revision 1631889e91

  - task: https://www.odoo.com/web#id=40284&view_type=form&model=project.task&action=333&active_id=967&menu_id=4720
  - Was PR #22599
2018-03-29 18:15:38 +02:00
qdp-odoo 9c4592761f [IMP] account: support of several payments linked to the same statement line.
This is needed to allow having a single bank statement validating 2 payments in case of our internal OGONE processing. An incoming commit in account_batch_deposit will explain more in-depth the use case covered
2018-03-29 12:12:33 +02:00
qdp-odoo 771f65ecf5 [IMP] account: usability of payments
Payments created without partner_type (field not required) were previously not shown anywhere.
2018-03-29 12:09:28 +02:00
Thibault Delavallée e76d492636 [MERGE][IMP] mail: use xmlid_to_res_id instead of ref when accessing subtype ids
Deleting comment / note / activity subtypes make the whole system quite
impossible to use. Indeed the whole communication mechanism is based on
those subtypes that are hardcoded.

There are some use of env.ref() about subtypes to try to avoid having those
removed. As there is some work to make some xml ids impossible to delete we
can already update some code to use xmlid_to_res_id instead of env.ref(). This
leads to some gain in query count as there is no exists() that is performed.

Globally this merge allows to save a few query on each message post and about
7K on community runbot.
2018-03-29 10:53:00 +02:00
Thibault Delavallée 4451e505cd [IMP] mail: use xmlid_to_res_id instead of ref in remaining places of mail
As explained in previous commit we can use xmlid_to_res_id instead of ref()
which leads to some query gain. This commit update some other less important
places: when setting activities as done and in the composer. This lead to
a gain in tests involving activities and composer, including tracking
triggering a template. On community runbot this leads to a gain of about 1K
queries.
2018-03-28 16:57:05 +02:00
Thibault Delavallée a2511f3a5a [IMP] mail: use xmlid_to_res_id instead of ref to find subtype in various post methods
As explained in previous commit we can use xmlid_to_res_id instead of ref()
which leads to some query gain. We gain 1 query on most post due notably to
notify and logging is still improved. This leads to a gain of about 4K queries
on community runbot.
2018-03-28 16:56:16 +02:00
Thibault Delavallée 1e4ee402a3 [IMP] mail: use xmlid_to_res_id instead of ref to find subtype in message_format
Deleting comment / note / activity subtypes make the whole system quite
impossible to use. Indeed the whole communication mechanism is based on
those subtypes that are hardcoded.

There are some use of env.ref() about subtypes to try to avoid having those
removed. As there is some work to make some xml ids impossible to delete we
can already update some code to use xmlid_to_res_id instead of env.ref(). This
leads to some gain in query count as there is no exists() that is performed.

Gain: 1 query on most tests implying post, because message_format is called
by bus notification. About 1.5K queries on community runbot
2018-03-28 16:55:08 +02:00
Thibault Delavallée d4dcfb6c6a [FIX] test_mail: increase activity-related counters to avoid sometimes-red runbot
Still this "sometimes one query more" in activity-related tests. Let us avoid
false red occurrences of runbot by adding one query on sometimes-failing tests.
Purpose of performance test is to have an idea of query count. Adding one query
is not harmful.
2018-03-28 16:17:36 +02:00
Tejas Shahu e069da80fd [IMP] account: improve usability in the bank reconciliation widget.
- Removed 'OK' button to save title. Now, title will be saved on focusout or enter key pressed.
    - If more than one statements to be reconciled, then title should not be editable.
    - If no title for statement display text 'No Title'.
    - Improve UI for title to better understand clickable area and fix issue if title is too long.

Was task 34890. Was PR #19971
2018-03-28 15:45:52 +02:00
Martin Trigaux ee228e087c [IMP] base: always show overwrite box
It is not a technical feature
2018-03-28 14:20:55 +02:00
Raphael Collet d92b1d7818 [FIX] auth_crypt: do not invalidate the whole cache when setting password 2018-03-28 14:17:43 +02:00
Martin Geubelle 6676c3b189 [IMP] web: override size attributes in image widget
Size attributes (e.g. `max-width`) are sometimes set in css (i.e. with classes,
see `oe_avatar`).

They must however be overriden if they are specified on the widget.

Example:
  <field name="image" widget="image" class="oe_avatar" options="{'size': [180, 180]}"/>

The `max-width: 90px` set on oe_avatar must be overriden in this case.

Note that the attribute `img_width` and `img_height` have been depreciated as
`width` and `height` are fulfilling the exact same purpose.
2018-03-28 14:02:00 +02:00
Olivier Colson 98ee15977a [IMP] stock_account, anglo-saxon accounting: help to clear out interim accounts
Accounting entries made for invoices and stock valuation on the interim accounts (stock input/output accounts) are now reconciled together for both sales and purchases. This will definitively help to have those accounts zero-outed when all operations are processed.

The reconciliation is made as long as the stock valuation is set in real-time, whatever the costing method.

Note that change change also allow a particular use case to be solved: when a purchase is made in a foreign currency whose rate change between the incoming shipment reception and the bill validation (there will be an automated exchange rate entry created).

Was task 32331. Was PR #22483
2018-03-28 13:45:47 +02:00
Christophe Simonis 3a537c789a [MERGE] forward port branch saas-11.2 up to 55a14f9ce8 2018-03-27 19:41:30 +02:00
Christophe Simonis 55a14f9ce8 [FIX] sale_timesheet: use existing field
Oversight of previous forward-port
2018-03-27 19:02:06 +02:00
Christophe Simonis 87a0f4dc4c [MERGE] forward port branch 11.0 up to b33d5af4a7 2018-03-27 18:22:18 +02:00
Arnold Moyaux b33d5af4a7 [FIX] stock: allow to validate a picking with 2 extra moves
Use case to reproduce:
- Create a picking containing 2 moves that have a quantity_done greater than reserved quantity
- Validate the picking with or without backorder

Traceback due to a record that do not exist anymore.

It happens due to 2 functionality that have a wrong behavior when used together:
- merge_move function that will try to merge moves with same characteristics inside a same picking.
- action_done functionality that will create an extra move if the quantity done for a move is greater
than reserved quantity. (the extra move is used in order to propagate changes)

With our usecase:
- MOVE A, reserved_qty: 10, qty_done: 20
- MOVE B, reserved_qty: 10, qty_done: 15
action_done on move A will create a new move thus we will have
- MOVE A, reserved_qty: 10, qty_done: 20
-  A bis, reserved_qty: 10, qty_done: 0
- MOVE B, reserved_qty: 10, qty_done: 15
then merge move will not only merge move A and A bis but will also merge B
which result with inconsenstencies and traceback since system will try to
process move B after A
- MOVE A,A',B reserved_qty:30, qty_done:35 (the 5 extra qty is not propagated)

This commit adds a kwarg in action_confirm that is propagated to merge_move
this kwargs is a record set taht will limit the moves that can be used for the merge
in order to merge extra move in original move

opw-1825264
2018-03-27 17:36:44 +02:00
Jeremy Kersten d24675f76a [IMP] website_sale: confirmation page fix margin
Move right column after the title to keep same logic than previous
steps where wizard in not into the left column but has his own row.
2018-03-27 17:31:45 +02:00
Christophe Simonis f22c5794c4 [MERGE] forward port branch saas-15 up to a9542240fc 2018-03-27 17:17:38 +02:00
Christophe Simonis a9542240fc [MERGE] forward port branch saas-14 up to ce5b4b6512 2018-03-27 16:41:47 +02:00
Thibault Delavallée 5cbd9ae0ab [MERGE][IMP] mail, various: add automatic activities generation to ease business flows
This merge make several application automatically generate activities based
on business requirements in order to ease the daily job of people using it.

In this merge

 * methods allowing to create, reschedule, mark as done or unlink activites
   are added in mail.activity.mixin;
 * automated activities are flagged using the newly-added automated field
   to distinguish them from other activities;
 * mail.activity.mixin is added to some models to ensure activities are
   activated;
 * several main applications use this API to integrate activities automation
   in their flow: hr_holidays (leave and allocation), hr_expense (expense
   report), fleet (vehicle contract), maintenance (maintenance request),
   sale (sale order);

Please see sub-commits for more details about the mixin update as well as
the integration in the various applications.

This merge is linked to task ID 39578. Closes #20799 .
2018-03-27 16:39:14 +02:00
Thibault Delavallée d0e2caee4e [IMP] maintenance: improve activity management on maintenance request model
This commit improves maintenance requests management through a better
integration of activities and addition of automated activities. Several
things are done in this commit :

 * automatic activities generation is added for maintenance requests.
   Activities are generated to remind assigned users about maintenance to
   perform. They are also automatically removed or updated if the scheduled
   date is changed or if the request is done to avoid bloating users with
   unnecessary activities;
 * a menu to configure activity types is added. Indeed equipment managers
   should be able to see and configure activity types related to their job;
2018-03-27 16:31:05 +02:00
Thibault Delavallée 77c7b68a9b [IMP] fleet: improve activity management on fleet contract model
This commit improves fleet contracts management through a better integration
of activities and addition of automated activities. Several things are done
in this commit :

 * fleet vehicle log contract does not inherit from mail.activity.mixin.
   This commit adds the inherit so that fleet users and managers can now
   schedule and manage activities on vehicle contracts. This will help them
   in their daily job;
 * automatic activities generation is added when contracts are nearly expired
   and renewal is required;
 * a menu to configure activity types is added. Indeed fleet managers should
   be able to see and configure activity types related to their job;
 * filters are added to be able to use the systray and to filter the kanban
   view based on activities

Having automated activities allow to replace some messages posted on the
contract. Indeed currently there are messages posted on vehicles about
contracts to renew. As we now have automated activities on contracts to
remind assigned people to renew it the log can be safely removed. It will
lessen noise generated on chatter.
2018-03-27 16:31:01 +02:00
Thibault Delavallée fce33767af [IMP] fleet: add responsible on fleet vehicle log contract model
Currently there is no place to indicate who is responsible of managing
fleet contracts. As we plan to integrate activities to fleet app having
responsible to push notifications is necessary.

This commit adds a responsible field following Odoo convention, aka a
user_id field linking res.users records. It is also added on the view.
2018-03-27 16:31:00 +02:00
Thibault Delavallée 17c9b7afee [IMP] sale: improve activity management on sale order model
This commit improves sale management through a better integration of
activities and addition of automated activities. Several things are done
in this commit :

 * automatic activities generation is added for sale order upselling.
   They are also automatically removed or updated when the sale order state
   changes from or to upselling to avoid bloating users with unnecessary
   activities;
 * a menu to configure activity types is added. Indeed HR managers should be
   able to see and configure activity types related to their job;

Technically we choose to override _write in order to catch the invoice_status
computed field update and try to have a lightweight implementation. Indeed
sale.order is a complex model and we tried to have a low-level override
that do not mess with business overrides.
2018-03-27 16:31:00 +02:00
Christophe Simonis ce5b4b6512 [MERGE] forward port branch 10.0 up to fc659d3f78 2018-03-27 16:10:35 +02:00
Thibault Delavallée 133fd0a21e [IMP] hr_expense: improve activity management on expense sheet model
This commit improves expense flow management through a better integration
of activities and addition of automated activities. Several things are done
in this commit :

 * expense sheet (report) model do not inherit from mail.activity.mixin.
   This commit adds the inherit so that expense users and managers can now
   schedule and manage activities on expense reports. This will help them
   in their daily job;
 * automatic activities generation is added for expense reports. Activities
   are generated for approval. They are also automatically set as done when
   validating or unlinked when refusing or resetting to avoid bloating users
   with unnecessary activities;
 * a menu to configure activity types is added. Indeed HR managers should be
   able to see and configure activity types related to their job;
 * filters are added to be able to use the systray and to filter the kanban
   view based on activities

Having automated activities allow to replace some messages and tracking
that were implemented to warn people of expense reports to approve.
This commit therefore

 * simplifies the tracking as tracking to confirm reports is not necessary
   anymore;
 * removes to approve subtype on report model as well as its parent subtype
   on the department. This allows to simplify chatter in hr_expense app;
2018-03-27 15:19:34 +02:00
Thibault Delavallée 238c20ffff [IMP] hr_holidays: correctly set description of allocation to leaves allocation
Seeing allocation word notably in the activity widget is not easy to
understand. Leaves allocation is a better naming.
2018-03-27 15:19:26 +02:00
Thibault Delavallée 1d71c06233 [IMP] hr_holidays: improve activity management on leave model
This commit improves leave request and allocation management through a
better integration of activities and addition of automated activities.
Several things are done in this commit :

 * leave and allocation models do not inherit from mail.activity.mixin.
   This commit adds the inherit so that HR users and managers can now
   schedule and manage activities on leave and allocation requests. This
   will help them in their daily job;
 * automatic activities generation is added for leave and allocation.
   Activities are generated for approval and second approval. They are also
   automatically set as done when validating or unlinked when refusing or
   resetting to avoid bloating users with unnecessary activities;
 * a menu to configure activity types is added. Indeed HR managers should be
   able to see and configure activity types related to their job;
 * filters are added to be able to use the systray and to filter the kanban
   view based on activities

Having automated activities allow to replace some messages and tracking
that were implemented to warn people of leave and allocation to approve
or validate. This commit therefore

 * simplifies the tracking as only approved or refused state now trigger
   a subtype;
 * removes to approve and to validate subtypes on leave and allocation
   model as well as their parent subtypes on the department. This allows
   to simplify chatter a lot in hr_holidays app;
2018-03-27 15:19:10 +02:00
Thibault Delavallée 78c4d936e5 [MOV] hr_holidays: reorder a bit views and menus to avoid circular issues
Commit a0f4f6548b splitted hr_holidays models and moved them
to different files according to guidelines. However some bits of code related
to views were not correctly put in separate files. This commit finishes to
order views and moves some of them in the right file. Other views or actions
are moved because of dependency between them.
2018-03-27 15:19:08 +02:00
Nicolas Martinelli 905cd6d903 [FIX] account_bank_statement_import: default partner
When importing a bank statement containing an unknown bank account
number, the newly created account is automatically linked to the partner
of the current company.

This is due to the default value for `partner_id`.

Introduced in 6db235385a

opw-1816832
2018-03-27 15:06:12 +02:00
Simon Lejeune dc56bb5071 [FIX] stock: stock.move.line: _free_reservation
In a situation where `_action_done` is called on a batch of move line
when one of them is forced and there isn't enough quantity available
to reserve it, a call to `_free_reservation` is made in order to not
have move lines reserved on quantity now unavailable.

The issue is that the method looks for move line to unlink by making a
search on move line having a quantity reserved. As the `_action_done`
method defer the update of the reserved quantity at the end of the
batch, `_free_reservation` could try to find and unreserve move lines
that were juste processed, resulting in a traceback because there isn't
enough stock to unreserved (because the move line was processed and thus
moved at the next location).

We fix this issue by explicitely passing the move lines to ignore.
2018-03-27 15:04:26 +02:00
Thibault Delavallée 60b81e00b2 [IMP] mail: add tool methods to manage activities directly from the mixin
This commit adds tools methods related to activities in the mail.activity
mixin. It gives to models inheriting from the activity mixin an easy-to-use
API to schedule, unlink or mark activities as done. Purpose of those methods
is to avoid having people manually managing activities in the code to hide
the technical details of the activities model, notably access rights
or activity types.

A field is added on activity model to indicate they have been generated
automatically. This way when rescheduling or unlinking based on some
specific activity types we do not change user-created activities.

Those methods include scheduling activities, changing their dates, marking
them as done or unlinking them. Future commits will use those methods
in various addons to automatically generate activities based on workflow
we want to implement.

This commit also adds tests for the newly added code. Future commits should
probably have a look at activity security and add some tests cases to check
it is correctly taken into account. It is considered a bit out of scope for
this task.

Thanks to @jem-odoo for its in-depth review of this commit. Well thanks for
other commits also.
2018-03-27 15:00:46 +02:00
Thibault Delavallée 093dd9b512 [IMP] test_mail: clean reminder-related activity tests
It has not been done completely at f488dc58c3.
2018-03-27 15:00:36 +02:00
Thibault Delavallée 1905b8a5d5 [IMP] mail: take first found reminder activity type as default when creating reminders
If people define several reminders, take first found one based on sequence
as default activity type when creating reminders. This commit is linked to
the recent merge of reminders done at f488dc58c3.
2018-03-27 14:59:51 +02:00
Goffin Simon fc659d3f78 [FIX] sale: Description of the product 'Downpayment' not translated
When you create a down payment invoice from an SO, the product that is used in the line is 'Down Payment'.
The description of this product, which is visible for the customer, was not translated to the language
of the customer in the SO and in the invoice. It was translated to the language of the user logged.
This fix is made to keep the same behavior for the description of an SO line and for the description
of the invoice line.

opw:1820081
2018-03-27 14:19:29 +02:00
Thibault Delavallée 60e5a887c5 [IMP] mail: set a sequence on activity data in order to at least have one 2018-03-27 13:26:41 +02:00
f488dc58c3 [IMP] mail: allow to use stand alone activities as reminders
This commit allows to create personal reminders and to manage them using
activities. It is done using activities not necessarily linked to a record
but only to a user. Reminders can be used for example as a personal todo
list.

Technically we choose to model a reminder as an activity related to no
record. This means having a void res_id and model. An activity type is
added to classify reminders in it.

Settings reminder as done is not done like classic activities. Indeed classic
activities are unlinked and a message is logged on the related document.
As there is no document for reminders those are archived instead. It means
an active field is added as well as an override of toggle_archive to update
systray counter.

Activities systray widget is improved to display reminders in activities
list. This entry leads to a kanban view of activities allowing their
management. It is also possible to create them directly from the systray
allowing a quick creation of reminders.

This commit is related to task ID 41745. Closes #22143 .

Co-authored-by: Dharmang Soni <dpr@odoo.com>
Co-authored-by: Xavier Dollé <xdo@odoo.com>
2018-03-27 13:26:41 +02:00
Nicolas Martinelli 3a654ce256 [FIX] payment_authorize: ZIP code is optional
The ZIP code is an optional field, therefore we should not block the
user.
2018-03-27 12:55:01 +02:00