Commit Graph
132009 Commits
Author SHA1 Message Date
Odoo's Mergebot f591ec1ea9 [IMP] *: translation methods cleaning
Extract some cleaning wanted in #30759 but not related to language packs

- `amount_to_text` should work only on activated languages
- deprecate `load_lang` and rely on `_create_lang` or `_activate_lang`
- `trans_load_data` and `_load_module_terms` no longer silently activate languages
- pass explicitly parameters instead of relying on context content
- replace some `IrTranslation._load_module_terms(['base'], ['fr_FR'])` by `BaseModule._update_translations(['fr_FR'])` for higher level methods
- create `TranslationExporter` class to clarify the `trans_export` method (and clean dead code)

closes odoo/odoo#38859

Task-id: 2088290
Pad: https://pad.odoo.com/p/r.f6f789f8711d21314bd902972153ea9d
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-11-19 14:58:29 +01:00
Victor Feyens ab4507ed32 [IMP] doc: with_company display
closes odoo/odoo#40497

Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2019-11-19 10:52:35 +00:00
Nikunj Ladava 76dc26aad9 [ADD] l10n_no: added a new accounts
This Commit is related to task ID 37726

closes odoo/odoo#40490

X-original-commit: 43000c7f2ed10e960f9611b004e3b48adb568c5a
Signed-off-by: Josse Colpaert <jco@openerp.com>
2019-11-19 11:34:13 +00:00
Nikunj Ladava c6f7caca53 [ADD] l10n_no: convert existing account to csv
This Commit is related to task ID 37726

X-original-commit: 98e41dfeb133a941389cccf44b3cb232b94ac85d
2019-11-19 11:34:12 +00:00
Martin Trigaux 95ed21795d [IMP] tools: create TranslationModuleReader class
Instead of previous long methods, use a class to clarify what the
export actually does.
The TranslationModuleReader is written to copy the API of the
TranslationFileWriter.
This way, exporting translations is reduced to:
1. create a reader that will fetch all module translations (either
   from db or from static files)
2. create a writer in a specific format (po or csv)
3. export the content from the reader to the writer

Simplify the writer by deducing modules from exported translations
instead of fetching it again in a oneliner (this way can benefit from
yield operations)

Remove the 'all_installed' possibility in modules as it was not
working (creating query with 2 WHERE clause).

The new methode _get_translatable_records works on a per model basis.
This will allow a big performance gain as the previous code was
making a .exists() for each record individually.
In the future, this method could be removed as the main goal is to
test the presence of the rare attribute _translate=False.
2019-11-19 11:36:57 +01:00
Martin Trigaux 62d3675869 [IMP] tools: remove module_name parameter
It was misleading as only forced for translations of type 'code' but
for the other translations, it was retrieved from the imported file
(the comment in a .po file or column in a .csv)

This will allow another optimisation in the next commit, moving to a
TranslationModuleReader instance
2019-11-19 11:36:57 +01:00
Martin Trigaux f5e2038386 [IMP] base: use less tools method
Instead, updating the translations of a module can be done directly
on the ir.module.module record
Remove one call to _update_translation by the actual creation of the
language
2019-11-19 11:36:52 +01:00
Martin Trigaux 8790173ee6 [IMP] base: update comment
To keep up with the new API
Note we still do not have a good solution for the problem mentionned
below.
2019-11-19 10:38:19 +01:00
Martin Trigaux ac63556e23 [IMP] base: explicitly pass parameters for translation methods
Instead of relying on the context content, pass explicit values for
overwrite and create_empty_translations
applu this to trans_load and trans_load_data
Adapt the test that was trying to create empty translations.
2019-11-19 10:37:07 +01:00
Martin Trigaux 49fbab5329 [IMP] base: split and deprecate load_lang
load_lang was a kind of hybrid method trying to active or creating a
language if not found. This was error prone.
Instead rely on two methods with clear purpose:
ResLang._create_lang(lang, lang_name=None)
  - create a new res.lang entry using the locale of the server
    return the res.lang record to match the API of _activate_lang

ResLang._active_lang(code)
  - activate the given code lang

Most of the time, _active_lang is what is expected

tools.trans_load_data and IrTranslation._load_module_terms no longer
activate the language if not active.
Loading the translations should be explicit on an activated language,
it is too error prone to silently activate/create a language if not
found.
Remove lang_name from trans_load_data as no longer needed.
2019-11-19 10:37:01 +01:00
Martin Trigaux 7bf6992869 [IMP] base: do not use unactivated language
Only activated languages should be used in "amount to text" features.
If a language code of a not-used language is used, it should be
ignored for consistency with the rest of the interface.
2019-11-19 10:36:52 +01:00
jdoutreloux 700a81feca [IMP] project: Merge project/fsm form views
Purpose
=======

Merge the form views of project tasks and fsm tasks so that it is
consistent and coherent wherever the user is in odoo.

closes odoo/odoo#40273

Taskid: 2070964
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-11-19 09:36:50 +00:00
Baptiste Vergote ce57b34f43 [FIX] payment_paypal: wrong param expected in paypal_urls
Issue was blocking the system to confirm a SO/Invoice after redirection
from paypal.

In V13 is getting the value of the paypal_urls using
paypal_get_form_action_url() returning the correct string, not a dict
anymore.

Closing
opw-2119027
opw-2122833

closes odoo/odoo#40471

X-original-commit: b7f32e6451da75a9583d28686641fc328ab661da
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-11-19 08:16:47 +00:00
Nicolas Lempereur a9a2fba683 [FIX] web_editor: remove forced source mode
In e29c08969 source mode was reintroduced. Since complex template seemed
broken when it was edited, the feature of forcing source mode when there
is a `% if ` or `% set` template directive of 12.3 was reintroduced.

Since the direct breaking of the template was mostly solved with the
added line:

`options.prettifyHtml = false;`

the force source mode is not so much necessary and there was report that
it was not very clear.

In this commit it is removed, and if necessary could be reintroduced
later with clearer implementation.

opw-2123730
fix #40410
closes #40421

closes odoo/odoo#40458

X-original-commit: be30a3ba431cf24a5fcfdfedd0f9d9f73163c717
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2019-11-18 19:28:21 +00:00
Martin Trigaux b0b5fa6ec9 [FIX] website_sale: translate waiting message
closes odoo/odoo#40456

X-original-commit: 50d2a80e458bcf99025bf2e96afafd8606745c85
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-11-18 17:21:59 +00:00
Raphael Collet d2ff759ec0 [IMP] tools: make domain validation less strict
We do not want to block developers from using dynamic domains like:

    domain="country_id and [('country_id', 'in', [False, country_id])] or []"

closes odoo/odoo#40445

Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2019-11-18 15:17:02 +00:00
Martin Trigaux 69cbab713a [FIX] base,product: fix typos
closes odoo/odoo#40453

X-original-commit: 3b7a98bd5a7ce57a8f03b06fe9ac6c8eb349d2ad
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-11-18 16:41:57 +00:00
Andrea Grazioso (agr-odoo) 760ae910d4 [FIX] web_editor: restore debug assets in iframe
Open Mass Mailing in debug mode, create a new mass mailing,
choose a template for the body, check with the inspector the iframe.

The head of the iframe does not have the debug assets. This is because
the global variable relative to the debug mode gets temporary
overwritten before solving the promise.

For Gorash this has been done for:

* Performance as all the editor assets must be inserted into the iframe
assets
* As an indication to bugfixers that the fix must not be done in this
bundle as it is the exact same content as outside of the iframe and the
exact same content as previous Odoo versions.

Removing the override given that:

* If someone enable debug=assets he/she is aware of the performance hit
* A ticket has been opened because the iframe is hard to debug
without debug assets.

opw-2117649

closes odoo/odoo#40417

X-original-commit: 17c6952af3242c22bae2596f64b0addd04b9f9e0
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-11-18 11:49:11 +00:00
Victor Feyens eae9055f49 [FIX] analytic: wrong domain creation
Leftover typo from #36804 .

closes odoo/odoo#40478

Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2019-11-19 10:09:46 +00:00
Martin Trigaux 32dd2e97ec [FIX] account,base: python 3.8 compatibility
Remove warnings
Add mandatory parameter posonlyargs

closes odoo/odoo#40396

X-original-commit: aeb1e592a6fbc918fb4edf4a8953aa375124337d
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-11-18 08:37:09 +00:00
Yenthe666 ad34b4f6e0 [FIX] mrp: add product_uom_category for domain
Without the product_uom_category_id set you cannot edit this tree view. There is a domain [('category_id', '=', product_uom_category_id)] triggered from this view whcich is not fulfilled if we do not have the field set in the tree.

closes odoo/odoo#40186

X-original-commit: 4873e5ef3192480fdd3889331f13ff0e10ba5d6a
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-11-19 08:27:09 +00:00
Kevin Baptiste 2c6cd81f30 [IMP] mail: track fields based on ir_model_fields
The tracked field is now a relation to the corresponding ir.model.field.
This prevents potential privacy issues should the field be deleted or renamed.

closes odoo/odoo#39232

Taskid: 2088634
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-11-19 07:50:34 +00:00
fw-bot abd9d1506e [FIX] mrp: error w/o traceback on create BoM
If a Bill of Material is created without code (eg. when created as a new
group from a kanban view grouped by BoM) we would get a traceback
instead of an error.

With this changeset, we get a "You cannot create a new Bill of Material
from here." error if it is being tried.

opw-2124162
fix #38904
closes #40289

closes odoo/odoo#40457

X-original-commit: 32c13cd7d1387c0ea81a9bb5968d18c2b8f32051
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2019-11-18 19:28:01 +00:00
Nans Lefebvre 4fd8310e76 [FIX] account: send invoices with the right name
The mail_notification_paynow template expects a model_description
parameter or defaults to the model _description, "Journal Entries".
We add, similar to 4a3fd02af4 on sale.order, a type_name field to
get the correct type name in an extensible way.

Similar to 8c91b193fca3b, 65b6375cf3f9b.

opw 2120545

closes odoo/odoo#40245

X-original-commit: d1b66ca8ea46af1034e344dfd3eb99e00f5a2a34
Signed-off-by: Nans Lefebvre (len) <len@odoo.com>
2019-11-14 09:55:05 +00:00
Simon Lejeune ea92c813fd [FIX] stock_landed_cots: bring bach additional_landed_cost in the view
This field was deemed redundant and thus removed from the view but we
forgot the use case where multiple valuation adjustment lines are
generated (eg applying a lc on multiple pickings) and the added value
by picking must be adapted manually (eg decrease one to increase the
other).

task-2125127

closes odoo/odoo#40454

X-original-commit: 3e6d6315adf1c33ec3fd5eb106defb0c80d7290b
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-11-18 16:42:15 +00:00
fw-bot cf4a6cbdec [FIX] web: fix kanban "group by stage" wrong display
Reproduce the issue

    - Install Projects and Studio
    - Edit the projects app's kanban view
    - Enable group by stage
    - Close studio
    - Add several stages

    The stages are wrapped to the next line

Cause

    I think the problem comes from c5f6802, we apply a wrapping to
    all the kanban_dashboard items and in this cases the items are
    the stages.

This commits apply the wrap only on non-grouped kanban dashboard.

OPW-2123031

closes odoo/odoo#40449

X-original-commit: f40478d5bacfdc44c76b0aac2f749549bbc58681
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2019-11-18 15:52:03 +00:00
laa 70c370b01e [IMP] project,hr_expense,hr_timeshee: Add optional fields in list view
Add and modify multiple fields in tree view for next next model:
- hr.expense
- hr.expense.sheet
- project.project
- planning.slot
- Field Service project.task

closes odoo/odoo#39441

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-11-18 12:56:10 +00:00
fw-bot 4c28667efd [IMP] hr_holidays: prevent grouping leaves by name
closes odoo/odoo#40426

Taskid: 2088559
X-original-commit: 5653520252f321d1fa185bffd897952830b509c4
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-11-18 13:33:30 +00:00
Romain Derie e9106f8f98 [IMP] http_routing, portal, website: nicer 404 layout
This commit introduces a nicer 404 page, which is basically the same layout as
the one used on Odoo.com.

Also, the 404 is now fully customizable, blocks can be drag'd & drop'd.

task-1966460

closes odoo/odoo#38901

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2019-11-18 13:59:09 +00:00
Goffin Simon d3fe36d817 [FIX] account: Cannot search fiscal positions
It was not possible to search a fiscal position by name without a custom
filter.

opw:2124184

closes odoo/odoo#40404

X-original-commit: 72534d7ae21677b02d7cb26dd06d84d532be9514
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
2019-11-18 10:25:20 +00:00
jbm-odoo be15be7fa6 [IMP] hr_attendance: Introduce Kiosk users group
It's the unique group needed for a kiosk attendance. Avoid to give
to much rigths.

id=2088561

closes odoo/odoo#38954

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-11-18 12:37:42 +00:00
Victor Feyens 23d66d7045 [FIX] website_slides: default values for all compute fields.
closes odoo/odoo#36804

Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2019-11-18 12:25:05 +00:00
Victor Feyens 37b1689be7 [FIX] account, analytic: remove company_ids context key mechanism 2019-11-18 12:25:05 +00:00
Victor Feyens d52f8ce8b0 [FIX] portal: remove company_id context key. 2019-11-18 12:25:05 +00:00
Victor Feyens 3cf7b3778a [FIX] account: no impact company_id ctxt key. 2019-11-18 12:25:05 +00:00
Victor Feyens ce9fe1fcf6 [IMP] * : remove company context key 2019-11-18 12:25:05 +00:00
Victor Feyens 57b999d40a [FIX] sale,account,purchase_requisition: multi-company
Use correct company to get fiscal positions and properties

Ensure company used to fetch fiscal positions is always the correct one
when coming from a company restricted model (company_id required, or
related.required).

NB: if the company_id isn't defined, with_company doesn't change the
environment.

purchase: get_fiscal_position doesn't consider company_id ctxt key

others: properties were accessed with potentially the wrong company.
2019-11-18 12:25:05 +00:00
Victor Feyens 48b887618c [IMP] * : replace with_context(allowed_cids=[c]) by with_company(c). 2019-11-18 12:25:05 +00:00
Victor Feyens 9215e73fa2 [IMP] * : replace with_context(force_company=c) by with_company(c) 2019-11-18 12:25:05 +00:00
Victor Feyens 3455d02189 [IMP] base: remove force_company
From now on, if one wants to force following operations to happen in a given company,
use with_company(company) or with_company(cid) to update the environment.
2019-11-18 12:25:05 +00:00
Victor Feyens ef20d818ea [IMP] ORM: warn on bad company context keys usage. 2019-11-18 12:25:05 +00:00
Victor Feyens 0bfb695b4f [ADD] ORM: with_company 2019-11-12 16:23:33 +00:00
fw-bot e76276e083 [FIX] mrp,stock: error w/o traceback on create warehouse
If a warehouse is created without code (eg. when created as a new group
from a kanban view grouped by warehouse) we would get a traceback
instead of an error:

```
  The operation cannot be completed:
  - Create/update: a mandatory field is not set.
  - Delete: another model requires the record being deleted. If possible, archive it instead.

  Model: Warehouse (stock.warehouse), Field: Short Name (code)
```

opw-2124162
fix #40233
closes #40267

closes odoo/odoo#40382

X-original-commit: b6caa179e17199b29a9ca4009c53acb378423926
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2019-11-15 20:23:59 +00:00
Adrien Dieudonne 00e3eb8efd [FIX] web: restore responsive mode for website only
Due to a recent change: https://github.com/odoo/odoo/commit/c3335a0db03b7ef5e98bddb7c15b143510d58c1e#diff-c7dab7f11ffa06829bbc6ac5c87a99a8L420
website wasn't responsive anymore.
This was not intended as we only wanted to remove the
responsive support for the backend, not the frontend.

closes odoo/odoo#40314

Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
2019-11-18 10:18:49 +00:00
Debauche Stéphane a7d029afa7 [FIX] crm_website: fix the type of a lead created with the contact form
Lead/Opportunity type
=====================
In the settings, if ``group_use_leads`` is checked, we add the group ``use_leads`` to all users in the group ``base.group_user``

To know if the setting is checked, in the model ``crm.lead``, we compute this code,
```
self.env['res.users'].has_group('crm.group_use_lead')
```

In 12.0
=======
When we compute ``sudo``, we are as the admin user.
The admin user is in the group ``base.group_user`` and so, he can be in the group ``use_leads``,
so everything work fine.

In 13.0
=======
When we perform a ``sudo``, we keep the same user.
But the visitor is not in the group ``base.group_user`` (he is in the group ``base.group_public``)
So, the visitor can never be in the group ``use_leads``

Fix
===
To fix it, we just need to compute the method ``has_group`` as the super user (which is in the group ``base.group_user``).
```
self.with_user(SUPERUSER_ID).env['res.users'].has_group('crm.group_use_lead')
```

Task #2124421

closes odoo/odoo#40418

X-original-commit: 8758bdc24297032ba8fd65f637a6990c6351dd27
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2019-11-18 11:49:28 +00:00
jvm-odoo 6188378e57 [FIX] web_editor: fix wrong datetime parsing
Reproduce the issue

    - Install Events
    - Set the english default format date to %d/%m/%Y
    - Create an event & edit the date

    The date is set correctly in the backend

    - Edit the date of an event on the website directly

    The date format is still the old one

Cause

    The `from_html` method of DateTime was using `parser.parse` and
    ignore the user's date format.

This commit changes `parser.parse` into `datetime.strptime` taking
into consideration the user's date format.

closes odoo/odoo#40415

X-original-commit: d00c0e317f8affbe8bea231972c2b6da70b9f240
Signed-off-by: Jason Van Malder <jasonvanmalder@users.noreply.github.com>
2019-11-18 11:35:19 +00:00
Simon Lejeune 94e91972d4 [FIX] sale_stock: hide effective_date when empty
task-2125070

closes odoo/odoo#40412

X-original-commit: 965ef8ea1b2dcf3415e3f002248c8fb68cbfdfb6
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2019-11-18 11:04:23 +00:00
Florimond Husquinet (fhu) c9bed78c2b [FIX] crm: compute lead probability on kanban quick create
-In CRM, click the CREATE button.
-Only enter a title for the new lead and directly click ADD.
-Click on the newly created lead to view its details.

Before this commit:

although a probability could be computed based on the stage of the lead, this
field has a default value and, at creation time, this value doesn't end up in
the list of values from which the `_write_probability` function decide whether
to recompute the probability.

After this commit:

The `_write_probability` function, renamed `_update_probability`, doesn't check
whether it should or not update the probability. It just does it. This function
is directly called in the `create`. `_should_update_probability` is called
before `_update_probability` in the `write`.

Task ID : 2081480

closes odoo/odoo#40411

X-original-commit: 483a94116629e418ebb224bad375747cf9ab3c1d
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2019-11-18 11:04:05 +00:00
laa a8fdda6638 [FIX] hr_holidays: don't show the name in edit mode
When changing fields in Manager -> Allocation Form, the name (display_name) was recalculated only after the form was saved or only after the description was changed.

closes odoo/odoo#39553

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-10-30 08:10:21 +00:00
qsm-odoo 00022bd7fc [REF] web_editor: get rid of we-collapse elements
Now, we should either use:
- A we-select (in the end, same as collapse except it does not push the
  elements in the UI)
- A simple div to always display the elements

Part of https://github.com/odoo/odoo/pull/38959
task-2066614

closes odoo/odoo#38959

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2019-11-18 09:56:40 +00:00