Commit Graph
53 Commits
Author SHA1 Message Date
Christophe Simonis 74033eb007 [MERGE] forward port branch saas-11.2 up to 90f8f17fb4 2018-04-16 19:50:50 +02:00
Christophe Simonis 5f2d080cf8 [MERGE] forward port branch 11.0 up to ad825b673b 2018-04-16 18:34:56 +02:00
Nicolas Martinelli 7242544506 [FIX] base_import: activate advanced mode
The commit 1ba4fbe640 did not match the specs of the task, but
was merged anyway. Reverting the commit, and check by default so the
user is not confused with missing fields.

opw-1824074
2018-04-12 14:54:25 +02:00
Christophe Simonis 76027a6e12 [MERGE] forward port branch saas-11.2 up to 6773bdbe32 2018-03-21 19:42:34 +01:00
Christophe Simonis 6773bdbe32 [MERGE] forward port branch 11.0 up to e8f630e44d 2018-03-21 19:36:58 +01:00
Nicolas Martinelli aed8e199ce [FIX] base_import: import empty date/datetime
When a user imports a file with a datetime field set to a blank space,
the value is computed as 1900-01-01 00:00:00. However, when converted in
the user's TZ, this can lead to a value < 1900-01-01, which is not
recognized at the JS level as a valid value.

This makes the access to the record impossible, and possibly makes the
access to an app impossible. It is for example the case with Purchase,
where the order date is displayed on the default's action view (list
view).

We strip the value before testing if the value exists to avoid this
case.

opw-1826344
2018-03-21 14:43:45 +01:00
Christophe Simonis 0f57bdba72 [MERGE] forward port branch saas-11.2 up to 42659dc70c 2018-03-09 16:25:58 +01:00
Christophe Simonis 36945a5853 [MERGE] forward port branch 11.0 up to c2e878e34c 2018-03-01 19:43:25 +01:00
Nicolas LempereurandHumberto Arocha f0c801778a [FIX] base_import: allow whitespace as empty float
Empty cells containing only spaces may have unexpected results (not
shown traceback and broken import) when being imported and they were
intended for a float or monetary field.

To avoid the error we could either, ignore left/right whitespace when
parsing a float value (so same behavior as en emtpy cell) or prevent the
error and get an friendly import report error:

 ' ' does not seem to be a number for field 'Name of Field'

This change choose the first way, so a float ' ' (just whitespace) will
be considered as '' (empty).

opw-1816784
closes #23105
closes #23355

Co-authored-by: Humberto Arocha <hbto@vauxoo.com>
2018-02-28 11:17:21 +01:00
Raphael Collet 80f1ac3599 [REF] never defer parent_store computation
Simplify the implementation of parent_left/parent_right by removing this
optimization.
2018-02-28 10:33:44 +01:00
Ivan Yelizariev decc668f76 [FIX] base_import: typo 2018-01-25 12:59:19 +01:00
Christophe Simonis f02ed9ab9a [MERGE] forward port branch saas-16 up to 0af13af5de 2018-01-02 16:54:38 +01:00
Christophe Simonis 0af13af5de [MERGE] forward port branch saas-15 up to ddd293065e 2018-01-02 15:36:25 +01:00
Nicolas Martinelli 601bf82ba9 [FIX] base_import: currency removal
Typo in the currency removal method.

opw-787873
2017-12-15 10:55:03 +01:00
Raphael Collet 446be392ea [FIX] base_import, web: error messages related to data import modules
OPW 777366
2017-10-25 15:44:18 +02:00
Christophe Simonis 10128fa7e8 [MERGE] forward port branch saas-16 up to dc2a6c6cd2 2017-10-20 19:27:04 +02:00
Christophe Simonis 868e718e09 [MERGE] forward port branch saas-15 up to 8d0942380b 2017-10-17 15:14:47 +02:00
Yannick Tivisse 2651717251 [IMP] base_import: Defer parent computation after record creation/update
Currently when importing files, the parent left and right are recomputed on each record creation/update, which could lead to a lot a request.

This commit will defer the parent field recomputation to the end on the `load` function by recomputing the values from the MPTT and inserting directly the new values on the records.

Tested on a customer instance, this will reduce the execution time when importing a thousand stock.location from 15 minutes to several seconds.
2017-10-13 15:24:05 +02:00
amoyaux e1769cbea9 [FIX] base_import: parse date and float for relational fields
Use case to reproduce:
-> Import a file with a float using a coma related to the model
(for example the product.supplierinfo/price)

It happens because the method that parse the date and float field
only compare them to the main imported model.

This commit complete the method by using a recursion on relational
model in order to also parse the relational subfields.
2017-10-13 09:43:11 +02:00
Christophe Simonis bd08d4f052 [MERGE] forward port branch saas-16 up to 3ac2a1106c 2017-09-11 14:02:19 +02:00
Christophe Simonis 3ac2a1106c [MERGE] forward port branch saas-15 up to ec15765eec 2017-09-11 13:30:03 +02:00
Christophe Simonis 48f88992da [MERGE] forward port branch 10.0 up to 7d7e94c6ef 2017-09-11 11:45:44 +02:00
Goffin Simon 8fd5951fbe [FIX] base_import: Specified Date Format in Import Statment is not recognized
Steps to reproduce the bug:

1. Import a bank statement with the shown dateformad DDMMYYYY (without headers)
2. Specify this date format in the advanced options
3. Try to find the date column to assign.

Bug:

The date format is not suggested for the fields with format DDMMYYYY.

opw:769118
2017-09-06 13:45:16 +02:00
Christophe Simonis b8dd34fcbb [MERGE] forward port branch saas-16 up to 64d56995e0 2017-09-06 13:29:05 +02:00
Christophe Simonis 64d56995e0 [MERGE] forward port branch saas-15 up to ef5ac872b8 2017-09-06 12:26:36 +02:00
Christophe Simonis ec0d51f20e [MERGE] forward port branch 10.0 up to a4bcb66bfc 2017-09-06 10:59:06 +02:00
Nicolas Martinelli a4bcb66bfc [FIX] base_import: headerless import
- Import a CSV file without header
- Untick the option 'The first row contains the label of the column'

An error is reported.

If no header, the method `_match_headers` should return consistent
object types.

opw-769117
2017-09-05 16:37:48 +02:00
Christophe Simonis 30bd5ac0e9 [MERGE] forward port branch saas-16 up to aec6248bb3 2017-08-23 16:44:58 +02:00
Christophe Simonis 59f8b849fb [MERGE] forward port branch saas-15 up to d5f2a38b50 2017-08-23 11:23:08 +02:00
Olivier Dony 695716efb0 [FIX] P3: remove pycompat.{keys,items,values} helpers
Now that we're closer to switching to P3 for good, these helpers have
outlived their usefulness, and mostly add noise.

All remaining dict.iter*() or dict.view*() must be converted to the
normal keys(), values() or items() calls.

Whenever the result is likely to be used for more than the scope of a
loop, or when the dict needs to be modified during iteration, the calls
must be wrapped in a ``list()``, to protect the new P3 semantics.
Those cases are very exceptional.

Also removed some dead code or improved the API to remove unnecessary
conversions.
2017-08-20 23:25:54 +02:00
Xavier Morel e33a79c65b [FIX] P3: date parsing text model 2017-08-20 23:25:54 +02:00
Xavier Morel be7c5aefdf [FIX] P3: CSV reading & writing 2017-08-20 23:25:54 +02:00
Xavier Morel 7dd062f835 [FIX] P3: text model types
* remove references to basestring & unicode (use relevant pycompat
  helpers)
* remove some str calls (either entirely or replaced by relevant
  helper, either text or native)
* use better API to avoid unnecessary conversions
* remove some XML declarations in views
2017-08-20 23:25:54 +02:00
Xavier Morel 3824b5dcc1 [FIX] P3: fix base64 and StringIO uses
* StringIO removed from stdlib, replace with io
* try to correctly handle BytesIO/StringIO (one is for bytes the other
  is for text)
* fix base64: Python 3 removed bytes-encoding and bytes-bytes
  codecs (via #encode) so replace all calls to str.encode('base64'),
  also b64encode is a bytes->bytes conversion so attempt to properly
  handle that

issue #8530
2017-08-20 23:25:54 +02:00
Yannick Tivisse fd089ee467 [IMP] base_import: Defer parent computation after record creation/update
Currently when importing files, the parent left and right are recomputed on each record creation/update, which could lead to a lot a request.

This commit will defer the parent field recomputation to the end on the `load` function by recomputing the values from the MPTT and inserting directly the new values on the records.

Tested on a customer instance, this will reduce the execution time when importing a thousand stock.location from 15 minutes to several seconds.
2017-08-14 15:02:52 +02:00
Christophe Simonis db2f82d5f1 [MERGE] forward port branch saas-16 up to 4ca3d9cadf 2017-07-14 15:51:59 +02:00
Christophe Simonis 4ca3d9cadf [MERGE] forward port branch saas-15 up to aa19cb61f4 2017-07-14 14:27:38 +02:00
Cedric Snauwaert 999dc80e7c [FIX] base_import: when parsing date field, strip extra spaces 2017-07-12 13:48:22 +02:00
Akash Bhavsar 049cf42639 [IMP] base_import: improve import action
- Rename "Validate" button to "Test Import"
- unmatched columns are marked in red
- better column matching (show suggestions of the char field even if the imported values are of int type)

PR  #16881, close task 32894
2017-05-23 10:00:48 +02:00
Xavier Morel 07ab8b6cd2 [FIX] P3: Exception.message removed 2017-05-12 16:15:40 +02:00
xmo-odoo 6659d5a7d2 [FIX] P3: metaclasses handling
* cross-version metaclass spec
* more formally deprecate browse_record and browse_null since they
  were using metaclasses anyway
* update docstrings referencing the latter
2017-05-11 15:25:36 +02:00
xmo-odoo fffaf735f5 [FIX] P3: list -> iterable builtins (#16811)
In Python 3:

* various builtins and dict methods were changed to return
  view/iterable objects rather than lists
* and the separate Python 2 view/iterable builtins and methods were
  removed altogether

This is problematic when using these items as list (which the happens
repeatedly in Odoo), but more viciously when iterating *multiple times*
over them (which also happens, which I've messed up multiple times while
writing this, and which is a pain to debug even when you've just created
the issue).

Convert all code using these to semantics-matching cross-version
helper functions to get the LCD behaviour between P2 and P3, and
forbid the builtins via lint.

issue #8530
2017-05-10 09:39:55 +02:00
xmo-odoo b4429c2a91 [FIX] Various P3-related import changes
* LDAP import: python-ldap is not python3-compatible, pyldap is

  Warning: only supported from debian Stretch (current testing)?
  https://packages.debian.org/search?searchon=names&keywords=pyldap

* implicitly relative imports
* imports of moved or removed stdlib modules

issue #8530
2017-04-28 09:06:53 +02:00
Xavier Morel 3979f6802e [#8530] convert exception handlers to except..as syntax
Futurize fixers:
* lib2to3.fixes.fix_except
2017-04-11 14:53:29 +02:00
Haresh Shyara c02b2ca7d1 [IMP] base_import: Improve import preview for related fields
normal mode: Importing only regular/basic fields from source file
advanced mode: Importing any related fields from source file(i.e. if detected pattern in header like '<relational_fieldname>/<fname>')

- Rename following checkbox "Show all fields for completion (advanced)" in "Show fields of relation fields (advanced)"
- If the import file contains a column with a field of a relation field, show the column label in the preview, even if "Show fields of relation fields (advanced)" is not checked > to make it less confusing when importing advanced files (e.g. products with attributes)

This is a backport of 1ba4fbe640, which was performed due to several
tickets mentioning confusion with the new import system.
2017-01-03 12:07:47 +01:00
Jeremy Kersten daa90edc8a Revert "[FIX] base_import: parse format from relation fields."
This reverts commit 8416c2bcfa.

Temporary revert this commit, to have enterprise green again...
Need to replace 'full' args by key in context to don't break override
Need to rewrite account_bank_statement_import_csv from enterprise
2016-12-21 14:37:39 +01:00
Jeremy Kersten 8416c2bcfa [FIX] base_import: parse format from relation fields.
Before this commit, the parser (date, datetime, float, monetary, ...) was only
called on field from current model, and not on sub field.

Eg: product_id.price was not parsed as float, because product_id != float

This commit add an overiddable function to get all the parsers: get_parsers

This commit closes #14572
2016-12-20 17:30:54 +01:00
Haresh Shyara 1ba4fbe640 [IMP] base_import: Improve import preview for related fields
normal mode: Importing only regular/basic fields from source file
advanced mode: Importing any related fields from source file(i.e. if detected pattern in header like '<relational_fieldname>/<fname>')

- Rename following checkbox "Show all fields for completion (advanced)" in "Show fields of relation fields (advanced)"
- If the import file contains a column with a field of a relation field, show the column label in the preview, even if "Show fields of relation fields (advanced)" is not checked > to make it less confusing when importing advanced files (e.g. products with attributes)
2016-11-10 09:44:20 +01:00
Jeremy Kersten 7a7723eacf [FIX] base_import: allow to specify datetime format, fix encoding, add test date, fix translation
After this commit,
 - chinese custom date are supported
 - Possibility to specify the custom datetime format and not only dateformat.
   Withtout it, impossible to import a date column and datetime column at
   sametime with custom format.
 - Add test to check import date with custom format
 - Fix translation where error messages was in the source.

This commit fixes #13783 and closes #13803

Courtesy of @odony for the review ;)
2016-10-14 12:36:04 +02:00
Christophe Simonis f3532a6da6 [MERGE] forward port branch saas-12 up to 54ebe31 2016-10-11 19:07:42 +02:00