Commit Graph
118603 Commits
Author SHA1 Message Date
Jigar Patel b60de0db41 [IMP] import/export UIs
Task 40692

Various changes to import/export (mainly) UIs:

* default to excel & "full" (non-import-compatible) export
* auto-detect encoding of CSV using chardet
* remember column -> field mapping after having imported a file (useful
   for repeated imports where auto-matching failed)
* better handle localised booleans & column names
* automatically select source list view's fields when exporting
* better integrate import templates feature and add a number of templates
2018-07-17 15:19:05 +02:00
Sébastien Theys 57676dc7d1 [IMP] doc: remove duplicate line
The same content is already there 2 lines above.
2018-07-17 13:55:25 +02:00
Hetashree Chauhan 5836f1611a [IMP] website_sale_delivery: More discrete delivery section if single delivery carrier available
This commit will replace the delivery carrier list choice by a single and more
discrete line bellow the billing/shipping section when there is only one
carrier available.

opw-1832976
2018-07-17 13:49:21 +02:00
Ravi Gadhia 762adedece [IMP] various: improve section and add note on sale order and invoice
The goal is to be able to more easily create section and notes on sale order, invoice, and quote.

================================
Problems of the existing feature
================================

The problematic part in the existing feature was that the same section had to be defined again and again for every line, instead of being defined only once where it needed to be. There was also no easy way to move them. Those concerns are solved here.

Moreover, due to the complexity of the feature, it was hidden by default, requiring a setting and multiple overrides. The new feature is simple enough that it will always be present.

==================
New implementation
==================

Sections are lines solely used for display purpose, there is no business logic attached to them. They will show as a nice header at the top of the section, and a subtotal at the bottom of the section.

We also take the opportunity to add notes, which are just like sections except they are displayed differently and don't include a subtotal.

=========
Reasoning
=========

We decided to implement it this way, as opposed to creating a proper section model, because it creates less changes in the code.

Creating a intermediary section model between the sale order/invoice/quote and their lines would have required to rewrite the entirety of the code associated to them. It would also have required to create a new JS widget to handle on the same view a double-level One2many (or a One2many + group by).

The current solution is much easier because it just requires adding 2 buttons, 1 simple field on the corresponding models which even has a NULL default value, and making some business checks (don't apply business to section/note).

We tried our best to impact as less as possible the existing models. Notably we didn't want to add any extra field if this was avoidable. This also makes the migration easier.

No matter the implementation choice the views/reports had to be updated to display the sections and notes correctly, which has been done.

===========
Limitations
===========

The current solution has several limitations:

* since the sections don't have business logic, it's not possible to make any reporting based on them

* any business related to sections has to be computed on the fly by browsing in order all of the lines, notably the subtotal has to be computed on the fly at every display

- when sections are moved (drag&drop) on the back-end, the following lines that are part of the section are not moving with the section

===========
Technically
===========

The commit will:

* update the models to add the display_type field (along with related sql constraints to guarantee integrity)

* add new buttons at the bottom of the lists to allow creating section and note, along with the existing add a line/product button

* add some business checks to not apply business to section/note (product_id and account_id became non-required fields)

!!! The most likely cause of potential bugs introduced in this commit would be to have forgotten to add those checks on some places where they would be needed. This is tedious to check but fortunately easy to fix.

* update the views to display sections and notes correctly, also made various improvements/fixes to those views (notably to apply B2B/B2C setting more consistently)

!!! This is the second likely cause of potential bugs: if the updated views are inherited in a way that is not compatible with the changes. Or if we forgot to apply the changes to some other views. Again this is tedious to check but fortunately easy to fix.

Task #53996
PR #25209
2018-07-17 11:50:35 +02:00
Sébastien Theys 3ec6294739 [IMP] account,sale: move B2B/B2C setting into account
Since sale depends on account and not the other way around, it's better to have this setting inside account.

Functionally it will allow the user to benefit from this setting also if he uses only invoice without sale.

Technically it will allow us to remove all of the overrides that were previously necessary for this setting.

While we moved the setting, we also renamed the different variables so their name better convey their meaning.

PR #25209
2018-07-17 11:50:35 +02:00
Sébastien Theys 73d54999df [IMP] web: make X2Many Renderer more extensible
This allows a custom widget to cleanly override the Renderer of a X2Many.

PR #25209
2018-07-17 11:50:35 +02:00
Sébastien Theys f241441433 [IMP] web: add control + create tags to customize "add a line"
The default "add a line" button creates a new line with the default values from the model. Sometimes we want to create a new line with different default values (or more generally a customized context), which is possible with this commit. Moreover it is possible to create multiple buttons for multiple default values/contexts.

This works both for in-line creation ("editable=") and dialog creation.

The new tags are:

<control> defines custom controls for the current view.

Does not support any attribute, but can have children:

<create> adds a button to create a new element on the current list.

This makes sense when the parent tree view is inside a One2many field.

If any create is defined, it will overwrite the default "add a line" button.

For more information and example, have a look at the Views documentation.

Technically, the commit will:
- parse the new XML tags (+ add appropriate validation)
- display the buttons based on the XML
- on button click/keyboard: pull up the additional context information from the button event up to the default_get
- add unit tests
- add documentation

PR #25209
2018-07-17 11:50:35 +02:00
Sébastien Theys d1f1cc9c27 [FIX] web: prevent tab shortcut from crashing when no input field
Currently, using the shortcut "tab" inside a list will crash if the list has no input field (ex. if it has only a textarea field).

This commit prevents the bug.

Also moved the test for the orderedResIDs crash in the correct module.

PR #25209
2018-07-17 11:50:35 +02:00
Florent de Labarre 561d22feb7 [IMP] project: cleanup in test mail
Coutersy of @tde-banana-odoo

Closes #25792
2018-07-17 11:47:47 +02:00
Yannick Tivisse 9d27ee5441 [FIX] mail: avoid warning on view validation 2018-07-16 17:39:48 +02:00
Alexandre Kühn 3210f10827 [IMP] web: provide infos for close action
With this commit, when we perform a close action, we can provide infos to
the `on_close` handler, so that it can handle different cases that caused
the close action.
2018-07-16 14:08:40 +02:00
Yannick Tivisse 0b78516047 [FIX] website_sale_options: Declare the demo data in the correct module
Purpose
=======

A demo data is declared in an incorrect module.

website_sale_comparison declares the model and website_sale_options does not depend on that one (it works on the runbot by chance)

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

Move the demo data to product and add its category in website_sale_options.
2018-07-16 13:18:54 +02:00
Christophe Simonis 182c2c6919 [MERGE] forward port branch saas-11.4 up to 8285630ad2 2018-07-16 12:34:20 +02:00
Xavier Morel e891313810 [IMP] base: disable demo data if they can't install
Task 1856935

Currently, if installing a module's demo data fails (because the
module was uninstalled and some were left over and can't be
reinstalled, or because they're broken, or…) the installation of the
module fails and further installations are skipped (?).

Since demo data are non-essential (though required to run tests),
rather than fail everything if they fail just roll them back and
notify the user.

This change generates a warning log *and* shows a notification popup
to the end user.
2018-07-16 11:44:33 +02:00
Xavier Morel 93c0d7e811 [IMP] de-commit-ify db/module install
Try to remove cr.commit (and rollback) from module and db install:

* put a savepoint around test data loading
* remove a bunch of commits sprinkled throughout
* remove rollback on data loading failure (assuming it bubbles up, the
  entire module's installation should be rolled back)
* add commit right before the tests are run, so they can run isolated
  and still see whatever was done when installing their module
* convert a few explicit closing to context managers
2018-07-16 11:44:32 +02:00
Xavier Morel 233874d5ef [IMP] web: use builtin crash manager hooks for special handling
* having a special case for session expiration seems unnecessary when
  the CM specifically supports hooking on the exception name
* and properly implement the special handling of HTTP 504 (Gateway
  Timeout) from #24854 using that same hook
2018-07-13 17:31:23 +02:00
Xavier Morel 35d452cffb [IMP] web: replace iframe-based get_file by XHR
The error handling in get_file has always been somewhat problematic
(sarcasm ho!). Pending PR #24854 attempts to add special handling for
gateway timeout aside from its base stuff, and that's really quite
terrible due to get_file's limitation of only being able to read the
content of the document loaded in the iframe (no proper access to status
codes & al).

That was the occasion to look up modern API and see if we could do
file downloads in JS without iframe crap.

Turns out we can: xhr2 is well supported so we can POST, get a blob
back, and create a "local download" for that in-memory blob using either
a[download] (most browsers) or msSaveBlob (IE10+, that's actually a
convenient-to-great API and it's a shame there's nothing like it in the
standard).

The changes are not trivial but save ~30LOC and most of the overhead
is replicating the old/weird error handling as that requires
additionally decoding the blob to a string & parsing that string to
a document before being able to get the content (whereas before we'd
just access to the document loaded in the iframe).

OTOH we can now properly forward non-200 status codes to the
crash manager (as name) which will allow using regular CM hooks to
provide custom warning and error messages.

Note that this requires two libraries:

* a stripped down version of the content-disposition NPM lib, as
  download file names are provided via that header and parsing the
  header is decidedly non-trivial
* the download.js library as it handles the various edge cases from
  different browsers, I'm don't think all of it is necessary for our
  use case but the library is not that big so no real point in trying
  to strip it out and potentially break it in the process
2018-07-13 17:31:22 +02:00
Xavier Morel ccbfa94d32 [FIX] the ; in content-disposition is a separator not a terminator
According to RFC 6266,

content-disposition = "Content-Disposition" ":"
                      disposition-type *( ";" disposition-parm )

disposition-parm can't be an empty string, and thus a ; in terminal
position is not legal, even though browsers apparently work around it.
2018-07-13 17:31:22 +02:00
Christophe Simonis 8285630ad2 [MERGE] forward port branch saas-11.3 up to 609491ad0e 2018-07-13 17:12:07 +02:00
Christophe Simonis af4df80283 [FIX] base: set default currency rate at date 2018-07-13 17:08:58 +02:00
RomainLibert 0bb5268cb3 [DOC] add measure attribute to aggregate
Closes #25713
2018-07-13 16:11:28 +02:00
Christophe Simonis 609491ad0e [FIX] sale: use new model & xmlid name in test 2018-07-13 15:11:16 +02:00
Christophe Simonis f3929aa0f7 [MERGE] forward port branch saas-11.2 up to 87dadc5bc8 2018-07-13 14:32:05 +02:00
Christophe Simonis 87dadc5bc8 Revert "[FIX] hr_timesheet: Removing task on a timesheet line"
Method `_analytic_compute_delivered_quantity` does not exists anymore.
The bug this patch resolved is not present in saas~11.2. Patch not
needed.

This reverts commit 371a92fb30.
2018-07-13 11:44:54 +02:00
Christophe Simonis c952a11770 [MERGE] forward port branch 11.0 up to 6e6e3d4c96 2018-07-13 10:47:18 +02:00
Christophe Simonis 6e6e3d4c96 [MERGE] forward port branch saas-15 up to 51d1fd6948 2018-07-12 21:19:02 +02:00
Christophe Simonis 51d1fd6948 [MERGE] forward port branch saas-14 up to be9378709c 2018-07-12 21:18:13 +02:00
Christophe Simonis be9378709c [FIX] sale: correctly setup currency rates in tests 2018-07-12 20:03:47 +02:00
qsm-odoo 7d63434680 [FIX] website, *: make datepicker properly behave in page property modal
* web_editor

Note: the <body/> element had to be explicitely 'position: relative;'
for the library to work.
2018-07-12 17:15:13 +02:00
qsm-odoo dc9f942e0a [FIX] website, *: restore publish buttons' design
* web

Those were broken with https://github.com/odoo/odoo/commit/9de1bc0eef6f5bfaa2a8d745431caa361ae91548
This commit takes advantage of the bug to also improve their design and
html validity a little bit.
2018-07-12 17:13:23 +02:00
qsm-odoo 965b2b7478 [FIX] web_editor: properly wait for save of the editor
A simple 'return' statement was removed by mistake with commit
https://github.com/odoo/odoo/commit/a473453b3166a381130d9bd6ec4851b9e1ecab26
2018-07-12 17:07:01 +02:00
Christophe Simonis 52e28c903c [MERGE] forward port branch saas-15 up to 650bc6419c 2018-07-12 16:06:19 +02:00
Christophe Simonis 650bc6419c [MERGE] forward port branch saas-14 up to eb56e6dcb3 2018-07-12 14:07:36 +02:00
Christophe Simonis eb56e6dcb3 [MERGE] forward port branch 10.0 up to 755081cbf4 2018-07-12 14:07:08 +02:00
Yannick Tivisse edd8bad5d9 [IMP] product,...: Improve demo data
* Update demo data sheet for barcode
* Modify product "Book: Office Renovation for Dummies:
    - Name: "eBook: Office Renovation for Dummies"
    - Image:
    - Internal category: All/Services/Saleable
* Tips internal reference
* Product 10.0 % Discount =
    - Name : "10.0% discount on total amount" (no space between 0 and %)
    - Internal reference : 10PERCENTDISC
* Free product - large cabinet
    - Should be a stockable
    - in category All/Saleable/Office Furniture
    - Name : Free Gift - Pencil Holder
    - Picture
* Desk Customizable :
    - Change its website sequence (should be displayed first in the shop)
* https://github.com/odoo/odoo/pull/25263
* Need to clean attributes and attribute values and attribute categories :
    - Attributes, keep : Brand, Color, Dimensions, Legs, Weight
    - Attribute Category : Rename Storage into "Material"
* Events
    - Suppress Functional Webinar and Technical Training
* PoS Categories :
    - Suppress
    - Create PoS Category : Desks (put desks in it)
    - Create PoS Category : Chairs (put chairs in it)
    - Create PoS Category : Miscellaneous (and put all other products in it)
* Products available in PoS
    - Remove : Air Flight, Car Travel Expense, Bpost domestic bpack 24h pro, Bpost World Express Pro, Customer Care, DHL USA Delivery, DHL USA -> International, Deposit, Expenses, Fdex International, Fedexs US, Hotel Accomodation, Restaurant Expenses,
* Product:
    https://drive.google.com/a/odoo.com/file/d/1KjxcB88aDfe8qAzIpFlkBmMj5ekA9eIf/view?usp=drivesdk
    Timesheet : description to update https://docs.google.com/spreadsheets/d/1nB8l8pFcRXRFnudgDJVyZZp3McaHNovlyvY0jE1ZZ54/edit?usp=sharing
* Project : less projects, more tasks
    Remove "Internal - GAP Analysis", "Internal Projects"
    Rename Support into After-Sales Services
    Task to rename: Data import + Doc ==> Office planning
    Move the task Internal Training from "Support" to "Office Design"
* AGR Project : add the following tasks and link it to the right SO line
    Decoration : SO Line ==> Senior Architect
    Planning :  SO Line ==> Senior Architect
    Furniture  SO Line ==> Senior Architect
    Furniture Delivery : not linked to an SO line
* Marketing Automation
    Partnership offer ==> to rename into "Commercial prospection"
    Steps to rename:
        Offer free trial ==> Offer free catalog
        After 7 days (if not yet partners) ==> After 7 days (if not yet customers)
    Message for sale person ==> keep the same
* Mass mailings:
    http://nimb.ws/zrKsZ9
    http://nimb.ws/CbNpwd
* Events:
    Suppress Functional Webinar and Technical Training
    Tracks to update : https://docs.google.com/spreadsheets/d/1sKkJrltXY3Gz7ue3mVysZxaWGybKpx5fIhgUBnhbNDs/edit?usp=sharing
* Helpdesk
    Rename team into Customer Care
    Create 2 tickets in default team
    Urgent : Kitchen collapsing (assigned to admin) : link to the task  SO053: [SERV_585189] Customer Care (Prepaid Hours)
    No pririoty : Where can I download a catalog ? (not assigned).  Ticket type = question
2018-07-12 13:58:45 +02:00
Lucas Perais (lpe) 755081cbf4 [FIX] account: reconciliation widget rounding
Set the rounding method to Round Globally

Create a tax A with rate = 1.1040 %
Create a bank statement with one line having amount = 1153.960

Go on to reconcile that bank statement

Reconcile with a new line on which the tax A applies
Create the write-off

Click on Reconcile

Before this commit, an error was thrown by the server (Move unbalanced)
This was because the amount of the write-off line sent by JS (which is the tax amount)
was 12.7397
The server though computes the taxes by forcing the rounding and gives off a tax amount of 12.74
Hence the error

After this commit, the JS will fetch the amount of the taxes by forcing the rounding there also
And the reconciliation process goes well

This fix is already present in v11.0 at 6fce298d70

OPW 1859939

closes #25733
2018-07-12 13:07:56 +02:00
Lucas Perais (lpe) c9a2b9a00a [FIX] web: keep searchview floating content on update
In a search view, write text in the input, then hit enter to select
the facet.

Before this commit, the search view was detached and then reattached
when the control panel was refreshed. This led to loosing the focus
momentarily and erasing any supplementary input one might have typed
*during* the rpc call.

After this commit, if the search view is the same as before, we don't
detach it in the first place. Thus, the input is conserved in this
situation.

OPW 1861941
OPW 185614t

closes #25546
2018-07-12 13:01:05 +02:00
Goffin Simon dad19a769a [FIX] sale: Price on SO not working with different uom
Steps to reproduce the bug:

- configuration on sale:
   - Unit of measure: Some products may be sold/purchased in different units of measure (Advanced)
   - Sale Price: Advaced pricing based on formulas (discounts, margins, rounding)
   - Discount: Allow discounts on sale order lines
- kg as the Reference UOM for weight
- create an uom 10 kg
   - Category: Weight
   - Type: Bigger...
   - Bigger ratio: 10.0
- create a product P
   - Sale price: 100
   - Unit of measure: kg
   - Purchase UOM: kg
- create a pricelist "My pricelist"
   - Discount policy: Show public price & discount to the customer
   - Items : All products - 10% discount
- create a SO with "My pricelist"
- create a SO line with P, the unit price is automatically 90 with 10 % of discount
- change the uom of the line with 10kg

Bug:

The unit price of the line didn't change and the discount on the line disappeared.

In function product_uom_change, the uom of the SO line has been set in the context
of the product(like in function product_id_change). So in funciton _get_display_price,
the function _get_real_price_currency must be called with the uom of product in the context.
In this way, the lst_price will be fetch on product with the right uom without any bad conversion
(because uom.id == product_uom with uom from the parameters and product_uom from the context).

But with function get_product_price_rule, no need to call this function with the uom in context as
it is already set in the product(check "if uom_id: ... else ..." in this function).

The same logic has been applied in function _onchange_discount

opw:186385
2018-07-12 11:45:15 +02:00
Christophe Simonis 1926b40212 [MERGE] forward port branch 10.0 up to 718a5b76b8 2018-07-12 11:29:22 +02:00
Christophe Simonis 718a5b76b8 [MERGE] forward port branch 9.0 up to 189e0088e0 2018-07-12 11:28:29 +02:00
Christophe Matthieu a729669a10 [IMP] mail: don't send attachment if the link is in the email
If the user send an email with a '/web/content' or /web/image' link in
the body, the attachment are not send by email to not to increase the
size of the email unnecessarily.
2018-07-12 08:25:47 +02:00
Stéphane Bidoul (ACSONE) 189e0088e0 [FIX] account: preserve deactivated taxes on move lines
Similar to cd3f52ba10 that was made for invoices.

Was PR #25655. Courtesy of Stéphane Bidoul (ACSONE)
2018-07-11 16:56:59 +02:00
Christophe Simonis 12a97cc7ad [MERGE] forward port branch 9.0 up to 2d0621da05 2018-07-11 16:42:42 +02:00
Christophe Matthieu 6a5dc8bcd1 [FIX] mail: remove attachment feature in add followers modal
Before this fix, the attachments are don't save to the record and are
remove with the wizard. We can't add the attachments to mail.message
(like 'mail.compose.message') because it's auto_delete/unlink and the
attachments are removed before the recipient can read it.
2018-07-11 15:38:59 +02:00
Christophe Matthieu 50ab181762 [FIX] mail: add access_token for image from base64 and cid 2018-07-11 15:38:59 +02:00
Christophe Matthieu 3472a34e8a [FIX] mail: write all attachments only once
wrong indent.
2018-07-11 15:38:59 +02:00
Christophe Matthieu 0cf5987610 [FIX] web_editor: display record linked to the record when add followers 2018-07-11 15:38:59 +02:00
Christophe Matthieu f83f532237 [FIX] web_editor: send an image thumbnail for attachment link in mail
Before this fix attachmentThumbnailToLinkImg is not called for
style-inline options. The mail received does not have thumbnail and the
user can't click on the invisible link.

opw-1863659
2018-07-11 15:38:59 +02:00
Alexandre Moens 6e8f1fcc63 [FIX] Stock : deliveryslip report - prioritize partner_id (#25709)
Display the address  of the partner_id when available rather than using the partner id  of the movelines. Important when the partner  is changed after the movelines are created.

support ticket :  1857582
2018-07-11 14:43:33 +02:00
Toufik Benjaa 03d8f528b7 [FIX] payment: Avoid accessing a field on an integer
- When clicking on the invoices stat button on payment transactions via
the form view a traceback is displayed.
  This is due to the fact that the code is trying to access to a
member/field named "id" on an integer.
  "invoice" is an integer, not a record/object.
2018-07-11 14:15:55 +02:00