Commit Graph
227 Commits
Author SHA1 Message Date
Christophe Simonis ea2faefe0d [FIX] odoo-bin shell: force rollback on exit
Each REPL python shell behave differently depending on the exit method.
Force a rollback at the end to avoid inconsitent behavior.

Thanks to Harry Jollenbeck for the report: https://www.odoo.com/groups/59/26318707
2017-04-14 12:38:51 +02:00
Raphael Collet 00e169c05a [FIX] modules: do not log warnings for studio_customization 2017-04-13 12:17:05 +02:00
Christophe Simonis 9e159ef204 [MERGE] forward port branch saas-11 up to f830c7c3e3 2017-04-12 18:51:16 +02:00
Raphael Collet ff8329f4dd [FIX] ir_model: in _prepare_update, make error messages useful 2017-04-12 11:26:33 +02:00
Raphael Collet c988402370 [FIX] ir_model: in _prepare_update, check custom fields only
This allows to remove a custom model without checking all views.
2017-04-12 11:26:16 +02:00
Goffin Simon cfb06c83e0 [FIX] base: preview_rml_report
Typo error

opw:728334
2017-04-12 09:19:25 +02:00
Raphael Collet 3481f0faff [FIX] fields: recompute recursive stored fields 2017-04-11 15:34:34 +02:00
Odoo Translation Bot 69b45530dc [I18N] Update translation terms from Transifex 2017-04-11 10:37:54 +02:00
Christophe Simonis 2c897d4199 [FIX] base: allow users to delete own filters, even if not creator 2017-04-10 15:17:49 +02:00
Goffin Simon 428d9e8177 [FIX] odoo: Copy a record in other language than US
When copying a record in an other language L than US, first a translation
was created for L by the create called in the copy function and afterwards,
a second translation was created by the function copy_translations

So there were two duplicated translations for L instead of one.

opw:706865
2017-04-06 17:13:15 +02:00
Raphael Collet 5219dcbae3 [FIX] base: malformed base.pot 2017-04-06 16:30:29 +02:00
Raphael Collet 6621ade382 [FIX] ir_model: prevent renaming/removing fields that are used in views 2017-04-06 15:06:06 +02:00
Raphael Collet 5a1672fab8 [FIX] ir_model: field names must be unique per model 2017-04-06 15:05:52 +02:00
Raphael Collet 6b48098c81 [FIX] ir_model: field names must be valid pg identifiers 2017-04-06 15:05:52 +02:00
Nicolas Lempereur dff2cf3ca1 [FIX] base: field monetary lose context of t-lang
In monetary field refactoring (3407fb70e4) there was a small issue that
made context lost so the language use to render the field could be
different from the one to render the view.

For example: if the user has english, and print a report using the lang
of a partner in language spanish, the report would use spanish to format
number for all fields but monetary (which would use english).

opw-708197
2017-04-05 14:49:03 +02:00
Odoo Translation Bot 48bf1bc863 [I18N] Update translation terms from Transifex 2017-04-02 04:32:01 +02:00
Christophe Simonis 27496730d8 [MERGE] forward port branch saas-11 up to c2569b9df1 2017-03-28 14:51:14 +02:00
Raphael Collet 48c773de1d [FIX] base: do not create field x_name when importing a model definition (#16039) 2017-03-27 17:28:23 +02:00
Odoo Translation Bot a18c453dd5 [I18N] Update translation terms from Transifex 2017-03-26 04:30:35 +02:00
Raphael Collet 9e23458d40 [FIX] models: ensure recomputation after inversing fields (#15683)
When updating record using "record.field = value", we need to ensure that
all fields in cache depending on "record.field" will be recomputed.
2017-03-23 17:11:00 +01:00
Martin Trigaux 71d86afb58 [FIX] base: deactivate default language
When a language is deactivated, it may still be referred to in a default value.
A ir.value is created at the database setup to specify the default language.
If a user deactivate the default language but not the ir.value, the creation of
a res.partner would fail as trying to set an unknown value to a selection field.

This commit removes the default value when deactivating the linked language.

The patch is minimal for the bug. A more generic solution would be to verify the
ir.value when calling the default_get method.
This is however a risk of performance degradation (e.g. during a csv import) for
a rare scenario.
The dynamic selection scenario is probably on relevant to res.lang.
A similar problem can occur with many2one fields but is difficult to fix without
performance degradation.

Closes #16009
Fixes #15979
Fixes #3854
2017-03-23 14:38:05 +01:00
Nicolas Lempereur a247939620 [FIX] test_new_api: new steps for onchange and o2m
In f65475d6 one2many fields of default view in a form view were propagated
to the ORM so the value received from an onchange was not empty.

These new steps test this on a tree view embedded in a form view, or a
tree view originating from a default view by testing onchange adding row
or updating values of a one2many.
2017-03-20 13:25:40 +01:00
Nicolas Lempereur f65475d68c [FIX] fields, web: improve form onchange to x2many
In a form view, when a field onchange lead to a change on a x2many,
there was two different behavior:

- if the x2many had an embedded view (eg. a tree view inside a form
view) the onchange would notify that it expected the x2many field in
this embedded view to be changed and handled the changes correctly.

- if the x2many had a default view, the onchange ORM would not be
aware the x2many could be modified and would not sent the changes
back causing blank or not updated x2m lines and error on save.

---

Two solutions were birthed to solve the second point:

=> PR #10557 = solving everything

With this PR the onchange in the ORM is aware of every fields in the
current view (even field in a x2m in a x2m in a x2m in a form view) and
if any of these are change the javascript gets back the value of the
fields present in the view.

This PR has currently not been merged by fear of changing too much and
anyway could only be done in master.

=> PR #12249 = if no field for x2many, send its form view fields

With this change, if the ORM onchange is not aware of the fields in the
x2many widget to returns, all the field in the x2m default form view are
returned.

This was merged in bbdf960 but introduced a number of other issue:

- in most situation the x2many is represented by a list view, which may
have fields missing of the form view,  so the original is still present.

- the view used may differ from the default form view in other way
(depending on value in context or other possibilities).

- the form view could have fields not present in the form view which
could end up in `write` on fields which should not be written to.

---

This commit reverts bbdf960 and adapts a small part of #10557 so the
x2many with default view works as an embedded x2many. For more than one
level (eg. a x2many in a x2many) this would still not work but it is
only solvable by a PR such as #10557 which could only be targetted for
master.

With this commit:

- the list of fields sent to ORM onchange is computed at the first onchange
- the fields from a x2many field default view is sent for onchange
- the initial onchange on record creation is delayed to when x2many are loaded

closes #12249, closes #15336, closes #15890
fixes #11236, fixes #12249, fixes #15129, #15419
opw-705965 opw-716095 opw-715619 opw-710440
2017-03-20 13:25:07 +01:00
Odoo Translation Bot 6e363a5756 [I18N] Update translation terms from Transifex 2017-03-19 04:33:46 +01:00
Christophe Simonis 7043fd529f [FIX] test_converter: use unicode string for comparison 2017-03-18 23:35:58 +01:00
Christophe Simonis 31ebb07773 [MERGE] forward port branch saas-11 up to aefdf96c25 2017-03-17 17:55:30 +01:00
Nicolas Lempereur cc1c15327c [FIX] expression: improve o2m with m2o integer
We sometimes use in Odoo a One2many field with an inverse Integer
field instead of a usual Many2one.

This allow for example in several instances to have a "Many2one" which
can be reference from several models, eg:

Model Ranking:
	name = String field
	res_id = Integer field
	res_model = String field

Model Toy:
	rank = One2many [inverse: Ranking -> res_id]
                        [domain: res_model == Toy]

Model Tool:
	rank = One2many [inverse: Ranking -> res_id]
                        [domain: res_model == Tool]

This enable us to have a shared feature between otherwise unrelated models.

But there was several issue when searching on these One2many:

1) if the Integer Many2one was not stored (eg. it came from an inherits) on
   the searched model, this could lead to an error.

2) when we searched:

   - by IDs (rank in ['55']) with at least one id not respecting the domain
   - by IDs with a negative operator
   - with a negative operator on unfound string (rank != "no rank has this")
   - with a false value (rank = False)

   we would not apply the One2many domain (eg. res_model == Toy) and thus
   possibly getting Toy 3 errenously because a Tool 3 was found without
   the domain being applied.

This fix modify the search on One2many and for:

1. if the inverse is an Integer not stored field instead of Many2one
   manage it.

2. if the field is an Integer field instead of Many2one and there is a
   domain on the One2many: apply the domain on the inverse model found.

So only some search on One2many with a domain whose inverse field is an
Integer could be impacted.

This would also be nice to have for all One2many with a domain but the
probability of it being useful versus risk for performance is not judged
high enough.

opw-710508
2017-03-16 11:57:04 +01:00
Goffin Simon 9f9657c04b [FIX] base: unlinking ir.model.constraint
When unlinking an ir.model, all the ir.model.constraint linked to this
ir.model must be removed to avoid to call unexisting model.

In stable version, the right fix would be to put an attribute ondelete=cascade
on the field model of ir.model.constraint.

In 10.0, the ir.model.constraint are created with module = the module where the related field
has been declared. But when unlinking the ir.model in function _module_data_uninstall, the related
ir.model.constraint to remove were chosen according to the removed modules. So with models
declaring constraints on inherited fields, some problems occured because the model could be removed
and not all the related constraints.

opw:716032
2017-03-15 09:17:53 +01:00
Moisés López 93bb6f322d [FIX] base: avoid variable referenced before assignment error
If the company currency is not active (that should not happen but nothing
prevents it, probably happening with some CoA installation), the variable
company_currency_format is undefined and an error is raised.

Closes #15799
2017-03-14 10:44:12 +01:00
Christophe Simonis 2ef43281c2 [MERGE] forward port branch saas-11 up to 2e972578b9 2017-03-13 15:53:55 +01:00
Odoo Translation Bot 00435d6384 [I18N] Update translation terms from Transifex 2017-03-12 04:31:45 +01:00
Nicolas Martinelli 6bb63edb98 [FIX] base: save ir.values
- Install accounting module
- Create new tax, keep note of its ID
- Go to Settings > Technical > User-Defined Defaults
- Change the value of 'taxes_id' to the ID of the tax created
- Create a new product => crash

The issue is that the value of 'taxes_id' is saved as a string, not as a
list. Therefore, once retrieved, it crashes.

opw-709906
2017-03-08 15:28:33 +01:00
Christophe Simonis 6b3a80862c [MERGE] forward port branch saas-11 up to 503227838d 2017-03-06 13:23:38 +01:00
Odoo Translation Bot c0f0d49542 [I18N] Update translation terms from Transifex 2017-03-05 04:32:11 +01:00
Christophe Simonis 7abeace770 [MERGE] forward port branch saas-11 up to 5c4744cd1f 2017-03-01 15:17:55 +01:00
Christophe Simonis 5655b43929 [FIX] base: clear cache through model instead of method
This allow cached method to be overwritten.
2017-03-01 12:21:11 +01:00
Odoo Translation Bot c224df04a5 [I18N] Update translation terms from Transifex 2017-02-26 04:31:11 +01:00
Christophe Simonis 387b2acfcb [MERGE] forward port branch saas-11 up to 1730dca101 2017-02-23 19:40:03 +01:00
Nicolas Martinelli 05810dc7de [FIX] base: default partner email
In a lead:
- Fill in contact information (phone, address, email...)
- Create a new contact

All information is copied to the new contact, except the email.

opw-706711
2017-02-21 11:04:54 +01:00
Odoo Translation Bot 2ab080bcae [I18N] Update translation terms from Transifex 2017-02-19 04:30:24 +01:00
Luis Ernesto Torres Macías 4cb1750a61 [FIX] base: correct Mexican state code based in SAT catalog
The SAT provide this catalog to state codes:
http://www.sat.gob.mx/informacion_fiscal/factura_electronica/Documents/Complementoscfdi/catNomina.xls

This attribute is required in payroll v1.2.
Previous code version did not match the validation

Closes #15535
2017-02-17 15:04:56 +01:00
Odoo Translation Bot 4669c103cc [I18N] Update translation terms from Transifex 2017-02-12 04:30:17 +01:00
Christophe Simonis ffd4442b06 [MERGE] forward port branch saas-11 up to 06e9e45d03 2017-02-10 11:49:35 +01:00
Goffin Simon 4f8ae9f993 [FIX] base: Traceback when creating a submenu
When self.name is False, the following expression:
"self.parent_id._get_full_name(level - 1) + MENU_ITEM_SEPARATOR + self.name"
raised:
"TypeError: coercing to Unicode: need string or buffer, bool found"

opw:706202
2017-02-08 12:22:20 +01:00
Goffin Simon 0d68acff8e [FIX] base: _compute_commercial_partner
Before the fix:

*Scenario 1:

create company A as a res.partner

on company A, add an individual contact B

on individual B, add an individual contact C

on individual C, go in accounting tab, click on 'parent company' link, you arrive on company A

*Scenario 2:

create individual B

add a contact individual C on individual B

create company A

on individual B, select a parent company A

on individual C, go in accounting tab, click on 'parent company' link, you arrive on B

After the fix, on each scenario, you arrive on company A.

opw:706757
2017-02-07 22:53:40 +01:00
Odoo Translation Bot 17f3185994 [I18N] Update translation terms from Transifex
after API rate limit reached
2017-02-07 17:01:49 +01:00
Christophe Simonis d83d0999e0 [FIX] base: ondelete cascade on transien 2017-02-03 19:01:19 +01:00
Nicolas Martinelli 5bd895721a [IMP] base: new cr for log method
The `log` method of a server action uses the same cursor than the
transaction. Therefore, if an error is raised during the server action
execution, the log messages are lost since the transaction is rolled
back.

We introduce a new cursor in the `log` method, so the log messages are
kept even when an exception is raised.

opw-704036
2017-02-02 12:49:17 +01:00
Nicolas Martinelli b34917cd6d [FIX] base: field 'Type' readonly
The field 'Type' should always be readonly since:
- it must not be changed for standard models
- its value must be 'Custom Object' for a custom model

opw-706130
2017-02-01 14:53:35 +01:00
Christophe Simonis 59d1f9b564 [IMP] core: only mark updated fields as modified at model reflection
`model` field of `ir.model` may be used as related stored field.
Marking it as modified force recomputation of these, even no change
occurs (by definition).
2017-01-31 13:56:28 +01:00