Commit Graph

7783 Commits

Author SHA1 Message Date
Xavier Morel e9f0d79f85 [IMP] config: deduplicate loggers in log_handler
Saving multiple levels for the same logger should work with few issues,
but over time pathological (basket) cases (e.g. using ``-s`` all the
time) may build pointlessly huge lists in their config file.

Only keep the last level for each logger when saving to a config file.
2015-01-27 12:35:53 +01:00
Xavier Morel 8641826ca4 [IMP] config: make log_handler and --log-handler additive
For log_handler (list of logger configuration specs), having the
configuration file and the CLI configuration be exclusive (one
overwriting the other) is detrimental: it precludes keeping the
configuration file as a convenient baseline and only altering the subset
of loggers of interest at any given time. Combine specs from both
sources instead of overwriting one with the other.

* remove log_handler and its special case from the first options loop
* remove seeding of option with DEFAULT_LOG_HANDLER
* my_default is the baseline "configuration file" value, it's None if
  not provided which is not convenient. Use DEFAULT_LOG_HANDLER for it
  as baseline configuration file. DEFAULT_LOG_HANDLER isn't a list
  anymore, it's a CSV of logger specs (same as file-serialized)
* could actually use a DEFAULT_LOG_HANDLER of ``:`` (the default logger
  is root, the default level is info), but that might be a tad too
  cryptic
* things are weird between my_default and the file-sourced value,
  _parse_config is first run with my_defaults then with the file, but if
  there's no file it's re-run with already-parsed my_defaults. So when
  the file and the command-line values are of different type,
  _parse_config must be ready to handle both
2015-01-27 12:35:52 +01:00
Xavier Morel 9f4dea0891 [FIX] config: correctly serialize log_handler to CSV 2015-01-27 12:35:52 +01:00
Xavier Morel 23ad48a91b [FIX] config: a list is always equal to itself
add_option(action=append*) always modifies the ``default`` list
in-place. When using DEFAULT_LOG_HANDLER directly, that means
log_handler is always equal to DEFAULT_LOG_HANDLER since they're the
same list object. Thus the --log-handler command-line would never
overwrite the log_handler value from the configuration file, which is
unexpected

Fix that by copying DEFAULT_LOG_HANDLER before passing it as the
option's default value.
2015-01-27 12:35:51 +01:00
Olivier Dony 8e03852fd4 [I18N] Update translations from Launchpad 8.0 branches 2015-01-26 16:36:51 +01:00
Olivier Dony 740bf28907 [FIX] ir.model.data: verify record exists in _update_dummy
When a stale XML ID exists in the database, `_update_dummy()`
must consider it as missing entirely, and the next call
to `_update()` will take care of cleaning up the old XML ID.

Failing to do so for `noupdate` records means the `_update`
will never happen, and as soon as another record is created
or updated with a relationship to that stale XML ID, it will
plainly crash the installation/update.
2015-01-24 00:15:26 +01:00
Xavier Morel fca83b45f8 [IMP] on non-rpc debug, only break on non-HTTPException
Completes/improves fd6dde7ca

Because Werkzeug uses/provides flow-control exceptions via
HTTPException (which can be used as straight responses) they are used in
a few places of the web client, when triggering some redirections for
instance.

Breaking into the debugger for such mundane situations is surprising and
inconvenient for developers trying to debug actual issues in the system,
even though HTTPExceptions are by and large not error per-se, and
shouldn't warrant triggering post-mortem debugging.

So in the non-RPC dispatcher, don't post-mortem on HTTPException either.
2015-01-23 15:34:53 +01:00
Denis Ledoux dab5ff7e76 [MERGE] forward port of branch saas-3 up to b3f3daf 2015-01-23 13:28:17 +01:00
Denis Ledoux b3f3dafcb9 [MERGE] forward port of branch 7.0 up to c62a75a 2015-01-23 13:27:13 +01:00
Christophe Simonis 6d37ff1091 [FIX] base: remove duplicated XOF res.currency (and rate) 2015-01-23 13:02:30 +01:00
Christophe Simonis ce1096c447 [FIX] base: correct currency rate wrongly changed during 9902424 2015-01-23 12:57:04 +01:00
Denis Ledoux c62a75a5f3 [FIX] report: line splitting compatible with reportlab > 3.0
While keeping the compatibility for reportlab 2.5.

Splitting the text node on line breaks '\n' leaded to orphans ending tags,
like '</font>', which is regarded by reportlab 3.0 as a paragraph,
and reportlab therefore surrounded these tags by <para> tags,
which leaded to not syntax correct html like
<para></font></para>

To test this patch:
 - While having reportlab > 3.0
 - Create a rml report containing (at least) '<font>\n</font>'
 - Then print the report. It must not crash (obviously)
2015-01-23 12:54:30 +01:00
Aaron Bohy 3cae676619 [FIX] Use local copies of png instead of fetching them from websites
Debian does not allow fetching data from external website at runtime.
This fixes the privacy-breach-generic lintian warnings for Debian packaging.
The removed youtube url was a dead link...
2015-01-23 11:23:04 +01:00
Christophe Simonis 99024240f5 [IMP] base: avoid useless call to time.strftime()
This will also ease next forward-port 8.0 -> master
2015-01-22 18:27:08 +01:00
Christophe Simonis be33101903 [FIX] base: correct currency rates.
- Do not force creation of rates.
- Using rates of 2010 and storing them as beeing from 2015 is not a good idea.
2015-01-22 16:23:42 +01:00
Raphael Collet 8cd2cc8910 [FIX] models: recompute fields with user admin to prevent access rights issues 2015-01-22 15:32:18 +01:00
Denis Ledoux e9d1d7aac0 [MERGE] forward port of branch saas-3 up to c5775e5 2015-01-22 14:45:16 +01:00
Denis Ledoux c5775e56d3 [MERGE] forward port of branch 7.0 up to 25f5329 2015-01-22 14:43:06 +01:00
Denis Ledoux 25f5329deb [FIX] report: break lines and splitted words with reportlab > 3.0
From reportlab 3.0, empty plaintext paragraphs do not lead to a break line anymore.
Before release 3.0, paragraphs having tags but no plaintext leaded to a break line.
This patch aims to recover the behavior of reportlab releases < 3.0, as
<para><font color="white"> </font></para> is used in allmost all rml reports
The current patch is not considered as clean, but we did not find any better solution.
If someone find a parameter to pass to reportlab in order to bring back the old behavior of reportlab
he is welcome to provide the better patch.

Besides, in reportlab 3.0, splitlongwords has been introduced as parameter,
to allow to break long words. The default value is True.
This parameter seems to break the columns headers
(it splits the text within the column header)
We therefore take the choice to not activate it, as it was not present anyway in reportlab < 3.0

To test the good behavior of this patch:
While having reportlab < 3.0 (2.5 for instance), print a draft invoice
Then, upgrade to reportlab > 3.0 (3.1.8 for instance), print the same draft invoice.
The generated pdf must be (allmost) identical, in particular concerning spaces.
Specifically, the space between the partner address and his phone.
2015-01-22 14:23:38 +01:00
Martin Trigaux 9f8731ca27 [FIX] base: backport of 152c5c2 to 7.0
[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
2015-01-22 13:34:19 +01:00
Denis Ledoux dcfd94cbf5 [FIX] orm: Revert 332154444d && acd7d84da4
These revs. introduced an API change in the _name_search method.

Indeed, the 'operator' attribute used to have 'ilike' as default value.
This cannot be changed, as every modules overriding this method
overrided it using the signature with operator='ilike'

For instance, _name_search method of addons/base/ir/ir_model.py
expects having 'ilike' as operator.
As it was not anymore the case,
it leaded to a crash when performing a name_search call on the model ir.model,
like when adding a new custom field to a model, from the web client.

opw-626161
2015-01-21 18:33:36 +01:00
Martin Trigaux 2c99ddc612 [FIX] tools: exec_command_pipe parameters
args is a tuple, do not popen it as it's concatanated with another tuple
in _exec_pipe. This made the "print workflow" method crash.
2015-01-21 18:33:04 +01:00
Martin Trigaux cbd9b46129 [FIX] tools: return data from exec_command_pipe call
Rendering of workflow uses it, returns the pdf data
2015-01-21 18:33:04 +01:00
Olivier Dony 495ec92251 [I18N] Update translations from Launchpad 8.0 branches 2015-01-21 15:36:54 +01:00
Olivier Dony 39f00b3637 [I18N] Update translation templates with latest terms
Total new terms: 270
Total deleted terms: 82
Total identical terms: 19653
Old total number of terms: 19735
New total number of terms: 19923
2015-01-21 15:31:22 +01:00
Olivier Dony 8ea6ebede1 [IMP] fields: reduce verbosity of debug log for registry loading
This log line is only useful when debugging registry
loading, a limited use case now that Odoo 8 is stable.
It makes the debug log more difficult to read and causes
a small performance penalty when debug[_rpc] is on.
(+0.2s i.e. 10% extra time for loading a registry with 47
modules on a core i5-4200U machine)
2015-01-21 12:53:26 +01:00
Raphael Collet 431f8de815 [IMP] models: prepare the setup of fields at one place only 2015-01-21 11:26:23 +01:00
Raphael Collet 54c655cb71 [FIX] models: do not introduce a one2many manual field if its inverse is not on its comodel 2015-01-21 11:26:23 +01:00
Raphael Collet cf26f7ed80 [IMP] models, registry: let the registry retrieve manual fields from database 2015-01-21 11:26:23 +01:00
Raphael Collet 5d7bba4eb7 [FIX] loading: move code that should not be executed on simply installed modules 2015-01-21 11:26:23 +01:00
Raphael Collet 6c29af3fa5 [FIX] models: init function fields once columns are known and not before 2015-01-21 11:26:23 +01:00
Raphael Collet 5fee95ca63 [FIX] models, fields: reorganize model setup to retrieve all inherited fields
The model setup sometimes misses entries in _inherit_fields and _all_columns.
This is because those dictionaries are computed from parent models which are
not guaranteed to be completely set up: sometimes a parent field is only
partially set up, and columns are missing (they are generated from fields after
their setup).

To avoid this bug, the setup has been split in three phases:
(1) determine all inherited and custom fields on models;
(2) setup fields, except for recomputation triggers, and generate columns;
(3) add recomputation triggers and complete the setup of the model.

Making these three phases explicit brings good invariants:
- when setting up a field, all models know all their fields;
- when adding recomputation triggers, you know that fields have been set up.
2015-01-21 11:26:23 +01:00
Raphael Collet 2f06adde9c [IMP] models: speedup registry loading (35% less time)
The field setup on models is improved: only fields are determined when building
the model's class; the final _columns is computed from the fields once they are
set up.
2015-01-21 11:26:23 +01:00
Simon Lejeune e40a6fd325 [FIX] tools: pass env in `exec_pg_command` 2015-01-20 17:36:20 +01:00
Samus CTO acd7d84da4 [IMP] make name_search() use '=' if col _rec_name is an integer
When looking for an issue number, it's more useful to match the word in
the whole string instead of just a part of it.
2015-01-20 09:52:55 +01:00
Samus CTO 332154444d [FIX] Can not search using a string operator on column id 2015-01-20 09:52:55 +01:00
Christophe Simonis edbb14143e [FIX] test_new_api: it works by accident but company_id <> partner_id 2015-01-19 20:26:31 +01:00
Laurent Mignon (aka lmi) aef2150179 [IMP] let scaffold render files ending by .rst and .html
closes #4773
2015-01-19 14:25:36 +01:00
Jeremy Kersten a0e775e3fa [IMP] ir_http: authentification method can redirect to an other page 2015-01-19 13:44:25 +01:00
Christophe Simonis 7b7554c91f [MERGE] forward port of branch saas-3 up to cdb48d3 2015-01-19 12:16:33 +01:00
Christophe Simonis cdb48d39ba [MERGE] forward port of branch 7.0 up to 6c55a4b 2015-01-19 12:09:48 +01:00
Stéphane Bidoul 34fe1d211d [IMP] add support for directory templates in scaffold
closes #4767
2015-01-19 10:35:41 +01:00
Antony Lesuisse c1c8ac7d7f [FIX] dbmanager: backup allow pg_dump custom dump to be larger than diskspace
- delete a forgotten print
- allow pg_dump custom dumps to be larger than the available disk size, the
  previous commit allowed dumps to be larger than memory, this one remove this
  limitation. zip dumps are still limited to by the disk size.
2015-01-19 02:42:34 +01:00
Antony Lesuisse ec9a543014 [FIX] dbmanager: backup support both zip and pg_dump custom format
- let the user choose between the pg_dump custom format or the zip format including the filestore
- use file objects to allow dumps larger than memory
- postgres subprocess invocation is now clean and thread-safe, we dont touch the local process environ anymore
- add a manifest to the zip dump format with version information about odoo, postgres (pg_dump doesnt output it) and modules
2015-01-19 02:05:12 +01:00
Denis Ledoux 5959c41631 [IMP] res_lang: constraint for grouping field
As entering a wrong value in the grouping field of res.lang,
for instance '[,]', leads to an unavailability of the web interface,
We add a constraint to prevent entering wrong values.
2015-01-16 17:47:33 +01:00
Martin Trigaux 2f5a7b63d3 [FIX] base: keep first multiline translation in po file
The first term of a po file is a comment for translator e.g.:
msgid ""
msgstr ""
"Project-Id-Version: openobject-addons\n"
...

This comment is ignored if there is no source and it is the first term of the po
file. The first flage was disabled too late and if the following terms also
started with an empty source (for too long terms), they were skipped as well.

Disable the flag as soon as the condition is evaluated to make sure no
additional terms are ignored. opw 619786
2015-01-16 13:05:46 +01:00
Raphael Collet 309e3def30 [FIX] api: fix api decorators to not add '_api' on original methods
This fixes an issue where the same function is used in several model classes:
once the function is wrapped for the first class, it is erroneously considered
as a wrapper for the second class, and is therefore not wrapped in other
classes.
2015-01-15 16:43:46 +01:00
Xavier Morel af90f5f638 [IMP] test experience and documentation
closes #3152
2015-01-15 15:23:08 +01:00
Denis Ledoux 87dd06c941 [MERGE] forward port of branch saas-3 up to 8c150c6 2015-01-15 14:43:32 +01:00
Xavier Morel 65cd4a2a33 [FIX] remove deprecated checks/fast_suite test attributes from standard modules 2015-01-15 14:31:40 +01:00
Raphael Collet 698981eccb [FIX] fields: do not set the inverse function on a readonly related field
This fixes #4681: prevent method copy() to write on the field.
2015-01-15 13:40:15 +01:00
Denis Ledoux 8c150c609e [MERGE] forward port of branch 7.0 up to 7530d28 2015-01-15 13:37:30 +01:00
Xavier Morel 9808ca3e31 [IMP] test discovery, documentation, deprecation warnings
* document and warn that checks and fast_suite in tests sub-packages are
  deprecated and have no effect
* avoid iterating all currently loaded modules when looking for test
  modules in a tests sub-package
* replace use of __import__ by importlib

Fixes #3152
2015-01-15 13:28:25 +01:00
Sandy Carter 894143cb4c [FIX] res.groups: when generating initial group view, use admin context and language
This means group category names can be translated in the
default/installation database language.

Closes #3921
2015-01-15 11:54:22 +01:00
Denis Ledoux a692c6e934 [MERGE] forward port of branch 7.0 up to f406847 2015-01-15 11:49:28 +01:00
Xavier Morel 8c3d71ccb8 [CHG] Fix task 7536 / PR #499 differently
Issue was the propagation of contextual values across actions, more
precisely conserving the selected fiscal year when selecting an account
from the chart of accounts tree view: the chart of accounts tree view is
generally opened for a specific fiscal year, and it seemed sensible that
opening an account would show only the journal items for the previously
selected fiscal years rather than all items ever.

PR #649 altered action.read by tentatively evaluating the action's
context, however this has the side-effect of providing evaluated
contexts when creating or editing actions via the UI, usually breaking
them in the process (as the context at this point is basically
nonsensical for the action's purpose).

This backs out the previous fix, and creates a fix restricted to the
tree view's JS (thereby removing the feature for window actions not
invoked from a tree view).

closes #4677, closes #4690
2015-01-14 13:28:23 +01:00
Raphael Collet ec25207b8f [IMP] models: force recomputation of all fields on a newly created record 2015-01-13 16:03:58 +01:00
Martin Trigaux 38fc04785a [FIX] http: log rpc.request and rpc.response handlers
The log level rec.request and rpc.response where no longer logged as
the webclient no longer uses XMLRPC but JSONRPC instead.
Duplicate the logging part from dispatch_rpc to dispatch method of JsonRequest
to add rpc logs when using JSON requests.
opw 617490
2015-01-13 15:50:29 +01:00
Raphael Collet 5e3de76f36 [FIX] expression: use "unaccent(column::text)" instead of "unaccent(column)::text"
As unaccent() of date fields will not work
Fixes #4615
2015-01-12 17:52:26 +01:00
Xavier Morel d89af0dad3 [FIX] over-eager merge b270e4f
Extract dropping of connection from exp_drop (as in 8.0), call it from
relevant database-alteration functions (drop, rename, duplicate)
2015-01-12 16:45:27 +01:00
xmo-odoo b270e4f77f Merge pull request #4427 from savoirfairelinux/7.0-fix-issue-4424-duplicate-db
[FIX] Issue #4424
2015-01-12 16:37:11 +01:00
Erwin van der Ploeg 5843a12f26 [Fix] Some missed frontend openerp to odoo changes 2015-01-12 16:17:12 +01:00
Sandy 3b7e00d718 [FIX] orm: prevent pgerrors from raising `UnicodeDecodeError`
Use `tools.ustr` for error conversion to prevent `UnicodeDecodeError` when
converting errors which can be unicode in depending on data.

Example:
```python
from openerp.osv.orm import convert_pgerror_23505
from psycopg2 import IntegrityError

e = IntegrityError(
    'duplicate key value violates unique constraint '
    '"hr_job_name_company_uniq"\nDETAIL:  '
    'Key (name, company_id)=(Directrice comptabilit\xc3\xa9, 1) '
    'already exists.\n'
)

convert_pgerror_23505(None, [], None, e)

UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 129: ordinal not in range(128)
```
2015-01-12 15:35:23 +01:00
youring be8ee97c44 [IMP] Look for TTC font files as well as TTF
TTC fonts is widely used in CJK font. Odoo should support ttc fonts recognition.
2015-01-12 15:16:10 +01:00
Antony Lesuisse aeaf7ef914 [FIX] logging: dont use color in windows cmd
windows cmd.exe terminal doesnt display them correctly so escape sequences end
up uselessly wasting some of the precious 80 char wide screen estate.
2015-01-09 01:45:41 +01:00
Antony Lesuisse 5a642a802e [FIX] test phantomjs discard stderr
To avoid phantomjs broken pipe messages on odoo stderr during testing.
2015-01-09 01:21:42 +01:00
Martin Trigaux dd558c40b8 [FIX] base: translation of terms in inherited view
If a view inherits from another with a different model (typically
product.product view inherits from product.template view), the terms from
the second view were not translated.
Checking on the parent view in case of different model and look up the terms
on this model.
Fixes some of #1755, opw 621512
2015-01-08 12:01:09 +01:00
Olivier Dony d0cd92bb9f [I18N] Sync updated 7.0 translations from Launchpad 2015-01-07 17:57:28 +01:00
Ajay javiya 5abcff8512 [FIX] fields: add minimal support for serialized fields in new API
This is necessary for supporting old-api sparse and serialized fields.  Without
this, old-api serialized fields are broken because they cannot be converted to
new-api fields.

This closes #4571
2015-01-07 16:34:50 +01:00
Antony Lesuisse f3a9a3d45b [FIX] http make psutil dependency optional 2015-01-07 03:34:03 +01:00
Antony Lesuisse 84419fcd0a [IMP] doc: update windows source code instructions
remove psutil dependency under windows

reverts documentation commit 96aba067a8 because
it prevent sphinx build

merge setup source code and vcs checkout sections and simplify wording

simplify source installation instructions for windows
2015-01-07 03:26:15 +01:00
Denis Ledoux 4c1908088c [MERGE] forward port of branch saas-3 up to 879fca0 2015-01-06 19:00:08 +01:00
Denis Ledoux 879fca0856 [MERGE] forward port of branch 7.0 up to 9191115 2015-01-06 18:56:10 +01:00
Martin Trigaux ae34a1e93e [IMP] config: remove deprecated comment
It was intended to be replaced by log-handler at first but log-level is still
a very convenient way to manage the level of debug.
2015-01-06 18:03:58 +01:00
Martin Trigaux cda46d7d81 [FIX] base: contact image wrongly displayed
The image of a contact of a company was wrongly resized.
Use image_small instead of image for correct ratio (anyway 48x48px).
Remove image_preview as always use image_small (was wrongly positioned and
considered as cache attribute, getting '&cache=NaN' urls...)
opw 593992
2015-01-06 12:31:25 +01:00
Olivier Dony d9e52f793b [FIX] res.lang: filter out unsupported format options in default locale info 2015-01-06 11:22:30 +01:00
Martin Trigaux 96d1520a5e [FIX] base: no line feed in translations
Revert "[FIX] ir_translation: remove control characters from translations"
This reverts commit 6d4e1cc73e.

This was intended to clean malformed translations but it introduced the side
effect of removing all '\n' in translations.

Fixes #4092, opw 619175
2015-01-06 10:43:54 +01:00
Denis Ledoux be5717434e [FIX] fields: apply user timezone in display name for models using a datetime as name
For models using a datetime field as name (hr.attendance for instance), the user timezone wasn't applied in the display name.
Therefore, in the breadcrumb, the datetime was different than in the form if the user had another timezone than UTC.

This rev. is related to 27d8cb843b, but is for the 8.0 api

We are aware we introduce a tiny change of API (method signature change), which we normally prohibit, but considering the really low level of the method, the fact it is probably not ovveriden by any other modules and the fact there is no cleaner way to correct this, we are making an exception.
2015-01-05 15:48:37 +01:00
Denis Ledoux 00762bbae0 [MERGE] forward port of branch saas-3 up to 643bbcb 2015-01-05 14:25:34 +01:00
Denis Ledoux 643bbcb00b [MERGE] forward port of branch 7.0 up to 27d8cb8 2015-01-05 13:48:01 +01:00
Denis Ledoux 27d8cb843b [FIX] fields: apply user timezone in display name for models using a datetime as name
For models using a datetime field as name (hr.attendance for instance), the user timezone wasn't applied in the display name.
Therefore, in the breadcrumb, the datetime was different than in the form if the user had another timezone than UTC.
2015-01-05 12:48:38 +01:00
Martin Trigaux fefc13a2db [IMP] account: better fix than edbd0df for reconciliation test
Revert edbd0df
Instead of removing the demo data (demo data is our friend), make the test more
specific, adding a date to match the rate of 1.5289 all year long.
2015-01-05 11:30:49 +01:00
Martin Trigaux 33c8aae8e4 [FIX] orm: do not aggregate non-stored columns
Columns defined in the new api as interger, computed and non-stored should not be aggregated in read_group.
Fallback on False if column is None
Fixes #3972, opw 619536
2015-01-05 11:30:26 +01:00
Martin Trigaux edbd0df9a0 [FIX] account: test assuming specific currency rate
Old demo data hardcoded the currency rate of USD to 1.5289 at the half
of the year, introducting new year red runbot.
Using assertAlmostEquals to avoid values like 32.730000000000004
2015-01-02 14:24:56 +01:00
Ronald Portier (Therp BV) 7c2795ca04 [FIX] base: specify correct pot file linked to po
In case of different directory for stroing po and pot files than 'i18n'
(e.g. 'i18n_extra'), a po could be linked to a wrong pot file.
Use the same folder as the po file to look for pot.
Fixes #4326
2014-12-31 13:56:54 +01:00
Maxime Chambreuil fa515607cb [FIX] Issue #4424 2014-12-25 14:57:46 -05:00
Denis Ledoux a175ed6b2f [MERGE] forward port of branch saas-3 up to 30674c3 2014-12-23 14:03:38 +01:00
Denis Ledoux 30674c3ed6 [MERGE] forward port of branch 7.0 up to e151e8f 2014-12-23 13:50:25 +01:00
Martin Trigaux 44d155d3d4 [FIX] base: translate place holders in partner view
Placeholders for City, ZIP and State were not translated
Fixes #4340 (and one of #1755), opw 616589
2014-12-23 11:05:44 +01:00
Raphaël Valyi b85ac1eb23 [FIX] company contacts should have the credit limit of the company they belong to; spotted by Alexis de Lattre. 2014-12-22 13:17:00 +01:00
Fabien Pinckaers c9446ed903 Merge pull request #1886 from lepistone/7.0-fix-yaml-onchange-user
use selected user and not admin to run yaml tests
2014-12-22 02:39:06 +01:00
Cedric Le Brouster 8f30ab04be [FIX] sql_db: close db connexions before removing them.
Closes #831 aka lp 1322191
2014-12-21 19:50:56 +01:00
Raphael Collet d9fedfebbd [IMP] registry loading: setup models only if necessary
When loading the registry without any module installation/upgrade, models are
set up once instead of twice.  In other cases, models are always set up before
installations/upgrades.
2014-12-19 13:57:08 +01:00
Raphael Collet 8f38a7806a [IMP] enable loading custom models/fields and views from module data files
Loading views for custom models from module data files was not possible because
custom models and fields were introduced into the registry after all modules
were loaded.  As a consequence, the view architecture did not pass the checks.

This patch takes a different approach: custom models and fields are loaded
early on in the registry, so that views can be validated.  The trick is to take
special care of relational custom fields: we skip them if their comodel does
not appear in the registry.  This allows to install and upgrade modules that
create/modify custom models, fields and views for them.
2014-12-19 13:57:08 +01:00
Olivier Dony 05707f5cb5 [FIX] server: worker exit log should mention registry count to help admins size deployment settings 2014-12-16 17:36:58 +01:00
Martin Trigaux d6b26c6890 [FIX] base: almost-duplicated translations ignored during import
Translations are not transfered from temporary table tmp_ir_translation_import
to ir_translation if translation already exists (using `find_expr`).
In case of import of QWeb terms (name = 'website'), the criteria was too weak,
finding already present terms in translations for different modules.
e.g. term "Quantity" is already present in a QWeb view from sale module and was
not imported for the translations of the website_sale module.
Fixed by adding the filter criteria 'irt.module = ti.module'

In case QWeb translations for the same term in the same modules were added in
two imports (second term added in the future), the second was still ignored.
Changed condition to check the res_id for views as well.

Fixes #4239
2014-12-16 14:34:43 +01:00
Georges Racinet 9dad29caaf Reintroduce fname kwarg in configmanager
In [f04f409], the configmanager's __init__ lost its fname kwarg, which
allows to pass the name of the config file to read (or write).
Without it the only way to programmatically specify this file name is to
use the OPENERP_SERVER environment variable, which may be unpractical and/or
subject to renaming.

External tools (such as the buildout recipe) may need to pass this file in a
clean way.
2014-12-16 12:54:16 +01:00
Xavier Morel f04f409943 [ADD] doc: setup documentation
* Odoo installation from packages or source
* Deployment instructions for production environments
* dbfilter

Add missing support for disabling xmlrpc(/http), useful for WSGI
deployments which require running cron-only Odoo instances.
2014-12-15 16:01:37 +01:00
Raphael Collet 7afbb0a7ed [IMP] module/loading: do not try to load module graph when nothing to load
This simple optimization in load_marked_modules() avoids unnecessary calls to
load_module_graph().  This provides a small speedup, and avoids confusing log:
some module updates were making it look like the registry was loaded 5 times
instead of once.
2014-12-15 14:51:18 +01:00
Christophe Simonis 44e401c983 [IMP] http.py: allow @route decorator to pass extra arguments to created werkzeug.routing.Rule 2014-12-12 19:34:31 +01:00
Denis Ledoux 8ef286a12c [MERGE] forward port of branch saas-3 up to 162eb84 2014-12-12 15:46:54 +01:00
Denis Ledoux 162eb84438 [MERGE] forward port of branch 7.0 up to f46fa1d 2014-12-12 15:44:44 +01:00
Christophe Simonis 0b6078dfea [IMP] base: apps integration 2014-12-12 15:11:08 +01:00
David Monjoie fd92f16801 [FIX] http: use default language when lang not in context 2014-12-12 15:11:08 +01:00
senthilnathang ccd2f68af0 [FIX] base: Malaysian currency
Default Currency for Malaysia is MYR (Malaysian ringgit), not MXN (Mexican peso)
Fixes #4193
2014-12-12 12:22:23 +01:00
Kit Sunde 1263278b74 [FIX] models: typos
closes #4169
closes #4170
2014-12-11 12:43:47 +01:00
Raphael Collet 058eaf01df [FIX] fields: make sure fields are set up before using them
Non-setup fields could cause problems in two places:
- when traversing the chain of fields in related fields;
- when adding recomputation triggers on inverse fields

Both issues are fixed by this patch.
2014-12-11 10:12:46 +01:00
Kit Sunde 107ba240de [FIX] models: docstring typo.
closes #4163
2014-12-11 09:34:03 +01:00
Jairo Llopis db98d0771a [FIX] base: address layout css
The double % was not understood by some browsers (e.g. Firefox).
No need for escaping in this block.
Fixes #4142
2014-12-10 17:23:20 +01:00
Christophe Simonis 5d60c1c887 [IMP] base: show "mode" in ir.ui.view form view 2014-12-09 19:49:50 +01:00
Christophe Simonis a59cf39f06 [IMP] models.py: increase logging level for columns that can't be casted automatically when upgrading a module. 2014-12-09 15:39:12 +01:00
Denis Ledoux 276d0e76b2 [MERGE] forward port of branch 7.0 up to 284ca73 2014-12-08 14:57:21 +01:00
Xavier Morel a2115ef544 [FIX] ensure default addon paths are valid (existing)
User-provided addons paths are checked for existence (and rejected), but
default addons paths are not checked, and blow up when trying to listdir
them (e.g. when http.py tries to load modules).

This is an issue when using Odoo from the distributed tarballs, because
the packaging currently moves all modules to openerp/addons and removes
the root ("main") addons directory.
2014-12-05 19:12:33 +01:00
Samus CTO 55fa50891d [FIX] Use _unknown model for missing models in relation fields
During a migration of database, it is possible that some custom field
("x_", state is 'manual') are relational to model from a module that is
not provided.

Note: this used to work in Odoo 7.0 but crashed in 8.0.

Closes #3877
2014-12-04 20:58:46 +01:00
Sandy Carter aa10972d13 Raise error on read of a browse object with bad id
Check if id is valid by searching record columns when a key error is raised
If the record has the column, the key error is actually an error on a
missing or inaccessible id.

Signed-off-by: Sandy Carter <sandy.carter@savoirfairelinux.com>

Closes #3658
2014-12-04 13:24:26 +01:00
Denis Ledoux 9c7fb721f0 [FIX] translate: allow common english 2 chars terms
Before, all isolated (between xml/html tags) two chars words coming from views were not translated (by choice).
But, for some words, allowing them is useful. For instance, the word 'or' located between two buttons.

opw-616716
2014-12-04 13:13:07 +01:00
Arthur Maniet 35431de125 [FIX] res.currency: correctly compute the number of decimal places for currencies formatting in 'get_format_currencies_js_function'. 2014-12-04 10:51:54 +01:00
Christophe Simonis 2e092ace29 [FIX] must manage() Environment before loading test file 2014-12-03 14:48:54 +01:00
Raphael Collet 894a898e9e [FIX] models: exists() should not consider record with id 0 as existing 2014-12-03 13:59:27 +01:00
Raphael Collet d82aa69ccc [IMP] models: add check for common conversion error in field definitions 2014-12-03 09:55:17 +01:00
Mack ffda023295 [FIX] http.py: no traceback for SessionExpiredException
Rebase and close #3618
2014-12-02 18:34:28 +01:00
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