Commit Graph
132829 Commits
Author SHA1 Message Date
Daniel Reis a6351bb76c [CLA] Add Daniel Reis to OSI Corporate CLA
Done at #41027

closes odoo/odoo#42384

X-original-commit: bc2a2070def5f489b69b85e7eb8d87d89ceead7e
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-12-26 10:02:25 +00:00
Jason Van Malder f8f872c7c2 [FIX] web: fix M2M tags rendering
Issue

    - Install CRM & Studio
    - Edit CRM kanban view
    - Add tags > select "tags"

    Traceback

Cause

    _render is called multiple times, there is one case where
    `this.$el` is undefined.

Solution

    Checking if `this.$el` exists before using it.

OPW-2156964

closes odoo/odoo#42382

X-original-commit: 05f31289c1bb1d8c4b8e1f72f519e8e35e5ecb8c
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-12-26 10:01:27 +00:00
Nicolas Martinelli 292971cb6c [FIX] stock_account: valuation multi-currency
- Set USD as company currency
- Set the EUR rate to 1.5
- Create a product A: FIFO & automated, invoicing based on delivery
- Create a pricelist in EUR
- Buy some quantity @ 100 USD
- Create a SO for 1 @ 200 EUR
- Confirm the SO, validate the picking, generate the invoice
- Post the invoice

The COGS are incorrect:

                            Amount Currency         Debit        Credit
Stock Interim (Delivered)            -66.67          0.00        100.00
Expense                               66.67        100.00          0.00

It should be:

                            Amount Currency         Debit        Credit
Stock Interim (Delivered)              0.00          0.00        100.00
Expense                                0.00        100.00          0.00

opw-2148171

closes odoo/odoo#42381

X-original-commit: 3a6ada5e550775e84c3d8a2f720bdd45250e2880
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-12-26 10:01:07 +00:00
Aurélien Pillevesse 800f21a894 [IMP] base_setup: conjugate the view content
Update company and language translations with condition

closes odoo/odoo#41311

Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-12-23 15:57:36 +00:00
Richard Mathot e25ea9e665 [FIX] website_mail: prevent crash
`self` is a controller, not a model, thus we use the request to get the
environment.

opw-2160614

closes odoo/odoo#42350

X-original-commit: ac456d8d12bfc26addb3f097aa5552176f6fb765
Signed-off-by: Richard Mathot (rim) <rim@openerp.com>
2019-12-24 15:39:03 +00:00
helly kapatel 02913c9920 [FIX] portal : fix error on user creation
Leftover typo from #36804.

The company_id key in the context was removed and replaced
by the generic with_company mechanism, we therefore have to use self.env.company
(and not self.env.company_id which doesn't exist).

closes odoo/odoo#42348

X-original-commit: 4a627816e9c803ff414e6d5a5267b6f44aa25e72
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2019-12-24 14:31:07 +00:00
Yenthe666 d4d26662fb [ADD] l10n_pl: add Polish states to localization
Courtesy of karol185 - based on #37429
Since Poland does not require states
(https://www.bitboost.com/ref/international-address-formats/poland/)
Add them in the l10n_pl module and not with the other states in the
base module

closes odoo/odoo#42273

Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-12-23 14:40:15 +00:00
Robin Heinz 99615ff6cc [FIX] pos_restaurant: double printing not allowed.
Before this, when we printed a ticket for the kitchen, if we went back to the table management and go back to the order, we could re print the same product.
Now, we can only reprint the order if there is something different.

closes odoo/odoo#42208

Task-id: 2123029
X-original-commit: c8f604045eb0d476766641386c4e5e1605b915c3
Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
2019-12-24 14:27:11 +00:00
Thibault Delavallée db54055747 [REF] crm: clean lead common test class
Purpose of this commit is to clean a bit crm tests, notably lessening data
created in tests and removing / improving some low level tests. As we are
about to remove onchange / default and replace them by editable computed
fields it is easier to clean some tests and data beforehand.

This commit is a preliminary cleaning coming from task 2088565 about CRM
onchange to compute methods update.

LINKS

Task ID 2088565
Community PR #42344
Enterprise PR odoo/enterprise#7403

Related: odoo/enterprise#7403
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2019-12-24 13:14:42 +00:00
Thibault Delavallée de6e980f59 [IMP] mail: slightly improve tool to call mail gateway in tests
We now also support formatting a return path when emulating incoming emails.
Purpose is to integrate some more tests in a near future about incoming
emails, notably in CRM.

This commit is a preliminary cleaning coming from task 2088565 about CRM
onchange to compute methods update.

LINKS

Task ID 2088565
Community PR #42344
Enterprise PR odoo/enterprise#7403
2019-12-24 13:14:02 +00:00
Thibault Delavallée 9a0267ee36 [FIX] website_slides: do not display links to unviewable slides
Channel allow to browse slides and a list of available slide is displayed
as a left panel in the eLearning frontend. Even slides current user
cannot see are displayed in order to give some information about course
content. Accessible slides are clickable, other slides should be
displayed as strings. However due to some sudo when computing slide
informations all links are set as clickable.

There is no security issue as when being redirected to a slide the
user cannot access there is an acl error. However he should not have
the links displayed, just strings. This commit fixes that behavior.

closes odoo/odoo#42338

X-original-commit: 04a957bb18665957faf87b6c47996643adbd4558
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2019-12-24 11:02:33 +00:00
Samuel Degueldre 7511f34c2b [IMP] website, website_blog: change stretch option to add smaller size
This commit adds the width of blog posts to the "Stretch" snippet option
(previously, only full width aka container-fluid and regular container
were allowed, hence the name), as such it has been renamed to width.
Some code in website_blog has been adapted to reuse that class, such
that the width of the small container can be adjusted and website and
website blog will stay consistent with one another.

task-2155513

closes odoo/odoo#41844

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2019-12-24 08:45:59 +00:00
Benjamin Vray 03c52a23c1 [IMP] website: add new 'Product Catalog' snippet
Before this task, we had some menu snippets but they were not really
perfect and there were theme specific.

task-2091911

closes odoo/odoo#40169

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2019-12-24 09:51:38 +00:00
Patrick Hoste 1894dc5414 [IMP] website_slides: allow to download slide content and additional resources
PURPOSE

Currently eLearning lacks feature of having downloadable resources on
lessons. Indeed for example teachers would like to attach zip files or
other resources linked to a given lesson.

SPECIFICATIONS

You can now allow the user to download the slide content for pdf and image
slides. A new icon will be visible next to the fullscreen button on the pdf
viewer.

Course maintainers can also add additional resources to a slide which will be
available to download for the user.

Task ID 2066741
PR #39890

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2019-12-24 09:53:20 +00:00
Jinal Patel ef8457cac7 [IMP] sale_product_configurator: 'Product Variant' field optionally visible
-Product configurator applies to all a db. If need it for just a few products.
 If want to scan or type sku of variants of other products to quickly populate the order.
 it's time-consuming to go through product configurator.

-In this commit, To overcome of this issue, 'Product Variant' field optionally
 visible when product_configurator is installed.

task- 2082126
closes- odoo#41979

closes odoo/odoo#41979

Signed-off-by: Damien Bouvy (dbo) <dbo@odoo.com>
2019-12-17 08:37:23 +00:00
Patrick Hoste e42ee496f8 [IMP] website_slides: add comments on answers showed after answering a quiz
PURPOSE :

A quiz after a course content is a good way to check if the user gets the previous lesson.
Despite, the user/student may not understand why his answer was wrong/correct.
In this task we'll allow the teacher to add a comment next to the asnwer of a quiz.

SPECIFICATION :

The quiz creator will now be able to comment the answers to inform the frontend user why
his answer is wrong/correct. He will be able to add the comments both in backend and frontend.

Task ID : 2072566
PR : #41188

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2019-12-24 08:56:12 +00:00
Florent Lejoly 9b534649d5 [FIX] crm: fix archive / restore PLS inconsistencies
SPECIFICATIONS

Fixes following issue: when a lead is marked as lost, the probability is
correctly set to 0 but not the automatic one. If one clicks on the "Set to
automatic", the probability is updated, which un-archives it without really
restoring it, meaning we get in a very strange state outside the expected flow
(no Won/Lost buttons, ...).

With this commit the automated probability is set to 0 when setting as lost.
Moreover restoring a lead recomputes its probabilities.

LINKS

Task ID 2092799
Manual backport of PR odoo/odoo#42015 done in master
PR odoo/odoo#42045

closes odoo/odoo#42057

X-original-commit: 9ac5f42cd0c381bdddfd196721983057bab7028b
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2019-12-17 15:34:12 +00:00
fw-bot e72ae1aa0c [FIX] stock: assign SN on move Lines
Before this commit, we can't use the Generate and Assign Serial Numbers
on already existing move line. It always creates new one, even if the
picking type use "Pre-fill Detailed Operations".
Now, it will edit existing lines, except if we ask to generate more SN
than we have unassigned move lines, or if the picking don't use the
"Pre-fill Detailed Operations" option, in which cases it will still
create new move line with the generated SN.

Also, before this commit, paste a list of serial numbers to assign them
on multiple move lines in once work only with creation of a new move
line for each serial number.
Now, it's also work with existing move lines.

Finally, some code shared the same logic in `stock.move` in the move
line onchange method and in the `_generate_serial_numbers` method.
Moves this code in a new method, `_generate_serial_move_line_commands`,
and call it in the two previous methods.

task-2150561

closes odoo/odoo#42316

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-12-23 17:04:17 +00:00
Fabien Meghazi 6ddf7a50b5 [IMP] server: prevent threaded server to exceed memory limit due to malloc's arenas
glibc's malloc() uses arenas [1] in order to efficiently handle memory
allocation of multi-threaded applications. This allows better memory
allocation handling in case of multiple threads that would be using
malloc() concurrently [2].

Due to the python's GIL, this optimization have no effect on
multithreaded python programs. Unfortunately, a downside of creating one
arena per cpu core is the increase of virtual memory which Odoo is based
upon in order to limit the memory usage for threaded workers.

On 32bit systems the default size of an arena is 512K while on 64bit
systems it's 64M [3], hence a threaded worker will quickly reach it's
default memory soft limit upon concurrent requests. We therefore set the
maximum arenas allowed to 2 unless the MALLOC_ARENA_MAX env variable is
set.

This commit also brings the following changes:
- allow to disable the memory hard limit for all servers if the provided
  value is 0 (instead of crashing)
- increase the log level for threaded server in case of limits reached

Note: Setting MALLOC_ARENA_MAX=0 allow to explicitely set the default
      glibs's malloc() behaviour.

[1] https://sourceware.org/glibc/wiki/MallocInternals#Arenas_and_Heaps
[2] https://www.gnu.org/software/libc/manual/html_node/The-GNU-Allocator.html
[3] https://sourceware.org/git/?p=glibc.git;a=blob;f=malloc/malloc.c;h=00ce48c;hb=0a8262a#l862

closes odoo/odoo#42323

X-original-commit: 85fe2c6e60f7f1f6ea72cb55e85f85d420ce6616
Signed-off-by: Christophe Simonis <chs@odoo.com>
2019-12-23 18:03:35 +00:00
Samuel Degueldre bbf93a8085 [FIX] website: fix snippet animations not being destroyed before clone
In a80775ce3c, some code was refactored to stop using the confusing
'animation' denomination, as in reality they were just public facing
widgets that did many things, such as loading data based on
data-attributes and other things that were not always animation related.
One instance of the animation_stop_demand event was not renamed in the
_onSnippetWillBeCloned method, which creates some problems, one of which
being that the facebook snippet's iframe wouldn't be destroyed on clone,
but since the animation was started after the clone, this would result
in one facebook page snippet with two iframes with the facebook page,
for a total of 3 instead of 2, and one of these was unconfigurable.

This commit renames the event to restore the proper behavior.

closes odoo/odoo#42311

X-original-commit: 2a671f47f87e2bb52a5fade11ea6b79070516694
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2019-12-23 15:49:09 +00:00
wan fe97c78a40 [FIX] l10n_pe: adapt account group
The account.group model has been refactored in
https://github.com/odoo/odoo/commit/a124050511d508f6f1f8a4d4f9dfb2fa1507ad98

Although the filename was correct (.template) and one field was changed
(code_prefix -> code_prefix_start), we don't accept a parent anymore and
we have to provide the chart of account id.

closes odoo/odoo#42302

X-original-commit: 079ebab64e1ea7c17d786c8b4d17bbb707ff856a
Signed-off-by: Josse Colpaert <jco@openerp.com>
2019-12-23 14:11:59 +00:00
Samuel Degueldre a36c1cca08 [IMP] website: move facebook page snippet options in left panel
Before this commit, the configuration of the facebook page snippet was
done in a modal window. In an effort to streamline and unify snippet
options, the configuration has been moved into the left panel.

task-2146928

closes odoo/odoo#41104

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2019-12-18 15:12:47 +00:00
Jinal Patel 6ae2ba8d84 [ADD] sale_margin: margin percentage
New field to express the profitability percentage of a Sales Order (/SO line).

task-2033253

closes odoo/odoo#39926

Signed-off-by: Damien Bouvy (dbo) <dbo@odoo.com>
2019-12-23 14:15:56 +00:00
Jeremy Kersten 5a25b7dc87 [IMP] website: add new s_popup snippet
task-2118794

closes odoo/odoo#42207

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2019-12-23 13:36:35 +00:00
qsm-odoo 4b6245eb32 [FIX] web_editor: fix default value handling of left panel inputs
closes odoo/odoo#42295

X-original-commit: 680e1de7d6efaaa342366899460d00b79455ab18
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2019-12-23 12:40:46 +00:00
Prakash Prajapati 0bd38574d2 [FIX] website_sale: fix traceback for website 404
Purpose of the commit is, the template website.404 is renamed
in commit https://github.com/odoo/odoo/commit/423402f1e50000186924186beba0cbe87e02e774

but still remains use of it at some places which is going to produce
the traceback so replace the template website.404 rendering with NotFound
exception as it will use the template http_routing.404

Task-2145659

closes odoo/odoo#42294

Closes: #40924
X-original-commit: e5af7617e02e39b8a37a02b102d3da0e4525ffa9
Related: odoo/enterprise#7394
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-12-23 12:17:11 +00:00
Kevin Baptiste b7856d6ea7 [IMP] project: display remaining hours on tasks
The remaining hours on a task are now displayed unless there are no
planned hours defined.

 - Between 0 and 79%: green border
 - Between 80 and 100%: yellow border
 - Above 100%: red border

closes odoo/odoo#41222

Taskid: 2150121
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-12-09 07:45:13 +00:00
William Henrotin a60b90c530 [FIX] stock: cast string as date
Writing for the web interface on the scheduled date of a stock move
will failed as the date is send to the python server as a string. Then,
a duration in datetime format is added. This failed as operation on string
and datetime is forbidden.
This commit cast the string date into a datetime object before applying
date logic.

closes odoo/odoo#42287

X-original-commit: 8f122297f80e06c06a3a5efc6815b9ba627d0ed8
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-12-23 10:56:13 +00:00
Hemali Bhimani e288af818f [IMP] sale_stock: refactor availability widget in sale stock
purpose of this commit is to reuse availability widget for
rental products so need to refactor the widget

task- 2081260
closes- #41598

Related: odoo/enterprise#7169
Signed-off-by: Damien Bouvy (dbo) <dbo@odoo.com>
2019-12-23 10:27:53 +00:00
Jason Van Malder 222fe36405 [FIX] mass_mailing: fix unsaved changes in source mode editor
Issue

    - Install Email Marketing
    - Create/Edit a template
    - Switch into source mode
    - Add things
    - Save

    Things not saved.

Cause

    The widget override his parent `commitChanges` and don't take
    source mode into account.

Solution

    Take source mode into account like:
    https://github.com/odoo/odoo/commit/e29c08969f6e7ad981e9b7b79027d84dc89fbca2#diff-59db103a74684967379b66a89695cfdeR102-R105

OPW-2151675

closes odoo/odoo#42193

X-original-commit: 14f55b8d95bbcaf2409342140ccad55a1cd1c2d7
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2019-12-19 15:26:16 +00:00
Jason Van Malder fb926fe883 [FIX] web_editor: fix mail template toolbar in debug mode
Issue

    - Install Mail template
    - Enable debug mode (normal or assets)
    - Create or edit a mail template
    - Click in the text editor

    The toolbar is not showing up (it does when we're not in debug mode)

Cause

    We are doing `splice(-1, 0, ['view', ['codeview']])` on toolbar
    which is undefined, the method crashes and the toolbar doesn't
    render.

Solution

    Checking if the toolbar is defined before doing all that logic.

OPW-2151675

X-original-commit: 0e5ca50d5a8401bb3495e83691eab5c86a97a616
2019-12-19 15:26:15 +00:00
Siddarth GajjarandJigar Patel c44d846006 [IMP] product: added new product pricelist report
Generate a pricelist report for products and its variants. It's base on selected
pricelist and quantities. It also bring new UI.

closes odoo/odoo#35341

Signed-off-by: Damien Bouvy (dbo) <dbo@odoo.com>
Co-authored-by: Jigar Patel <jat@openerp.com>
2019-12-23 09:18:16 +00:00
Siddarth Gajjar 34cfd0df0d [REM] product: removed older product pricelist report 2019-12-23 08:17:35 +00:00
Katherine Zaoral cc20e899a2 [ADD] l10n_ar: update translation, add missing terms
closes odoo/odoo#42174

X-original-commit: 76991683473bf152e56a0944197fb04edbd73356
Signed-off-by: Josse Colpaert <jco@openerp.com>
2019-12-16 16:35:16 +00:00
Katherine Zaoral 8802709b26 [ADD] l10n_ar: add demo date for bank accounts
This is usefull for tests invoicing cases.

closes odoo/odoo#42169

X-original-commit: 32b443752dd0fb1ceda3e05da0d878bf908ebf8a
Signed-off-by: Josse Colpaert <jco@openerp.com>
2019-12-17 16:08:45 +00:00
jbm-odoo 3b40a324d6 [FIX] hr_org_chart: Avoid write on employee just by loading the view
Before this commit:
When loading a employee form, a write is done due to hr_org_chart

After this commit:
No write should be performed

closes odoo/odoo#42214

Taskid: 2150314
X-original-commit: 6e150ee19bb1f42c14d13218114ae9afbb84ebf4
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-12-19 17:24:31 +00:00
Simon Lejeune 4f0b6d6ce5 [FIX] stock: wrong security rule
rev[0] aimed to fix an intercompany reservation issue by allowing the
intercompany moves to be seen, however the new domain was too soft and
also allows the visibility of any moves going to a location without
company, for example now outgoing moves to customer from all companies
are visible.

We strengthen the domain to only allow intercompany moves, ie we add the
transit constraint in the domain.

We also fix the same issue for the move line model (see [1])

Now that this one is fixed, the next move is automatically reserved
during _action_done. This didn't work either, so we carefully sudo and
force_company on the destination move.

[0] 3c4bb080c3
[1] f9461c7096a65565a05136a4c6c42ddfa6881926
task-2157248

closes odoo/odoo#42270

X-original-commit: 9a237d1af79519665d0895a30c9ce55a1d835918
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-12-21 10:43:00 +00:00
Nicolas Lempereur 26fac9a834 [FIX] base: attachment check linked record 'write'
When an attachment is linked to a record (res_id and res_model are set)
we check the access rights and access rules of that record.

The access we check on linked record has changed as follow:

- 15905e78 (2013) => we check `write` access right/rule for `create`
- f5ebc509 (2014) => we check `write` access right for all mode
- 66644e85 (2015) => we check write access right for all but create mode

So currently we check on the linked record for each mode:

- create: write access right / write access rule
- read:   read access right  / read access rule
- write:  write access right / write access rule
- unlink: write access right / unlink access rule

The behavior is not expected for `unlink`, we should check if we have
write access through access rules instead of checking unlink access.

Without the change, the added test failed with a `unlink` access rule
AccessError on the linked record.

opw-2154448
closes #41814

closes odoo/odoo#42264

X-original-commit: 2b3fc2e3b80f191b4cd126abccf6f94b1302ac11
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2019-12-20 14:14:12 +00:00
Nicolas Vannieuwerburghandbeledouxdenis 75f91ca8e9 [FIX] Base: Don't crash on manual_field issue
closes odoo/odoo#42248

X-original-commit: abdc08d8d252647f388730ff84833249b5ef83a6
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
Co-authored-by: beledouxdenis
2019-12-20 11:13:31 +00:00
Raphael Collet 2448ff2c8c [FIX] models: avoid neverending recomputation on missing records
Assume F and G are computed by the same method on a missing record R.
During recomputation of F on R, the compute method is called but fails
because R is missing.  Both fields are re-marked to compute (because
computation failed), then F is discarded (because R is missing).  Then
comes G's turn: G is accessed on R and the computation fails.  Both
fields are re-marked to compute (because computation failed), then G is
discarded (because R is missing).  Now F is marked again to compute: the
process never ends.

To avoid this situation, discard all fields to recompute on missing
records.

closes odoo/odoo#42234

X-original-commit: 78bf4dbaa1c4adfa1dac68a4d79b87800003ac05
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2019-12-20 09:21:38 +00:00
Arnaud Willem 46088e3439 [CLA] signature for serenite24h24
closes odoo/odoo#39621

Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-12-20 12:58:03 +00:00
Jairo Llopis 9c25891e29 [FIX] crm: move iap widget where it belongs
To reproduce the bug:

1. Install `crm`.
2. Uninstall `iap`.
3. Go to any `res.config.settings` view.

Odoo will crash because the `iap_buy_more_credits` JS widget doesn't
exist (defined in iap).

Moving the widget from `crm` to `crm_iap_lead_enrich`. Since
`crm_iap_lead_enrich` depends on `iap`, this problem will not happen
anymore.

@Tecnativa TT20916

closes odoo/odoo#42258

X-original-commit: ec1be332c984bfcd0db3517db718fa85dbce7414
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-12-20 12:47:11 +00:00
Vmaxadmin b590224335 [CLA] Signature for Vmaxadmin
closes odoo/odoo#42253

X-original-commit: 1b0050250a2fcb3eb668c911f032c662f144936c
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-12-20 12:08:30 +00:00
Debauche Stéphane 01dadaecca [IMP] website_slides: improve error message when google API key is invalid
Currently when there is an issue with the google API key, a generic message
is send to the user, with the error details embedded in it in an ugly way.

Now a message is displayed: "Your Google API key is invalid, please update it
into your settings. Settings > Website > Features > API Key". This is done
by parsing the JSON google sends back after request and determining if the
error is linked to the API key.

Task #2082857

closes odoo/odoo#40547

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2019-12-20 12:24:43 +00:00
Patrick Hoste 7b0df05706 [MOV/REF] website_slides: move quiz finish modal to its own dialog widget
This commit moves the finished quiz modal into a dedicated dialog widget.
It will lessen the "slide_course_quiz.js" code length and simplify the dialog template.

Task ID : 2126621
PR : #40801

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2019-12-18 09:11:24 +00:00
Damien Bouvy 6ac675f50f [IMP] mail: support custom x_active field
An override of toggle_active was present to ensure that activities
would be removed before archiving records; this commit adapts this
mechanism to take custom active fields into account, since they are
now supported at ORM-level by getting the active field through the
`_active_name` model attribute instead of blindly using the `active`
hard-coded field that was used until now..

closes odoo/odoo#40109

Signed-off-by: Damien Bouvy (dbo) <dbo@odoo.com>
2019-12-20 11:16:01 +00:00
Damien Bouvy 59eee6ba5f [IMP] base_import_module: clean up after itself
Uninstalling an imported module leaves behind an ir.module.module entry
which is entirely useless: it cannot be reinstalled without re-uploading
the module.

A quick solution is provided here by simply cleaning up after the
uninstallation and deleting the ir.module.module records of imported
modules that just got removed.

Another possibility could be to store the uploaded module for good in
an attachment and re-load it from there upon re-installation, but that
would lead to some conflict with Studio, as uninstalling the
studio_customization module usually means you want to get rid of it for
good.
2019-12-20 11:16:01 +00:00
Damien BouvyandRaphael Collet 220eb4db39 [IMP] base, web: support x_active for archiving
While x_name has long been automatically supported as an equivalent
of name, x_active was not.

This commit adds this behaviour OoB, both in the ORM and the web client.

On the ORM-side, a new `_active_name` attribute is supported on models.
This attribute specifies the field that should behave as an active marker
for records of the model. It is supported the same way `active` has been
until now (filtering by the `active_test` context key and toggled by the
`action_archive`, `action_unarchive` and `toggle_active` methods).
Although no check has been added on the field's type, it is assumed to
be a boolean field (the same way no check is present on the `(x_)name`
field).

On the client-side, the list view and form view now both support
detecting the presence of either `active` or `x_active` on records,
automatically adding an '(Un)Archive' button in the Action menu if such
a field is detected.

Note that the ORM implementation does actually need the field to be named
in any specific way, but since the web client has no mechanism to load
information regarding a model (the lifecycle of an action loading
includes loading the action, view and record(s) but no generic
information about the model itself besides what is included in the
views), we restrict the field's name to `(x_)active` to avoid confusion
as any other name would work at the ORM-level but not in the client.

In the future, the client might be able to more elegantly get
information about models, but this was not the scope of this change and
this solution should cover most cases.

Note that the `active` field will always takes precedence over the
`x_active` field to avoid confusing the polarity, even if both fields
are present on the model.

In the case of a custom field, it might be slightly annoying that the
default value of a Boolean field is `False`, which means that upon
adding the column, all existing records are automatically archived. This
can easily be worked around using an `ir.default` record for that
particular field and an update of existing records (e.g. through the
list view). The goal of this change was not to make it easy to add
support for custom active fields, but to make it possible - we have
therefore kept this implementation which introduces few changes while
adding enough flexibility for developers.
See https://twitter.com/zubair_shafiq/status/1202587553871880192?s=20
for more info regarding supporting any `_active_name` in the web client.

Co-authored-by: Raphael Collet <rco@odoo.com>
2019-12-20 11:16:01 +00:00
Thibault Delavallée 4ef326de3c [FIX] website_slides: fix wrong comodel name in many2many
Channels uses tags allowing to categorize and filter content. For that
purpose a m2m exists between channels (slide.channel) and tags (slide.channel
.tag). The 2many relationship from tags to channels holds however a wrong
comodel name. It has no impact on code since relationship table is
correctly defined and current code does not use the channel_ids fields
from tags.

closes odoo/odoo#42244

X-original-commit: 46c3ac94485292c59fdfe4b21a8e32eef9d1f998
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2019-12-20 10:38:22 +00:00
Andrea Grazioso (agr-odoo) 0090a3c924 [FIX] point_of_sale: avoid adding the same tax twice
Activate a Fiscal position with a defined tax mapping(i.e. 15%). Add to a
product the same tax. Set the tax to be included in price.
In POS Settings add the default fiscal position as the one from before.
Now open POS and add the product.

The total price calculated will be wrong: the tax is added twice, one
from the product line and one from the localization.

Mimic the behavior as in
https://github.com/odoo/odoo/blob/saas-12.3/addons/account/models/account.py#L1512

closes odoo/odoo#42194

X-original-commit: db16d119f02ed5244482276a3701d3d3ab2fdb7b
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2019-12-19 15:27:32 +00:00