Commit Graph

4966 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
Denis Ledoux eeb1f0355c [FIX] res.users: exactly match login when operator in ilike, equal 2014-10-09 18:57:37 +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
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 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 eb9113c04d [FIX] ir_attachment: restrict access to orphan attachments to employees 2014-10-02 15:17:48 +02:00
Olivier Dony 9b1a9c9518 [FIX] tools: remove useless attributes 2014-09-29 17:39:01 +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
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
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
Olivier Dony 938502aa37 [FIX] loading: always process auto-installed modules for new databases
If the server was started without -i or -u and
happened to initialize a fresh database,
auto-installed modules that depend
on `base` only would stay in status "to install"
without actually being installed (until the next
installation round was triggered).
This was of little consequence in 7.0, but causes
a crash in 8.0.

Fixes #953
2014-09-17 15:11:01 +02:00
Denis Ledoux f5f76094a7 [FIX] orm write: do not try to store computed & stored fields for relational records deleted by *2many fields
opw-613772
2014-09-17 13:32:30 +02:00
Martin Trigaux 32f5168974 [FIX] orm: do not drop foreign keys of transient models
During the update of a module, the existing foreign keys are dropped if they have a different ondelete_rule than the one specified on the field.
The foreign keys for many2one transiant -> non-transiant are created with cascade rule by default (see `m2o_add_foreign_key_checked` method) so the check needs to be realised in the same conditions.
2014-09-15 15:24:53 +02:00
Denis Ledoux b601015800 [FIX] tools: restrict available attributes 2014-09-15 11:55:53 +02:00
Martin Trigaux f2cf6ced17 [FIX] mail: encoding of sender name with unicode
When sending an email, both formats 'Name <email>' or '"Name" <email>' can be used for fields 'From', 'To' and others. If the name contains unicode characters, a regex only matching '"Name" <email>' was used to encode the name with RFC2047. That meant that the name was not encoded and eventually dropped, using only the email part.
Instead of using a limited regex, use the parseaddr method from email library.
Fixes lp:1272610, opw 607683
2014-09-10 17:36:00 +02:00
Denis Ledoux 2459cd5dd1 [FIX] ir_attachment: attachements removed on record unlink 2014-09-10 12:18:14 +02:00
Denis Ledoux 8dff247096 [FIX] orm, read_group: read_group_fill_results handle no_leaf 2014-09-09 16:47:40 +02:00
Denis Ledoux 1e374b4ad7 [FIX] ir_attachment: ignore if model uninstalled
if the model of an attachement no longer exists (the according module have been uninstalled, for instance), ignore the security check
2014-09-08 10:51:46 +02:00
Denis Ledoux d824769b3c [FIX] tools,mail: improve parsing of references from rev. 0bee015dd6
Backport of 8.0 fix was not enough for 7.0, because it still fails for the legacy reference match (model+res_id), which is not used in 8.0
2014-09-05 11:44:20 +02:00
Christophe Simonis f65c913027 [FIX] base: security: employee must have access to res.groups 2014-08-28 18:14:08 +02:00
Leonardo Donelli 3509e15cc9 [IMP] report_sxw: missing parameter without_company for display_address
Fixes #811
2014-08-27 16:55:02 +02:00
Denis Ledoux dd86d41eb4 [FIX] security: disallow read on ir.sequence for externals 2014-08-26 16:17:24 +02:00
Denis Ledoux 53582c2ea6 [FIX] security: res.groups should be readable by admins only 2014-08-26 13:31:41 +02:00
Denis Ledoux 72d3697fbc [FIX] security: externals should be able to read attachements
without having the rights to read ir.config_parameter
2014-08-26 12:55:48 +02:00
Denis Ledoux 80017b04c2 [FIX] security: ir.config_parameter should not be readable by externals 2014-08-26 12:50:04 +02:00
Martin Trigaux 0ab88f54f9 [FIX] ir_model: invalidate cache when adding new fields
When a new ir.model.field is created, add the new field in the fields_by_model (cache of custom fields). This is required as the __init__ method would not retrieve the new field if fields_by_model is already set.
Otherwise, the _columns would not contain the new fields and we could not access it without restarting the server (e.g. the installation of a module adds ir.model.fields and use it in the a view.
2014-08-21 17:24:45 +02:00
Desai Binjal 8fe9f07cac [FIX] note: small bugs 2014-08-21 15:55:23 +02:00
Martin Trigaux 768b3592c2 [FIX] base: wrong model change check
Comparing an id and a browse record will always fail so the exception would have always been raised when changing a model (e.g. updating a module with custom fields).
2014-08-21 14:30:10 +02:00
Martin Ambroz 106cb1ec2b [FIX] base: python 2.6 incompatibility for dictionary comprehension 2014-08-20 10:28:37 +02:00
Martin Trigaux deacba0ed6 [IMP] base: no default domain for partner's title
The title field should not have a domain by default.
When a new record is created or the 'is company' field is changed, the onchange_type is triggered to restrict the domain accordingly to is_company field.
When an existing record is modified, there will have no domain on title field. It's not ideal but at least companies will be able to change the title without the need to modify twice the field is_company.
Fixes #1713
2014-08-14 12:00:27 +02:00
Olivier Dony 85d2b45aaa [I18N] Update 7.0 translations with latest changes on Launchpad
See also https://github.com/odoo/odoo/wiki/GitHub-Transition#translations
2014-08-14 03:38:58 +02:00
Olivier Dony 96c36e895c [I18N] Update all 7.0 translation templates with latest terms and annotations
Total new terms: 168
Total deleted terms: 95
Total identical terms: 16329
(Some modules skipped, typically all l10n_* modules)
2014-08-14 02:24:24 +02:00
Olivier Dony 69eef5ac8d [FIX] tools.translate: addons path resolution failed with duplicates
When the addons_path config contained the
default path, the system was working with
an empty addons_path in the middle of the
other paths. This empty one matched for all
files, making all files appear to belong to
the root path component, e.g. `home` if the
root path is in /home.
Refactored a bit to avoid duplicates and
redundant path calculations.
2014-08-14 02:07:59 +02:00
Vo Minh Thu 680214c47e [FIX] tools.translate: when loading entries from a PO file, use also the POT.
On Launchpad, as commented on bug 933496, PO entries (and their comments) are
shared between series. This mean that e.g. the 7.0 series can have the wrong
`reference` comments (those beginning with #:) as they would be copied from say
the trunk series. Those `reference` comments are used to import translations
and look them up.

This patch adds a few lines of code to tools.translate so that targets
defined in the POT `reference` comments are used in addition to those from the
PO file.

Also adds a test module to validate the new behavior.

This patch stems from:
 - the 6.1 branch by Vo Minh Thu:
    https://code.launchpad.net/+branch/~openerp-dev/openobject-server/6.1-fix-po-targets-933496-vmt
 - the 7.0 port by Numerigraphe:
    https://code.launchpad.net/~numerigraphe-team/openobject-server/7.0-fix-po-targets-933496-vmt
2014-08-13 23:07:40 +02:00
Martin Trigaux bceb278199 [FIX] base: revert 19e401a for title on res.partner form
The title of the partner is restricted with a context that will change in the onchange_type. Having twice the same field will not work well.
Remove the invisible attribute as the domain is handled by the domain.
2014-08-13 15:04:54 +02:00
Samus CTO 1a7c8953fe [IMP] calculating nextcall datetime of a cron SHOULD use the cron's user 2014-08-13 14:58:55 +02:00
Samus CTO 7f88681186 [FIX] context_timestamp MUST return a "timezone aware" timestamp 2014-08-13 14:58:55 +02:00
Denis Ledoux 2b0487113a [FIX] yaml tests: Set on_change keys not in view logger as debug instead of warning
This is related to commit d31faceb67
(This is to avoid the runbot being yellow if on_change methods have extra keys in the returned value, this is not wrong, the web client will simply ignore them).
2014-08-11 11:11:36 +02:00
Samus CTO c16884364b [FIX] Calculate date interval using super user time zone
When you set the date of a cron the July 1st at midnight, if the user
time zone has a positive offset, then the converted UTC date is the
June 30th and adding 1 month will end up on July 30th translating to
July 31th instead of September 1st.

To solve this issue we use the super user time zone for the date
calculation.
2014-08-08 18:01:13 +02:00
Denis Ledoux d31faceb67 [FIX] yaml tests: extra key in on_change result isn't that bad.
In the return result of an on_change, having keys which are not ine the view is not that bad, it is not an actual problem.

Display warning instead of asserting all the keys are in the views.
2014-08-08 11:40:30 +02:00
Denis Ledoux ea05a21938 [FIX] report: allow using 0 decimal precision in rml reports 2014-08-07 14:50:14 +02:00