Commit Graph
116646 Commits
Author SHA1 Message Date
Adrian Torres dc9525c3f0 Revert "[IMP] mail: check if template can be rendered on write (#20834)"
This reverts commit a094095ef3.

Context problems, see PR #20834
2018-04-09 08:12:27 +02:00
Hiral Bhavsar 9201f92a4f [IMP] mrp: add new bom and cost report
Add a new report in order to display:
- bom structure and cost
- bom structure
- bom cost
The user is allowed to print multiple bom reports at once.
Print the report dynamically depending what have been unfolded.

In html the rendering is lazy, when unfolding the client make a request
to the server in order to get the html that will be append to the DOM.

For the pdf the kwargs unfolded could be used in order to render everything
at once.

With the help of:
Dhaval Suthar <dut@odoo.com>
Jigar Patel <jat@openerp.com>

task-36741
2018-04-06 17:05:14 +02:00
Jigar Patel 5a22b79af5 [IMP] mrp: add cost by hour on workcenter
Move it from enterprise to community since it will
be used for bom structure report and set bom_cost on product
cost functionalities.
2018-04-06 17:05:14 +02:00
Arnold Moyaux 157459877e [IMP] stock: improve generic stock controller
Include set_html in the deferred of start
2018-04-06 17:05:14 +02:00
Arnold Moyaux f384db9b67 [IMP] base, web: define landscape in report template
Since report refactoring the function to override is get_report_values
that only returns a dict of value that are used in rendering.
In order to render a pdf with a landscape orientation, a context key could
be added however since it's not possible to return a report object in
get_report_values, it's difficult to add a contexti without using some tricks.

This commit add a report option to use in the template that will be used
in order to modify the pdf orientation. The process used was already existing
for other options like dpi,...
2018-04-06 17:05:14 +02:00
Arnold Moyaux 3242fced63 [IMP] mrp: add advanced demo data for mrp
Current demo data do not have advanced configuration.
This commit provides new demo data in order to test
bom report or advanced MRP configuration with sub bom
bom with kit,...
2018-04-06 17:05:14 +02:00
Hiral Bhavsar 7cb32d1f36 [REM] mrp: remove old report for BoM structure/cost
The pupose is to add the new dynamic bom report
Chekc the next commits in order to have more details
2018-04-06 17:05:14 +02:00
Commandant Custo 5ba54aa43e [IMP] sale: use widget handle on tree view
Closes #20161
2018-04-06 16:41:00 +02:00
jem-odoo 395db264bb [MERGE] *_timesheet: selling services, phase 3
Impacted modules: hr_timesheet, sale_timesheet and project.

This merge commit provides feature for service flow (selling
timesheet). The most important points are

1/ selling project based on template: on product configuration,
user can now set a template for the Sales Order to create a
project by duplicating this ones (stages, tasks, ... are duplicated
from the template). If several Sale Lines are based on the same
template, only one will be created. Same mecanism if multiple product
creating a project without template: only one project per SO.

2/ Project Overview Revamp: before this, it was based on a filter
domain on analytic line (aka timesheet). This causes many problem
as if you are selling prepaid services, you project plan was empty
as long as no timesheet was created. Moreover, this kind of domain
is not very usefull for the user (nobody want to see project plan of
timesheet containing "analysis" for instance). The project plan is
now a filter on project, to ease fetching data from the project (even
if no timesheet or forecast), and allow cross project analysis.
The overview table part is now available even when forecast is not
installed.

3/ Assign Tasks Massively: a wizard is provided to ease linking
task to the same Sale Order Line, to ease billing their related
timesheets.

4/ Usability Details: filter task per SO or SO line, stat button
on Sale Order now redirect to kanban project instead of global
project plan, generated task/project names are cleaner, ...

5/ Installing only timesheet module, user will be able to track
cost without selling time. Fields of cost and employee hourly cost
are moved from sale_timesheet to hr_timesheet.

To make this feature works, some technical efforts was required:

1/ Project and Analytic Account: To allow SO to generate multiple
project, we wanted them to share the same analytic account (the one
of the Sale Order). To do so, we had to remove the inheritS between
project.project and account.analytic.account models.
To allow timesheet on a project, an analytic need to be set manually,
or it will be automatically generated (like before with the inheritS),
if allow_timesheet is checked.

2/ Refactoring of SOL service generation: to allow SOL to generate
only one project (per template) for the SO, the part of service creation
on sale.order.line needed a refactoring.

3/ Revamping the overview also improve its performances: some part
are now based on SQL queries (table part), or on report (profitability
report). Doing a report allow the user to create its own filters, and
give him a more accurate tools to extract statistics then project plan.
The idea is to get only one source of information for reporting and
analysis.

Please see sub commits for more details.

Thanks for @tde-banana-odoo for his review and advices during
development,
and thanks to @bst-odoo for his functionnal ideas, testing and support.

Tasks #34702
Closes #22268
2018-04-06 15:38:48 +02:00
jem-odoo d50a1e2622 [IMP] project,hr_timesheet: no 'remaining hours' field in project
'remaining_hours' is defined in project as a simple
float field, manually updateable, only displayed
when the group "Time Estimation on Task" is activated.
But for now, there is no setting to active this group.

Those are legacy useless stuff, so we can remove it.
The purpose is to make 'time estimation' feature only
available when timesheet is installed.

Thie commit also split the compute methods of
'remaining_hours' and 'progress' fields to make
'remaining_hours' updateable, though inverse method.
Without splitting the compute method, the calculation
of the progress was done correctly during onchange
but not when saving.
2018-04-06 14:30:47 +02:00
jem-odoo 3a40ee0097 [FIX] sale_timesheet: correct uom xml id 2018-04-06 14:30:47 +02:00
jem-odoo 0cbcbf89d2 [IMP] sale_order: name and description of generated task
We want to split the sale order line description as follow:
 - first line will be the title of the task, prefixed by SO
   reference
 - the rest of SO line description should be the task
   description
The purpose is to avoid duplicating the first SO line
description in task title and description.

Task #1831934
2018-04-06 14:30:47 +02:00
jem-odoo 29d64be400 [IMP] sale_timesheet: group task by Sales Order
From task stat button from SO form view, it
is relevant to see the task of the SO only.
So, we add a filter to do so. AS the kanban
task use a read_group, it is required to store
the sale_order_id field on task.
2018-04-06 14:30:47 +02:00
jem-odoo 30f3d4144f [IMP] sale_timesheet: plan project when timesheet only
The code of the project overview is split to be used when only
timesheet is installed (no forecast). The table part only
display column for timesheeted time per month.
When forecast is installed and activated, other columns
comes to complete this table.

This commit also makes visible SO line having no timesheet
linked in project overview.
2018-04-06 14:30:47 +02:00
jem-odoo abfa921009 [IMP] sale_timesheet: tasks linked to SOL of project
When selling a project from a sale order, the SO line
creates the project. When we create a task in that
kind of project, by default, the task will be linked
to the SO line of its project.
However, for the SO line field to be visible on the
task form view, the customer must be set. This commit
set the customer from the SO line when changing
the project (billable project only).
2018-04-06 14:30:47 +02:00
jem-odoo 460f57f510 [IMP] sale_timesheet: selling project based on template
Selling product creating project can now be based
on project template. When setting a project template
on product, this will copy the project (like a duplicate)
and replace its customer, ... with information from the
SO line, on SO confirmation.

There is only one project without template per SO, and
one project per template per SO (so 2 SO lines with the
same project template on their product will only create
one project with this template).
2018-04-06 14:30:47 +02:00
jem-odoo eb5cb1359b [IMP] sale_timesheet: improve tests 2018-04-06 14:30:47 +02:00
jem-odoo 236a7011b8 [REF] sale_timesheet: project/task generation from SO
When confirming a SO, only one project will be created, even if
some so lines would create a project. Only the first line will
create the project, the other will not be linked to its.
`project_id` field is added on so line, to keep track of the
generated project, as already done for the task.

The '_timesheet_service_generation' method has been rewritten
to be execute in batch and improve performance and prefetching.

On SO confirmation, no message are now post in chatter to avoid
having one message per so line that should have created a task.
A message is only posted when user manually add SO lines on
confirmed SO.
2018-04-06 14:30:47 +02:00
jem-odoo 9774b78852 [IMP] sale: analytic_account field edition
Now that an analytic account can be linked
to several projects, you might want to change
the analytic on the SO.
Before this commit, the user was allow to create
an analytic account on a confirmed SO but not
modify it. This was usefull when you wanted to
reinvoice an expense on a SO without AA set.
This is now solved (AA is automatically created
when validated expense).
Now, we want to allow set manually the AA before
confirming SO to match the one of potential
projects.
2018-04-06 14:30:47 +02:00
jem-odoo 3dd3e26483 [IMP] project: a project is not an analytic account anymore !
This commit removes the inheritS between account.analytic.account and
project.project. This means :
- When a project is created, an analytic account is not necessarily
genareted
- project has now its own name, company_id and partner_id fields
- an analytic account can be linked to several project
- project module does not depend anymore of analytic, but hr_timesheet
does.

This change implied
- an analytic account is required on project to timesheet on
its tasks. So, when checking 'allow_timsheets', if an AA is not
provided at project creation, an AA will be generated.
- to timesheet on project, an active AA is required. We don't want
timesheeting on project linked to unused AA to avoid bad analytic
entries.

This prepare the fact a sale order can create multiple project, sharing
the same analytic account (the one from the SO).
2018-04-06 14:30:47 +02:00
jem-odoo 60a8b88cc9 [IMP] sale_timesheet: revamp project overview
The project overview is kind of badly design. This
commit does not solve all the issue but tries to make
it simpler and more efficient:
- Does not depends on AAL anymore: the overview search
is now about projects. You can see the overview of multiple
projects. Even when no timesheet are encoded, the plan will
not be empty.
- "Time by people" displays each employee assigned to task,
even if no timesheet are recorded.
- Code now use reporting view to keep consistency and simple
code in overview controller.
2018-04-06 14:30:46 +02:00
jem-odoo 7782265a8a [IMP] sale_timesheet: add wizard to link multiple task to SO lines
Adding a wizard to assign multiple task to the same
sale order line. This will allow user to invoice
timesheet created before SO confirmation.
2018-04-06 14:30:46 +02:00
jem-odoo 8f3f1827cb [IMP] hr_timesheet: ability to track cost without selling time
The cost of an employee should be in hr_timesheet for a long time, to
allow user to track time on project/task: hours spent and their cost.
This commit simply moves fields and related views. It also moves the
'postprocess' method from sale_timesheet to hr_timesheet since this
method is responsible to set the amount (cost) on AAL.

User can now track their time and cost, without having sale_timesheet
installed.
2018-04-06 14:30:46 +02:00
jem-odoo ca36c22c54 [IMP] sale_timesheet: remove project of a Sales Order
The project of a SO will not be used anymore, as we planned
to have a sale order creating multiple projects.
The concept of 'only project from SO' does not make sense.
2018-04-06 14:30:46 +02:00
jem-odoo 89055c167e [IMP] sale_timesheet: add profitability report analysis
This commit provide a real reporting tool
for project profitability: graph and pivot
views.
You can now have a look at cost and revenues
per project, so line, product, see which
project manager brings the more money, which
project costs many human time, ...

The project overview is based on this report
analysis to be consistent.

However, a change of computation for 'amount
invoiced' is introduced: we now based the amount
on the price_reduce of the SO line, and not from
the invoice lines. Also, once a draft invoice is
generated, the quantity is considered as invoiced
at the price of the SO line (no matter is extra
discount happens when validating invoices).
2018-04-06 14:30:46 +02:00
stefanorigano a5a788981a [IMP] web, mail: mimetype icons design
- Redesign all mimetype icons
- use SVG to reduce file size and improve rendering quality.
- Add a data attribute to attachments to detect the file extension (in somes
  cases just mimetype is not accurate)
2018-04-06 14:14:32 +02:00
stefanorigano 6e12372f95 [IMP] mail: attachments list design
With this commit, the attachments displayed in a thread (typically a
chatter) are properly styled.
2018-04-06 14:14:32 +02:00
Jeremy Kersten 3820b56c07 [IMP] website_sale: multi image by default
Remove the option to switch from simple image to multi mode.
If only 1 image, multi image show it without carousel
2018-04-06 11:54:39 +02:00
Jeremy Kersten 704755515a [FIX] website_sale: fix zoom wich was not always computed
In some case, (many JS like runbot with all modules), the onload event was
binded after that the image was loaded. So the JS code that make the zoom
conditionnal was not executed.

Now we apply the function on all images already loaded, or that will is loading

Courtesy of @ged-odoo for help and review
2018-04-06 11:54:39 +02:00
Siddarth Gajjar b90b8f3d5d [IMP] account, hr_expense: add section for attachment preview
An empty div `o_attachment_preview` is added in expense and vendor bills form
views. It will be used as a container to preview the attachment.

The actual behaviour will be implemented in another commit.

Task 40663
2018-04-06 11:18:45 +02:00
Raphael Collet 0eb8518786 [IMP] fields: describe group_operator when given on all field types 2018-04-06 10:57:02 +02:00
Valentin Löfberg 8e567f819d [IMP] project: Place every links on relative position on kanbans cards
Purpose
========

The links on the project kanban cards are not always at the same place : https://drive.google.com/file/d/1aONUYkZerqqD7fSVmgozRScgLKR-QHtA/view

============
Specification
============

I get rid of the flex element to allow the placing of links using width
attribute. Create the .o_project_timesheet_box class to assure that the
timesheet/overview link is always placed in the middle.
I also deleted the needaction_count button to avoid breaking the display.

Task: 1817850
2018-04-06 10:49:31 +02:00
Adrian Torres 2875b94e03 [FIX] osv.expression: normalize domains in combine
Before this rev:

* Take 2 domains that contain at least two leaves, and at least one of
them must use the implicit `&` operator

e.g.:
    d1 = [('so_line', 'in', [91]), ('amount', '<=', 0.0)]
    d2 = ['&', ('so_line', 'in', []), ('project_id', '!=', False)]

* Perform osv.expression.OR() between both domains

Expected result:
    d3 = ['|', d1, d2]

Actual result (after normalization):
    d3 = ['&', '|', d1, d2]

This is because, since the `&` is implicit for the first domain, when we
OR it, we give it an explicit `|` operator, so when we pass this domain
through the normalize_domain function, d1 no longer contains an implicit
`&` operator but instead the implicit operator is the one between d1 and
d2, therefore giving us a completely wrong domain.

The `combine` function states that it only accepts normalized domains,
however neither the OR nor AND functions do, this leads to a lot of
developers putting non-normalized domains into these functions, and
there's no error checking or anything that obviously indicates that the
domain is incorrect, so we might as well normalize all domains being
passed since it's already pretty optimized.
2018-04-06 07:45:25 +02:00
Raphael Collet 5f06926093 [FIX] models: in _read_group_raw, do not aggregate grouped fields 2018-04-05 18:44:40 +02:00
Parth Gajjar 1d08e12a94 [FIX] mail: not able to see attachment preview in mobile
Chat window having higher z-index value then attachment preview model and in the
mobile chat windows are covers whole screen so attachment preview is hidden behind
chat window. so increasing preview model's z-index by 1 will fix the issue.

(PR #24065)
2018-04-05 16:40:03 +02:00
Mathieu Duckerts-Antoine 5144414a3a [IMP] web: graph views can now aggregate many2ones
The read_group method was recently modified to allow more flexibility.
With this commit, we add the possibility of aggregating many2one fields.
These fields can be aggregating by counting the number of distinct IDs,
directly in postgres.

Also, note that we had to modify the mock server to implement the
corresponding functionality.
2018-04-05 15:59:40 +02:00
Dharmraj Jhala b67331fc18 [IMP] web: Allow user to set custom 'create_text' for x2m fields
For x2many relational fields(of type kanban), we shoud be able to set custom label for
'Create / Add' button by adding 'create_text' node option on particual field from xml.

Right now, 'create_text' is only handled for many2many fields, preventing users to set
custom label for one2many fields.

This commit allows users to set Create Button label for both m2m and o2m fields.
2018-04-05 15:15:07 +02:00
Alexandre Kühn fef6d7967f [FIX] mail: various discuss test fixes
This commit fixes two issues with discuss tests (JS):

    1. Improved mocked `message_fetch` rpc

        Some tests were incorrectly mocking the `message_fetch` rpc.

        With this commit, the mock server correctly mock this route,
        so that tests should simply pass the records as data, and the
        mock server correctly handles this rpc.

    2. Patch `_.debounce` and `_.throttle`

        The test "older messages are loaded on scroll" failed with
        Google Chrome right after destroying the widget discuss.
        This is due to a debounced function that called its inner
        function at this moment.

        With this commit, any discuss test patch `_.debounce` and
        `_.throttle` so that the inner functions are executed
        immediately and synchronously.
2018-04-05 14:57:49 +02:00
Fabien Meghazi fd4939dc78 [FIX] base: honor registry/cache signaling for multiple threaded servers
Before this patch the registry and cache signaling was only activated
for PreforkServer. In case Odoo was deployed in a multi process/multi
threaded architecture the signaling was not ensured, causing registry
de-synchronisation amongst threaded servers.

This fix will be backported in v10.0 and v11.0 as soon as it has been
battle tested.
2018-04-05 14:22:32 +02:00
Xavier Morel 944755dd1d [FIX] doc: non-module JS autodocumenters
Also when there is both a docstring and directive-level content put
the docstring first. That seems to match what Sphinx's autodoc does
and looks less odd.

Possible future improvement: a parameter to suppress the docstring?
Possibly a way to reorder the non-docstring content (e.g. members
documentation)?
2018-04-05 12:28:56 +02:00
stefanorigano c99177bcf5 [IMP] mail: document_viewer, add reset zoom button 2018-04-05 11:12:58 +02:00
stefanorigano 00aabb8895 [IMP] mail: document_viewer, improve design and fixes
- Improve design
- LESS: use mixing and variables when possible, code formatting
- Solve a minor issue causing images to be not perfectly centered
- Improve visual feedbacks (tooltips, cursors, hover states...)
2018-04-05 11:12:26 +02:00
Mathieu Duckerts-Antoine e5b109b422 [IMP] web: update mock server to better match server semantics
The read_group method (from the server) is implemented in the mock
server, to allow easy unit testing in javascript.  However, the
behaviour was not exactly the same: a read_group call on a domain with
no records returns null for aggregates.  But the mock implementation
returned a value of 0.

We fix this in this commit, to allow more precise testing of Odoo
javascript.
2018-04-05 10:33:24 +02:00
Géry Debongnie 19946294fa [DOC] doc: update/add documentation on js framework
The state of the JS documentation was quite sad, not updated in a long
time.  With this commit, we rework a lot of the JS doc.  Most notably,
we add a section 'Javascript Cheatsheet' (help on some common
customization tasks) and rewrite the 'Javascript Reference' totally.

Note that the JS reference page also contains a reference on all field
widgets.

This work is just the beginning, it is probably not complete, but at
least we will have a foundation.
2018-04-05 09:22:09 +02:00
Arnaud Baes 438006b56d [ADD] stock: replenish wizard
This wizard allows the stock users to replenish a product using the
routes applied to this product. A specific route can also be applied
to bypass the default route.

This replaces the "request procurement" wizard from v10, lost during the
stock refactoing.

Task ID: 47938
related to #22041
2018-04-04 16:06:19 +02:00
Haresh Shyara 2c1611da29 [IMP] stock: putaway strategies by product
This commit allows to define a putaway strategy by product. Before
this commit, it was only possible to define a putaway strategy by
category.

We add a second one2many on the model 'product.putaway': the original
(fixed_location_ids) is used for the putaway per category, the new one
(product_location_ids) is used for the putway per product.

The two one2many are displayed on the putaway strategy and a domain on
the fields is used to filter the records between them. Inline tree view
add a required on the product_id on the one2many per product and a
required on category_id on the one2many per category.

If a putaway strategy per product AND per category match for a product,
the putaway per product takes precedence

This task also reword some tooltips.

We add some testcases to display the behaviour
- when a putaway per product is applied
- the conflict between a putaway per product and category
- the fallback to the category when nothing is found on the product

Task 23495
PR #20143
2018-04-04 14:22:00 +02:00
Géry Debongnie d86eb9e1a0 [FIX] web,doc: fix errors that prevented doc from building 2018-04-04 14:11:48 +02:00
xmo-odoo 14840d2064 [IMP] core: modernize tgz translations export
* don't use FS to do export
* update translations export dialog to fix outdated links (launchpad
  & 6.1 translations doc)

Note: can't use ``TarFile.gettarinfo`` to create the TarInfo object
because it wants an actual file object with a ``name`` attribute and
possibly even an fd.

closes #22798
2018-04-04 13:12:33 +02:00
Thibault Delavallée f9c210923d [MERGE][REF] mail, various: optimize implementation of follower subscription
This merge replaces followers subscription code in order to be optimized
and perform less queries. This improvement is done in several steps :

 * mail followers model has new low-level and optimized methods to compute
   followers to create or update. It uses SQL queries to fetch data in a
   single request;
 * mail thread message_subscribe method is rewritten to use this new method.
   Its API is also simplified and message_subscribe_user is removed to
   simplify the whole subscription API;
 * auto subscription is also rewritten. Fetching subtype data about parent /
   child like project / task is done in a single query that prepares data.
   It then uses new method to create followers;

Various addons are updated because of message_subscribe or auto subscription
change. Functionally behavior should stay the same as purpose is to be
equivalent in term of functional coverage.

Performance counters show this optimized code works well when dealing with
large set of followers to subscribe or update. Most tests perform better
of a few queries. Most complex ones involving (auto) subscription of several
followers perform way better. About 30% of query are saved in the three top
tests, aka between 80 and 90 queries with auto subscription of 10 followers.
On overall community runbot we have a gain of about 11K queries. As Odoo
data has few followers impact on runbot is probably less interesting than
impact on real-life use case.

Thanks to @rco-odoo for reviewing, and cheers !
2018-04-03 18:07:21 +02:00
Thibault Delavallée 2dbcbdd3f2 [REM] mail: remove now unused add_followers_command
All code using it has been gradually replaced. It can be safely removed.
2018-04-03 17:50:51 +02:00