Commit Graph
122404 Commits
Author SHA1 Message Date
Antoine Prieels (ANP) 3edecd2aad [IMP] snailmail_account: Add tests to make sure that all default templates can be sent with Pingen
Add tests to make sure that, with sample data, the format of the invoices is accepted by Pingen.
2018-12-26 10:11:05 +00:00
Antoine Prieels (ANP) e338deb223 [IMP] base: Add context key to force the rendering of the pdf in 'test-enabled' mode
In `test_enable` mode, `render_qweb_pdf` fallbacked to `render_qweb_html`. We add a context key to be able to force the rendering of the pdf, even in `test-enable` mode.
2018-12-26 10:11:05 +00:00
Swapnesh Shah 595209a3e8 [FIX] purchase_requisition: Use correct field to access state
closes odoo/odoo#29715
2018-12-21 19:31:30 +00:00
Frederic Junod 614adc0198 [CLA] Add fredj to Camptocamp CLA
closes odoo/odoo#29307
2018-12-06 10:41:24 +00:00
Frederic Junod 181ec4fe49 [FIX] doc: correct spelling mistake in javascript reference 2018-12-06 10:32:32 +00:00
Sergio Zanchetta bdf2711f01 [FIX] account: fix untranslatable strings
The "customer invoice" and "vendor bill" string was untranslated.
Instead of adding a _ call, properly translate it.
No need to try saving bytes by splitting the sentences, this makes it very
difficult to translate in some languages where the order of words are not the
same as English

closes odoo/odoo#29690
2018-12-26 07:28:39 +00:00
Atul Patel c5cb1a6b38 [FIX] website: remove faulty decorator
copy_menu_hierarchy is not a model function since it expects
to iterate on a recordset of websites

closes odoo/odoo#29723
2018-12-24 18:05:51 +00:00
Swapnesh Shah 41da55f58e [IMP] stock_account: Fixed typo in field's help
closes odoo/odoo#29692
2018-12-21 08:37:36 +00:00
Martin Trigaux f92cddcf1c [I18N] fix bad comment
f8dad1bb4 added the terms in the .pot with an incorrect syntax in the comment
The pulled translation have this incorrect syntax as well which produces a warning

closes odoo/odoo#29729
2018-12-24 12:45:21 +00:00
Odoo Translation Bot b234af04c1 [I18N] Update translation terms from Transifex 2018-12-24 12:51:19 +01:00
Odoo Translation Bot 47aae6faba [I18N] Update translation terms from Transifex 2018-12-23 01:29:13 +01:00
Romain Derie 88242d6a15 [FIX] website: simplify filter_duplicate
The `filter_duplicate()` method was introduced with b0b6b9afb5 for
website_version.
The module was removed on Odoo 12.0 with https://github.com/odoo/enterprise/commit/51c1bb3cca9ae02fc55cb49ba98cec2901a8e273

`filter_duplicate()` can now fit the multi-website behavior more simply.

Closes #29347
2018-12-19 18:24:50 +00:00
Romain Derie e0c67651db [FIX] website: prevent customize options to be reordered
With multi-website, activating a customize option (customize_show view) will
actually duplicate the customize view to make it specific.
By doing so, the duplicated view will have a higher ID than the original, and
the original's siblings customize options.

Before this fix, two issues could be seen:
1. When toggling a customize option, it would appear last in the dropdown
   afterward. This is because of the views being sorted by (priority, id)
   (if the views have the same priority).
2. When toggling, sometimes the views header would be duplicated. This comes
   from the JS code that loop through the returned views and create the DOM
   by adding a header when the view inherit_id is different than the previous.
   Obviously, as 2 views with the same inherit_id could not be grouped together
   now that the specific one has a bigger ID, it will create twice the DOM.

=> Check tests in this commit, they have schemas that will explain it clearly

Note: We don't take priority into account for customize menu view order as it
      would create the same problem as (2.)
      We could have sorted by (inherit_id, priority, name) to avoid the issue
      and give the user possibility to order options in header but it was
      decided we dont.

Closes #29347
2018-12-19 18:24:50 +00:00
Romain Derie ae8232136d [FIX] website: get only specific view children on _views_get()
Before this comit:
The `_views_get()` method would be called recursively for every
`inherit_children_ids`.
At the end of the method, we would get the complete view hierarchy, including
duplicate hierarchies for website specific copies (COW).

Then, the `get_related_views` that is calling `_views_get()` would be overriden
in website module to keep only most specific views.

But this would not be enough as it would leave orphans from other trees:
  - Have a base view 'B'
  - That has an inherited view 'I'
  - That has itself an inherited view 'II'
  - Now make the hierarchy specific on a website from 'I'
  - And add another inherited view to 'I' on the generic tree
This become:
              B
             / \
            /   \
           I     I'
          / \     |
        II  II2   II'

As explained, filtering duplicates would not be enough as it would correctly
remove 'I' and 'II' from the generic tree but would not remove 'II2'.

At the end, it would return "B", "II2", "I'" and "II'".

Now, we correctly return only "B", "I'" and "II'" by ignoring generic trees
when there is a specific one.

Closes #29347
2018-12-19 18:24:53 +00:00
Romain Derie 9411ac0acd [FIX] website_*: get specific view over generic one
Before this commit, self.env.ref would always find the generic view loaded from
the assets.
Disabling a customize_show view on a website would not hide completely the
feature as the self.env.ref would retrieve the active generic one and not the
inactive specific one.

Step to reproduce (on one of the module):
  - Install website_sale_wishlist
  - Disable "Wishlist" on the Customize menu of /shop
  - Go to a product page, the wishlist hearth icon is still there

opw-1914576
Closes #29347
2018-12-19 18:24:50 +00:00
Romain Derie f7df35540b [FIX] web_editor, website(_theme_install): avoid theme.ir.ui.view crash
In a particular case, `_views_get` was mixing apples and oranges, ir.ui.view
and theme.ir.ui.view.

This was the case if a theme has a theme.ir.ui.view t-calling another
theme.ir.ui.view.
(Only theme's sale bridge cause this issue, eg theme_kea_sale.products)
Then, having that theme installed on a website would make all other website
without that theme to crash when opening the /shop customize menu.

Indeed, the theme.ir.ui.view would have the xml_id theme_kea_sale.search.
The generic view `website_sale.products` would have `theme_kea_sale.products`
as inherit child which is website specific and t-call `theme_kea_sale.search`.

Then, on a website witout theme_kea installed, opening the customize menu would
call `get_related_views` that would call `_views_get` that would loop through
inherit children calling `_view_obj` that would not find a view with that key
and would fallback on self.env.ref, finding the theme.ir.ui.view.

Note: `_views_get` might return specific view for another website but that will
      be filtered on `get_related_views` override in website.

Step to reproduce:
  - Have at least 2 websites and website_sale installed
  - Install theme_kea on a website, it will also install theme_kea_sale
  - Go on the website that has not theme_kea installed
  - Go to /shop
  - Open Customize menu, it won't load because of python crash

opw-1914576
Closes #29347
2018-12-19 18:23:36 +00:00
Olivier Dony eb19016ba3 [REV] Revert "[FIX] modules: load demo data fallback"
This reverts commit 5f4a945182.
The cure is worse than the original disease.

The main installation cursor often holds exclusive locks (due to DDL
changes) on vital tables such as res_users. As a result, using
another cursor to perform changes while the main cursor is waiting
is extremely deadlock-prone. And these deadlocks can't be detected by
PostgreSQL as they mix Python-SQL locking, which leads to deadlocked
HTTP workers.

Related to:
- opw-1916918
- #29528
2018-12-21 16:01:31 +01:00
Martin Trigaux f4e7e06a1f [IMP] l10n_{be,ca}: translate the CoA in both base languages too
Same as ea747d23e4 for Belgium and Canada

If somebody chose nl instead of nl_BE as the language (e.g. on the SaaS on
odoo.com, only nl is proposed on startup), the chart of account was not
translated.
Now it will be in both languages.

Rename the translation file so it is loaded by any nl_* language
Add multiple spoken_languages to be sure to load each one via the
process_translation mechanism.

Apply same logic for fr_CA

closes odoo/odoo#29682
2018-12-20 14:35:30 +00:00
Xavier Morel 9dcca1aced [IMP] doc: convert xmlrpc python examples to P3
closes odoo/odoo#29485
2018-12-20 16:35:04 +00:00
Jorge Pinna Puissant 149e04b10d [IMP] website: Explain scope of language in keywords in seo
When there is a website with traduction (for exemple, Spanish and
French). In the Spanish website, at the SEO menu, you can add keywords
using any of the languages (Spanish or French), but these keywords are
only added to the Spanish website.

To avoid misunderstanding between the website language and the keyword
language a tooltip is added.

closes odoo/odoo#29683
2018-12-20 14:05:01 +00:00
lieyanqzu 849b169248 [CLA] Signature for lieyanqzu
closes odoo/odoo#29198
2018-12-01 04:54:24 +00:00
Nans Lefebvre ddc5cc186f [FIX] web: call _applyX2ManyChange with the correct viewtype
Have a one2many display records in a kanban subview,
which opens a form view when edited.
Edit a field displayed only on the form view.
A call to _applyX2ManyChange is done without giving it the viewtype argument,
therefore the fieldinfo is taken from the wrong view, traceback ensues.

opw 1914163

closes odoo/odoo#29607
2018-12-18 14:28:55 +00:00
lul-odoo 9b6073c3ea [FIX] web: Load form subviews without previous '*_view_ref' in context
On a form view of model A, if a many2one field (model B) has a [tree|form]_view_ref in the context
(to display a custom 'Search More...' tree view dialog for example),
when clicking on this field to display the model B form view, the context key *_view_ref is passed
when loading subviews (model C) making them crash because the view ref corresponds to the model B.

After this commit, '*_view_ref' keys in the context are dropped when loading subviews

closes odoo/odoo#29022
2018-12-03 08:03:09 +00:00
Sébastien Theys f8dad1bb4b [FIX] product,(website_)sale(*): fix product configurator
This commit has several parts:

- fix ordering of attributes and values
- fix/create python logic (notably for checking the possibility of a combination
	and for price computing)
- fix currency
- display correct info on the views without the need of JS (prevent flickering)
- fix various issues with website and SO
- add a lot of tests (both unit and tour)

================================================================================

*** Make consistent the filtering and ordering of product variants ***

Filter & Check possibility
==========================

The first variant shown on the website should always be possible.

When activating the customize "list view of variants", we don't want to show
impossible combination on the list.

We also don't want the user to be able to add to cart an impossible variant.

Show appropriate messages when no combination is possible.

Order
=====

We want the variant order to be consistent with what the user selected with the
sequence fields. The display order on the website should be the same than the
display on the various backend views.

This implies also fixing the order of:
- product.attribute
- product.attribute.value
- product.template.attribute.line
- product.template.attribute.value

The general order is now: (parent,) sequence, id.

Before, it was already a mix of those, but not always in the same order, and not
every key for every model. The name has been removed from the order: either we
sequence them correctly, or we want them in the creation order.

On the website, the first combination shown by the python should be the same as
the one that will be computed by the JS to prevent flickering.

Ideally there should be no RPC at page loading if the python has computed
everything correctly, but it is currently not possible to achieve because the
view logic for website_sale_stock is only in JS.

================================================================================

*** Fix product template and variant price computation ***

Move and improve the get_combination_info method:

- take into account tax included/excluded settings (B2B/B2C)
- take into account pricelist discount policy (striked price)
- fix inconsistencies when price after pricelist would be 0
- use proper rounding and discount compute with the currency helper methods
- fix an issue where context "partner" would have a mix of id and recordset

================================================================================

*** Fix currency conversions ***

The list_price and lst_price of a product are always encoded using the currency
of the product.

The results of "combination info" are always returned using the currency of the
pricelist if given, or the currency of the product.

The prices on an order (line) are encoded with the currency of its pricelist.

================================================================================

*** Fix dynamic variants access rights ***

Public users on the e-commerce should be able to create product variants if the
configuration of the attributes of the product template is set as "dynamic".

This uses "sudo" to bypass create security rules for public users.
Multiple checks are done to ensure that it creates a valid product variant.

================================================================================

*** Miscellaneous bugs, tracebacks and necessary improvements ***

In general:
 - correctly show warning when no variant is possible
 - don't let user add to cart an impossible variant (from optional product
 	modal or from any RPC), both in interface and controller logic
 - fix as much flickering as possible by correctly pre-computing in python/views
 - move business logic from controllers to models
 - correctly add no_variant and is_custom values on the SO line description

Sale order:
 - fix traceback when emptying the product_id field from configurator

website_sale:
 - correctly compute first image / carousel, and correctly swap images when
 	changing variants, without duplicate image or zoom problems
 - don't use list view of variants when it doesn't make sense
 - added missing product info when adding a no_variant attribute to cart
 - fix cart accessory product computation

website_sale_wishlist:
 - fix it with dynamic variants, no_variant and is_custom

website_sale_comparison:
 - fix it with dynamic variants (comparison and alternative products)

website_sale_stock:
 - fix it in general (some flickering still present)

================================================================================

Authored by @seb-odoo with contribution from @awa-odoo

task-1910821

closes odoo/odoo#28079
2018-12-18 16:21:32 +00:00
Sébastien Theys 4e01d5f702 [FIX] sale: fix indent of product configurator templates
This will make the diff of the following commit easier to read.
2018-12-18 13:02:06 +00:00
Sébastien Theys dc1b20f484 [FIX] sale,website: fix variant alert style
It should be warning instead of danger, and use appropriate BS4 classes.

Without this commit, the resulting style might be wrong with some themes.
2018-12-18 13:02:06 +00:00
Sébastien Theys 9e71571999 [FIX] website_sale: fix product variant image zoom
The product image zoom was computed in the start method, and an "on load" event
was set in some but not all cases.

This commit makes sure the load event is always set, to correctly recompute the
zoom feature when the image is later changed (for example, changing variant).
2018-12-18 13:02:06 +00:00
Sébastien Theys 87d75f78d6 [IMP] web_tour: allow simulating click without leave
This is important if the mouse must stay on the element after it has been
clicked. This is the case for the product image zoom, which will be tested in
the following commit.
2018-12-18 13:02:06 +00:00
Sébastien Theys bb8e6e7a82 [IMP] product: improve variant demo data
Activate variant by default with demo data: since we have demo data creating
variants, the database will be more consistent if the option is also activated
by default. It also allows to gain time when making a demo or testing feature
using them on a new database.
2018-12-18 13:02:06 +00:00
Sébastien Theys f763193374 [FIX] sale_quotation_builder: remove warning when installed
We don't need to clutter the interface with this warning once the module is installed.
2018-12-18 13:02:06 +00:00
Sébastien Theys 42ded05f4b [FIX] base: fix print pdf with --test-file command 2018-12-18 13:02:06 +00:00
mgh-odoo 6be0cdef98 [FIX] web: remove extra space in kanban dragging images
While dragging kanban record which have a cover image set, the kanban view
creates extra space, which makes it difficult to properly target a
position.

This is because of a jquery.ui issue for sortable when helper=clone is used.
In that case, then jquery.ui sortable will create a clone of current element
after hiding it. Note that jquery.ui tries to get height to current dragged
element after making it hidden(display: none) and display: none, so the element
does not return actual height and hence it gives innerHeight which considers
height of the image also and extra space is generated.

An alternative solution is to add start event in sortable option and
1) show ui.item
2) get height of the element and
3) hide ui.item, which gives proper height of the current dragged element

But removing helper=clone will also fix the issue and is not actually required.
Note that some special care had to be done to prevent the click from the
drag and drop operation to actually open the record.

Related to task: #1865788
Closes: #25734

closes odoo/odoo#29642
2018-12-19 10:28:17 +00:00
Martin Trigaux fa98749154 [I18N] export 12.0 source terms
Update to reflect the recent code changes

closes odoo/odoo#29636
2018-12-19 08:50:10 +00:00
Goffin Simon 4612d50bae [FIX] stock_account: No returned value for function _run_valuation
This commit 9eac6c6377 expects a returned value
from function called "_run_valuation".

But this function always returned None.

opw:1907021

closes odoo/odoo#29302
2018-12-06 09:45:09 +00:00
celm1990 b750c78b91 [FIX] web: translate terms on search view
Group by options for fields date and datetime was untranslated
Add call to translation method _t

closes odoo/odoo#29490
2018-12-18 16:48:46 +00:00
Nicolas Martinelli 16c1c89e46 [FIX] payment: manual acquirer
Raise an error if no manual acquirer could be found for the current
company instead of crashing.

opw-1915813
opw-1917979

closes odoo/odoo#29608
2018-12-18 12:53:31 +00:00
Mathieu Duckerts-Antoine 7618f84beb [FIX] web: sort pivot rows in comparison mode
Before this commit, it was not possible to sort
the rows of a pivot view while in comparison
mode. This fix makes it now possible. Note that
in comparison mode, a click on a header of type
"measure" will sort the rows according to the
column values coming from the data of interest.

closes odoo/odoo#28411
2018-12-18 12:56:06 +00:00
Jorge Pinna Puissant c7a307ffd2 [FIX] account: Two actions same name
opw-1917444

In the "Chart of Accounts" view, the action to view journal items show
up twice. This was because, two action windows had the same name, one
is for view journal items, and the second one is for view jounral items
for Tax Audit.
After this commit, the second action is named
"Journal Items for Tax Audit".

closes odoo/odoo#29597
2018-12-18 10:04:09 +00:00
Jeremy Kersten 7afaf2c277 [FIX] website: seo - fix translation for seo modal
Lang / Context is implicitely added in the query using this._rpc

Before this commit if you set the title 'Title 1' for your website in the main
langage and after edit the title as "Title 2" in another language, it was the
main title that was replaced instead of the translation.

Now we use this._rpc that bind automatically the context and so the current lang
that we are editing.

closes odoo/odoo#29596
2018-12-18 09:22:49 +00:00
qsm-odoo e1990d267c [FIX] sale: use theme design for optional product modal
Since the product configurator task, the optional product modal was
always using the backend style instead of the theme style.

task-1911015

closes odoo/odoo#29587
2018-12-17 15:46:19 +00:00
len-odoo 71ae0eac33 [FIX] im_livechat: fix table layout overflowing with long URL/words
Ignorant fools have been saying for more than a decade that <table> elements
should not be used for layout.
Once again, Odoo proves them wrong. You just need the right css.

opw 1914139

closes odoo/odoo#29498
2018-12-13 09:16:31 +00:00
Toufik Ben Jaa b49d5388ff [FIX] mail: crash on mail resend
- When resending a failed mail the code could crash.
  The issue is caused by the fact that calling `_get_recipient_data`
  with the parameter `pids` only, returns as the partners' groups the
  value `None`.

  The codes that uses the result of this method consider the groups as
  an iterable and crash when trying to iterate on a `NoneType`.

  OPW-1916498

closes odoo/odoo#29408
2018-12-11 08:32:12 +00:00
Nicolas Martinelli c819fc69ee [FIX] fields, test_impex: export Datetime
- Set a TZ on the user different from UTC
- Export a record containing a datetime, e.g. the Order Date of a SO
- Import the file

The Order Date is changed on the record.

The data export is always in UTC, but the data import takes into account
the user TZ, which explains the difference.

There is no good way of solving this in stable. We have 3 choices:
1. Do nothing: the flow export then import the same data is broken, as
   explained above.
2. Export in the user TZ: if the file is imported in a third-party
   software, we break the flow.
3. Import in UTC: if the file is generated from a third-party software,
   we break the flow.

Whatever the choice is, we either break a flow or keep an inconsistent
behavior. We choose option 2, assuming that in most cases the user wants
to export the data in his TZ, therefore keeping the values displayed. We
only do it in v12 in order to mitigate the impact on existing
installations. A proper fix should be discussed for v13.

opw-1915631

closes odoo/odoo#29576
2018-12-18 07:13:34 +00:00
Nicolas Martinelli dc9e87baa6 [FIX] test_impex: use context provided
The `export` method accepts a `context` parameter, but doesn't use it.
This actually hides an incorrect test: when exporting in French, `Bar`
should be exported as `titi`.
2018-12-17 13:37:32 +00:00
Lucas Perais (lpe) 8a1f9f09c2 [FIX] account_facturx: pass all fields to compute_all in xml template
continuing commit 8f4b98e67f

OPW 1914928

closes odoo/odoo#29572
2018-12-17 10:16:18 +00:00
Jorge Pinna Puissant 9d0d5b6e8c [FIX] account: change accounting plan access
opw-1916511

When you try to change the accounting plan it sets off an access error.
To change the accounting plan it must delete and create some records in
the model 'ir.property' and none of the current security groups have
access to do it.

This issue was not present in the version 11.0 because in that version
the administrator was also the super-user.
In version 12.0 the administrator and the super-user were dissociated.

This was changed to level-up (sudo) the rights of the administrator
when the ir.property are deleted.

Note that, this fonction have two pre-existing constraints to avoid
issues when configuring an accounting plan: it can only be changed if
there are not alredy existings accounting entries;
and only the administrator can change it.

closes odoo/odoo#29493
2018-12-14 09:23:10 +00:00
Nicolas Martinelli 5f4a945182 [FIX] modules: load demo data fallback
- Create a new DB with `base_automation`, without demo data
- Switch to developer mode
- Go to Settings, then 'Load demo data', validate

A traceback occurs.

An error since the demo data in `base_automation_demo.xml` are pointing
to `model_base_automation_lead_test`, which is a test model. It is
therefore not created whithout demo data. The error is:

```
bad query: b'RELEASE SAVEPOINT "5159....."'
```

However, that's not the real crash. Indeed, in case the installation of
demo data crashes, `demo_failure_todo` is supposed to handle the
situation like a boss. But in this case, the DB cursor seems unusable.
Therefore, the following crashes like a gros caca:

``` python
todo = env.ref('base.demo_failure_todo', raise_if_not_found=False)
```

Solution: use a new cursor.

opw-1916918

closes odoo/odoo#29528
2018-12-13 18:22:34 +00:00
Odoo Translation Bot 3ce5c8bebd [I18N] Update translation terms from Transifex 2018-12-16 01:18:51 +01:00
Lucas Perais (lpe) 8f4b98e67f [FIX] account_facturx: template should compute taxes with partner
Otherwise account_tax_python will crash if 'partner' triggers a condition

OPW 1914928

closes odoo/odoo#29539
2018-12-14 10:09:01 +00:00
Lucas Perais (lpe) 7bc849c3a6 [FIX] account: journal dashboard shows invoices and refund for given journal
Have an invoice and a credit not in one journal
Go on the dashboard for journals

Before this commit, the count of invoices in draft took into account
both invoices and credit notes, while clicking on the button to see the invoices/credit notes
only showed invoices

After this commit, clicking on the button show both invoices and credit notes

It is worth noting that this is the behavior in v11.0
And that the way the dashboard is computed cannot allow to differentiate
within the kanban records, invoices and refunds as two separate buttons

OPW 1916135

closes odoo/odoo#29482
2018-12-12 15:46:30 +00:00