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
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
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#23105closes#23355
Co-authored-by: Humberto Arocha <hbto@vauxoo.com>
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.
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.
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
- 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
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.
* 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
* 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
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.
- 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
* cross-version metaclass spec
* more formally deprecate browse_record and browse_null since they
were using metaclasses anyway
* update docstrings referencing the latter
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
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.
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
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
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)
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 ;)