Commit Graph

7612 Commits

Author SHA1 Message Date
Christophe Simonis 640e77eaa3 [FIX] base: deleting a view must not delete linked actions 2014-12-02 17:45:31 +01:00
Raphael Collet 591e329bb0 [FIX] fields: inherited fields get their attribute 'state' from their base field 2014-12-02 14:58:17 +01:00
Raphael Collet be10d1e573 [IMP] translate: small, non-breaking code improvements 2014-12-02 09:40:59 +01:00
Raphael Collet 4854d5562f [IMP] translate: improve management of targets in POT file 2014-12-02 09:40:59 +01:00
Xavier Morel d7fb4d903d [IMP] various tentative improvements to translation code 2014-12-02 09:40:59 +01:00
Xavier Morel 4d4d4f248f [FIX] base: incorrect translation mark 2014-12-02 09:40:59 +01:00
Xavier Morel 8ee2a89731 [FIX] translations: don't skip first line of translations when extracting module names
Used to be the first line was the CSV headers, the slice was left over after
these were removed from the source data. It probably didn't hurt (only issue
would be if the first module — alphabetically — has a single translatable
term), but it's just as clean not to have that.

Also removed now-unused variable (probably leftover of the CSV thing as well)
2014-12-02 09:40:59 +01:00
Xavier Morel 9964aae7a3 [IMP] translations: simplify condition in qweb terms extraction 2014-12-02 09:40:59 +01:00
Xavier Morel 4beba1dc31 [IMP] translations: parse views iteratively instead of recursively
also fix a pair of docstrings
2014-12-02 09:40:58 +01:00
Xavier Morel f164c44ae2 [FIX] base: export PO template files as pot
was already done when exporting to tgz, but not for po
2014-12-02 09:40:58 +01:00
Xavier Morel f32141017b [IMP] base: language export wizard
* move stuff around
* call write() from browse, correctly pass context to browse
* remove useless default to file name
* use contextlib with stringio
2014-12-02 09:40:58 +01:00
Christophe Simonis d37dd37059 [MERGE] forward port of branch saas-3 up to e1e7dc0 2014-12-01 15:42:51 +01:00
Christophe Simonis ec30b21336 [MERGE] forward port of branch 7.0 up to de07c64 2014-11-28 15:16:38 +01:00
Commandant Custo d3b680e7b2 [FIX] ir_ui_view: Missing separator in search view 2014-11-28 15:09:57 +01:00
Goffin Simon ae294f6222 [FIX] base: QWeb monetary field rounding
QWeb monetary widget uses the precision of the currency to know the number of
digits to display on a price. The number of digits is based on log10(rounding).
For currency with rounding different than 10^x (e.g. in Switzerland 0.05
to allow 5 cents coins only), the number of displayed digits should be rounded
up. e.g. log10(0.05) is -1.3, rounded up to 2 digits.

Fixes #3233
2014-11-28 15:00:59 +01:00
Andrius Preimantas de07c642b6 [FIX] base: delete parent partner reset use_parent_address
When deleting a partner with some contacts, if the contacts had selected
the "use parent address" checkbox, the address of the contacts was stucked in
readonly mode (no checkbox to disable it).
Disable use_parent_address for orphan partners.

Fixes #3611 #3613
2014-11-28 12:03:42 +01:00
Denis Ledoux 5ccbfdd5ec [IMP] res: partner form replace widget selection by option no_create 2014-11-28 11:31:36 +01:00
Antony Lesuisse e2cfe6cbd1 [FIX] Customers remove action domain customer=1 use the context default.
Closes #3902
2014-11-28 10:54:09 +01:00
Xavier Morel fd6dde7ca0 [FIX] enable --debug for non-xmlrpc contexts
fixes #3102
2014-11-28 08:35:14 +01:00
Denis Ledoux 1cbf48417e [FIX] translate: lang detection fallback actually falls back
For instance, when a context was passed to a method, but no lang was defined in the context, it did not tried to fallback to other places where we could have find the user language.
2014-11-27 17:18:46 +01:00
Christophe Simonis de27e19794 [FIX] fields.py: in many2one convert_to_cache, value can be int but long as well 2014-11-27 17:06:48 +01:00
Christophe Simonis 9b670049b6 [FIX] fields.py: Many2one fields only put valid values in cache 2014-11-27 17:06:48 +01:00
Denis Ledoux e347011f24 [MERGE] forward port of branch 7.0 up to 2080ea0 2014-11-27 13:27:37 +01:00
Sandy Carter 043f7b84b8 [FIX] base: avoid having 'False' in name of a bank
The name_get of res.partner.bank uses the format_layout to generate the name
of the bank. As every field is not required, we may get 'False' in the name.
Replace these missing values by an empty string.

Fixes #3590
2014-11-27 13:09:01 +01:00
David Monjoie f1c70d4cc9 [FIX] openerp: don't ignore active field on new views when updating a module
Without this fix, if you have a new view in a module with active=False, the active tag will be ignore when upgrading the module because of 'update' mode, and the view will be activated by default !
2014-11-27 09:52:17 +01:00
Somesh Khare f317fedc4b [Fix] ir_translation: fix the problem of base_field object has no attribute model (Maintenance Case:618054)
Fixes #3859
2014-11-26 12:25:58 +01:00
Olivier Dony e5f7b56735 [FIX] ir.ui.view: deletion of parent view should not cascade
This is safer to avoid inadvertently dropping customizations,
and does not impact the normal update/uninstall process, which
is based on the dependency order.
2014-11-25 18:38:39 +01:00
Raphael Collet cd2a432362 Merge pull request #3645 from odoo-dev/8.0-fix2manyupdateonchanges-chs
[FIX] api: avoid to return all fields *2many in onchanges
2014-11-25 12:42:36 +01:00
Raphael Collet ebdbd9f8b7 [FIX] fields: in *2many convert_to_write(), return all fields for new records and dirty fields for existing records 2014-11-25 11:25:50 +01:00
Raphael Collet 5ae3215f21 [FIX] test_new_api: fix/simplify the result of the onchange on one2many fields 2014-11-24 17:22:47 +01:00
Raphael Collet bc8c7596a5 [IMP] models: rework the API that deals with dirty fields on records 2014-11-24 15:31:18 +01:00
Christophe Simonis ad98da68f3 [IMP] http: do not log traceback for Warnings 2014-11-24 13:52:36 +01:00
Xavier Morel ec7736a051 [ADD] ws doc: introspection, reports and workflows
* use static imports in java examples to make them terser
* inline ``domain`` in java and php example to make examples more
  self-contained
* try to extend/improve Model.write's docstring
* add convenience kwarg to fields_get, mostly for user-driven
  introspection

Closes #3689
2014-11-24 08:54:55 +01:00
Simon Lejeune 467968b79a [FIX] tools: find_in_path: config is not ready at import time
commit f76d4525a was not actually working: extra keys from
config files are not yet into the config options dict at
import time. The fix is to move the logic inside the method,
like in `find_pg_tool` just below.

Also fix the use of `find_in_path` in report.py: the subprocess
may also raise AttributeError exception, so instead of listing
all the possible ones just re-raise the IOError shallowed by
`find_in_path` when the result is None.

Fixes #3809 #3811
2014-11-23 15:22:02 +01:00
Simon Lejeune f76d4525a3 [ADD] tools: handling of bin_path key in find_in_path
The openerp-server.conf now generates the bin_path record, in order
to resolve calls to external binaries served in the thirdparty dir.

Adpated report.py to use find_in_path and not directly which.
2014-11-21 18:08:12 +01:00
Christophe Simonis abcba53a7f [FIX] http.py: log 400 errors 2014-11-21 15:25:44 +01:00
Christophe Simonis 473fe9a331 [FIX] http.py: invalid request must return a status code 400 2014-11-20 16:06:55 +01:00
Denis Ledoux 6cb2c9edc6 [FIX] base: copy access rights on group duplication 2014-11-19 19:09:57 +01:00
Olivier Dony a6d24db305 [I18N] Update translations from Launchpad 8.0 branches 2014-11-19 17:49:12 +01:00
Christophe Simonis 6bbc21b906 [FIX] graph.py: correct Node() creation.
Fixes #3730
2014-11-19 15:14:14 +01:00
Olivier Dony c87b9c6539 [FIX] decimal_precision: avoid refreshing float precisions at each cache invalidation
Changing the decimal precision of float fields is a rare
operation, while cache clearing occurs fairly frequently.
Signaling a full registry change when the decimal precision
is changed (instead of a mere cache change) is therefore
a better trade-off, and more semantically correct as well.
This way we avoid the decimal precision refresh for each
invalidation.

Registry invalidation implies cache invalidation.
2014-11-19 12:53:58 +01:00
Antony Lesuisse fb9794835b [FIX] windows ctrl-c from cmd as a non admin
return False when calling is_running_as_nt_service from a non adminstrator
account.
2014-11-18 23:27:48 +01:00
Antony Lesuisse aa9eec3497 [FIX] server.py traceback on ctrl-c from windows cmd
Define a shim signal.SIGHUP on windows to avoid an ifdef in the threaded server
loop.
2014-11-18 23:04:21 +01:00
Raphael Collet 86ba01976e [FIX] tests: make self.assertRaises() return the expected object 2014-11-17 15:39:14 +01:00
Raphael Collet 908252ec88 [FIX] tests: make sure that a failed tests does not leave the environment dirty
When a failure occurs, or when exiting an assertRaises(), the environment
should not contain fields to recompute.
2014-11-17 14:07:42 +01:00
Raphael Collet 2052c16d21 [FIX] ir_model: on a custom model, _rec_name should be 'x_name' if it exists 2014-11-17 12:05:37 +01:00
Denis Ledoux 999ed04c40 [FIX] api: avoid to return all fields *2many in onchanges
When an onchange returns a change in a 2many field line (a '1' tuple, update), avoid to return all fields of the *2many field but only the altered field.

Otherwise, the web client regard all the fields of the 2many as dirty, and try to write on all fields (even if the value is the same, thus)

opw-615062
2014-11-14 14:24:11 +01:00
Raphael Collet e038fec696 [IMP] models: improve performance of _setup_fields()
There was an issue in _setup_fields(): the method invokes _inherits_reload(),
which recomputes inherited fields, and invokes itself recursively on children
models.  This may be problematic if the children models have already been set
up.

This optimization avoids recursive calls of method _inherits_reload().  In
_setup_fields(), first all parent models are set up, then their fields are
inspected to determine inherited fields, and their setup is done.  This scheme
guarantees that inherited fields are computed once per model.
2014-11-13 14:54:04 +01:00
Raphael Collet 552dab0dc8 [FIX] models: simplify conditions that seem to lead to missing fields 2014-11-13 14:54:04 +01:00
Raphael Collet fc2975a9af [IMP] models: in _init_manual_fields(), create fields instead of columns
Note that serialized fields are ignored; they are no longer supported, anyway.
2014-11-13 14:54:04 +01:00
Raphael Collet 3c203703db [FIX] ir_model: always setup models before calling _auto_init() 2014-11-13 14:54:04 +01:00
Raphael Collet b573077be6 [FIX] models: do not copy translations of fields that are not copied
Fixes #3272.
2014-11-06 16:42:41 +01:00
Raphael Collet 54140331f3 [FIX] fields: fix the translations of the labels of inherited fields 2014-11-06 16:42:41 +01:00
Raphael Collet 5cc863245b [IMP] fields: improve _determine_default() and add test for inherited fields 2014-11-06 12:20:39 +01:00
Christophe Simonis c825d0552d [MERGE] forward port of branch saas-3 up to ec27773 2014-11-05 21:46:42 +01:00
Christophe Simonis ec277732fe [MERGE] forward port of branch 7.0 up to 3e3e35e 2014-11-05 21:10:15 +01:00
Christophe Simonis 491372e865 [MERGE] forward port of branch saas-3 up to d36eee9 2014-11-05 20:26:36 +01:00
Christophe Simonis d36eee98fb [MERGE] forward port of branch 7.0 up to 65d92da 2014-11-05 19:34:18 +01:00
Olivier Dony 65d92dadf4 [FIX] base: incorrect code and locale for Bosnian
Stems from prebiblical commit f083aa2.

Fixes #3480
2014-11-05 19:09:23 +01:00
Antony Lesuisse c2bff2afae [IMP] safe_eval allow math 2014-11-05 17:25:41 +01:00
Olivier Dony 71247cebb6 [FIX] longpolling/gevent: automatically restart worker when killed
Whenever the longpolling/gevent worker dies, it
should be automatically restarted by the prefork
server, just like it happens for HTTP workers.
2014-11-05 17:09:10 +01:00
Olivier Dony 1719e6b922 [FIX] longpolling/gevent: log errors occurring in main loop 2014-11-05 17:09:10 +01:00
Simon Lejeune afce229e5a [FIX] ir_qweb: contact widget: use name_get instead of display_name
display_name field is overidden in res.partner in order to pop the context
key leading to show the address, and we want the address.
2014-11-05 13:37:56 +01:00
Raphael Collet 3dc2fcd363 [IMP] models: improve _mapped_func(), and add parameter 'reverse' in sorted() 2014-11-05 11:35:33 +01:00
Denis Ledoux fab2e29d50 [MERGE] forward port of branch saas-3 up to f7a76cb 2014-11-04 18:05:58 +01:00
Denis Ledoux f7a76cbb17 [MERGE] forward port of branch 7.0 up to be7c894 2014-11-04 17:54:48 +01:00
Manuel Vázquez Acosta 2fb2d9f956 [FIX] mail: partners with missing/invalid emails must not halt notifications to others 2014-11-04 17:32:32 +01:00
Raphael Collet 29da331f92 [IMP] models: improve query generation for _write() and _store_set_values() 2014-11-04 17:32:04 +01:00
Raphael Collet 3adbb49ec0 [FIX] ir_model: fix create/update/delete custom fields
Creating custom fields would crash on a model that has a related field without
string.  The crash was caused by the field not being set up, and method
BaseModel._field_create() violating a non-null constraint on the field string.
This has been fixed by setting up fields before updating ir_model_fields.

Deleting a custom field could also cause trouble when that field is inherited
in a child model.  In that case, the registry was simply no longer consistent.
The fix is to reload completely the registry.

The modification of custom fields was not reflected on field objects.  The fix
applies changes on fields before updating columns accordingly.
2014-11-04 14:52:13 +01:00
Raphael Collet f2e4a10e1a [IMP] use model._fields instead of model._all_columns to cover all fields
The old-api model._all_columns contains information about model._columns and
inherited columns.  This dictionary is missing new-api computed non-stored
fields, and the new field objects provide a more readable api...

This commit contains the following changes:

 - adapt several methods of BaseModel to use fields instead of columns and
   _all_columns

 - copy all semantic-free attributes of related fields from their source

 - add attribute 'group_operator' on integer and float fields

 - base, base_action_rule, crm, edi, hr, mail, mass_mailing, pad,
   payment_acquirer, share, website, website_crm, website_mail: simply use
   _fields instead of _all_columns

 - base, decimal_precision, website: adapt qweb rendering methods to use fields
   instead of columns
2014-11-04 13:47:57 +01:00
Richard Mathot ef862084c9 [DOC] fields.py: oldname key 2014-11-03 18:09:16 +05:30
hiekmann fcf0b278a9 [FIX] corrected a word in a comment
closes #3423
2014-11-03 10:19:15 +01:00
Raphael Collet 5eb6e58156 [FIX] fields: make field.store=False on old-style function fields
Clarify the semantics of field attributes:
 - field.store is True when the field is actually stored in the database;
 - field.column is the column corresponding to field or None.

The various field definitions correspond to:
 - new-style stored field: field.store and field.column
 - new-style non-stored field: not field.store and not field.column
 - old-style regular field: field.store and field.column
 - old-style function field: not field.store and field.column
2014-10-30 13:29:21 +01:00
Christophe Simonis c846f16e1e [FIX] core: correct cron thread registry iteration
Fixes #3387
2014-10-30 11:05:07 +01:00
Christophe Simonis cc4fba6089 [IMP] core: manage registries via an LRU.
When working with a large number of databases, the memory allocated to
registries wasn't limited, resulting to waste memory (especially in the
longpolling worker, which is not recycled).
The size of the LRU is depending on the soft limit configured for
workers.
2014-10-29 18:28:07 +01:00
Florian Kisser c6741fb537 [FIX] sql_db: don't log dsn with unmasked passwords
The dsn may contain the connection password of the database when not accessed from a psycopg connection object.
Replace the unfiltered logs to use cxn.dsn avoiding password leakage in logs.
Fixes #1433
2014-10-28 14:49:57 +01:00
Raphael Collet 8db5b84fc1 [FIX] fields: inherited fields should get 'string' from their parent field
Because some parameters of a field may be determined during its setup, we have
to update the corresponding column after the setup, and recompute _all_columns
to make it consistent.
2014-10-28 09:12:31 +01:00
Fabien Meghazi 3e07eaa308 [FIX] Regression in image resize helper (Fixes #2529)
Commit 57ad514b makes the function preserve the aspect ration of the
original picture. Error of mine because the expected behavior was to
lose it for kanban view purpose.

For backward compatibility sake, this commit will keep the old behavior
by default.
2014-10-27 17:55:08 +01:00
Xavier Morel 4d2b24adcb [ADD] Stripe-style APIDoc: content 2014-10-27 17:23:16 +01:00
Raphael Collet 7b1ef7085a [IMP] fields: reduce the number of attributes on _column instances
This is a memory optimization: instead of setting all attributes on all
instances, set them with their default value on the class, and only set
specific ones on instances.  This reduces the memory footprint of around 14Mb
per registry with modules crm, sale, purchase and stock installed.
2014-10-27 14:36:09 +01:00
Christophe Simonis 89eaa8a8a8 [MERGE] forward port of branch saas-3 up to 309ca4f 2014-10-24 17:25:19 +02:00
Christophe Simonis 309ca4fcf7 [MERGE] forward port of branch 7.0 up to d2fd05e 2014-10-24 16:52:10 +02:00
Samus CTO d2fd05ef21 [IMP] config: Test that the config file is readable
Fixes #3237

cherry-pick of 8e72049
2014-10-24 16:48:27 +02:00
Christophe Simonis 472291b35c [FIX] When using "--stop-after-init", set the return code correctly. A non zero return code reflect the number of databases that fail to load/update
Backport of 2c4e370b76 and
33ce0e73db
2014-10-24 16:24:50 +02:00
Jeremy Kersten cd8bd872e8 [IMP] res_country: add relation from country to group_country. The purpose of this patch is to allow in domain (model.country_id.country_group_ids, '=', 'Europe') 2014-10-24 15:19:34 +02:00
Christophe Simonis 562272d9a0 [MERGE] forward port of branch saas-3 up to c89d1a0 2014-10-23 13:08:44 +02:00
Raphael Collet 4a65b61f2f [IMP] fields: remove unused imports 2014-10-23 10:35:27 +02:00
Raphael Collet ba1369fbef [IMP] fields: infer required=True on related fields
One can infer related=True on a non-stored related field if all fields on the
path are related.  This cannot be done if the related field is stored: when you
create a record, the database row is created first, and the related field is
computed and stored afterwards.  Making the field required in that case would
trigger a non-null constraint violation.
2014-10-23 10:28:13 +02:00
Raphael Collet 0873613767 [IMP] fields: initialized computed fields to a null value instead of a failed one
This should ease compute methods that assign a list to "update" a
one2many/many2many field.  With a failed value, the update crashes.
2014-10-23 10:14:24 +02:00
Denis Ledoux adf18765f6 [FIX] base: typo during forward port 0e4216361b 2014-10-22 19:27:00 +02:00
Denis Ledoux 0e4216361b [MERGE] forward port of branch 7.0 up to 3a0af6a 2014-10-22 19:26:27 +02:00
Raphael Collet 8e6d5beb35 [IMP] fields: reuse column objects when possible, instead of recreating them
This is a memory optimization: it reduces the memory footprint of each
registry.  We have observed a reduction of 10Mb on a database with modules crm,
sale, purchase, stock.
2014-10-22 16:22:39 +02:00
Jeremy Kersten add28795fb [FIX] ir_action: update context to get the real binary, else we have a traceback when we edit/view an ir_action_client where param is a binary field. Because we do safe_eval from the length and not from the binary 2014-10-22 16:20:05 +02:00
Cedric Snauwaert fa2f7b86bf [FIX] product: remove digits_precision from uom factor fields
Remove the hardcoded precision of 12 on factor and factor_inv,
to use the complete natural precision of NUMERIC types,
preserving all significant digits.

e.g. a UoM with a factor_inv of 6.0 used to be computed as:
factor_inv: 6.0 -> factor: 0.166666666667 (1.0/6.0, rounded to 12 digits) -> factor_inv: 5.999999999988 (1.0/factor)
which could lead to errors such 12*0.166666666667 = 2.000000000004 instead of 2.0

Slightly changed the way the ORM handles float fields to allow setting `digits=0`
as a way to explicitly require a NUMERIC value but without enforcing/rounding
the values at the ORM level, i.e. a truly full-precision field.

NUMERIC type has unlimited precision but is less efficient so should not be
used as the default behaviour, which is why we keep float8 as an alternative.

Modified the view to display the product UOM factor with a 5 digits value by default.
This value is for usability purpose only, the field still accepts bigger precision, by
setting the `digits` option on the field in the form view.

This change is safe in a stable series, the `digits=0` alternative is
treated the same as the default `digits=None` everywhere in the framework,
except when creating the database field.
2014-10-22 14:28:34 +02:00
Martin Trigaux 7705f883d2 [FIX] base: support float rounding with rounding_method=UP (ceiling)
Add rounding_method parameter on float_round method to offer
HALF-UP (default, usual round) or UP (ceiling) rounding method.
Use the second method instead of math.ceil() for product
reservations.

For UP, the python math.ceil() method uses "torwards infinity"
rounding method while we want "away from zero".
Therefore we use the absolute value of normalized_value to make
sure than -1.8 is rounded to -2.0 and not -1.

Fixes #1125 #2793

This is a cherry-pick of d4972ff which was reverted at 333852e due
to remaining issue with negative values.
2014-10-22 14:28:22 +02:00
Denis Ledoux 0a82397da3 [FIX] fields: selection, do not try to translate label if label is empty
- translate with no source returns first translation for this field, whatever the source
 - performance
2014-10-22 11:54:22 +02:00
Martin Trigaux 354b82bee0 [FIX] report: page numbering rml reports
Save the NumberedCanvas state before doing a page reset.
The order of execution when rendering an rml report is the following:
1. init canevas (_pageNumber = 1)
2. render the page element
3. if still pages to render, afterPage method
4. if still pages to render, showPage method (_pageNumber += 1)
5. back to step 2 for each page
6. draw the ResetPage element (setting flag _doPageReset=True)
7. end the document build with afterPage & showPage method

The PageReset element should be executed at the end of the rendering of a story (subdocument) to reinitialize the page numbers to 0 (for new story) and insert the pageCount element for that story with the total number of pages (needed if want to use tag <pageCount/> in rml).

In case of NumberedCanvas (e.g. used in Trial Balance report), the numbering is generated at the end of the build using the _saved_page_states dict in the canevas.
To have an accurate _saved_page_states content, it needs to be saved before the pageReset.

Fixes #2225
2014-10-21 15:36:01 +02:00
Christophe Simonis 262eb662de [MERGE] forward port of branch 8.0 up to d80376a 2014-10-21 14:33:36 +02:00
Christophe Simonis 22c390285f [MERGE] forward port of branch 7.0 up to 78a29b3 2014-10-21 13:06:27 +02:00
Julien Legros b00122ad99 [FIX] res_partner: add parent_name related field
In some cases (e.g. with record rules), the name_get might not have access
to the parent name. Therefore a parent_name related field solves the
issue (as it read with as superuser).
2014-10-20 15:50:49 +02:00
Arthur Maniet 6c61d3c800 [FIX] account: the partner of a bank account can only be a company or an individual not related to a company 2014-10-20 15:02:36 +02:00
Fabien Meghazi 088f9e5b12 [FIX] Do not lose session.db on authentication error 2014-10-17 17:09:01 +02:00
Raphael Collet 83b8e413ff [IMP] test_new_api, test_inherit: improve code of tests 2014-10-16 12:32:23 +02:00
Raphael Collet e9587bf130 [IMP] expression.py: add a check to forbid records in domains
Records in domains cause a "maximum recursion depth exceeded" error when
converted to SQL. Simply add a test to show a better error message.
2014-10-16 10:22:23 +02:00
Olivier Dony 2bdbe255a7 [FIX] config: fix parsing of geoip db paramater, rename command-line option for consistency 2014-10-15 17:26:54 +02:00
Raphael Collet 89031f5de6 [FIX] models: simplify partial setup of fields, let it crash silently
The setup of relational fields may be problematic, as they may refer to unknown
models via custom relational fields.  In a partial setup, do not try to skip
the field setup, but let it go and silently catch any exception if it crashes.
2014-10-15 11:39:12 +02:00
Raphael Collet 94e7dc6050 [FIX] models: do not look up the registry class when building cls._fields 2014-10-14 16:17:23 +02:00
Christophe Simonis 2e3f59181d [MERGE] forward port of branch saas-3 up to db75994 2014-10-14 15:13:14 +02:00
Raphael Collet 43abcb02ba [FIX] models: in _add_field(), set the field as an attr before setting it up
In the case of custom fields, the field's parameters were set up without the
field being present in the class hierarchy.  Because of this, the parameter
inheritance mechanism was missing the field itself.  As a consequence, custom
selection fields ended up without selection, for instance :-/
2014-10-14 11:56:59 +02:00
Olivier Dony c0644a5474 [FIX] read_group: date format: use natural year along with month names, do not mix with ISO week-year
The ISO week-year notation can produce confusing values
when the first week of the year is so short that it
becomes week 0 and is considered the last week of the
previous year, depending on the locale.

For instance, using ISO notation:
  'W53 2015' == dates.format_date(
      date(2015,1,1), format="'W'w YYYY", locale='en_GB')
  'W53 2005' == dates.format_date(
      date(2006,1,1), format="'W'w YYYY", locale='de_DE')

This is surprising but actually valid.

However it definitely yields wrong output when combined with
months formats:
  'January 2014' == dates.format_date(
      date(2015,1,1), format="MMMM YYYY", locale='en_GB')

As a result we must always use `y` to denote the year in
any date format, *except* when it is combined with the
week number `w`, in which case we must use `Y`.

See the documentation at:
   http://babel.pocoo.org/docs/dates/#date-fields
2014-10-13 19:15:37 +02:00
Jeremy Kersten c8e14f301f [FIX] GeoIP - allow to specify the path to GeoIP in the server config.
--geoip_db='the_path'  which can be used via openerp.tool.config['geoip_database']
2014-10-13 16:47:12 +02:00
Raphael Collet 41b55082ba [FIX] models: on update, call inverse function on field even when it is stored
The inverse function of a stored computed field was not called when creating or
writing on a record with such a field.
2014-10-13 13:45:52 +02:00
Raphael Collet 5db84cb07e [IMP] models: do not use compute methods to determine default values anymore
Compute methods could give results that should not be considered as default
values.  For instance, a related field usually defaults to a null value, which
is then set to the field with its inverse method by create().  This may violate
a non-null constraint if the original field is required.  Therefore, compute
methods are no longer used to determine default values.
2014-10-13 13:44:07 +02:00
Raphael Collet 044ed06fec [FIX] models: do not prefetch fields to recompute, and recompute once only
The method _prefetch_field() was accidentally prefetching fields to recompute;
which was skipping the actual recomputation, since a value was put in cache.
But sometimes the field's value was fixed by an extra recomputation of the
field.  Here we remove the extra recomputation and fix the cache corruption.
2014-10-13 12:38:59 +02:00
Olivier Dony edd94b623e [MERGE] Forward-port 7.0 up to 1b49a87 2014-10-10 19:21:18 +02:00
Olivier Dony 1b49a87619 [FIX] ir.mail.server: restore parsing of multiple RFC2822 addresses including non-ASCII chars
Rev f2cf6ced1 modified RFC2822 parsing in order to better support
unicode characters inside the Name part of an address header.
However the patch broke handling of multiple addresses (comma
separated) - silently discarding all recipients except the
first one, as soon as any non-ASCII character was present.

This patch restores the functionality while preserving the
fix from f2cf6ced1, and simplifies the code using email.utils
utility functions.

Fixes (again) lp:1272610, OPW 607683
2014-10-10 18:32:00 +02:00
Jeremy Kersten fc47823ab2 [IMP] ir_qweb: remove the option 'only_date' introducted in cefc9ad8e3. Now we can use widget='date' to do the same thing. That keeps the same behaviour that in the backend.
<span t-field=model.datetime_field t-field-options="{'widget': 'date'}"/>
2014-10-10 16:20:10 +02:00
Denis Ledoux eeb1f0355c [FIX] res.users: exactly match login when operator in ilike, equal 2014-10-09 18:57:37 +02:00
Raphael Collet 8a9027edd1 [IMP] fields: do not force required=True on related fields
This may cause issues if the field is stored: non-null constraint will prevent
saving records when no value is provided.
2014-10-09 17:18:28 +02:00
Raphael Collet ab8bd8066a [FIX] models: in _create() and _write(), mark fields to recompute earlier
An issue occurs when a constraint is checked before computed fields are marked
for recomputation: the constraint will read the field's current value, which
may be wrong.  If the field is marked soon enough, the constraint will trigger
the recomputation and use a correct value.
2014-10-09 17:14:34 +02:00
Xavier Morel bc59cfce61 [IMP] doc: add testing reference and improve docstrings 2014-10-09 15:38:36 +02:00
Raphael Collet 1c9ed9f534 [IMP] fields: rename attribute 'copyable' into 'copy' 2014-10-09 15:05:15 +02:00
Raphael Collet 8ddf145559 [IMP] fields: do not copy field objects anymore, but make new instances instead
Because of the parameter overriding mechanism implemented by fields, it is no
longer necessary to copy field objects.  It is even better to no copy them in
the case of related fields.
2014-10-09 15:05:15 +02:00
Martin Trigaux bd52298073 [IMP] mail: parsing emails with several html parts
If an email contains several text/html parts inside a multipart email, the previous code was only keeping the last content part.
The Content-Type: multipart/mixed allows several independent part (RFC1341 7.2.2), so two html is technically valid.
With this patch, the two parts are concatenated. (opw 614755)

Modify append_content_to_html regex to make sure the regex keeps the content of the html instead of removing it.
e.g.: "123 <html> 456 </html> 789" used to be stripped to "123  789" while we expect "123 456 789"
2014-10-09 13:53:23 +02:00
Raphael Collet be894166ef [IMP] fields: add assertions to check parameters (comodel_name, size, digits) 2014-10-09 10:50:40 +02:00
Raphael Collet 36174fcc6e [IMP] fields: set the default value to the closest field.default or _defaults
This solves a subtle issue: in the following case, the class Bar should
override the default value set by Foo.  But in practice it was not working,
because _defaults is looked up before field.default.

    class Foo(models.Model):
        _name = 'foo'
        _columns = {
            'foo': fields.char('Foo'),
        }
        _defaults = {
            'foo': "Foo",
        }

    class Bar(models.Model):
        _inherit = 'foo'
        foo = fields.Char(default="Bar")

The change makes field.default and the model's _defaults consistent with each
other.
2014-10-09 09:18:02 +02:00
Raphael Collet 3f31081bc2 [IMP] fields: make attribute 'default' callable 2014-10-09 09:18:02 +02:00
Olivier Dony 7439421ad2 [I18N] Update translations from Launchpad 8.0 branches 2014-10-08 17:52:25 +02:00
Xavier Morel 99d740ad7d [IMP] new-api-ify 'trigger' server action 2014-10-08 17:30:16 +02:00
Xavier Morel 8cfe731f76 [FIX] actions: match the behavior of multi actions with its help text
also fix the corresponding text and add explicit sequence number because I
don't understand what the bloody hell it does without that, except that it's
not the right thing. At all.
2014-10-08 17:29:36 +02:00
Raphael Collet 619a844428 [FIX] fields: in to_column(), returning self.column is generally not correct
Consider the following example:

    class Foo(models.Model):
        _name = 'foo'
        _columns = {
            'state': fields.selection([('a', 'A')]),
        }

    class Bar(models.Model):
        _inherit = 'foo'
        state = fields.Selection(selection_add=[('b', 'B')])

The attribute 'column' of the field does not have the full selection list,
therefore the column object cannot not be reused, even a copy of it.  The
solution is to systematically recreate the column from the field's final
specification, except for function fields that have no sensible way for being
recreated.
2014-10-08 16:39:59 +02:00
Raphael Collet 10142d7dc7 [FIX] openerp/osv/fields: fix method to_field() to pass some falsy parameters.
For instance, the attribute copy=False was not passed when converting the
_column to a Field.  Simply make sure those parameter are always passed.
2014-10-08 16:39:59 +02:00
Denis Ledoux c741d45ac1 [FIX] ir_actions: ids of unlink method can either be an ID list or one ID 2014-10-07 16:07:46 +02:00
Christophe Simonis 8ff7230e2d [FIX] migration: test if package is installed using its state.
checking if there is an installed version set is not enough because this field is not reset when the module is uninstalled
2014-10-07 14:57:26 +02:00
Olivier Dony 4202ea7c19 [FIX] ir.ui.view: creating custom views in backend did not compute view type
When creating new records in backend all field values are
sent to the server, including empty fields.
2014-10-07 13:12:38 +02:00
Xavier Morel 9cd2693286 [FIX] JS tutorial 2014-10-07 10:23:50 +02:00
Xavier Morel 5954335222 [ADD] pyqweb-specific stuff, pyqweb APIDoc 2014-10-06 19:13:46 +02:00
Xavier Morel c5dca416da [IMP] qweb: foreach handling
* fix mapping handling to match JS impl: current value set as _value instead
  of being lost
* add handling of integer parameter
* only set _size and _last if current iterable is sized
2014-10-06 19:13:45 +02:00
Xavier Morel 2ffcff8fa9 [ADD] qweb: handling of t-att=mapping
Changed render_att_att to return an iterable of pairs instead of a pair, and
dispatched t-att on whether its result is a Mapping.

Also changed qweb test runner so it uses ordereddict for JSON mapping in
params, otherwise iteration order (and thus order of attributes in output) is
unpredictable and results don't/can't match expectations (as both are
strings).

Note that this relies on JS implementation details wrt iteration order of
mappings. Tests would probably be somewhat less brittle if rendering output
was parsed to XML... if that's possible (?)
2014-10-06 19:13:44 +02:00
Xavier Morel 14a677090b [ADD] running of XML cases to python qweb 2014-10-06 19:13:43 +02:00
Xavier Morel 494dcbd0e3 [IMP] qweb doc, tests
* document qweb based (mostly) on JS version
* convert JS qweb tests to (mostly) language-independent XML so they can be
  used for JS and Python implementations
* add some more tests (e.g. precedence between t-value and body in t-set)
* remove ``t-import``
* fix parity in foreach(dict) (and rename some variables to make array and
  object versions more similar)
2014-10-06 19:13:43 +02:00
Martin Trigaux 8843974d04 Forward port of branch saas-3 up to fc9fc3e 2014-10-06 15:52:23 +02:00
Martin Zlámal fc9fc3e0b8 [FIX] common.py: missing import
It was not possible to call "about" function via remote control
(XML-RPC), because it contains string translation without import.
2014-10-06 12:28:45 +02:00
Raphael Collet afb91fde81 [FIX] models: fields_get() shall not return info about fields not set up yet
When processing data files during a module installation/upgrade, not all fields
are set up yet, in particular relational custom fields.  Make fields_get()
ignore those fields, so that views can be created/updated and validated,
provided they do not refer to those fields...
2014-10-06 11:56:03 +02:00
Denis Ledoux cd6dba5257 [MERGE] forward port of branch 7.0 up to 9066da3 2014-10-03 12:13:07 +02:00
Denis Ledoux 7cbd524448 [FIX] ir_translation: apply tools.ustr on the trad itself
tools.ustr(None) returns u'None', res[0] can be None.
2014-10-03 12:08:49 +02:00
Denis Ledoux 76fdbec3bb [MERGE] forward port of branch 7.0 up to 6d4e1cc 2014-10-03 11:22:47 +02:00
Denis Ledoux 6d4e1cc73e [FIX] ir_translation: remove control characters from translations
This is possible that control characters (such as line returns) are inserted wrongly in translations
These should not influence on the web interface
2014-10-03 11:20:19 +02:00
Denis Ledoux 1c6c289f7b [FIX] api: clear environments on module installation 2014-10-02 17:46:25 +02:00
Denis Ledoux 40c8dd9a28 [FIX] ir_qweb: search assets as superuser
A security has been introduce in eb9113c04d to restrict access to orphan attachments to employees only

Assets need to be build and accessed as superuser, thus
2014-10-02 16:36:17 +02:00
Denis Ledoux 14f3085776 [MERGE] forward port of branch saas-3 up to 77500e5 2014-10-02 15:36:58 +02:00
Denis Ledoux 77500e54ec [MERGE] forward port of branch 7.0 up to eb9113c 2014-10-02 15:34:02 +02:00
Denis Ledoux eb9113c04d [FIX] ir_attachment: restrict access to orphan attachments to employees 2014-10-02 15:17:48 +02:00
Jeremy Kersten cefc9ad8e3 [IMP] ir_qweb: allow to display a datetime like a date 2014-10-02 13:22:39 +02:00
Christophe Simonis a1eb27b8ef [FIX] migration: allow debugging of migration scripts + avoid useless copies 2014-10-01 16:34:13 +02:00
Raphael Collet 53ff84493f [IMP] fields: allow sorting on inherited field in list views 2014-10-01 16:00:44 +02:00
Raphael Collet a69996b50c [IMP] fields: split multi-purpose '_origin' into 'column' and 'inherited'
This makes it easier to determine when a field interfaces a column, and when it
implements an inherited field (with _inherits).
2014-10-01 16:00:44 +02:00
Raphael Collet 34ba5154e2 [IMP] fields: split the default value from the compute function
This separation allows to set a default value on a related field, for instance.
2014-10-01 09:24:09 +02:00
Denis Ledoux 30a0814159 [FIX] fields: copy origin to avoid sharing field objects between registries
Fix a bug introduced in revision f229974, where shared columns objects are
systematically reintroduced in registries.
2014-09-30 14:32:35 +02:00
Alexandre Fayolle 20267aa06c fix exception message in report seachr
when we get to the raise statement, `r` is `None`, so displaying it in the
exception message is useless. `name` is what we want to show.
2014-09-30 11:35:05 +02:00
Olivier Dony a01ce6a127 [MERGE] Forward-port of 7.0 up to 9b1a9c9 2014-09-29 19:39:02 +02:00
Olivier Dony 5e248f09c7 [FIX] tools: remove useless attributes 2014-09-29 18:41:58 +02:00
Olivier Dony 9b1a9c9518 [FIX] tools: remove useless attributes 2014-09-29 17:39:01 +02:00
xmo-odoo 77a0ca6864 Merge pull request #2620 from savoirfairelinux/8.0-http-unicode
Fix two possible UnicodeDecodeError when an exception occurs
2014-09-29 15:24:22 +02:00
Sandy Carter e6dd2a63c1 Fix two possible AsciiErrors when an exception occurs
Signed-off-by: Sandy Carter <sandy.carter@savoirfairelinux.com>
2014-09-29 09:05:58 -04:00
Denis Ledoux edf679cfab [REVERT] tests added in forward port e2e60bf4eb
This is related to the revert 333852e19d
2014-09-26 22:23:46 +02:00
Denis Ledoux 07ee2a1de9 [MERGE] forward port of branch saas-3 up to 39bb45a 2014-09-26 21:58:06 +02:00
Denis Ledoux 39bb45a8ea [MERGE] forward port of branch 7.0 up to 333852e 2014-09-26 21:32:40 +02:00
Denis Ledoux 333852e19d Revert "[FIX] product,float_utils: perform ceiling via float_round with new rounding_method UP"
This reverts commit d4972ffdb6.

Seems to break some cases, at least in _product_reserve from stock/stock.py

Actual use case:

SELECT product_uom, sum(product_qty) AS product_qty FROM stock_move WHERE location_dest_id=%s AND location_id<>%s AND product_id=3645 AND state='done' GROUP BY product_uom;
returning 1 | 6

SELECT product_uom,-sum(product_qty) AS product_qty FROM stock_move WHERE location_id=%s AND location_dest_id<>%s AND product_id=%s AND state in ('done', 'assigned') GROUP BY product_uom;
returning 1 | -6

results += cr.dictfetchall()
    total = 0.0
    results2 = 0.0
    for r in results:
        amount = uom_obj._compute_qty(cr, uid, r['product_uom'], r['product_qty'], context.get('uom', False))
        results2 += amount
        total += amount
Total = 1, amount = -5

It should actually be
Total = 0, amount = -6
2014-09-26 21:21:06 +02:00
Christophe Matthieu 77c41cc5cb [FIX] website: 'Display Editor Bar on Website' group stopped working at commit a2ef044c47
The Edit button never appeared anymore for these users.
The idea was that they should see an edit button with
limited editing capabilities depending on their other
access rights.
For example, someone with only Sales Manager access and
'Display Editor Bar on Website'
would be able to edit online quotes from the website_quote
module, but not change the actual website pages or menus,
for instance.
2014-09-26 16:50:34 +02:00
Christophe Simonis a3704beefb [FIX] base: correct non-copy of `login_date` + adapt tests 2014-09-26 13:54:37 +02:00
Christophe Simonis e2e60bf4eb [MERGE] forward port of branch saas-3 up to fe8106f 2014-09-26 12:53:59 +02:00
Christophe Simonis fe8106fb85 [MERGE] forward port of branch 7.0 up to af37b30 2014-09-26 12:33:17 +02:00
Denis Ledoux af37b3022b [FIX] cron: doall false by default
As in most cases, we do not want this doall
2014-09-26 10:17:50 +02:00
Denis Ledoux 074c7b6c25 [FIX] res_users: do not copy login_date when duplicating users 2014-09-25 17:00:59 +02:00
Denis Ledoux 76067367b2 [MERGE] forward port of branch 7.0 up to 5f6d324 2014-09-25 15:10:37 +02:00
Raphael Collet 330a3ff6ea [IMP] models: when checking for data in a table, do not use column 'id'
Replace the query "SELECT min(id) FROM xxx" by "SELECT 1 FROM xxx LIMIT 1".
Both requests are as efficient, and the second one does not crash if column
'id' is missing.
2014-09-25 10:37:28 +02:00
Raphael Collet 1f15055de3 [FIX] fields: a function field with fnct_search should be searchable 2014-09-24 18:41:20 +02:00
Cedric Snauwaert d4972ffdb6 [FIX] product,float_utils: perform ceiling via float_round with new rounding_method UP
Modified product ceiling() to use float_round() with special mode
for rounding UP (away from zero), avoiding pathological cases where
float representations errors were ceiling to the superior unit.

Also added correspding tests for rounding_method=UP

Fixes issue #1125, and replaces PR #1126.
2014-09-24 17:11:25 +02:00
Raphael Collet 24f26c0eeb [FIX] ir_models: fix registry when we add/remove/modify a custom model/field 2014-09-24 15:30:37 +02:00
Olivier Dony b74d830eb2 [I18N] Update translation templates with latest term changes 2014-09-23 19:13:50 +02:00
Olivier Dony 1c5b5e4290 [I18N] Update translations from Launchpad 8.0 branches
server: rev. 26 rev-id launchpad_translations_on_behalf_of_openerp-20140923072744-tkfs0yinu8msjh09
addons: rev. 39 rev-id launchpad_translations_on_behalf_of_openerp-20140923072715-5j7qvnuvmmb1zzy1
web: rev. 23 rev-id launchpad_translations_on_behalf_of_openerp-20140923072757-jvh9l6r2x0vfcyhb
2014-09-23 13:42:05 +02:00
Martin Trigaux 152c5c2b56 [IMP] base: safer locking at user login
When a users connects, a lock is taken on the res_user table to modify the last login date. If another running transaction uses a foreign key to res.users (e.g. write_uid column), postgres may detect the update as a concurrent update and rollback the transaction.
In pg 9.3, the lock_strength parameter 'NO KEY' allows a weaker lock which is less likely to break another transaction.
Fixes #552
2014-09-22 18:18:41 +02:00
Christophe Simonis c6290988ce [FIX] models: only check existance of inverse_field for one2many fields 2014-09-22 17:05:07 +02:00
Christophe Simonis dcca9b52c7 [FIX] models: correct lazy loading of manual fields 2014-09-19 16:51:29 +02:00
yingliu4203 fb4db6c938 [FIX] Packaging: Wndows: wrong handler used when logging to file 2014-09-19 11:17:13 +02:00
Olivier Dony 990d05e78d [REL] Odoo 8.0 2014-09-18 12:11:18 +02:00
Olivier Dony 53aa92d3c9 [I18N] Update translations from Launchpad branches 2014-09-18 11:47:16 +02:00
Thibault Delavallée 7cad4baa84 [FIX] [CLEAN] Various: fixed / cleaned use of dict.fromkeys.
Indeed using fromkeys with a list / dict as argument leads to the creation
of shared list / dict. This could create some ugly side effects when
used in loops. This commit fixes or cleans this kind of statement to avoid
unwanted side effects.
2014-09-18 11:18:30 +02:00
Martin Trigaux f0c3856be2 [IMP] gamification: allow to select fields of inherited models 2014-09-18 11:12:15 +02:00
Martin Trigaux 423a9f3011 [ADD] base: list of inherited models on a ir.model
This field is needed to retrieve the list of inherited fields (instead of only the fields of a current model) of a model using domain such as ('model_id', 'in', model.inherited_model_ids) on ir.model.fields
2014-09-18 11:12:15 +02:00
Raphael Collet 764c5acd81 [IMP] fields: reset decimal precision on new-style fields
When a decimal_precision record is created/modified, the float fields of the
models in the registry must be reset.  This was done on old-API columns only.
It is now handled by the new-API fields.
2014-09-18 11:11:19 +02:00
Simon Lejeune d9e72a3716 [FIX] Package: Debian, Windows: more odooification; Debian: correct Packages.gz 2014-09-18 00:17:32 +02:00
Fabien Meghazi 57ad514bb2 [FIX] Image resizing bug 2014-09-17 17:38:35 +02:00
Olivier Dony e5bff82aff [MERGE] Forward-port saas-5 up to f9bcd67 2014-09-17 16:39:06 +02:00
Denis Ledoux f9bcd67f5b [MERGE] forward port of branch saas-3 up to b6e6b57 2014-09-17 16:25:38 +02:00
Denis Ledoux b6e6b57326 [FIX] orm: typo during forward port 60a82133cc 2014-09-17 16:24:40 +02:00
Raphael Collet 6e0c73d2ad [FIX] fields: make convert_to_cache() more robust with inverse one2many
When a one2many field uses an integer field as inverse, the onchange method on
the second model may receive a dictionary for the value of the integer field.
This is because the client expects that field to be a many2one.
2014-09-17 16:01:02 +02:00
Fabien Meghazi 0084646475 [IMP] Refactor ir.ui.view's read_template cache invalidation 2014-09-17 15:52:47 +02:00
Olivier Dony c926b54a49 [MERGE] Forward-port saas-3 up to 09ab2d4 2014-09-17 15:16:30 +02:00